9 [
Attribute(
"true", UIWidgets.CheckBox,
"Export this widget and its components")]
10 protected bool ExportThisWidget;
12 [
Attribute(
"true", UIWidgets.CheckBox,
"Export children of this widget")]
13 protected bool ExportChildWidgets;
15 [
Attribute(
"", UIWidgets.EditBox,
"Variable name for this widget. If not provided, it will be deduced from widget name.")]
16 protected string WidgetVariableName;
21 static BaseContainer FindInWidgetSource(WidgetSource ws)
23 BaseContainerList components = ws.GetObjectArray(
"components");
26 typename compTypename;
27 for (
int i, count = components.Count(); i < count; i++)
29 comp = components.Get(i);
30 compTypename = comp.GetClassName().ToType();
41 static void ExtractVariablesFromBaseContainer(BaseContainer container,
42 out
bool out_ExportThisWidget,
43 out
bool out_ExportChildWidgets,
44 out
string out_WidgetVariableName)
46 container.Get(
"ExportThisWidget", out_ExportThisWidget);
47 container.Get(
"ExportChildWidgets", out_ExportChildWidgets);
48 container.Get(
"WidgetVariableName", out_WidgetVariableName);
52 static bool GetExportThisWidget(BaseContainer container)
55 container.Get(
"ExportThisWidget", outVar);
60 static bool GetExportChildWidgets(BaseContainer container)
63 container.Get(
"ExportChildWidgets", outVar);
68 static string GetWidgetVariableName(BaseContainer container)
71 container.Get(
"WidgetVariableName", outVar);
79 class SCR_WidgetExportRuleRoot : ScriptedWidgetComponent
83 ResourceName DestinationPath;
85 [
Attribute(
"$ArmaReforger:", UIWidgets.EditBox,
"File system in which new script will be created.",
"")]
88 [
Attribute(
"true", UIWidgets.CheckBox,
"When true, widget is resolved with FindWidget() in generated code. When false, widget is resolved with FindAnyWidget().")]
89 bool GenerateFullWidgetPath;
91 [
Attribute(
"SCR_", UIWidgets.EditBox,
"Prefix which will be added to the name of the generated class")]
92 string ScriptClassNamePrefix;
94 [
Attribute(
"Widgets", UIWidgets.EditBox,
"Suffix which will be added to the name of the generated class")]
95 string ScriptClassNameSuffix;
100 static BaseContainer FindInWidgetSource(WidgetSource ws)
105 BaseContainerList components = ws.GetObjectArray(
"components");
106 typename compTypename;
108 for (
int i, count = components.Count(); i < count; i++)
110 comp = components.Get(i);
111 compTypename = comp.GetClassName().ToType();
112 if (compTypename && compTypename.IsInherited(SCR_WidgetExportRuleRoot))
120 static ResourceName GetDestinationPath(BaseContainer container)
123 container.Get(
"DestinationPath", outVar);
128 static string GetScriptAddon(BaseContainer container)
131 container.Get(
"ScriptAddon", outVar);
136 static bool GetGenerateFullWidgetPath(BaseContainer container)
139 container.Get(
"GenerateFullWidgetPath", outVar);
144 static void GetClassPrefixAndSuffix(BaseContainer container, out
string prefix, out
string suffix)
146 container.Get(
"ScriptClassNamePrefix", prefix);
147 container.Get(
"ScriptClassNameSuffix", suffix);