Exemple #1
0
    private static void HandleUiimagewidgetEvent(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() == "uiimagewidgetcode")
            {
                AtomicMain.AppLog("UIImageWidget support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uiimagewidget.cs", widget.GetParent());
            }
            if (widget.GetId() == "uiimagewidgetlayout")
            {
                AtomicMain.AppLog("UIImageWidget support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uiimagewidget.ui.txt", widget.GetParent());
            }

            if (widget.GetId() == "imagecolor")
            {
                AtomicMain.AppLog("UIImageWidget action : " + widget.GetId() + " was pressed ");
                UIImageWidget img1 = (UIImageWidget)widget.FindWidget("imagewidgetdemo");
                img1.SetImage("Textures/HSV21.png");
            }
            if (widget.GetId() == "imagenewbuild")
            {
                AtomicMain.AppLog("UIImageWidget action : " + widget.GetId() + " was pressed ");
                UIImageWidget img1 = (UIImageWidget)widget.FindWidget("imagewidgetdemo");
                img1.SetImage("Textures/newbuilddetected_header.jpg");
            }
        }
    }
    private static void HandleUiclicklabelEvent(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() == "uiclicklabelcode")
            {
                AtomicMain.AppLog("UIClickLabel support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uiclicklabel.cs", widget.GetParent());
            }
            if (widget.GetId() == "uiclicklabellayout")
            {
                AtomicMain.AppLog("UIClickLabel support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uiclicklabel.ui.txt", widget.GetParent());
            }

            if (widget.GetId() == "somecheck")
            {
                AtomicMain.AppLog("UIClickLabel event : " + widget.GetId() + " was pressed, state = " + widget.GetValue().ToString());
            }
            if (widget.GetId() == "someradio")
            {
                AtomicMain.AppLog("UIClickLabel event : " + widget.GetId() + " was pressed, state = " + widget.GetValue().ToString());
            }
        }
    }
Exemple #3
0
    private static void HandleUipromptwindowEvent(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() == "uipromptwindowcode")
            {
                AtomicMain.AppLog("UIPromptWindow support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uipromptwindow.cs", widget.GetParent());
            }
            if (widget.GetId() == "uipromptwindowlayout")
            {
                AtomicMain.AppLog("UIPromptWindow support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uipromptwindow.ui.txt", widget.GetParent());
            }

            if (widget.GetId() == "stringfinder")
            {
                AtomicMain.AppLog("UIPromptWindow action : " + widget.GetId() + " was pressed ");
                UIWidget       someview = (UIWidget  )widget.GetView();
                UIPromptWindow windowp  = new  UIPromptWindow(someview, widget.GetId());
                windowp.SubscribeToEvent <UIPromptCompleteEvent> (windowp, HandlePromptCompleteEvent);
                windowp.Show("WindowTitle", "Message in window", "preset value", 0, 0, 0);
            }
        }
    }
Exemple #4
0
    private static void HandleUisceneviewEvent(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() == "uisceneviewcode")
            {
                AtomicMain.AppLog("UISceneView support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uisceneview.cs", widget.GetParent());
            }
            if (widget.GetId() == "uisceneviewlayout")
            {
                AtomicMain.AppLog("UISceneView support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uisceneview.ui.txt", widget.GetParent());
            }
        }
        if (widget.GetId() == "UISceneViewDemo")
        {
            AtomicMain.AppLog("UISceneView event : " + widget.GetId() + " got event= " + AtomicMain.EventReport((int)ev.Type));
        }
    }
    public static UIWidget FindTheWindowParent(UIWidget fromThisWidget)
    {
        if (fromThisWidget.Equals(null))
        {
            return(null);
        }
        string tname = fromThisWidget.GetTypeName();

        if (tname == "UIWindow" || tname == "UIDockWindow")
        {
            return(fromThisWidget);
        }
        UIWidget tbw = fromThisWidget.GetParent();

        while (!tbw.Equals(null))
        {
            string stname = tbw.GetTypeName();
            if (stname == "UIWindow" || stname == "UIDockWindow")
            {
                return(tbw);
            }
            tbw = tbw.GetParent();
        }
        return(null);
    }
Exemple #6
0
    private static void HandleUicolorwheelEvent(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() == "uicolorwheelcode")
            {
                AtomicMain.AppLog("UIColorWheel support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uicolorwheel.cs", widget.GetParent());
            }
            if (widget.GetId() == "uicolorwheellayout")
            {
                AtomicMain.AppLog("UIColorWheel support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uicolorwheel.ui.txt", widget.GetParent());
            }
        }
        else if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED)
        {
            if (widget.GetId() == "colorwheeldemo")
            {
                UIColorWheel cwx = (UIColorWheel)widget; // collect click color info
                if (!cwx.Equals(null))
                {
                    AtomicMain.AppLog("UIColorWheel event : " + widget.GetId() + " hue = " + cwx.GetHue().ToString() + " saturation = " + cwx.GetSaturation().ToString());
                }
            }
        }
    }
    private static void HandleUieditfieldEvent(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() == "uieditfieldcode")
            {
                AtomicMain.AppLog("UIEditField support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uieditfield.cs", widget.GetParent());
            }
            if (widget.GetId() == "uieditfieldlayout")
            {
                AtomicMain.AppLog("UIEditField support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uieditfield.ui.txt", widget.GetParent());
            }

            if (widget.GetId() == "editfieldadd")
            {
                AtomicMain.AppLog("UIEditField action : " + widget.GetId() + " was pressed ");
                UIEditField ef1 = (UIEditField)widget.FindWidget("editfieldmulti");
                if (!ef1.Equals(null))
                {
                    var    cache = GetSubsystem <ResourceCache>();
                    File   filex = cache.GetFile("Scenes/layout_uieditfield.ui.txt");
                    String textx = filex.ReadText();
                    filex.Close();
                    ef1.SetText(textx);
                }
            }
            if (widget.GetId() == "editfieldclr")
            {
                AtomicMain.AppLog("UIEditField action : " + widget.GetId() + " was pressed ");
                UIEditField ef1 = (UIEditField)widget.FindWidget("editfieldmulti");
                if (!ef1.Equals(null))
                {
                    ef1.SetText("");
                }
            }
        }
        else
        {
            if (widget.GetId() == "editfieldsingle")
            {
                UIEditField efx = (UIEditField)widget;
                AtomicMain.AppLog("UIEditField event : " + widget.GetId() + " text = `" + efx.GetText() + "` event type = " + AtomicMain.EventReport((int)ev.Type));
            }
            if (widget.GetId() == "editfieldmulti")
            {
                UIEditField efx = (UIEditField)widget;
                AtomicMain.AppLog("UIEditField event : " + widget.GetId() + " text = `" + efx.GetText() + "` event type = " + AtomicMain.EventReport((int)ev.Type));
            }
        }
    }
Exemple #8
0
    private static void HandleUipulldownmenuEvent(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() == "uipulldownmenucode")
            {
                AtomicMain.AppLog("UIPulldownMenu support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uipulldownmenu.cs", widget.GetParent());
            }
            if (widget.GetId() == "uipulldownmenulayout")
            {
                AtomicMain.AppLog("UIPulldownMenu support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uipulldownmenu.ui.txt", widget.GetParent());
            }
        }
        else if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED)
        {
            if (widget.GetId() == "FileMenu")
            {
                UIPulldownMenu pdm = (UIPulldownMenu)widget;
                if (!pdm.Equals(null))
                {
                    AtomicMain.AppLog("UIPulldownMenu event : " + widget.GetId() + " selected entry = " + pdm.GetSelectedId());
                }
            }
            if (widget.GetId() == "EditMenu")
            {
                UIPulldownMenu pdm = (UIPulldownMenu)widget;
                if (!pdm.Equals(null))
                {
                    AtomicMain.AppLog("UIPulldownMenu event : " + widget.GetId() + " selected entry = " + pdm.GetSelectedId());
                }
            }
            if (widget.GetId() == "ViewMenu")
            {
                UIPulldownMenu pdm = (UIPulldownMenu)widget;
                if (!pdm.Equals(null))
                {
                    AtomicMain.AppLog("UIPulldownMenu event : " + widget.GetId() + " selected entry = " + pdm.GetSelectedId());
                }
            }
            if (widget.GetId() == "HelpMenu")
            {
                UIPulldownMenu pdm = (UIPulldownMenu)widget;
                if (!pdm.Equals(null))
                {
                    AtomicMain.AppLog("UIPulldownMenu event : " + widget.GetId() + " selected entry = " + pdm.GetSelectedId());
                }
            }
        }
    }
