Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WidgetListEntryCheckList.c
Go to the documentation of this file.
1[BaseContainerProps(configRoot: true)]
3{
4 [Attribute()]
6
7 protected ref array<ref SCR_LocalizedProperty> m_aProperties = {};
8 protected ref array<ref SCR_ListBoxElementComponent> m_aCheckboxes = {};
9
10 //-------------------------------------------------------------------------------------------
12 override void CreateWidget(Widget parent)
13 {
14 // Create widget
15 m_EntryRoot = GetGame().GetWorkspace().CreateWidgets(m_sEntryLayout, parent);
16
17 // Show
18 m_EntryRoot.SetVisible(m_bShow);
19 if (!m_bShow)
20 return;
21
24 }
25
26 //-------------------------------------------------------------------------------------------
27 void ToggleCheckbox(notnull SCR_ListBoxElementComponent checkBox, bool enabled)
28 {
29 if (!m_aCheckboxes.Contains(checkBox))
30 {
31 Print("WidgetListEntryCheckList Checkbox couldn't be found", LogLevel.WARNING);
32 return;
33 }
34
35 checkBox.SetToggled(enabled);
36 }
37
38 //-------------------------------------------------------------------------------------------
41 {
42 Widget w = GetGame().GetWorkspace().CreateWidgets(m_sElementPath, m_EntryRoot);
44 if (!button)
45 return null;
46
47 button.SetText(property.m_sLabel);
48 button.SetToggled(enabled);
49
50 button.m_OnClicked.Insert(OnCheckboxClick);
51
52 m_aCheckboxes.Insert(button);
53 m_aProperties.Insert(property);
54
55 return button;
56 }
57
58 //-------------------------------------------------------------------------------------------
60 {
61 array<string> enabled = {};
62 foreach (int i, SCR_ModularButtonComponent checkbox : m_aCheckboxes)
63 {
64 if (checkbox.GetToggled())
65 enabled.Insert(m_aProperties[i].m_sPropertyName);
66 }
67
68 return enabled;
69 }
70
71 //-------------------------------------------------------------------------------------------
73 {
74 return m_aCheckboxes.Count();
75 }
76
77 //-------------------------------------------------------------------------------------------
79 {
80 foreach (int i, SCR_LocalizedProperty property : m_aProperties)
81 {
82 if (property.m_sPropertyName == propertyName)
83 return m_aCheckboxes[i];
84 }
85
86 return null;
87 }
88
89 //-------------------------------------------------------------------------------------------
91 protected void OnCheckboxClick(SCR_ModularButtonComponent button)
92 {
93 bool toggled = button.GetToggled();
94 button.SetToggled(!toggled);
95 }
96}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Variable that is using localized label.
ref array< ref SCR_LocalizedProperty > m_aProperties
ref array< ref SCR_ListBoxElementComponent > m_aCheckboxes
SCR_ListBoxElementComponent AddElement(SCR_LocalizedProperty property, bool enabled)
Add new element and create it in the list.
void ToggleCheckbox(notnull SCR_ListBoxElementComponent checkBox, bool enabled)
SCR_ListBoxElementComponent FindCheckboxByPropertyName(string propertyName)
override void CreateWidget(Widget parent)
Removed setting up of m_ChangeableComponent as it's not used for this case.
void OnCheckboxClick(SCR_ModularButtonComponent button)
Handle toggling in script as checkbox can't be interacted without script.
array< string > EnabledCheckListPropertyNames()
int CheckboxesCount()
ResourceName m_sElementPath
Configurable class for widget.
void SetupHandlers()
Empty function to override to assing custom handlers.
ResourceName m_sEntryLayout
void SetInteractive(bool interactive)
Can value be interacted - set handler enabled.
Widget m_EntryRoot
bool m_bInteractive
string m_sPropertyName
bool m_bShow
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute