Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WidgetListEntry.c
Go to the documentation of this file.
1 
6 //-------------------------------------------------------------------------------------------
7 // Custom titles
8 //-------------------------------------------------------------------------------------------
9 
10 //------------------------------------------------------------------------------------------------
11 class SCR_WidgetListEntryCustomTitle : BaseContainerCustomTitle
12 {
13  //------------------------------------------------------------------------------------------------
14  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
15  {
16  // Group tag string
17  string groupTag = "";
18  source.Get("m_sGroupTag", groupTag);
19 
20  // Name string
21  string name = "";
22  source.Get("m_sPropertyName", name);
23 
24  // Class tag
25  string classTag = "";
26  source.Get("m_sClassTag", classTag);
27 
28  // Setup title string
29  title = "";
30 
31  if (!groupTag.IsEmpty())
32  title += groupTag + ": ";
33 
34  if (!name.IsEmpty())
35  title += name;
36  else
37  title += "!!!";
38 
39  if (!classTag.IsEmpty())
40  title += string.Format("(%1)", classTag);
41 
42  return true;
43  }
44 };
45 
46 //------------------------------------------------------------------------------------------------
48 class SCR_LocalizedPropertyTitle : BaseContainerCustomTitle
49 {
50  protected string m_Label;
51  protected string m_PropertyName;
52 
53  //------------------------------------------------------------------------------------------------
54  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
55  {
56  // Group tag string
57  string label = "";
58  source.Get("m_Label", label);
59 
60  // Name string
61  string property = "";
62  source.Get("m_PropertyName", property);
63 
64  // Setup title string
65  title = label + ": " + property;
66 
67  return true;
68  }
69 };
70 
71 //-------------------------------------------------------------------------------------------
75 {
76  [Attribute("")]
77  string m_sLabel;
78 
79  [Attribute("")]
80  string m_sPropertyName;
81 
82  void SCR_LocalizedProperty(string label, string propertyName)
83  {
84  if (m_sLabel.IsEmpty())
85  m_sLabel = label;
86 
87  if (m_sPropertyName.IsEmpty())
88  m_sPropertyName = propertyName;
89  }
90 };
91 
92 //-------------------------------------------------------------------------------------------
96 {
97  [Attribute()]
98  ref array<string> m_aInfo;
99 
100  void SCR_LocalizedPropertyExtended(string label, string propertyName, array<string> info)
101  {
102  m_sLabel = label;
103  m_sPropertyName = propertyName;
104  m_aInfo = info;
105  }
106 };
107 
108 //-------------------------------------------------------------------------------------------
109 // Widget entries
110 //-------------------------------------------------------------------------------------------
111 
112 //-------------------------------------------------------------------------------------------
116 {
117  const string INVALID_VALUE = "-invalid-";
118 
119  [Attribute("{0022F0B45ADBC5AC}UI/layouts/WidgetLibrary/EditBox/WLib_EditBox.layout", UIWidgets.ResourceNamePicker, "What kind of widget should be generated for this value", "layout")]
120  protected ResourceName m_sEntryLayout;
121 
122  [Attribute("1")]
123  protected bool m_bShow;
124 
125  [Attribute("", UIWidgets.EditBox, "Text for label")]
126  protected string m_sLabel;
127 
128  [Attribute("", UIWidgets.EditBox, "Name of property that in json file")]
129  protected string m_sPropertyName;
130 
131  [Attribute("", UIWidgets.EditBox, "Name of property that in json file")]
132  protected string m_sGroupTag;
133 
134  [Attribute("", UIWidgets.EditBox, "Fallback value that will be prefilled at start")]
135  protected string m_sDefaultValue;
136 
137  [Attribute("1")]
138  protected bool m_bRequired;
139 
140  [Attribute("1")]
141  protected bool m_bInteractive;
142 
143  protected SCR_ChangeableComponentBase m_ChangeableComponent;
144  protected EJsonApiStructValueType m_iType;
145  protected string m_sClassTag;
146 
147  protected Widget m_EntryRoot;
148 
149  protected bool m_bValidInput = true;
150 
151  //-------------------------------------------------------------------------------------------
152  void CreateWidget(Widget parent)
153  {
154  // Create widget
155  Widget w = GetGame().GetWorkspace().CreateWidgets(m_sEntryLayout, parent);
156 
157  // Setup component
158  m_ChangeableComponent = SCR_ChangeableComponentBase.Cast(w.FindHandler(SCR_ChangeableComponentBase));
159  if (!m_ChangeableComponent)
160  return;
161 
162  m_ChangeableComponent.SetLabel(m_sLabel);
163 
164  SetupHandlers();
165  SetInteractive(m_bInteractive);
166 
167  m_EntryRoot = w;
168 
169  // Show
170  w.SetVisible(m_bShow);
171  }
172 
173  //-------------------------------------------------------------------------------------------
175  protected void SetupHandlers();
176 
177  //-------------------------------------------------------------------------------------------
179  string ValueAsString();
180 
181  //-------------------------------------------------------------------------------------------
182  void SetValue(string str){}
183 
184  //-------------------------------------------------------------------------------------------
186  bool CheckValidity()
187  {
188  if (CanSkip())
189  return true;
190 
191  m_bValidInput = true;
192 
193  return m_bValidInput;
194  }
195 
196  //-------------------------------------------------------------------------------------------
198  protected bool CanSkip()
199  {
200  return ValueAsString().IsEmpty() && !m_bRequired;
201  }
202 
203  //-------------------------------------------------------------------------------------------
205  void SetInteractive(bool interactive)
206  {
207  if (!m_ChangeableComponent)
208  return;
209 
210  m_ChangeableComponent.SetEnabled(interactive, false);
211  }
212 
213  //-------------------------------------------------------------------------------------------
214  // Get and Set
215  //-------------------------------------------------------------------------------------------
216 
217  //-------------------------------------------------------------------------------------------
218  ResourceName GetEntryLayout()
219  {
220  return m_sEntryLayout;
221  }
222 
223  //-------------------------------------------------------------------------------------------
224  void SetEntryLayout(ResourceName layout)
225  {
226  m_sEntryLayout = layout;
227  }
228 
229  //-------------------------------------------------------------------------------------------
230  string GetLabel()
231  {
232  return m_sLabel;
233  }
234 
235  //-------------------------------------------------------------------------------------------
236  void SetLabel(string label)
237  {
238  m_sLabel = label;
239  }
240 
241  //-------------------------------------------------------------------------------------------
242  string GetPropertyName()
243  {
244  return m_sPropertyName;
245  }
246 
247  //-------------------------------------------------------------------------------------------
248  void SetPropertyName(string propertyName)
249  {
250  m_sPropertyName = propertyName;
251  }
252 
253  //-------------------------------------------------------------------------------------------
254  string GetGroupTag()
255  {
256  return m_sGroupTag;
257  }
258 
259  //-------------------------------------------------------------------------------------------
260  void SetGroupTag(string tag)
261  {
262  m_sGroupTag = tag;
263  }
264 
265  //-------------------------------------------------------------------------------------------
266  EJsonApiStructValueType GetType()
267  {
268  return m_iType;
269  }
270 
271  //-------------------------------------------------------------------------------------------
272  Widget GetEntryRoot()
273  {
274  return m_EntryRoot;
275  }
276 
277  //-------------------------------------------------------------------------------------------
278  bool IsInputValid()
279  {
280  return m_bValidInput;
281  }
282 };
283 
284 //-------------------------------------------------------------------------------------------
285 [BaseContainerProps(configRoot: true)]
287 {
288  [Attribute("", UIWidgets.EditBox, "Group tag for fast recongition")]
289  protected string m_sTag;
290 
291  [Attribute()]
292  protected ref array<ref SCR_WidgetListEntry> m_aEntries;
293 
294  //-------------------------------------------------------------------------------------------
295  string GetTag()
296  {
297  return m_sTag;
298  }
299 };
300 
301 
302 //-------------------------------------------------------------------------------------------
304 [BaseContainerProps(configRoot: true)]
306 {
307  [Attribute("8")]
308  protected float m_iOffsetTop;
309 
310  [Attribute("8")]
311  protected float m_iOffsetBottom;
312 
313  [Attribute("8")]
314  protected float m_iLeftBottom;
315 
316  //-------------------------------------------------------------------------------------------
317  override void CreateWidget(Widget parent)
318  {
319  TextWidget wText = TextWidget.Cast(GetGame().GetWorkspace().CreateWidgets(m_sEntryLayout, parent));
320  if (!wText)
321  return;
322 
323  wText.SetText(m_sLabel);
324  VerticalLayoutSlot.SetPadding(wText, m_iLeftBottom, m_iOffsetTop, 0, m_iOffsetBottom);
325 
326  m_sClassTag = "label";
327  }
328 };
329 
330 //-------------------------------------------------------------------------------------------
334 {
335  [Attribute(EJsonApiStructValueType.TYPE_STRING.ToString(), uiwidget: UIWidgets.ComboBox, enums: SCR_Enum.GetList(EJsonApiStructValueType))]
336  protected EJsonApiStructValueType m_iEditType;
337 
338  [Attribute("100")]
339  protected int m_CharLimit;
340 
341  [Attribute("5", UIWidgets.EditBox, "In how many seconds should editbox error should be cleared after focus")]
342  protected int m_fClearErrorTimes;
343 
344  [Attribute()]
345  protected ref SCR_WidgetEditFormat m_FormatCheck;
346 
347  [Attribute("...")]
348  protected string m_sPlaceholderText;
349 
350  [Attribute("0", desc: "When false - there will be used warning text below as default. Otherwise there might be hardcoded strings in format messages.")]
351  protected bool m_bUseFormatWarning;
352 
353  [Attribute("")]
354  protected string m_sWarningText;
355 
356  [Attribute("")]
357  protected string m_sObfuscation;
358 
359  [Attribute("")]
360  protected string m_sCharBlackList;
361 
362  [Attribute("0")]
363  protected bool m_bShowWriteIcon;
364 
365  protected SCR_EditBoxComponent m_EditBox;
366  protected EditBoxFilterComponent m_Filter;
367 
368  //-------------------------------------------------------------------------------------------
369  override protected void SetupHandlers()
370  {
371  if (m_ChangeableComponent)
372  m_EditBox = SCR_EditBoxComponent.Cast(m_ChangeableComponent);
373 
374  if (!m_EditBox)
375  return;
376 
377  m_Filter = EditBoxFilterComponent.Cast(m_EditBox.m_wEditBox.FindHandler(EditBoxFilterComponent));
378 
379  m_iType = m_iEditType;
380  m_sClassTag = "edit";
381 
382  // Editbox setup
383  m_EditBox.SetValue(m_sDefaultValue);
384  m_EditBox.SetPlaceholderText(m_sPlaceholderText);
385  m_EditBox.GetHint().SetMessage(m_sWarningText);
386  m_EditBox.ShowWriteIcon(m_bShowWriteIcon);
387 
388  EditBoxWidget editBox = EditBoxWidget.Cast(m_EditBox.GetEditBoxWidget());
389  editBox.SetObfuscationChar(m_sObfuscation);
390 
391  if (m_FormatCheck)
392  {
393  m_EditBox.m_OnConfirm.Insert(CheckValidity);
394  m_EditBox.m_OnChanged.Insert(CheckValidity);
395  m_EditBox.m_OnFocusChangedEditBox.Insert(OnFocusChange);
396 
397  if (m_Filter)
398  {
399  m_FormatCheck.SetEditBoxFilter(m_Filter);
400 
401  // Call character list settings next frame to ensure list is properly override default values
402  GetGame().GetCallqueue().CallLater(SetCharLists);
403  }
404  }
405 
406  // Number specific setup
407  if (m_iType == EJsonApiStructValueType.TYPE_INT || m_iType == EJsonApiStructValueType.TYPE_FLOAT)
408  {
409  if (m_Filter)
410  {
411  m_Filter.SetNumbers(true);
412  m_Filter.SetPunctuation(m_iType == EJsonApiStructValueType.TYPE_FLOAT);
413  m_Filter.SetASCIIchars(false);
414  m_Filter.SetUTFMultibyte(false);
415  }
416  }
417 
418  // Limit
419  if (m_Filter)
420  {
421  m_Filter.SetCharacterLimit(m_CharLimit);
422  m_Filter.m_OnInvalidInput.Insert(OnInvalidInput);
423  m_Filter.m_OnTextTooLong.Insert(OnInvalidInput);
424  }
425 
426  m_Filter.SetCharBlacklist(m_sCharBlackList);
427  }
428 
429  //-------------------------------------------------------------------------------------------
430  protected void SetCharLists()
431  {
432  m_Filter.SetCharBlacklist(m_sCharBlackList);
433  }
434 
435  //-------------------------------------------------------------------------------------------
436  override string ValueAsString()
437  {
438  if (!m_EditBox)
439  return INVALID_VALUE;
440 
441  return m_EditBox.GetValue();
442  }
443 
444  //-------------------------------------------------------------------------------------------
445  override void SetValue(string str)
446  {
447  if (m_EditBox)
448  m_EditBox.SetValue(str);
449  }
450 
451  //-------------------------------------------------------------------------------------------
452  override bool CheckValidity()
453  {
454  if (CanSkip())
455  return true;
456 
457  CheckEditBoxValidity(m_EditBox, m_EditBox.GetValue());
458  return m_bValidInput;
459  }
460 
461  //-------------------------------------------------------------------------------------------
462  protected void OnFocusChange(SCR_EditBoxComponent editBox, Widget editBoxWidget, bool focused)
463  {
464  if (!focused)
465  {
466  // Check input
467  bool valid = CheckValidity();
468 
469  if (!valid)
470  GetGame().GetCallqueue().Remove(ClearInvalidInput);
471  }
472  else
473  {
474  // Clear input error
475  if (!m_bValidInput)
476  {
477  m_bValidInput = true;
478  OnInvalidInput();
479  }
480  }
481  }
482 
483  //-------------------------------------------------------------------------------------------
485  void CheckEditBoxValidity(SCR_EditBoxComponent editBox, string value)
486  {
487  if (!m_FormatCheck)
488  {
489  m_bValidInput = true;
490  return;
491  }
492 
493  m_bValidInput = m_FormatCheck.IsFormatValid(value);
494 
495  // Invalid
496  if (m_Filter && !m_bValidInput)
497  {
498  // Call in next frame to make sure this invoke happens after editbox change
499  // Change clears invalid input
500  GetGame().GetCallqueue().CallLater(InvokeInvalidInput);
501  }
502 
503  // Setup error
504  if (m_bUseFormatWarning)
505  m_EditBox.GetHint().SetMessage(m_FormatCheck.GetFormatMessage());
506  }
507 
508  //-------------------------------------------------------------------------------------------
509  protected void InvokeInvalidInput()
510  {
511  m_Filter.m_OnInvalidInput.Invoke();
512  }
513 
514  //-------------------------------------------------------------------------------------------
515  protected void OnInvalidInput()
516  {
517  // Call later to clear out invalid input
518  if (m_bValidInput)
519  GetGame().GetCallqueue().CallLater(ClearInvalidInput, m_fClearErrorTimes * 1000);
520  }
521 
522  //-------------------------------------------------------------------------------------------
523  void ClearInvalidInput()
524  {
525  if (m_EditBox)
526  m_EditBox.ClearInvalidInput();
527  }
528 
529  //-------------------------------------------------------------------------------------------
530  SCR_EditBoxComponent GetEditBoxComponent()
531  {
532  return m_EditBox;
533  }
534 
535  //-------------------------------------------------------------------------------------------
536  SCR_WidgetEditFormat GetFormatCheck()
537  {
538  return m_FormatCheck;
539  }
540 
541  //-------------------------------------------------------------------------------------------
542  void SetWarningText(string warning)
543  {
544  if (!m_EditBox)
545  return;
546 
547  if (m_EditBox.GetHint())
548  m_EditBox.GetHint().SetMessage(warning);
549  }
550 };
551 
552 //-------------------------------------------------------------------------------------------
556 {
557  protected SCR_WidgetEditFormatIP m_IPCheck;
558 
559  //-------------------------------------------------------------------------------------------
560  override protected void SetupHandlers()
561  {
562  super.SetupHandlers();
563  m_IPCheck = SCR_WidgetEditFormatIP.Cast(m_FormatCheck);
564  }
565 
566  //-------------------------------------------------------------------------------------------
567  override bool CheckValidity()
568  {
569  super.CheckValidity();
570 
571  // Private IP
572  if (m_IPCheck)
573  {
574  if (m_IPCheck.IsPrivate())
575  m_EditBox.ShowHint(true);
576  }
577 
578  return m_bValidInput;
579  }
580 }
581 
582 //-------------------------------------------------------------------------------------------
585 class SCR_WidgetListEntryCheckBox : SCR_WidgetListEntry
586 {
587  [Attribute("")]
588  protected string m_sPositive;
589 
590  [Attribute("")]
591  protected string m_sNegative;
592 
593  protected SCR_CheckboxComponent m_Checkbox;
594 
595  //-------------------------------------------------------------------------------------------
596  override protected void SetupHandlers()
597  {
598  if (m_ChangeableComponent)
599  m_Checkbox = SCR_CheckboxComponent.Cast(m_ChangeableComponent);
600 
601  m_iType = EJsonApiStructValueType.TYPE_BOOL;
602  m_sClassTag = "check box";
603 
604  // Checkbox value setup
605  if (!m_sNegative.IsEmpty() && m_Checkbox.m_aSelectionElements[0])
606  {
607  SCR_ButtonTextComponent textComp = SCR_ButtonTextComponent.Cast(m_Checkbox.m_aSelectionElements[0]);
608  if (textComp)
609  textComp.SetText(m_sNegative);
610  }
611 
612  if (!m_sPositive.IsEmpty() && m_Checkbox.m_aSelectionElements[1])
613  {
614  SCR_ButtonTextComponent textComp = SCR_ButtonTextComponent.Cast(m_Checkbox.m_aSelectionElements[1]);
615  if (textComp)
616  textComp.SetText(m_sPositive);
617  }
618 
619  m_Checkbox.SetChecked(SCR_JsonApiStructHandler.StringToBool(m_sDefaultValue), false, false);
620  }
621 
622  //-------------------------------------------------------------------------------------------
623  override void SetValue(string str)
624  {
625  if (!m_Checkbox)
626  return;
627 
628  bool checked = SCR_JsonApiStructHandler.StringToBool(str);
629  m_Checkbox.SetChecked(checked);
630  }
631 
632  //-------------------------------------------------------------------------------------------
633  override string ValueAsString()
634  {
635  if (!m_Checkbox)
636  return INVALID_VALUE;
637 
638  return m_Checkbox.IsChecked().ToString();
639  }
640 
641  //-------------------------------------------------------------------------------------------
642  SCR_CheckboxComponent GetCheckbox()
643  {
644  return m_Checkbox;
645  }
646 };
647 
648 //-------------------------------------------------------------------------------------------
652 {
653  [Attribute()]
654  protected ref array<ref SCR_LocalizedProperty> m_aOptions;
655 
656  protected SCR_SelectionWidgetComponent m_Selection;
657 
658  //-------------------------------------------------------------------------------------------
659  override protected void SetupHandlers()
660  {
661  if (m_ChangeableComponent)
662  m_Selection = SCR_SelectionWidgetComponent.Cast(m_ChangeableComponent);
663 
664  if (!m_Selection)
665  return;
666 
667  // Fill values
668  for (int i = 0, count = m_aOptions.Count(); i < count; i++)
669  {
670  m_Selection.AddItem(m_aOptions[i].m_sLabel);
671  }
672 
673  // Select default value
674  if (!m_sDefaultValue.IsEmpty())
675  SelectOption(m_sDefaultValue.ToInt());
676  }
677 
678  //-------------------------------------------------------------------------------------------
679  override string ValueAsString()
680  {
681  if (!m_Selection)
682  return INVALID_VALUE;
683 
684  int id = m_Selection.m_iSelectedItem;
685 
686  #ifdef SB_DEBUG
687  Print("option Id: " + id + "/" + m_aOptions.Count());
688  #endif
689 
690  if (id == -1 || id >= m_aOptions.Count())
691  return INVALID_VALUE;
692 
693  if (m_aOptions[id] == null)
694  return INVALID_VALUE;
695 
696  return m_aOptions[id].m_sPropertyName;
697  }
698 
699  //-------------------------------------------------------------------------------------------
701  int ValueId()
702  {
703  if (!m_Selection)
704  return INVALID_VALUE;
705 
706  return m_Selection.m_iSelectedItem;
707  }
708 
709  //-------------------------------------------------------------------------------------------
710  // API
711  //-------------------------------------------------------------------------------------------
712 
713  //-------------------------------------------------------------------------------------------\
714  void SelectOption(int id)
715  {
716  if (m_Selection)
717  m_Selection.SetCurrentItem(id);
718  }
719 
720  //-------------------------------------------------------------------------------------------
722  SCR_LocalizedProperty GetSelectedOption()
723  {
724  int id = -1;
725 
726  if (m_Selection)
727  id = m_Selection.GetCurrentIndex();
728 
729  if (id == -1)
730  return null;
731 
732  return m_aOptions[id];
733  }
734 
735  //-------------------------------------------------------------------------------------------
737  void SetOptions(array<ref SCR_LocalizedProperty> options)
738  {
739  m_aOptions = options;
740 
741  // Update values
742  if (!m_Selection)
743  return;
744 
745  m_Selection.ClearAll();
746 
747  for (int i = 0, count = m_aOptions.Count(); i < count; i++)
748  {
749  m_Selection.AddItem(m_aOptions[i].m_sLabel);
750  }
751  }
752 
753  //-------------------------------------------------------------------------------------------
754  SCR_SelectionWidgetComponent GetSelectionComponent()
755  {
756  return m_Selection;
757  }
758 
759  //-------------------------------------------------------------------------------------------
760  void GetOptions(out array<ref SCR_LocalizedProperty> options)
761  {
762  for (int i = 0, count = m_aOptions.Count(); i < count; i++)
763  {
764  options.Insert(m_aOptions[i]);
765  }
766  }
767 };
768 
769 //-------------------------------------------------------------------------------------------
773 {
774  [Attribute("1")]
775  protected bool m_bCycle;
776 
777  protected SCR_SpinBoxComponent m_SpinBox;
778 
779  //-------------------------------------------------------------------------------------------
780  override protected void SetupHandlers()
781  {
782  super.SetupHandlers();
783  m_SpinBox = SCR_SpinBoxComponent.Cast(m_Selection);
784 
785  if (!m_SpinBox)
786  return;
787 
788  m_SpinBox.SetCycleMode(m_bCycle);
789  }
790 
791  //-------------------------------------------------------------------------------------------
792  override void SetValue(string str)
793  {
794  if (m_SpinBox)
795  m_SpinBox.SetCurrentItem(str.ToInt());
796  }
797 
798  //-------------------------------------------------------------------------------------------
799  SCR_SpinBoxComponent GetSpinBox()
800  {
801  return m_SpinBox;
802  }
803 }
804 
805 //-------------------------------------------------------------------------------------------
807 class SCR_WidgetListEntryBoolSpinBox : SCR_WidgetListEntrySpinBox
808 {
809  [Attribute("0", desc: "Revert item reading order*")]
810  protected bool m_bReversed;
811 
812  //-------------------------------------------------------------------------------------------
813  override protected void SetupHandlers()
814  {
815  if (m_ChangeableComponent)
816  m_Selection = SCR_SelectionWidgetComponent.Cast(m_ChangeableComponent);
817 
818  if (!m_Selection)
819  return;
820 
821  // Fill values
822  if (m_bReversed)
823  {
824  for (int i = m_aOptions.Count() - 1; i >= 0; i--)
825  {
826  m_Selection.AddItem(m_aOptions[i].m_sLabel);
827  }
828  }
829  else
830  {
831  for (int i = 0, count = m_aOptions.Count(); i < count; i++)
832  {
833  m_Selection.AddItem(m_aOptions[i].m_sLabel);
834  }
835  }
836 
837  // Select default value
838  if (!m_sDefaultValue.IsEmpty())
839  SelectOption(m_sDefaultValue.ToInt());
840 
841  // Spinbox
842  m_SpinBox = SCR_SpinBoxComponent.Cast(m_Selection);
843 
844  if (!m_SpinBox)
845  return;
846 
847  m_SpinBox.SetCycleMode(m_bCycle);
848  }
849 
850  //-------------------------------------------------------------------------------------------
851  override void SetValue(string str)
852  {
853  int value = str.ToInt();
854  if (m_bReversed)
855  {
856  if (value == 0)
857  value = 1;
858  else if (value == 1)
859  value = 0;
860  }
861 
862  if (m_SpinBox)
863  m_SpinBox.SetCurrentItem(value);
864  }
865 }
866 
867 //-------------------------------------------------------------------------------------------
870 class SCR_WidgetListEntrySlider : SCR_WidgetListEntry
871 {
872  [Attribute()]
873  protected float m_fMin;
874 
875  [Attribute()]
876  protected float m_fMax;
877 
878  [Attribute("0.05")]
879  protected float m_fStep;
880 
881  [Attribute("%1")]
882  protected string m_sFormatText;
883 
884  protected SCR_SliderComponent m_Slider;
885 
886  //-------------------------------------------------------------------------------------------
887  override protected void SetupHandlers()
888  {
889  if (m_ChangeableComponent)
890  m_Slider = SCR_SliderComponent.Cast(m_ChangeableComponent);
891 
892  m_Slider.SetMin(m_fMin);
893  m_Slider.SetMax(m_fMax);
894  m_Slider.SetStep(m_fStep);
895  m_Slider.SetFormatText(m_sFormatText);
896 
897  m_Slider.SetValue(m_sDefaultValue.ToFloat());
898  }
899 
900  //-------------------------------------------------------------------------------------------
901  override void SetValue(string str)
902  {
903  if (!m_Slider)
904  return;
905 
906  m_Slider.SetValue(str.ToFloat());
907  }
908 
909  //-------------------------------------------------------------------------------------------
910  override string ValueAsString()
911  {
912  if (!m_Slider)
913  return INVALID_VALUE;
914 
915  return m_Slider.GetValue().ToString();
916  }
917 
918  //-------------------------------------------------------------------------------------------
919  void SetRange(float min, float max)
920  {
921  m_Slider.SetMin(min);
922  m_Slider.SetMax(max);
923  }
924 };
SCR_ChangeableComponentBase
Base class for all widgets that can change their internal state as editbox or spinbox.
Definition: SCR_ChangeableComponentBase.c:4
SCR_CheckboxComponent
This is refactored checkbox preserving its own class and API for compatability purposes.
Definition: SCR_CheckboxComponent.c:3
SCR_Enum
Definition: SCR_Enum.c:1
SCR_WidgetListEntryEditBox
Configurable widget list entry for various value that can be typed - numbers, strings,...
Definition: SCR_WidgetListEntry.c:333
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_WidgetEditFormat
Definition: SCR_WidgetEditFormat.c:7
m_fMax
protected float m_fMax
Definition: SCR_BaseEditorAttribute.c:520
SetValue
override void SetValue(string str)
Definition: SCR_WidgetListEntry.c:603
SCR_LocalizedPropertyTitle
Displays label and value name for variable with localization.
Definition: SCR_WidgetListEntry.c:48
SCR_SliderComponent
Definition: SCR_SliderComponent.c:2
SCR_JsonApiStructHandler
Handler for json api struct values.
Definition: SCR_JsonApiStructHandler.c:8
Attribute
typedef Attribute
Post-process effect of scripted camera.
BaseContainerProps
SCR_WidgetListEntryCustomTitle BaseContainerProps
SCR_ButtonTextComponent
Definition: SCR_ButtonTextComponent.c:2
SCR_SpinBoxComponent
Definition: SCR_SpinBoxComponent.c:1
SCR_WidgetListEntryEditBoxIP
IP specific entry.
Definition: SCR_WidgetListEntry.c:555
m_bCycle
protected bool m_bCycle
Definition: SCR_WidgetListEntry.c:586
SCR_WidgetListEntrySpinBox
Configurable widget list entry selection specific for spinbox.
Definition: SCR_WidgetListEntry.c:772
SCR_WidgetListEntryLabel
Configurable widget list entry for list label.
Definition: SCR_WidgetListEntry.c:305
SCR_LocalizedPropertyExtended
Localied property with extra array info.
Definition: SCR_WidgetListEntry.c:95
SCR_LocalizedProperty
Variable that is using localized label.
Definition: SCR_WidgetListEntry.c:74
layout
UI layouts HUD CampaignMP CampaignMainHUD layout
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:20
m_SpinBox
protected SCR_SpinBoxComponent m_SpinBox
Definition: SCR_WidgetListEntry.c:588
m_fStep
protected float m_fStep
Definition: SCR_BaseEditorAttribute.c:521
SCR_EditBoxComponent
Definition: SCR_EditBoxComponent.c:8
SCR_WidgetListEntry
Configurable class for widget.
Definition: SCR_WidgetListEntry.c:115
m_IPCheck
protected SCR_WidgetEditFormatIP m_IPCheck
Definition: SCR_WidgetListEntry.c:2
SCR_WidgetListEntryGroup
Definition: SCR_WidgetListEntry.c:286
SetRange
void SetRange(float range)
Definition: SCR_ResourceConsumtionResponse.c:62
SCR_SelectionWidgetComponent
Definition: SCR_SelectionWidgetComponent.c:1
m_sPropertyName
BaseContainerCustomCheckIntWithFlagTitleField m_sPropertyName
Attribute for setting UIInfo's name property as (Localized) custom title.
SetupHandlers
override protected void SetupHandlers()
Definition: SCR_WidgetListEntry.c:5
SCR_WidgetListEntryCustomTitle
Definition: SCR_WidgetListEntry.c:11
EditBoxFilterComponent
Definition: EditBoxFilterComponent.c:5
EJsonApiStructValueType
EJsonApiStructValueType
Definition: SCR_JsonApiStructHandler.c:87
m_fMin
SCR_BaseEditorAttributeEntryUIInfo m_fMin
SCR_WidgetListEntrySelection
Configurable widget list entry list selection.
Definition: SCR_WidgetListEntry.c:651