Exemple #9
0
    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");
                }
            }
        }
    }
Exemple #10
0
    private static void HandleUimenuwindowEvent(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() == "uimenuwindowcode")
            {
                AtomicMain.AppLog("UIMenuWindow support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uimenuwindow.cs", widget.GetParent());
            }
            if (widget.GetId() == "uimenuwindowlayout")
            {
                AtomicMain.AppLog("UIMenuWindow support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uimenuwindow.ui.txt", widget.GetParent());
            }

            if (widget.GetId() == "uimenuwindowpush")
            {
                AtomicMain.AppLog("UIMenuWindow action : " + widget.GetId() + " was pressed ");
                UIMenuWindow     mymenuwindow = new UIMenuWindow(widget, "MenuWindowDemo");
                UIMenuItemSource mis          = new UIMenuItemSource();
                mis.AddItem(new UIMenuItem("UISelectItem1", "item1"));
                mis.AddItem(new UIMenuItem("UISelectItem2", "item2", "Ctrl+C"));
                mis.AddItem(new UIMenuItem("UISelectItem3", "item3", "Ctrl+A", "DuckButton"));
                mis.AddItem(new UIMenuItem("UISelectItem4", "item4", "Ctrl+O", "LogoAtomic"));
                int xx = widget.GetX() + (widget.GetWidth() / 2);
                int yy = widget.GetY() + (widget.GetHeight() / 2);
                mymenuwindow.SubscribeToEvent <WidgetEvent> (mymenuwindow, HandleUimenuwindowEvent);
                mymenuwindow.Show(mis, xx, yy);
            }

            if (widget.GetId() == "MenuWindowDemo")
            {
                AtomicMain.AppLog("UIMenuWindow event : " + widget.GetId() + " and " + refid + " was selected ");
            }
        }
        else
        {
            if (widget.GetId() == "MenuWindowDemo")
            {
                AtomicMain.AppLog("UIMenuWindow event : " + widget.GetId() + " refid=" + refid + " event type=" + AtomicMain.EventReport((int)ev.Type));
            }
        }
    }
    private static void HandleAllTabcontainerEvent(WidgetEvent ev)
    {
        UIWidget widget = (UIWidget)ev.Target;

        if (widget.Equals(null))
        {
            return;
        }

        if (widget.GetId() == "UITabContainerDemo" && ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_TAB_CHANGED)
        {
            UITabContainer tcx = (UITabContainer)widget;   // check the focus & stuff, or it gets a little spammy
            AtomicMain.AppLog("UITabContainer event : " + widget.GetId() + " UI_EVENT_TYPE_TAB_CHANGED to " + tcx.GetCurrentPage().ToString()
                              + " id: " + tcx.GetCurrentPageWidget().GetId());
        }
    }
    public void Setup(UIWidget layout)
    {
        var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>();

        layout.SearchWidgetClass("TBButton", dest);
        for (var ii = 0; ii < dest.Size; ii++)
        {
            dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUifontdescriptionEvent);
        }
        UIWidget demo = layout.GetWidget("fontstep");

        if (!demo.Equals(null))
        {
            demo.SubscribeToEvent <WidgetEvent> (demo, HandleUifontdescriptionEvent);
        }
    }
    public void Setup(UIWidget layout)
    {
        var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>();

        layout.SearchWidgetClass("TBButton", dest);
        for (var ii = 0; ii < dest.Size; ii++)
        {
            dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUicheckboxEvent);
        }
        UIWidget demochk = layout.GetWidget("democheck");

        if (!demochk.Equals(null))
        {
            demochk.SubscribeToEvent <WidgetEvent> (demochk, HandleUicheckboxEvent);
        }
    }
    private static void HandleAllScrollcontainerEvent(WidgetEvent ev)
    {
        UIWidget widget = (UIWidget)ev.Target;

        if (widget.Equals(null))
        {
            return;
        }

        if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED)
        {
            if (widget.GetId() == "scrollbardemo")
            {
                AtomicMain.AppLog("UIScrollBar action : " + widget.GetId() + " changed value to " + widget.GetValue().ToString());
            }
        }
    }
