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); } } } }
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."); } } } } } } } }