private static void HandleUicolorwidgetEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uicolorwidgetcode") { AtomicMain.AppLog("UIColorWidget support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uicolorwidget.cs", widget.GetParent()); } if (widget.GetId() == "uicolorwidgetlayout") { AtomicMain.AppLog("UIColorWidget support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uicolorwidget.ui.txt", widget.GetParent()); } if (widget.GetId() == "uicolorwidgetred") { AtomicMain.AppLog("UIColorWidget action : " + widget.GetId() + " was pressed "); UIColorWidget clw = (UIColorWidget)widget.FindWidget("colorwidgetdemo"); if (!clw.Equals(null)) { clw.SetColorString("#FF1111"); } } if (widget.GetId() == "uicolorwidgetgreen") { AtomicMain.AppLog("UIColorWidget action : " + widget.GetId() + " was pressed "); UIColorWidget clw = (UIColorWidget)widget.FindWidget("colorwidgetdemo"); if (!clw.Equals(null)) { clw.SetColorString("#11FF11"); } } if (widget.GetId() == "uicolorwidgetblue") { AtomicMain.AppLog("UIColorWidget action : " + widget.GetId() + " was pressed "); UIColorWidget clw = (UIColorWidget)widget.FindWidget("colorwidgetdemo"); if (!clw.Equals(null)) { clw.SetColorString("#1111FF"); } } } }
private static void HandleUiradiobuttonEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uiradiobuttoncode") { AtomicMain.AppLog("UIRadioButton support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uiradiobutton.cs", widget.GetParent()); } if (widget.GetId() == "uiradiobuttonlayout") { AtomicMain.AppLog("UIRadioButton support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uiradiobutton.ui.txt", widget.GetParent()); } if (widget.GetId() == "demoradio") { AtomicMain.AppLog("UIRadioButton event : " + widget.GetId() + " was pressed, state = " + widget.GetValue().ToString()); } if (widget.GetId() == "radioset") { UIWidget demochk = widget.FindWidget("demoradio"); if (!demochk.Equals(null)) { demochk.SetValue(1); AtomicMain.AppLog("UIRadioButton action : " + widget.GetId() + " was pressed, set state to 1"); } } if (widget.GetId() == "radiounset") { UIWidget demochk = widget.FindWidget("demoradio"); if (!demochk.Equals(null)) { demochk.SetValue(0); AtomicMain.AppLog("UIRadioButton action : " + widget.GetId() + " was pressed, set state to 0"); } } } }
private static void HandleUitexturewidgetEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uitexturewidgetcode") { AtomicMain.AppLog("UITextureWidget support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uitexturewidget.cs", widget.GetParent()); } if (widget.GetId() == "uitexturewidgetlayout") { AtomicMain.AppLog("UITextureWidget support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uitexturewidget.ui.txt", widget.GetParent()); } if (widget.GetId() == "uitexturewidgetch1") { AtomicMain.AppLog("UITextureWidget support : " + widget.GetId() + " was pressed "); var cache = GetSubsystem <ResourceCache>(); UITextureWidget tw = (UITextureWidget)widget.FindWidget("UITextureWidgetDemo"); tw.SetTexture(cache.GetResource <Texture2D>("Textures/newbuilddetected_header.jpg")); } if (widget.GetId() == "uitexturewidgetch2") { AtomicMain.AppLog("UITextureWidget support : " + widget.GetId() + " was pressed "); var cache = GetSubsystem <ResourceCache>(); UITextureWidget tw = (UITextureWidget)widget.FindWidget("UITextureWidgetDemo"); tw.SetTexture(cache.GetResource <Texture2D>("Textures/HSV21.png")); } if (widget.GetId() == "uitexturewidgetch3") { AtomicMain.AppLog("UITextureWidget support : " + widget.GetId() + " was pressed "); var cache = GetSubsystem <ResourceCache>(); UITextureWidget tw = (UITextureWidget)widget.FindWidget("UITextureWidgetDemo"); tw.SetTexture(cache.GetResource <Texture2D>("Textures/planet.jpg")); } } }
private static void HandleUisectionEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uisectioncode") { AtomicMain.AppLog("UISection support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uisection.cs", widget.GetParent()); } if (widget.GetId() == "uisectionlayout") { AtomicMain.AppLog("UISection support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uisection.ui.txt", widget.GetParent()); } } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) { UIWidget demo1 = widget.FindWidget("UISectionDemo"); // event comes in on child widget! if (demo1.IsAncestorOf(widget)) { AtomicMain.AppLog("UISection event : " + demo1.GetId() + " changed to value = " + demo1.GetValue().ToString()); } UIWidget demo2 = widget.FindWidget("UISection2Demo"); if (demo2.IsAncestorOf(widget)) { AtomicMain.AppLog("UISection event : " + demo2.GetId() + " changed to value = " + demo2.GetValue().ToString()); } } }
private static void HandleUiinlineselectEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uiinlineselectcode") { AtomicMain.AppLog("UIInlineSelect support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uiinlineselect.cs", widget.GetParent()); } if (widget.GetId() == "uiinlineselectlayout") { AtomicMain.AppLog("UIInlineSelect support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uiinlineselect.ui.txt", widget.GetParent()); } } else if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) { if (widget.GetId() == "inlineselectdemo") { UIInlineSelect ils = (UIInlineSelect)widget; if (!ils.Equals(null)) { AtomicMain.AppLog("UIInlineSelect event : " + widget.GetId() + " changed value to " + ils.GetValue().ToString()); } } if (widget.GetId() == "ilsstep") { UISlider steps = (UISlider)widget; if (!steps.Equals(null)) { UIInlineSelect ils = (UIInlineSelect)widget.FindWidget("inlineselectdemo"); if (!ils.Equals(null)) { ils.SetStepSize(steps.GetValue()); } AtomicMain.AppLog("UIInlineSelect event : " + widget.GetId() + " step size changed to " + steps.GetValue().ToString()); } } } }
private static void HandleUifontdescriptionEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uifontdescriptioncode") { AtomicMain.AppLog("UIFontdescription support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uifontdescription.cs", widget.GetParent()); } if (widget.GetId() == "uifontdescriptionlayout") { AtomicMain.AppLog("UIFontdescription support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uifontdescription.ui.txt", widget.GetParent()); } } else if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) { if (widget.GetId() == "fontstep") { UISlider uis = (UISlider)widget; if (!uis.Equals(null)) { UITextField mytext = (UITextField)widget.FindWidget("changetext"); UIFontDescription myfont = new UIFontDescription(); int mysize = (int)uis.GetValue(); myfont.SetSize(mysize); myfont.SetId("Vera"); mytext.SetFontDescription(myfont); mytext.SetText("Size " + mysize); AtomicMain.AppLog("UIFontdescription action : " + widget.GetId() + " step size changed to " + mysize); } } } }
// handle table clicks private static void HandleTableEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { UITabContainer maintb = (UITabContainer)widget.FindWidget("maintabs"); UITabContainer acttb = (UITabContainer)widget.FindWidget("primarytabs"); UITabContainer semitb = (UITabContainer)widget.FindWidget("moretabs"); UITabContainer viewtb = (UITabContainer)widget.FindWidget("supporttabs"); UITabContainer supporttb = (UITabContainer)widget.FindWidget("atomictabs"); if (widget.GetId() == "A1") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(0); } if (widget.GetId() == "A2") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(1); } if (widget.GetId() == "A3") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(2); } if (widget.GetId() == "A4") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(3); } if (widget.GetId() == "A5") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(4); } if (widget.GetId() == "A6") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(5); } if (widget.GetId() == "A7") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(6); } if (widget.GetId() == "A8") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(7); } if (widget.GetId() == "A9") { maintb.SetCurrentPage(1); acttb.SetCurrentPage(8); } if (widget.GetId() == "B1") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(0); } if (widget.GetId() == "B2") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(1); } if (widget.GetId() == "B3") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(2); } if (widget.GetId() == "B4") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(3); } if (widget.GetId() == "B5") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(4); } if (widget.GetId() == "B6") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(5); } if (widget.GetId() == "B7") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(6); } if (widget.GetId() == "B8") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(7); } if (widget.GetId() == "B9") { maintb.SetCurrentPage(2); semitb.SetCurrentPage(8); } if (widget.GetId() == "C1") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(0); } if (widget.GetId() == "C2") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(1); } if (widget.GetId() == "C3") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(2); } if (widget.GetId() == "C4") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(3); } if (widget.GetId() == "C5") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(4); } if (widget.GetId() == "C6") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(5); } if (widget.GetId() == "C7") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(6); } if (widget.GetId() == "C8") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(7); } if (widget.GetId() == "C9") { maintb.SetCurrentPage(3); viewtb.SetCurrentPage(8); } if (widget.GetId() == "D2") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(0); } if (widget.GetId() == "D3") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(1); } if (widget.GetId() == "D4") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(2); } if (widget.GetId() == "D5") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(3); } if (widget.GetId() == "D6") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(4); } if (widget.GetId() == "D7") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(5); } if (widget.GetId() == "D8") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(6); } if (widget.GetId() == "D9") { maintb.SetCurrentPage(4); supporttb.SetCurrentPage(7); } } }
private static void HandleUilayoutEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "go_layout_config") // its LAYOUT-O-MATIC time. { AtomicMain.AppLog("UILayout action : " + widget.GetId() + " was pressed, its LAYOUT-O-MATIC time"); UIView someview = widget.GetView(); UIWindow window = new UIWindow(); window.SetSettings(UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_DEFAULT); window.SetText("LAYOUT-O-MATIC(tm)"); window.Load("Scenes/view_layout.ui.txt"); window.ResizeToFitContent(); someview.AddChild(window); UIWidget okbutt = window.GetWidget("ok"); okbutt.SubscribeToEvent <WidgetEvent> (okbutt, HandleUilayoutEvent); var lox = new AtomicEngine.Vector <AtomicEngine.UIWidget>(); window.SearchWidgetClass("TBRadioButton", lox); for (var ii = 0; ii < lox.Size; ii++) { lox[ii].SubscribeToEvent <WidgetEvent> (lox [ii], HandleUilayoutEvent); } } if (widget.GetId() == "ok") { UIWindow mywindow = (UIWindow)AtomicMain.FindTheWindowParent(widget); if (!mywindow.Equals(null)) { mywindow.Close(); } } if (widget.GetId() == "set_ax") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(0, 'X'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_ay") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(0, 'Y'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_sza") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(1, 'A'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_szg") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(1, 'G'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_szp") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(1, 'P'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_posc") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(2, 'C'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_posg") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(2, 'G'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_posl") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(2, 'L'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_posr") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(2, 'R'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_dista") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(3, 'A'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_distg") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(3, 'G'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_distp") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(3, 'P'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_dpc") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(4, 'C'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_dpl") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(4, 'L'); targetl.SetLayoutConfig(layoutomaticstr); } } } if (widget.GetId() == "set_dpr") { UILayout targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on. UIRadioButton setla = (UIRadioButton)widget; // who we are if (!targetl.Equals(null) && !setla.Equals(null)) { if (setla.GetValue() == 1) { ReplaceChar(4, 'R'); targetl.SetLayoutConfig(layoutomaticstr); } } } } }
private static void HandleUimessagewindowEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; string refid = (string)ev.RefID; if (widget.Equals(null)) { return; } UIWidget mylayout = (UIWidget)widget.FindWidget("pageuimessagewindow"); if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uimessagewindowcode") { AtomicMain.AppLog("UIMessageWindow support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uimessagewindow.cs", widget.GetParent()); } if (widget.GetId() == "uimessagewindowlayout") { AtomicMain.AppLog("UIMessageWindow support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uimessagewindow.ui.txt", widget.GetParent()); } if (widget.GetId() == "msgnone") { AtomicMain.AppLog("UIMessageWindow support : " + widget.GetId() + " was pressed "); UIMessageWindow mess1 = new UIMessageWindow(mylayout, "mymess1"); mess1.Show("MessageWindow - NONE", "this is a MessageWindow - None button", (UI_MESSAGEWINDOW_SETTINGS)0, false, 0, 0); } if (widget.GetId() == "msgok") { AtomicMain.AppLog("UIMessageWindow support : " + widget.GetId() + " was pressed "); UIMessageWindow mess2 = new UIMessageWindow(mylayout, "mymess2"); mess2.SubscribeToEvent <WidgetEvent> (mess2, HandleUimessagewindowEvent); mess2.Show("MessageWindow - OK", "this is a MessageWindow - OK button", UI_MESSAGEWINDOW_SETTINGS.UI_MESSAGEWINDOW_SETTINGS_OK, false, 0, 0); } if (widget.GetId() == "msgkcancel") { AtomicMain.AppLog("UIMessageWindow support : " + widget.GetId() + " was pressed "); UIMessageWindow mess3 = new UIMessageWindow(mylayout, "mymess3"); mess3.SubscribeToEvent <WidgetEvent> (mess3, HandleUimessagewindowEvent); mess3.Show("MessageWindow - OK CANCEL", "this is a MessageWindow - OK CANCEL buttons", UI_MESSAGEWINDOW_SETTINGS.UI_MESSAGEWINDOW_SETTINGS_OK_CANCEL, false, 0, 0); } if (widget.GetId() == "msgyesno") { AtomicMain.AppLog("UIMessageWindow support : " + widget.GetId() + " was pressed "); UIMessageWindow mess4 = new UIMessageWindow(mylayout, "mymess4"); mess4.SubscribeToEvent <WidgetEvent> (mess4, HandleUimessagewindowEvent); mess4.Show("MessageWindow - YES NO", "this is a MessageWindow - YES NO buttons", UI_MESSAGEWINDOW_SETTINGS.UI_MESSAGEWINDOW_SETTINGS_YES_NO, false, 0, 0); } if (refid == "TBMessageWindow.ok") { AtomicMain.AppLog("UIMessageWindow event : " + refid + " closed the UIMessageWindow"); } if (refid == "TBMessageWindow.cancel") { AtomicMain.AppLog("UIMessageWindow event : " + refid + " closed the UIMessageWindow"); } if (refid == "TBMessageWindow.yes") { AtomicMain.AppLog("UIMessageWindow event : " + refid + " closed the UIMessageWindow"); } if (refid == "TBMessageWindow.no") { AtomicMain.AppLog("UIMessageWindow event : " + refid + " closed the UIMessageWindow"); } } else { AtomicMain.AppLog("UIMessageWindow event : " + widget.GetId() + " event type = " + AtomicMain.EventReport((int)ev.Type)); } }
private static void HandleUitabcontainerEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; string refid = (string)ev.RefID; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uitabcontainercode") { AtomicMain.AppLog("UITabContainer support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uitabcontainer.cs", widget.GetParent()); } if (widget.GetId() == "uitabcontainerlayout") { AtomicMain.AppLog("UITabContainer support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uitabcontainer.ui.txt", widget.GetParent()); } if (widget.GetId() == "uitabcontainerremove") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); int current = tcx.GetCurrentPage(); tcx.DeletePage(current); } if (widget.GetId() == "uitabcontaineradd") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); tcx.AddTabPageFile("New File", "Scenes/sheet.ui.txt"); } if (widget.GetId() == "uitabcontainermake") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); var cache = GetSubsystem <ResourceCache>(); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); UILayout lo = new UILayout(); lo.SetLayoutConfig("YAGAC"); // YACAC! UIEditField myeditfield = new UIEditField(); myeditfield.SetGravity(UI_GRAVITY.UI_GRAVITY_ALL); myeditfield.SetMultiline(true); File filex = cache.GetFile("Components/code_uitabcontainer.cs"); String textx = filex.ReadText(); filex.Close(); myeditfield.SetText(textx); UIFontDescription myfont = new UIFontDescription(); // put in a coder font myfont.SetSize(16); myfont.SetId("Vera"); myeditfield.SetFontDescription(myfont); lo.AddChild(myeditfield); tcx.AddTabPageWidget("New Code", lo); } if (widget.GetId() == "uitabcontainerundock") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); int current = tcx.GetCurrentPage(); tcx.UndockPage(current); } if (widget.GetId() == "uitabcontainerredock") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); if (!tcx.DockWindow("tab1")) { if (!tcx.DockWindow("tab2")) { if (!tcx.DockWindow("tab3")) { if (!tcx.DockWindow("New File")) { if (!tcx.DockWindow("New Code")) { AtomicMain.AppLog("UITabContainer action : no more windows to dock."); } } } } } } } }
private static void HandleUiselectlistEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; string refid = (string)ev.RefID; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uiselectlistcode") { AtomicMain.AppLog("UISelectList support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uiselectlist.cs", widget.GetParent()); } if (widget.GetId() == "uiselectlistlayout") { AtomicMain.AppLog("UISelectList support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uiselectlist.ui.txt", widget.GetParent()); } if (widget.GetId() == "UISelectListDemo") { AtomicMain.AppLog("UISelectList event : " + widget.GetId() + " and " + refid + " was selected "); } if (widget.GetId() == "selectlistadd") { AtomicMain.AppLog("UISelectList action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectListDemo"); slist.AddItem(slist.GetNumItems(), "New Entry"); } if (widget.GetId() == "selectlistdel") { AtomicMain.AppLog("UISelectList action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectListDemo"); int si = (int)slist.GetValue(); // this is the selected index slist.DeleteItem(si); } if (widget.GetId() == "selectlistdelall") { AtomicMain.AppLog("UISelectList action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectListDemo"); slist.DeleteAllItems(); } if (widget.GetId() == "selectlistnew") { AtomicMain.AppLog("UISelectList action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectListDemo"); UISelectItemSource sis = new UISelectItemSource(); sis.AddItem(new UISelectItem("list 1", "list1", "LogoAtomic")); sis.AddItem(new UISelectItem("list 2", "list2", "")); sis.AddItem(new UISelectItem("list 3", "list3", "")); sis.AddItem(new UISelectItem("list 4", "list4", "")); sis.AddItem(new UISelectItem("list 5", "list5", "")); sis.AddItem(new UISelectItem("list 6", "list6", "")); slist.SetSource(sis); } } }
private static void HandleUiselectitemEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; string refid = (string)ev.RefID; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uiselectitemcode") { AtomicMain.AppLog("UISelectItem support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uiselectitem.cs", widget.GetParent()); } if (widget.GetId() == "uiselectitemlayout") { AtomicMain.AppLog("UISelectItem support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uiselectitem.ui.txt", widget.GetParent()); } if (widget.GetId() == "UISelectItemList") { AtomicMain.AppLog("UISelectItem event : " + widget.GetId() + " and " + refid + " was selected "); } if (widget.GetId() == "uisi1") { AtomicMain.AppLog("UISelectItem action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectItemList"); sis.AddItem(new UISelectItem("New UISelectItem")); slist.SetSource(sis); } if (widget.GetId() == "uisi2") { AtomicMain.AppLog("UISelectItem action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectItemList"); sis.AddItem(new UISelectItem("Newer UISelectItem", "neweritem")); slist.SetSource(sis); } if (widget.GetId() == "uisi3") { AtomicMain.AppLog("UISelectItem action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectItemList"); sis.AddItem(new UISelectItem("A Duck", "aduck", "DuckButton")); slist.SetSource(sis); } if (widget.GetId() == "uisi4") { AtomicMain.AppLog("UISelectItem action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectItemList"); sis.AddItem(new UISelectItem("Atomic!", "atomic", "LogoAtomic")); slist.SetSource(sis); } if (widget.GetId() == "uisi5") { AtomicMain.AppLog("UISelectItem action : " + widget.GetId() + " was pressed "); UISelectList slist = (UISelectList)widget.FindWidget("UISelectItemList"); sis.Clear(); slist.SetSource(sis); } } }