Exemplo n.º 1
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        TitleLabel label = new TitleLabel
        {
            StyleName = "title",
            Left = 10,
            Top = 20
        };
        AddChild(label);

        var labelStyles = new Hashtable
        {
            {"labelStyle", BlueLabelStyle.Instance}
        };

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
            {
                "Composite Control Demo", 
                "Created with eDriven.Gui",
                //"Author: Danko Kozar",
                "Composite controls could be built using child controls",
                "These controls could treated as simple controls...",
                "... and used to build even more complex controls"
            },
            Callback = delegate(string line) { label.Text = line; }
        }.Start();

        AddChild(new Spacer { Height = 20 });

        HGroup hbox = new HGroup
        {
            HorizontalCenter = 0,
            VerticalCenter = 0,
            Gap = 50
        };
        AddChild(hbox);

        WrapVBox(hbox, new Label { Text = "RGB Mixer", Styles = labelStyles, PercentWidth = 100 },
            new RgbMixer { RgbColor = ColorMixer.FromHex(0xFBAF5C).ToColor() });

        WrapVBox(hbox, new Label { Text = "RGB Mixer", Styles = labelStyles, PercentWidth = 100 },
            new RgbMixer { RgbColor = ColorMixer.FromHex(0x855FA8).ToColor() });

        WrapVBox(hbox, new Label { Text = "RGB Mixer", Styles = labelStyles, PercentWidth = 100 },
            new RgbMixer { RgbColor = ColorMixer.FromHex(0x438CCA).ToColor() });
    }
Exemplo n.º 2
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        TitleLabel titleLabel = new TitleLabel
        {
            StyleName = "title",
            HorizontalCenter = 0,
            Top = 20
        };
        AddChild(titleLabel);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
                        {
                            "Cursor Demo", 
                            "Created with eDriven.Gui",
                            //"Author: Danko Kozar",
                            "Cursor packages are loaded dynamically",
                            "You can set the priority to each cursor operation"
                        },
            Callback = delegate(string line) { titleLabel.Text = line; }
        }
        .Start();

        var buttonStyles = new Hashtable
                                      {
                                          {"cursor", "pointer"}
                                      };
        #region VBox

        var vbox = new VGroup
                        {
                            HorizontalCenter = 0,
                            VerticalCenter = 0,
                            Gap = 10
                        };
        AddChild(vbox);

        #endregion

        vbox.AddChild(new Label { Text = "Load cursor package:" });

        #region HBox

        var hbox = new HGroup();
        /*hbox.Click += delegate(Event e)
        {
            var me = (MouseEvent)e;
            if (me.Target is Button)
                AudioPlayerMapper.GetDefault().PlaySound("button_click");
        };*/
        vbox.AddChild(hbox);

        #endregion

        #region Cursor package 1

        var btnCursor1 = new Button
        {
            Text = "Load cursor package 1",
            Icon = (Texture)Resources.Load("Icons/drive_disk"),
            FocusEnabled = false,
            SkinClass = typeof(ImageButtonSkin),
            Styles = buttonStyles,
            MinWidth = 200, 
            MinHeight = 120,
            ToggleMode = true,
            Selected = true
        };
        hbox.AddChild(btnCursor1);

        #endregion

        #region Cursor package 2

        var btnCursor2 = new Button
        {
            Text = "Load cursor package 2",
            Icon = (Texture)Resources.Load("Icons/drive_disk"),
            FocusEnabled = false,
            SkinClass = typeof(ImageButtonSkin),
            Styles = buttonStyles,
            MinWidth = 200,
            MinHeight = 120,
            ToggleMode = true,
            Selected = false
        };
        hbox.AddChild(btnCursor2);

        // button 1 press
        btnCursor1.Click += delegate
        {
            if (_selectedButton != 0)
                AudioPlayerMapper.GetDefault().PlaySound("button_click");

            _selectedButton = 0;
            DeferManager.Instance.Defer(delegate
            {
                btnCursor1.Selected = _selectedButton == 0;
                btnCursor2.Selected = _selectedButton == 1;
                CursorManager.Instance.LoadPackage("Cursors/antialiased-classic/package");
            }, 1);
        };

        // button 2 press
        btnCursor2.Click += delegate
        {
            if (_selectedButton != 1)
                AudioPlayerMapper.GetDefault().PlaySound("button_click");

            _selectedButton = 1;
            DeferManager.Instance.Defer(delegate
            {
                btnCursor1.Selected = _selectedButton == 0;
                btnCursor2.Selected = _selectedButton == 1;
                CursorManager.Instance.LoadPackage("Cursors/blueglass-vista/package");
            }, 1);
        };
        
        #endregion

        #region Spacer

        vbox.AddChild(new Spacer {Height = 30});

        #endregion

        vbox.AddChild(new Label { Text = "Hover cursor over buttons:" });

        TileGroup tileGroup = new TileGroup { PercentWidth = 100, RequestedRowCount = 2 };
        vbox.AddChild(tileGroup);

        #region Crosshair

        var btnCrosshair = new Button
                                  {
                                      Text = "Crosshair",
                                      Icon = (Texture)Resources.Load("Icons/star"),
                                      SkinClass = typeof(ImageButtonSkin),
                                      FocusEnabled = false,
                                      Styles = new Hashtable { { "cursor", "crosshair" } },
                                      MinWidth = 200,
                                      MinHeight = 120
                                  };
        tileGroup.AddChild(btnCrosshair);

        #endregion

        #region Move

        var btnMove = new Button
        {
            Text = "Move",
            Icon = (Texture)Resources.Load("Icons/star"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false,
            Styles = new Hashtable { { "cursor", "move" } },
            MinWidth = 200,
            MinHeight = 120
        };
        tileGroup.AddChild(btnMove);

        #endregion

        #region Help

        var btnHelp = new Button
        {
            Text = "Help",
            Icon = (Texture)Resources.Load("Icons/star"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false,
            Styles = new Hashtable { { "cursor", "help" } },
            MinWidth = 200,
            MinHeight = 120
        };
        tileGroup.AddChild(btnHelp);

        #endregion

        #region E-Resize

        var btnEResize = new Button
        {
            Text = "E-Resize",
            Icon = (Texture)Resources.Load("Icons/star"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false,
            Styles = new Hashtable { { "cursor", "e-resize" } },
            MinWidth = 200,
            MinHeight = 120
        };
        tileGroup.AddChild(btnEResize);

        #endregion

        #region Spacer

        vbox.AddChild(new Spacer { Height = 30 });

        #endregion

        vbox.AddChild(new Label { Text = "Click the button for a high-priority cursor:" });

        #region Cursor progress

        var btnProgress = new Button
        {
            Text = "Show progress cursor (5 sec)",
            Icon = (Texture)Resources.Load("Icons/star"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false,
            Styles = buttonStyles,
            MinWidth = 200,
            MinHeight = 120,
            PercentWidth = 100
        };
        btnProgress.Press += new eDriven.Core.Events.EventHandler(delegate
        {
            int id = CursorManager.Instance.SetCursor("wait", 1);
            var t = new Timer(5, 1);
            t.Complete += delegate
            {
                t.Dispose();
                CursorManager.Instance.RemoveCursor(id);
            };
            t.Start();
        });
        vbox.AddChild(btnProgress);

        #endregion
    }
Exemplo n.º 3
0
    /*void Awake()
    {
        Debug.Log("CreateChildren");
    }

    void OnEnable()
    {
        Debug.Log("OnEnable");
    }*/

    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof(ScrollerSkin2),
            Left = 0,
            Right = 0,
            Top = 0,
            Bottom = 0,
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        TitleLabel titleLabel = new TitleLabel
        {
            Text = "Slider Demo",
            StyleName = "title",
            Right = 20,
            Top = 20
        };
        AddChild(titleLabel);

        var labelStyles = new Hashtable
                              {
                                  {"labelStyle", BlueLabelStyle.Instance}
                              };

        AddChild(new Spacer { Height = 20 });

        #region Vertical sliders

        HGroup hbox = new HGroup
        {
            PercentWidth = 100,
            PercentHeight = 100,
            Gap = 10
        };
        viewport.AddChild(hbox);

        WrapVBox(hbox, new Label {Text = "100% slider", Styles = labelStyles},
            new VSlider {PercentHeight = 100})
            .PercentHeight = 100;

        WrapVBox(hbox, new Label {Text = "400px slider", Styles = labelStyles},
            new VSlider { Width = 30, Height = 400, SkinClass = typeof(VSliderSkin2) });

        WrapVBox(hbox, new Label { Text = "400px slider, disabled", Styles = labelStyles },
            new VSlider { Width = 30, Height = 400, SkinClass = typeof (VSliderSkin2), Enabled = false });

        WrapVBox(hbox, new Label {Text = "50x400 slider", Styles = labelStyles},
            new VSlider {Width = 50, Height = 400, SkinClass = typeof (VSliderSkin2)});

        WrapVBox(hbox, new Label { Text = "80x400 slider", Styles = labelStyles },
            new VSlider { Width = 80, Height = 400, SkinClass = typeof(VSliderSkin3) });

        WrapVBox(hbox, new Label { Text = "80x100% slider", Styles = labelStyles },
            new VSlider { Width = 80, PercentHeight = 100, Maximum = 1000, Value = 500, SkinClass = typeof(VSliderSkin3) })
            .PercentHeight = 100;

        #endregion

        #region Horizontal sliders

        WrapHBox(viewport, new Label {Text = "100% slider", Styles = labelStyles},
            new HSlider {Id = "miki", Maximum = 400, PercentWidth = 100})
            .PercentWidth = 100;

        WrapHBox(viewport, new Label { Text = "400px slider", Styles = labelStyles },
            new HSlider { Width = 400, Maximum = 400, Height = 30, SkinClass = typeof(HSliderSkin2) });

        WrapHBox(viewport, new Label {Text = "400px slider, disabled", Styles = labelStyles},
            new HSlider { Width = 400, Maximum = 400, Height = 30, SkinClass = typeof(HSliderSkin2), Enabled = false });

        WrapHBox(viewport, new Label {Text = "400x50 slider", Styles = labelStyles},
            new HSlider {Width = 400, Maximum = 400, Height = 50, SkinClass = typeof (HSliderSkin2)});

        WrapHBox(viewport, new Label { Text = "80x400 slider", Styles = labelStyles },
            new HSlider { Width = 400, Height = 80, SkinClass = typeof(HSliderSkin3) });

        WrapHBox(viewport, new Label { Text = "80x100% slider", Styles = labelStyles },
            new HSlider { PercentWidth = 100, Maximum = 1000, Value = 500, Height = 80, SkinClass = typeof(HSliderSkin3) })
            .PercentWidth = 100;

        #endregion

        AddChild(new Spacer {Height = 20});
    }
Exemplo n.º 4
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Top label

        Label label = new TitleLabel {Left = 20, Top = 20, StyleName = "title"};
        AddChild(label);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
            {
                "Absolute Layout Demo",
                "Created with eDriven.Gui"/*,
                "Author: Danko Kozar"*/
            },
            Callback = delegate(string line) { label.Text = line; }
        }
        .Start();

        #endregion

        #region Bottom label

        Label label2 = new Label
        {
            Text = "[Resize your screen to see the layout changes]",
            Bottom = 20,
            HorizontalCenter = 0
        };
        label2.SetStyle("labelStyle", BlueLabelStyle.Instance);
        AddChild(label2);

        #endregion

        Button btn1 = new Button
        {
            Left = 100,
            Top = 100,
            Width = 300,
            Height = 300,
            FocusEnabled = false,
            Text = @"Left = 100,
Top = 100,
Width = 300,
Height = 300",
            Tooltip = @"This is the tooltip
Nice, eh? :)",
            SkinClass = typeof(ButtonSkin4),
            Icon = ImageLoader.Instance.Load("Icons/star_big")
        };
        AddChild(btn1);

        Button btn2 = new Button
        {
            Left = 500,
            Right = 100,
            Top = 100,
            Height = 300,
            MinWidth = 200,
            FocusEnabled = false,
            Text = @"Left = 500,
Right = 100,
Top = 100,
Height = 300,
MinWidth = 300",
            Tooltip = @"This is the tooltip of the second button
(this one is constrained in width, so resizes with screen width)",
            SkinClass = typeof(ButtonSkin4),
            Icon = ImageLoader.Instance.Load("Icons/star_big")
        };
        AddChild(btn2);

        Button btn3 = new Button
        {
            Left = 100,
            Top = 500,
            Bottom = 100,
            Width = 300,
            MinHeight = 200,
            FocusEnabled = false,
            Text = @"Left = 100,
Top = 500,
Bottom = 100,
Width = 300,
MinHeight = 300",
            Tooltip = @"This is the tooltip of the third button
(this one is constrained in height, so resizes with screen height)",
            SkinClass = typeof(ButtonSkin4),
            Icon = ImageLoader.Instance.Load("Icons/star_big")
        };
        AddChild(btn3);

        Button btn4 = new Button
        {
            Left = 500,
            Right = 100,
            Top = 500,
            Bottom = 100,
            MinWidth = 300,
            MinHeight = 300,
            FocusEnabled = false,
            Text = @"Left = 500,
Right = 100,
Top = 500,
Bottom = 100,
MinWidth = 300,
MinHeight = 300",
            SkinClass = typeof(ButtonSkin4),
            Icon = ImageLoader.Instance.Load("Icons/star_big")
        };
        AddChild(btn4);
    }
Exemplo n.º 5
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Top label

        Label label = new TitleLabel { HorizontalCenter = 0, Top = 20, StyleName = "title" };
        AddChild(label);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
            {
                "Form Demo 2",
                "Created with eDriven.Gui"/*,
                "Author: Danko Kozar"*/
            },
            Callback = delegate(string line) { label.Text = line; }
        }
        .Start();

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof(ScrollerSkin2),
            Left = 0,
            Right = 0,
            Top = 100,
            Bottom = 0
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            MouseEnabled = true,
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Center,
                VerticalAlign = VerticalAlign.Middle,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 0,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        Panel panel = new Panel
        {
            Title = "Form Demo 2",
            Icon = Resources.Load<Texture>("Icons/star"),
            SkinClass = typeof(PanelSkin2),
            MaxHeight = 800,
            //Height = 600 // for getting a scrollbar
        };
        viewport.AddChild(panel);

        Group container = new Group { Left = 10, Right = 10, Top = 10, Bottom = 10 };
        panel.AddContentChild(container);

        Form form = new Form {PercentWidth = 100};
        container.AddContentChild(form);

        #region Form items

        List list = new List
        {
            PercentWidth = 100,
            RequireSelection = true,
            SelectedItem = "Sine",
            DataProvider = new ArrayList(new List<object>
                                               {
                                                   new ListItem("Back", "Back"),
                                                   new ListItem("Bounce", "Bounce"),
                                                   new ListItem("Circ", "Circ"),
                                                   new ListItem("Cubic", "Cubic"),
                                                   new ListItem("Elastic", "Elastic"),
                                                   new ListItem("Expo", "Expo"),
                                                   new ListItem("Linear", "Linear"),
                                                   new ListItem("Quad", "Quad"),
                                                   new ListItem("Quart", "Quart"),
                                                   new ListItem("Quint", "Quint"),
                                                   new ListItem("Sine", "Sine")
                                               })
        };
        form.AddField("list", "List:", list);

        DropDownList dropDown = new DropDownList
        {
            PercentWidth = 100,
            DataProvider = new ArrayList(new List<object>
            {
                "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six"
            })
        };
        form.AddField("dd", "Drop down list:", dropDown);

        #region _test