Exemple #15
0
    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 HandleAllSelectdropdownEvent(WidgetEvent ev)
    {
        UIWidget widget = (UIWidget)ev.Target;

        if (widget.Equals(null))
        {
            return;
        }

        if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED)
        {
            if (widget.GetId() == "selectdropdowndemo")
            {
                AtomicMain.AppLog("UISelectDropdown event : " + widget.GetId() + " changed value to " + widget.GetText());
            }
        }
    }
    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");
                }
            }
        }
    }
Exemple #18
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 HandleUibuttonEvent(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() == "uibuttoncode")
            {
                AtomicMain.AppLog("UIButton support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uibutton.cs", widget.GetParent());
            }
            if (widget.GetId() == "uibuttonlayout")
            {
                AtomicMain.AppLog("UIButton support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uibutton.ui.txt", widget.GetParent());
            }

            if (widget.GetId() == "demobutton")
            {
                AtomicMain.AppLog("UIButton action : " + widget.GetId() + " was pressed ");
            }
            if (widget.GetId() == "buttonducky")
            {
                AtomicMain.AppLog("UIButton action : " + widget.GetId() + " was pressed ");
            }
            if (widget.GetId() == "buttonready")
            {
                AtomicMain.AppLog("UIButton action : " + widget.GetId() + " was pressed ");
            }
            if (widget.GetId() == "buttonatomic")
            {
                AtomicMain.AppLog("UIButton action : " + widget.GetId() + " was pressed ");
            }
            if (widget.GetId() == "buttongreen")
            {
                AtomicMain.AppLog("UIButton action : " + widget.GetId() + " was pressed ");
            }
        }
    }
    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);
                }
            }
        }
    }
Exemple #21
0
    public void Setup(UIWidget layout)
    {
        var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>();

        layout.SearchWidgetClass("TBButton", dest);
        for (var ii = 0; ii < dest.Size; ii++)
        {
            dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUiinlineselectEvent);
        }
        UIWidget demo1 = layout.GetWidget("ilsstep");

        if (!demo1.Equals(null))
        {
            demo1.SubscribeToEvent <WidgetEvent> (demo1, HandleUiinlineselectEvent);
        }
        UIWidget demo2 = layout.GetWidget("inlineselectdemo");

        if (!demo2.Equals(null))
        {
            demo2.SubscribeToEvent <WidgetEvent> (demo2, HandleUiinlineselectEvent);
        }
    }
    public void Setup(UIWidget layout)
    {
        var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>();

        layout.SearchWidgetClass("TBButton", dest);
        for (var ii = 0; ii < dest.Size; ii++)
        {
            dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUisectionEvent);
        }
        UIWidget sec1 = layout.GetWidget("UISectionDemo");

        if (!sec1.Equals(null))
        {
            sec1.SubscribeToEvent <WidgetEvent> (sec1, HandleUisectionEvent);
        }
        UIWidget sec2 = layout.GetWidget("UISection2Demo");

        if (!sec2.Equals(null))
        {
            sec2.SubscribeToEvent <WidgetEvent> (sec2, HandleUisectionEvent);
        }
    }
