DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Show() [4/4]

void ScriptedWidgetEventHandler::Show ( int x,
int y )
inlineprivate

См. определение в файле ContextMenu.c строка 41

42 {
43 if ( m_count == 0) return;
44 int screen_w, screen_h;
45 float w, h;
46 float sx, sy;
47 int offset_x;// = -20;
48 int offset_y;// = -10;
49
50 GetScreenSize(screen_w, screen_h);
51
52 // align buttons
53 float button_height_percent = 0.02; // button height is 4% of screen height
54 float button_height = screen_h * button_height_percent;
55
56 for ( int i = 0; i < m_count; i++)
57 {
58 ButtonWidget menu_button = ButtonWidget.Cast( m_context_menu_root_widget.FindAnyWidget( String( "Button" + (i+1).ToString() ) ) );
59 if (menu_button)
60 {
61 menu_button.SetSize(0.90, button_height);
62 menu_button.Show(true);
63 }
64 }
65
66
67 AutoHeightSpacer spacer;
68 m_context_menu_panel_widget.GetScript(spacer);
69 if ( spacer )
70 {
71 spacer.Update();
72 }
73
74 m_context_menu_root_widget.GetSize(w, h);
75 m_context_menu_panel_widget.GetSize(sx, sy);
76 m_context_menu_root_widget.SetSize(w, sy);
77
78 // set position
79 m_context_menu_root_widget.GetScreenSize(w,h);
80 screen_w -= 10;
81 screen_h -= 10;
82
83 int right_edge = x + w - offset_x;
84 if (right_edge > screen_w)
85 {
86 x = screen_w - w - offset_x;
87 }
88 else
89 {
90 x = x + offset_x;
91 }
92
93 int bottom_edge = y + h - offset_y;
94 if (bottom_edge > screen_h)
95 {
96 y = y - h - offset_y;
97 }
98 else
99 {
100 y = y + offset_y;
101 }
102
105 }
proto string ToString()
Icon x
Icon y
void Update()
Определения AutoHeightSpacer.c:11
Widget m_context_menu_root_widget
Определения ContextMenu.c:6
int m_count
Определения ContextMenu.c:10
Widget m_context_menu_panel_widget
Определения ContextMenu.c:7
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Определения EnScript.c:339
proto void GetScreenSize(out int x, out int y)

Перекрестные ссылки GetScreenSize(), m_context_menu_panel_widget, m_context_menu_root_widget, m_count, String(), ToString(), AutoHeightSpacer::Update(), x и y.