//cb.Opening += delegate (Event evt)
        //                  {
        //                      Debug.Log("Opening");
        //                      //evt.PreventDefault();
        //                  };
        //cb.Closing += delegate(Event evt) { 
        //    Debug.Log("Closing");
        //    //evt.PreventDefault();
        //};
        //cb.Open += delegate { Debug.Log("Open"); };
        //cb.Close += delegate { Debug.Log("Close"); };

        //cb.AddEventListener(IndexChangeEvent.CHANGE, delegate (Event e)
        //                                     {
        //                                         IndexChangeEvent ice = (IndexChangeEvent)e;
        //                                         Debug.Log("Index changed from " + ice.OldIndex + " to " + ice.Index);
        //                                     });
        //cb.SelectedIndexChanged += delegate(Event e)
        //                                    {
        //                                        IndexChangeEvent ice = (IndexChangeEvent)e;
        //                                        Debug.Log("Index changed from " + ice.OldIndex + " to " + ice.Index);
        //                                    };

        #endregion

        ComboBox cb1 = new ComboBox
        {
            PercentWidth = 100,
            DataProvider = new ArrayList(new List<object>
                                                 {
                                                     new ListItem("Failure", "Failure"),
                                                     new ListItem("Teaches", "Teaches"),
                                                     new ListItem("Success", "Success")
                                                 })
        };
        form.AddField("combo1", "Combo 1:", cb1);

        ComboBox cb2 = new ComboBox
        {
            PercentWidth = 100,
            DataProvider = new ArrayList(new List<object>
                                                 {
                                                     new ListItem("Back", "Back"),
                                                     new ListItem("Bounce", "Bounce"),
                                                     new ListItem("Circ", "Circ"),
                                                     new ListItem("Cubic", "Cubic"),
                                                     new ListItem("Elastic", "Elastic"),
                                                     new ListItem("Expo", "Expo"),
                                                     new ListItem("Linear", "Linear"),
                                                     new ListItem("Quad", "Quad"),
                                                     new ListItem("Quart", "Quart"),
                                                     new ListItem("Quint", "Quint"),
                                                     new ListItem("Sine", "Sine")
                                                 })
        };
        form.AddField("combo2", "Combo 2:", cb2);

        TextField txtSubject = new TextField
                                   {
                                       FocusEnabled = true,
                                       PercentWidth = 100,
                                       Optimized = true,
                                       //PasswordMode = true // test password mode
                                   };
        form.AddField("subject", "Subject:", txtSubject);

        CheckBox chk1 = new CheckBox { Text = "Checkbox 1" };
        chk1.Change += delegate
        {
            form.ToggleItem("checkbox2");
        };
        form.AddField("checkbox", "Checkbox:", chk1);

        CheckBox chk2 = new CheckBox { Text = "Checkbox 2" };
        chk2.Change += delegate
        {
            form.ToggleItem("checkbox3");
        };
        form.AddField("checkbox2", "Checkbox:", chk2);
        form.ToggleItem("checkbox2", false);

        CheckBox chk3 = new CheckBox { Text = "Checkbox 3 with long text......." };
        form.AddField("checkbox3", "Checkbox:", chk3);
        form.ToggleItem("checkbox3", false);

        #endregion

        #region Buttons

        Button btnSet = new Button
                            {
                                Text = "Set data (true/Expo/Expo)",
                                Icon = ImageLoader.Instance.Load("Icons/arrow_up"),
                                SkinClass = typeof(ImageButtonSkin)
                            };
        btnSet.Press += delegate
                            {
                                form.Data = new Hashtable
                                                {
                                                    {"subject", "The subject"},
                                                    //{"message", "This is the message..."}
                                                    {"checkbox", true},
                                                    {"combo1", "Expo"},
                                                    {"list", "Expo"}
                                                };
                            };
        panel.ControlBarGroup.AddChild(btnSet);
        
        Button btnSet2 = new Button
        {
            Text = "Set data (false/Circ/Sine)",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/arrow_up")
        };
        btnSet2.Press += delegate
        {
            form.Data = new Hashtable
                                                {
                                                    {"subject", "The subject 2"},
                                                    //{"message", "This is the message..."}
                                                    {"checkbox", false},
                                                    {"combo1", "Circ"},
                                                    {"list", "Sine"}
                                                };
        };
        panel.ControlBarGroup.AddChild(btnSet2);
        
        panel.ControlBarGroup.AddChild(new Spacer {PercentWidth = 100});

        Button btnGet = new Button
                            {
                                Text = "Get data",
                                SkinClass = typeof(ImageButtonSkin),
                                Icon = ImageLoader.Instance.Load("Icons/arrow_down")
                            };
        btnGet.Press += delegate
                            {
                                StringBuilder sb = new StringBuilder();
                                int count = form.Data.Count;
                                int index = 0;
                                foreach (DictionaryEntry entry in form.Data)
                                {
                                    if (index < count - 1)
                                        sb.AppendLine(string.Format(@"[{0}]: {1}", entry.Key, entry.Value));
                                    else
                                        sb.Append(string.Format(@"[{0}]: {1}", entry.Key, entry.Value));
                                    //sb.AppendLine();
                                    index++;
                                }

                                Alert.Show("This is the form data", sb.ToString(), AlertButtonFlag.Ok,
                                    new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/information")));
                            };
        panel.ControlBarGroup.AddChild(btnGet);

        #endregion

        // focus
        list.SetFocus();

        panel.Plugins.Add(new TabManager
        {
            TabChildren = new List<DisplayListMember> { list, dropDown, cb1, cb2, txtSubject, chk1, chk2, chk3, btnSet, btnGet }
        });
    }
