public void FindEditableForms() { _formsList.ClearChilden(); //Go searching for attributes foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { foreach (Type type in assembly.GetTypes()) { object[] __foundAttributes = type.GetCustomAttributes(typeof(UWidgetFormAttribute), false); if (__foundAttributes != null && __foundAttributes.Length == 1) { UWidgetFormAttribute __formAttribute = __foundAttributes[0] as UWidgetFormAttribute; if (__formAttribute.CanEditInDesigner) { _listFormTypes.Add(new ListItems(type.FullName, type)); UEditorWidgetButton __formItem = UWidget.Create <UEditorWidgetButton>(); __formItem.BaseStyle = "label"; __formItem.Width = 200; __formItem.Height = 16; __formItem.LayoutMode = ePositioningLayout.Layout; __formItem.Label = type.FullName; __formItem.Alignment = TextAnchor.MiddleLeft; __formItem.Padding.left = 5; __formItem.OnClick += __formItem_OnClick; _formsList.AddChild(__formItem); } } } } }
private void __formItem_OnClick(IUEditorWidgetClickable sender, EventArgs e) { if (this._activeButton != null) { this._activeButton.FontStyle = FontStyle.Normal; } this._activeButton = sender as UEditorWidgetButton; this._activeButton.FontStyle = FontStyle.Bold; this._btnOpenForm.GUIEnabled = true; }
void AddControl_OnClick(IUEditorWidgetClickable sender, EventArgs e) { UEditorWidgetButton __buttonPressed = (UEditorWidgetButton)sender; widgetDef __widgetDef = (widgetDef)__buttonPressed.BoundObject; this._lastSelectedType = __widgetDef.WidgetFQName; if (this.OnClick != null) { this.OnClick(this, new EventArgs()); } }
private UEditorWidgetButton BuildButton(string Label) { UEditorWidgetButton __newButton = Create <UEditorWidgetButton>("", true); __newButton.Height = 16; __newButton.Width = 100; __newButton.Alignment = TextAnchor.MiddleCenter; __newButton.BaseStyle = "textField"; __newButton.LayoutMode = ePositioningLayout.Layout; __newButton.Label = Label; __newButton.OnClick += AddControl_OnClick; return(__newButton); }
public override bool BindTo(object Object, string MemberName) { //return base.BindTo(Object, MemberName); this._dataWidgets.Clear(); this._vertWidgets.ClearChilden(); this._dataPanels.Clear(); this._vertPanels.ClearChilden(); this._dataContols.Clear(); this._vertControls.ClearChilden(); this._dataDecorators.Clear(); this._vertDecorators.ClearChilden(); this._dataOthers.Clear(); this._vertOthers.ClearChilden(); //Go searching for attributes foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { foreach (Type type in assembly.GetTypes()) { object[] __foundAttributes = type.GetCustomAttributes(typeof(UWidgetWidgetAttribute), false); if (__foundAttributes != null && __foundAttributes.Length == 1) { UWidgetWidgetAttribute __attribute = (UWidgetWidgetAttribute)__foundAttributes[0]; switch (__attribute.DesignerCatogery) { case eUWidgetDesignerCategory.NotSet: break; case eUWidgetDesignerCategory.Panels: this._dataPanels.Add(new widgetDef() { WidgetFQName = type.AssemblyQualifiedName, Label = __attribute.DesignerLabel }); break; case eUWidgetDesignerCategory.Widgets: this._dataWidgets.Add(new widgetDef() { WidgetFQName = type.AssemblyQualifiedName, Label = __attribute.DesignerLabel }); break; case eUWidgetDesignerCategory.Controls: this._dataContols.Add(new widgetDef() { WidgetFQName = type.AssemblyQualifiedName, Label = __attribute.DesignerLabel }); break; case eUWidgetDesignerCategory.Decorators: this._dataDecorators.Add(new widgetDef() { WidgetFQName = type.AssemblyQualifiedName, Label = __attribute.DesignerLabel }); break; case eUWidgetDesignerCategory.Other: this._dataOthers.Add(new widgetDef() { WidgetFQName = type.AssemblyQualifiedName, Label = __attribute.DesignerLabel }); break; default: break; } } } } //Now we have the widgets found, build out the menu foreach (var widget in _dataWidgets) { UEditorWidgetButton __newButton = this.BuildButton(widget.Label); __newButton.BindTo(widget, "this"); _vertWidgets.AddChild(__newButton); } foreach (var widget in _dataContols) { UEditorWidgetButton __newButton = this.BuildButton(widget.Label); __newButton.BindTo(widget, "this"); _vertControls.AddChild(__newButton); } foreach (var widget in _dataDecorators) { UEditorWidgetButton __newButton = this.BuildButton(widget.Label); __newButton.BindTo(widget, "this"); _vertDecorators.AddChild(__newButton); } foreach (var widget in _dataPanels) { UEditorWidgetButton __newButton = this.BuildButton(widget.Label); __newButton.BindTo(widget, "this"); _vertPanels.AddChild(__newButton); } foreach (var widget in _dataOthers) { UEditorWidgetButton __newButton = this.BuildButton(widget.Label); __newButton.BindTo(widget, "this"); _vertOthers.AddChild(__newButton); } //Bind group buttons; this._btnControls.OnClick += _btnControls_OnClick; this._btnDecorators.OnClick += _btnDecorators_OnClick; this._btnOthers.OnClick += _btnOthers_OnClick; this._btnPanels.OnClick += _btnPanels_OnClick; this._btnWidgets.OnClick += _btnWidgets_OnClick; return(true); }