Exemple #23
0
    private static void HandleUifinderwindowEvent(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() == "uifinderwindowcode")
            {
                AtomicMain.AppLog("UIFinderWindow support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uifinderwindow.cs", widget.GetParent());
            }
            if (widget.GetId() == "uifinderwindowlayout")
            {
                AtomicMain.AppLog("UIFinderWindow support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uifinderwindow.ui.txt", widget.GetParent());
            }

            if (widget.GetId() == "filefinder")
            {
                AtomicMain.AppLog("UIFinderWindow action : " + widget.GetId() + " was pressed ");
                UIWidget       someview = (UIWidget)widget.GetView();
                UIFinderWindow windowf  = new UIFinderWindow(someview, widget.GetId());
                windowf.SubscribeToEvent <UIFinderCompleteEvent> (windowf, HandleFinderCompleteEvent);
                windowf.FindFile("Find a File", "", 0, 0, 0);
            }
            if (widget.GetId() == "folderfinder")
            {
                AtomicMain.AppLog("UIFinderWindow action : " + widget.GetId() + " was pressed ");
                UIWidget       someview = (UIWidget)widget.GetView();
                UIFinderWindow windowd  = new UIFinderWindow(someview, widget.GetId());
                windowd.SubscribeToEvent <UIFinderCompleteEvent> (windowd, HandleFinderCompleteEvent);
                windowd.FindPath("Find a Folder", "", 0, 0, 0);
            }
        }
    }
    private static void HandleUiskinimageEvent(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() == "uiskinimagecode")
            {
                AtomicMain.AppLog("UISkinImage support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uiskinimage.cs", widget.GetParent());
            }
            if (widget.GetId() == "uiskinimagelayout")
            {
                AtomicMain.AppLog("UISkinImage support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uiskinimage.ui.txt", widget.GetParent());
            }
        }
    }
    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 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 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));
        }
    }
Exemple #28
0
    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);
                    }
                }
            }
        }
    }
Exemple #29
0
    private static void HandleUiwindowEvent(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() == "uiwindowcode")
            {
                AtomicMain.AppLog("UIWindow support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uiwindow.cs", widget.GetParent());
            }
            if (widget.GetId() == "uiwindowlayout")
            {
                AtomicMain.AppLog("UIWindow support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uiwindow.ui.txt", widget.GetParent());
            }

            if (widget.GetId() == "windowdemo")
            {
                AtomicMain.AppLog("UIWindow action : " + widget.GetId() + " was pressed ");
                UIView   someview = widget.GetView();
                UIWindow window   = new UIWindow();
                window.SetSettings(UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_DEFAULT);
                window.SetText("UIWindow demo (a login dialog)");
                window.Load("Scenes/login_dialog.ui.txt");
                window.ResizeToFitContent();
                someview.AddChild(window);
                window.Center();
                UIWidget login = window.GetWidget("login");
                login.SubscribeToEvent <WidgetEvent> (login, HandleUiwindowEvent);
                UIWidget cancel = window.GetWidget("cancel");
                cancel.SubscribeToEvent <WidgetEvent> (cancel, HandleUiwindowEvent);
            }
            if (widget.GetId() == "login")
            {
                AtomicMain.AppLog("UIWindow action : " + widget.GetId() + " was pressed ");
                UIWindow mywindow = (UIWindow)AtomicMain.FindTheWindowParent(widget);
                if (!mywindow.Equals(null))
                {
                    mywindow.Close();
                }
            }
            if (widget.GetId() == "cancel")
            {
                AtomicMain.AppLog("UIWindow action : " + widget.GetId() + " was pressed ");
                UIWindow mywindow = (UIWindow)AtomicMain.FindTheWindowParent(widget);
                if (!mywindow.Equals(null))
                {
                    mywindow.Close();
                }
            }
            if (widget.GetId() == "windowdemo1")
            {
                AtomicMain.AppLog("UIWindow action : " + widget.GetId() + " was pressed ");
                UIView   someview = widget.GetView();
                UIWindow window   = new UIWindow();
                window.SetSettings(UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_DEFAULT);
                window.SetText("UIWindow demo (a table)");
                window.Load("Scenes/sheet.ui.txt");
                window.ResizeToFitContent();
                someview.AddChild(window);
                window.Center();
            }
        }
    }
Exemple #30
0
    // 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);
            }
        }
    }