Exemplo n.º 6
0
        override protected void CreateChildren()
        {
            base.CreateChildren();

            #region Controls

            Toolbar toolbar = new Toolbar();
            toolbar.Plugins.Add(new TabManager { ArrowsEnabled = true });
            AddChild(toolbar);

            #region Text field

            _txtSearch = new TextField
            {
                StyleName = "search",
                Text = "croatian coast",
                FocusEnabled = true,
                Width = 400
            };
            _txtSearch.SetFocus();
            _txtSearch.KeyUp += delegate(Event e)
            {
                KeyboardEvent ke = (KeyboardEvent)e;
                if (ke.KeyCode == KeyCode.Return)
                {
                    _newSearch = true;
                    Search();
                }

            };
            toolbar.AddContentChild(_txtSearch);

            #endregion

            Button btnLoad = new Button
            {
                Text = "Load data",
                SkinClass = typeof(ImageButtonSkin),
                Icon = ImageLoader.Instance.Load("Icons/arrow_refresh"),
                AutoRepeat = true
            };
            btnLoad.ButtonDown += delegate
            {
                Search();
                btnLoad.Text = "Load more...";
            };
            toolbar.AddContentChild(btnLoad);

            Button btnClear = new Button
            {
                Text = "Remove all",
                SkinClass = typeof(ImageButtonSkin),
                Icon = ImageLoader.Instance.Load("Icons/cancel"),
                AutoRepeat = true
            };
            btnClear.ButtonDown += delegate
            {
                _scroller.Visible = false;
                _dataProvider.RemoveAll();
                btnLoad.Text = "Load data";
            };
            toolbar.AddContentChild(btnClear);

            #endregion

            #region Lower group

            Group group = new Group
            {
                PercentWidth = 100,
                PercentHeight = 100
            };
            AddChild(group);

            #endregion

            #region Title label

            Label label = new TitleLabel { HorizontalCenter = 0, VerticalCenter = 0, StyleName = "title" };
            group.AddChild(label);

            new TextRotator
            {
                Delay = 5, // 5 seconds delay
                Lines = new[]
            {
                "Load Data Demo",
                "Created with eDriven.Gui",
                "Loads images from Flickr"/*,
                "Author: Danko Kozar"*/
            },
                Callback = delegate(string line) { label.Text = line; }
            }
            .Start();

            #endregion
            
            #region Scroller / viewport

            _scroller = new Scroller
            {
                SkinClass = typeof (ScrollerSkin2),
                PercentWidth = 100, PercentHeight = 100,
                Visible = false
            };
            _scroller.SetStyle("showEffect", _scrollerShow);
            group.AddChild(_scroller);

            Group viewport = new Group
            {
                /*MouseEnabled = true,
                Layout = new VerticalLayout
                {
                    HorizontalAlign = HorizontalAlign.Left,
                    PaddingLeft = 10,
                    PaddingRight = 10,
                    PaddingTop = 10,
                    PaddingBottom = 10,
                    Gap = 10
                }*/
            };
            _scroller.Viewport = viewport;

            #endregion

            #region Data controls

            List<object> source = new List<object>();

            _dataProvider = new ArrayList(source);

            /* LISTS */

            #region HGroup

            #endregion

            #region List

            _list = new List
                       {
                           Left = 10, Right = 10, Top = 10, Bottom = 10,
                           Layout = new TileLayout { HorizontalGap = 0, VerticalGap = 0/*, RequestedRowCount = 4, RequestedColumnCount = 3*/ },
                           DataProvider = _dataProvider,
                           SkinClass = typeof(ListSkin2),
                           ItemRenderer = new ItemRendererFactory<ThumbnailItemRenderer>(),
                           LabelFunction = LabelFunction // extracting the title
                       };
            viewport.AddChild(_list);

            #endregion

            #endregion

            // bubbling event listener
            AddEventListener("showImage", ShowImageHandler);
        }
Exemplo n.º 7
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Top label

        Label label = new TitleLabel { HorizontalCenter = 0, Top = 20, StyleName = "title" };
        AddChild(label);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
            {
                "Form Demo 1",
                "Created with eDriven.Gui"/*,
                "Author: Danko Kozar"*/
            },
            Callback = delegate(string line) { label.Text = line; }
        }
        .Start();

        #endregion

        Panel panel = new Panel
        {
            Title = "Form Demo",
            Icon = Resources.Load<Texture>("Icons/star"),
            SkinClass = typeof(PanelSkin2),
            //SkinClass = typeof(WindowSkin),
            Width = 350,
            MaxHeight = 500,
            HorizontalCenter = 0, VerticalCenter = 0,
            //Top = 100, Bottom = 100 // additional constrains for screen resize
        };
        AddChild(panel);

        Group container = new Group { Left = 10, Right = 10, Top = 10, Bottom = 10 };
        panel.AddContentChild(container);

        Form form = new Form { PercentWidth = 100 };
        container.AddContentChild(form);

        #region Text Fields

        TextField txtSubject = new TextField
                                   {
                                       FocusEnabled = true,
                                       PercentWidth = 100,
                                       Text = "Input text",
                                       //Optimized = true
                                       //AlowedCharacters = "a1"
                                   };
        form.AddField("subject", "Subject:", txtSubject);

        TextArea txtMessage = new TextArea
                       {
                           FocusEnabled = true,
                           PercentWidth = 100,
                           Height = 200,
                           Text = LoremIpsum,
                           //Optimized = true
                       };
        form.AddField("message", "Message:", txtMessage);

        #endregion

        #region Buttons

        panel.ControlBarGroup.AddChild(new Spacer {PercentWidth = 100});

        Button btnSet = new Button
                       {
                           Text = "Set data",
                           Icon = ImageLoader.Instance.Load("Icons/arrow_up"),
                           SkinClass = typeof(ImageButtonSkin)
                       };
        btnSet.Press += delegate
        {
            form.Data = new Hashtable
                            {
                                {"subject", "The subject"},
                                {"message", "This is the message..."}
                            };
        };
        panel.ControlBarGroup.AddChild(btnSet);
        btnSet.SetFocus();

        Button btnGet = new Button
        {
            Text = "Get data",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/arrow_down")
        };
        btnGet.Press += delegate
        {
            StringBuilder sb = new StringBuilder();
            foreach (DictionaryEntry entry in form.Data)
            {
                sb.AppendLine(string.Format(@"""{0}"": {1}", entry.Key, entry.Value));
                sb.AppendLine();
            }

            Alert.Show("This is the form data", sb.ToString(), AlertButtonFlag.Ok,
                new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/information")));
        };
        panel.ControlBarGroup.AddChild(btnGet);

        #endregion

        panel.Plugins.Add(new TabManager
        {
            TabChildren = new List<DisplayListMember> { txtSubject, txtMessage, btnSet, btnGet }
        });
    }
Exemplo n.º 8
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Top label

        Label label = new TitleLabel { HorizontalCenter = 0, Top = 20, StyleName = "title" };
        AddChild(label);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
            {
                "Loading Mask Demo",
                "Created with eDriven.Gui"
                //"Author: Danko Kozar"
            },
            Callback = delegate(string line) { label.Text = line; }
        }
        .Start();

        #endregion

        #region VBox

        VGroup vbox = new VGroup
                        {
                            HorizontalCenter = 0,
                            VerticalCenter = 0,
                            HorizontalAlign = HorizontalAlign.Center, 
                            Gap = 20
                        };
        AddChild(vbox);

        #endregion

        HGroup hbox = new HGroup { Gap = 20, VerticalAlign = VerticalAlign.Middle };
        vbox.AddChild(hbox);

        // 3 example mask, just for fun
        hbox.AddChild(new LoadingMaskAnimator { Width = 250, Height = 100, Message = "Loading something..." });
        hbox.AddChild(new LoadingMaskAnimator { Width = 250, Height = 150, Message = "Loading something else..." });
        hbox.AddChild(new LoadingMaskAnimator { Width = 250, Height = 200, Message = "And yet something else..." });

        //vbox.AddChild(new Spacer {Height = 40});

        hbox = new HGroup { Gap = 20, VerticalAlign = VerticalAlign.Middle };
        vbox.AddChild(hbox);

        // create 3 buttons
        CreateButton(hbox);
        CreateButton(hbox);
        CreateButton(hbox);

        Button btn = new Button
        {
            Text = @"Click to show a global mask for 3 seconds",
            Icon = Resources.Load<Texture>("IconsBig/oxyblue-address-book-new"),
            SkinClass = typeof(ButtonSkin5),
            Left = 100,
            Top = 100,
            Width = 250,
            Height = 250,
            FocusEnabled = false
        };
        btn.Click += new EventHandler(delegate
        {
            int count = 0;

            GlobalLoadingMask.Show("");

            Timer t = new Timer(1, 3) { TickOnStart = true };
            t.Tick += delegate
            {
                GlobalLoadingMask.SetMessage(string.Format("Masking... {0} seconds", count));
                count++;
            };
            t.Complete += delegate { GlobalLoadingMask.Hide(); };
            t.Start();
        });
        vbox.AddChild(btn);
    }
Exemplo n.º 9
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Title

        Label label = new TitleLabel {HorizontalCenter = 0, Top = 20, StyleName = "title", Text = "Panel demo"};
        AddChild(label);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            Left = 0,
            Right = 0,
            Top = 0,
            Bottom = 0,
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group();
        scroller.Viewport = viewport;

        #endregion

        #region HGroup

        HGroup hGroup = new HGroup {Gap = 10, HorizontalCenter = 0, VerticalCenter = 0};
        viewport.AddChild(hGroup);

        #endregion

        #region Panel 1

        Panel panel = new MyPanel
        {
            Width = 360,
            Height = 600,
            Icon = ImageLoader.Instance.Load("Icons/shape_square_add"),
            Title = "First panel",
            StyleName = "default"
        };
        hGroup.AddChild(panel);

        #endregion
        
        #region Panel 2

        panel = new MyPanel
        {
            //Width = 360,
            Height = 600,
            SkinClass = typeof(PanelSkin2),
            Icon = ImageLoader.Instance.Load("Icons/page_white_text"),
            Title = "Second panel"
        };
        hGroup.AddChild(panel);

        //// NOTE: propagation of styles to skin still not implemented
        //// So, this won't work: panel.SetStyle("headerLabelColor", 0xffff00);
        //// This is a temporary solution:
        //panel.CreationCompleteHandler += delegate
        //{
            //Debug.Log("panel.Skin: " + panel.Skin);
            //panel.Skin.SetStyle("headerLabelColor", Color.yellow);
        //};

        #endregion

        #region Panel 2 skin switch

        VGroup vGroup = new VGroup();
        vGroup.Plugins.Add(new TabManager { ArrowsEnabled = true, UpDownArrowsEnabled = true });
        hGroup.AddChild(vGroup);

        Button button = new Button { Text = "Skin 1", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 };
        button.Press += delegate
        {
            panel.SkinClass = typeof (PanelSkin);
            //((MyPanel)panel).CreateButtons();
        };
        vGroup.AddChild(button);

        button = new Button { Text = "Skin 2", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 };
        button.Press += delegate
        {
            panel.SkinClass = typeof (PanelSkin2);
        };
        vGroup.AddChild(button);

        button = new Button { Text = "Skin 3", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 };
        button.Press += delegate
        {
            panel.SkinClass = typeof (PanelSkin3);
        };
        vGroup.AddChild(button);

        button = new Button { Text = "Skin 4", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 };
        button.Press += delegate
        {
            panel.SkinClass = typeof (PanelSkin4);
        };
        vGroup.AddChild(button);

        button = new Button { Text = "Add button", AutoRepeat = true, Icon = Resources.Load<Texture>("Icons/add"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 };
        /*button.Press += delegate
        {
            ((MyPanel)panel).AddButton("Button");
        };*/
        button.ButtonDown += delegate
        {
            ((MyPanel)panel).AddButton("Button");
        };
        vGroup.AddChild(button);

        #endregion
    }
Exemplo n.º 10
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        TitleLabel titleLabel = new TitleLabel
        {
            Text = "Scrollbar Demo",
            StyleName = "title",
            Right = 20,
            Top = 20
        };
        AddChild(titleLabel);

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass = typeof (ScrollerSkin2),
            Left = 0,
            Right = 0,
            Top = 0,
            Bottom = 0,
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        AddChild(scroller);

        Group viewport = new Group
        {
            Layout = new VerticalLayout
            {
                HorizontalAlign = HorizontalAlign.Left,
                PaddingLeft = 10,
                PaddingRight = 10,
                PaddingTop = 10,
                PaddingBottom = 10,
                Gap = 10
            }
        };
        scroller.Viewport = viewport;

        #endregion

        #region Vertical scrollbars

        HGroup hGroup = new HGroup {Gap = 10, Id = "hbox2", PercentHeight = 100};
        viewport.AddChild(hGroup);

        VScrollBar s = new VScrollBar {PercentHeight = 100, Maximum = 300};
        s.Change += delegate(Event e)
        {
            Debug.Log("Change: " + e);
        };
        hGroup.AddChild(s);

        s = new VScrollBar {PercentHeight = 100, Maximum = 400, PageSize = 100};
        hGroup.AddChild(s);

        s = new VScrollBar {SkinClass = typeof (VScrollBarSkin2), PercentHeight = 100, Maximum = 1000, PageSize = 100};
        hGroup.AddChild(s);

        s = new VScrollBar {SkinClass = typeof (VScrollBarSkin2), Height = 400, Maximum = 400, PageSize = 100};
        hGroup.AddChild(s);

        s = new VScrollBar {SkinClass = typeof (VScrollBarSkin3), PercentHeight = 100, Maximum = 200, PageSize = 100};
        hGroup.AddChild(s);

        s = new VScrollBar {SkinClass = typeof (VScrollBarSkin3), Height = 400, Maximum = 300, PageSize = 100};
        hGroup.AddChild(s);

        #endregion

        #region Horizontal scrollbars

        Label label = new Label {Text = "Will change the skin on drag: "};
        viewport.AddChild(label);

        HScrollBar scrollBar1 = new HScrollBar {Width = 300, Maximum = 300, PageSize = 100};
        scrollBar1.Change += delegate(Event e)
        {
            scrollBar1.SkinClass = typeof (HScrollBarSkin3);
        };
        viewport.AddChild(scrollBar1);

        label = new Label {Text = "Will change the skin on drag: "};
        viewport.AddChild(label);

        _scrollbar2 = new HScrollBar {PercentWidth = 100, Maximum = 500, Value = 200, PageSize = 100};
        _scrollbar2.Change += delegate(Event e)
        {
            _scrollbar2.SkinClass = typeof (HScrollBarSkin3);
        };
        viewport.AddChild(_scrollbar2);

        HScrollBar scrollbar3 = new HScrollBar
        {
            SkinClass = typeof (HScrollBarSkin2),
            MinWidth = 600,
            Maximum = 1000,
            PageSize = 100
        };
        viewport.AddChild(scrollbar3);

        HScrollBar scrollbar4 = new HScrollBar
        {
            SkinClass = typeof (HScrollBarSkin3),
            MinWidth = 700,
            Maximum = 300,
            PageSize = 100
        };
        viewport.AddChild(scrollbar4);

        HScrollBar scrollbar5 = new HScrollBar
        {
            PercentWidth = 100,
            MinWidth = 600,
            SkinClass = typeof (HScrollBarSkin3),
            Maximum = 1000,
            PageSize = 100
        };
        viewport.AddChild(scrollbar5);

        #endregion

    }
Exemplo n.º 11
0
    protected override void CreateChildren()
    {
        base.CreateChildren();

        #region Heading

        TitleLabel button = new TitleLabel
        {
            StyleName = "title",
            HorizontalCenter = 0,
            Top = 20
        };

        AddChild(button);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
                            {
                                "Drag and Drop Demo 2", 
                                "Created using eDriven.Gui",
                                //"Author: Danko Kozar",
                                "Drag items from the left panel (source)",
                                "Drop them to the right panel (destination)"
                            },
            Callback = delegate(string line) { button.Text = line; }
        }
            .Start();


        #endregion

        #region Box

        _box = new Group
                   {
                       HorizontalCenter = 0, VerticalCenter = 0,
                       Layout = new HorizontalLayout
                                    {
                                        HorizontalAlign = HorizontalAlign.Center,
                                        VerticalAlign = VerticalAlign.Top
                                    }
                   };

        // mandatory listeners
        AddEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown); // mouse down
        AddEventListener(DragEvent.DRAG_ENTER, OnDragEnter); // drag enter
        AddEventListener(DragEvent.DRAG_DROP, OnDragDrop); // drag drop (on drop target)

        // optional listeners
        AddEventListener(DragEvent.DRAG_START, OnDragStart); // drag start(on drag initiator)
        AddEventListener(DragEvent.DRAG_EXIT, OnDragExit); // drag exit (on drop target)
        AddEventListener(DragEvent.DRAG_COMPLETE, OnDragComplete); // drag complete (on drag initiator)

        //_box.AddEventListener(MouseEvent.MOUSE_OVER, OnMouseOver);
        //_box.AddEventListener(MouseEvent.MOUSE_OUT, OnMouseOut);
        //_box.AddEventListener(MouseEvent.MOUSE_UP, OnMouseUp);

        AddChild(_box);

        #endregion

        #region Source

        _pnlSource = new Panel
                         {
                             Title = "Source",
                             Icon = Resources.Load<Texture>("Icons/star"),
                             //Width = 450,
                             //Height = 500,
                             MouseEnabled = true,
                             SkinClass = typeof(PanelSkin2),
                             Layout = new TileLayout
                             {
                                 Orientation = TileOrientation.Rows,
                                 HorizontalGap = 10,
                                 VerticalGap = 10,
                                 RowHeight = 128 + 20, // image = 128x128, padding = 10 + 10
                                 ColumnWidth = 128 + 20,
                                 RequestedRowCount = 3,
                                 RequestedColumnCount = 3
                             }
                         };
        _pnlSource.SetStyle("addedEffect", _panelShowEffect);

        _box.AddChild(_pnlSource);

        Button btnReset = new Button
        {
            Text = "Reset",
            SkinClass = typeof(ImageButtonSkin),
            Icon = ImageLoader.Instance.Load("Icons/arrow_refresh")
        };
        btnReset.Press += delegate { InitChildren(); };
        _pnlSource.ControlBarGroup.AddChild(btnReset);

        /*Label lbl = new Label { Text = "miki" };
        _pnlSource.ControlBarGroup.AddChild(lbl);*/

        #endregion

        #region Destination

        _pnlDest = new Panel
                       {
                           Title = "Destination",
                           Icon = Resources.Load<Texture>("Icons/star"),
                           //Width = 450,
                           //Height = 500,
                           MouseEnabled = true,
                           SkinClass = typeof(PanelSkin2),
                           Layout = new TileLayout
                           {
                               Orientation = TileOrientation.Rows,
                               HorizontalGap = 10,
                               VerticalGap = 10,
                               RowHeight = 128 + 20,
                               ColumnWidth = 128 + 20,
                               RequestedRowCount = 3,
                               RequestedColumnCount = 3
                           }
                       };
        _pnlDest.SetStyle("addedEffect", _panelShowEffect);

        _box.AddChild(_pnlDest);

        InitChildren();

        #endregion

    }