コード例 #1
0
        override protected void CreateChildren()
        {
            base.CreateChildren();

            HGroup hbox = new HGroup {
                PercentWidth = 100
            };

            AddContentChild(hbox);

            _btnCc = new Button {
                Text = "Show Cc:", ToggleMode = true
            };
            hbox.AddChild(_btnCc);

            _btnBcc = new Button {
                Text = "Show Bcc:", ToggleMode = true
            };
            hbox.AddChild(_btnBcc);

            _form = new Form {
                PercentWidth = 100               /*, Padding = 0*/
            };
            _form.SetStyle("paddingLeft", 0);
            _form.SetStyle("paddingRight", 0);
            _form.SetStyle("paddingTop", 0);
            _form.SetStyle("paddingBottom", 0);
            AddContentChild(_form);

            _txtTo = new TextField {
                PercentWidth = 100, ProcessKeys = true
            };
            _form.AddField("to", "To: ", _txtTo);

            _txtCc = new TextField {
                PercentWidth = 100
            };
            _form.AddField("cc", "Cc: ", _txtCc);

            _txtBcc = new TextField {
                PercentWidth = 100
            };
            _form.AddField("bcc", "Bcc: ", _txtBcc);

            _txtMessage = new TextField {
                PercentWidth = 100, Height = 150
            };
            _form.AddField("message", "Message: ", _txtMessage);

            HGroup hbox2 = new HGroup {
                PercentWidth = 100, HorizontalAlign = HorizontalAlign.Right
            };

            AddContentChild(hbox2);

            _btnSend = new Button {
                Text = "Send", MinWidth = 150
            };
            hbox2.AddChild(_btnSend);
        }
コード例 #2
0
        // ReSharper restore MemberCanBePrivate.Global

        #endregion

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

            #region Background

            _background = new RectShape
            {
                Left   = 0,
                Right  = 0,
                Top    = 0,
                Bottom = 0,
                Alpha  = 0.5f
            };
            AddChild(_background);

            #endregion

            #region Box

            _box = new RectShape
            {
                MinWidth         = 300,
                MinHeight        = 100,
                HorizontalCenter = 0,
                VerticalCenter   = 0
            };
            AddChild(_box);

            #endregion

            HGroup hGroup = new HGroup
            {
                HorizontalCenter = 0,
                VerticalCenter   = 0
            };
            AddChild(hGroup);

            #region Icon

            IconDisplay = new Image {
                MouseEnabled = false
            };
            hGroup.AddChild(IconDisplay);

            #endregion

            #region Label

            LabelDisplay = new Label
            {
                Text         = "miki",
                MouseEnabled = false,
                Width        = 100
            };
            hGroup.AddChild(LabelDisplay);

            #endregion
        }
コード例 #3
0
        protected override void CreateChildren()
        {
            //Debug.Log("Button skin creating children");
            base.CreateChildren();

            #region Background

            _backgroundImage = new Image
            {
                Left   = 0,
                Right  = 0,
                Top    = 0,
                Bottom = 0,
                Mode   = ImageMode.Tiled,
                AdjustWidthToTexture  = false,
                AdjustHeightToTexture = false,
                Visible = false // default
            };
            AddChild(_backgroundImage);

            HGroup hGroup = new HGroup
            {
                HorizontalCenter = 0,
                VerticalCenter   = 0,
                Right            = 6,
                Left             = 6,
                Top    = 6,
                Bottom = 6
            };
            AddChild(hGroup);

            _iconImage = new Image
            {
                Width     = 16, Height = 16,
                MinWidth  = 4,
                MinHeight = 4
            };
            hGroup.AddChild(_iconImage);

            #endregion

            #region Label

            LabelDisplay = new Label();
            hGroup.AddChild(LabelDisplay);

            #endregion
        }
コード例 #4
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            _display = new RectShape {
                PercentWidth = 100, Height = 150
            };
            AddChild(_display);

            HGroup hGroup = new HGroup {
                Gap = 10, PercentHeight = 100
            };

            AddChild(hGroup);

            _red = new VSlider
            {
                SkinClass     = typeof(VSliderSkin2),
                Width         = 50,
                PercentHeight = 100, Maximum = 255/*, BoolExample = true*/
            };
            _red.Change += ChangeHandler;
            hGroup.AddChild(_red);

            _green = new VSlider
            {
                SkinClass     = typeof(VSliderSkin2),
                PercentHeight = 100,
                Width         = 50,
                Maximum       = 255
            };
            _green.Change += ChangeHandler;
            hGroup.AddChild(_green);

            _blue = new VSlider
            {
                SkinClass     = typeof(VSliderSkin2),
                Width         = 50,
                PercentHeight = 100,
                Maximum       = 255
            };
            _blue.Change += ChangeHandler;
            hGroup.AddChild(_blue);
        }
コード例 #5
0
ファイル: ViewportDemo.cs プロジェクト: iwaken71/ActivityGame
 private void AddPanel()
 {
     _panel = new Panel
     {
         SkinClass = typeof(PanelSkin4),
         Title     = "Panel " + _count,
         MinWidth  = 200,
         MinHeight = 300
     };
     _panel.SetStyle("headerBackgroundRollOverColor", Color.cyan);
     _hgroup.AddChild(_panel);
     _count++;
 }
コード例 #6
0
ファイル: SliderDemo.cs プロジェクト: onamoni/edriven-gui
    private static HGroup WrapHBox(Component parent, params DisplayListMember[] children)
    {
        HGroup wrapper = new HGroup {
            HorizontalAlign = HorizontalAlign.Left, VerticalAlign = VerticalAlign.Middle
        };

        parent.AddChild(wrapper);

        foreach (DisplayListMember child in children)
        {
            wrapper.AddChild(child);
        }
        return(wrapper);
    }
コード例 #7
0
ファイル: Login.cs プロジェクト: onamoni/edriven-gui
        override protected void CreateChildren()
        {
            base.CreateChildren();

            HGroup hbox = new HGroup {
                PercentWidth = 100
            };

            AddContentChild(hbox);

            _form = new Form {
                PercentWidth = 100               /*, Padding = 0*/
            };
            _form.SetStyle("paddingLeft", 0);
            _form.SetStyle("paddingRight", 0);
            _form.SetStyle("paddingTop", 0);
            _form.SetStyle("paddingBottom", 0);
            AddContentChild(_form);

            _txtUsername = new TextField {
                PercentWidth = 100, ProcessKeys = true
            };
            _form.AddField("to", _usernameLabel, _txtUsername);

            _txtPassword = new TextField {
                PercentWidth = 100, PasswordMode = true
            };
            _form.AddField("cc", _passwordLabel, _txtPassword);

            HGroup hbox2 = new HGroup {
                PercentWidth = 100, HorizontalAlign = HorizontalAlign.Right
            };

            AddContentChild(hbox2);

            _btnSubmit = new Button {
                Text = "Send", MinWidth = 150
            };
            hbox2.AddChild(_btnSubmit);
        }
コード例 #8
0
ファイル: ComboBoxDemo.cs プロジェクト: onamoni/edriven-gui
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        Button button = new Button
        {
            Text       = "Add data",
            SkinClass  = typeof(ImageButtonSkin),
            Icon       = ImageLoader.Instance.Load("Icons/add"),
            AutoRepeat = true
        };
        button.ButtonDown += delegate
        {
            _dataProvider.AddItem("data " + _random.Next(1, 100));
        };
        toolbar.AddContentChild(button);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass     = typeof(ScrollerSkin2),
            PercentWidth  = 100,
            PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        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

        List <object> source = new List <object> {
            "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six"
        };

        _dataProvider = new ArrayList(source);

        HGroup hGroup = new HGroup();
        viewport.AddChild(hGroup);

        //List<object> source = new List<object> {"Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six"};

        var factory = new ItemRendererFactory <DefaultItemRenderer>();

        VGroup vGroup = new VGroup {
            PercentHeight = 100
        };
        hGroup.AddChild(vGroup);

        HGroup hGroup2 = new HGroup
        {
            PercentWidth = 100
        };
        vGroup.AddChild(hGroup2);

        /* LISTS */

        #region List 1

        List list = new List
        {
            Id = "list1",
            //Layout = new TileLayout { RequestedColumnCount = 4 },
            Width        = 200, Height = 200,
            DataProvider = _dataProvider,
            //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            ItemRendererFunction = delegate
            {
                return(factory);
            }
        };
        hGroup2.AddChild(list);

        #endregion

        #region List 2

        list = new List
        {
            Id = "list2",
            //Layout = new TileLayout { RequestedColumnCount = 3 },
            Width        = 200, Height = 245,
            DataProvider = _dataProvider,
            //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            ItemRendererFunction = delegate
            {
                return(factory);
            }
        };
        hGroup2.AddChild(list);

        #endregion

        #region List 3

        list = new List
        {
            Id           = "list3",
            Width        = 400,
            Height       = 600,
            DataProvider = _dataProvider,
            SkinClass    = typeof(ListSkin2),
            ItemRenderer = new ItemRendererFactory <BigItemRenderer>()
        };
        hGroup.AddChild(list);

        #endregion

        vGroup.AddChild(new Spacer {
            PercentHeight = 100
        });

        #region Drop down lists

        VGroup vGroup2 = new VGroup();
        vGroup.AddChild(vGroup2);

        DropDownList dropDownList1 = new DropDownList
        {
            DataProvider = _dataProvider
        };
        vGroup2.AddChild(dropDownList1);

        DropDownList dropDownList2 = new DropDownList
        {
            Width        = 200,
            DataProvider = _dataProvider,
            Prompt       = "Pick an item"
        };
        vGroup2.AddChild(dropDownList2);

        DropDownList dropDownList3 = new DropDownList
        {
            Width        = 200,
            SkinClass    = typeof(DropDownListSkin2),
            DataProvider = _dataProvider/*,
                                         * SelectedIndex = 0*/
        };
        vGroup2.AddChild(dropDownList3);

        ComboBox comboBox = new ComboBox
        {
            Width        = 200,
            DataProvider = _dataProvider/*,
                                         * SelectedIndex = 0*/
        };
        vGroup2.AddChild(comboBox);

        vGroup2.Plugins.Add(new TabManager
        {
            TabChildren = new List <DisplayListMember> {
                dropDownList1, dropDownList2, dropDownList3, comboBox
            }
        });

        #endregion

        #region Process renderer click

        AddEventListener(BigItemRenderer.ADD_BUTTON_CLICKED, delegate(Event e)
        {
            BigItemRenderer itemRenderer = (BigItemRenderer)e.Target;
            Alert.Show("Info", itemRenderer.Data.ToString(), AlertButtonFlag.Ok,
                       new AlertOption(AlertOptionType.HeaderIcon, ImageLoader.Instance.Load("Icons/information")));
        });

        #endregion
    }
コード例 #9
0
ファイル: BigMess.cs プロジェクト: onamoni/edriven-gui
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        #region Alert

        Button btnAlert = new Button
        {
            Text         = "Alert",
            FocusEnabled = false,
            SkinClass    = typeof(ImageButtonSkin),
            Icon         = ImageLoader.Instance.Load("Icons/comment")
        };
        btnAlert.Click += delegate
        {
            Alert.Show("Info", "This is the example alert.", AlertButtonFlag.Ok,
                       new AlertOption(AlertOptionType.HeaderIcon, Resources.Load <Texture>("Icons/information")),
                       new AlertOption(AlertOptionType.Icon, Resources.Load <Texture>("Icons/star_big")));
        };
        toolbar.AddContentChild(btnAlert);

        #endregion

        #region Window

        Button btnWindow = new Button
        {
            Text         = "New window",
            FocusEnabled = false,
            SkinClass    = typeof(ImageButtonSkin),
            Icon         = ImageLoader.Instance.Load("Icons/comment")
        };
        btnWindow.Click += delegate
        {
            _count++;
            var window = new MyWindow
            {
                Title     = "The Window " + _count,
                Id        = "window_" + _count,
                SkinClass = typeof(WindowSkin2),
                Icon      = ImageLoader.Instance.Load("Icons/balloon_32"),
                Width     = 400,
                Height    = 600
            };

            window.SetStyle("addedEffect", _windowShow);
            window.Plugins.Add(new Resizable {
                ShowOverlay = false
            });
            window.AddEventListener(CloseEvent.CLOSE, delegate
            {
                PopupManager.Instance.RemovePopup(window);
            });
            PopupManager.Instance.AddPopup(window, false);
            PopupManager.Instance.CenterPopUp(window);
        };
        toolbar.AddContentChild(btnWindow);

        #endregion

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass    = typeof(ScrollerSkin2),
            PercentWidth = 100, PercentHeight = 100
        };
        //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 Horizontal Scrollbars

        viewport.AddChild(new HScrollBar {
            SkinClass = typeof(HScrollBarSkin3), PercentWidth = 100, MinWidth = 300, Maximum = 300, PageSize = 100
        });
        viewport.AddChild(new HScrollBar {
            SkinClass = typeof(HScrollBarSkin3), PercentWidth = 50, Maximum = 500, Value = 200, PageSize = 100
        });
        viewport.AddChild(new HScrollBar {
            SkinClass = typeof(HScrollBarSkin2), MinWidth = 600, Maximum = 1000, PageSize = 100
        });
        viewport.AddChild(new HScrollBar {
            SkinClass = typeof(HScrollBarSkin3), MinWidth = 700, Maximum = 300, PageSize = 100
        });
        viewport.AddChild(new HScrollBar {
            PercentWidth = 100, MinWidth = 600, SkinClass = typeof(HScrollBarSkin3), Maximum = 1000, PageSize = 100
        });

        #endregion

        #region HGroup

        HGroup hGroup = new HGroup { /*PercentWidth = 100, */
            Gap = 10
        };
        viewport.AddChild(hGroup);

        #endregion

        #region Vertical scrollbars

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

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

        #endregion

        #region Panels

        //hGroup.AddChild(new Spacer { PercentWidth = 50 });

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

        panel = new MyPanel2
        {
            MaxWidth  = 500,
            Height    = 600,
            SkinClass = typeof(PanelSkin2),
            Icon      = ImageLoader.Instance.Load("Icons/page_white_text"),
            Title     = "Second panel"
        };
        panel.SetStyle("titleColor", 0xffff00);
        hGroup.AddChild(panel);

        //hGroup.AddChild(new Spacer { PercentWidth = 50 });

        #endregion

        #region Vertical sliders

        hGroup.AddChild(new VSlider {
            PercentHeight = 100
        });
        hGroup.AddChild(new VSlider {
            Width = 30, Height = 400, SkinClass = typeof(VSliderSkin2)
        });
        hGroup.AddChild(new VSlider {
            Width = 30, Height = 400, SkinClass = typeof(VSliderSkin2), Enabled = false
        });
        hGroup.AddChild(new VSlider {
            Width = 50, Height = 400, SkinClass = typeof(VSliderSkin2)
        });
        hGroup.AddChild(new VSlider {
            Width = 80, Height = 400, SkinClass = typeof(VSliderSkin3)
        });
        hGroup.AddChild(new VSlider {
            Width = 80, PercentHeight = 100, Maximum = 1000, SkinClass = typeof(VSliderSkin3)
        });

        #endregion

        #region Horizontal sliders

        viewport.AddChild(new HSlider {
            Maximum = 400, PercentWidth = 100
        });
        viewport.AddChild(new HSlider {
            Width = 400, Maximum = 400, Height = 30, SkinClass = typeof(HSliderSkin2)
        });
        viewport.AddChild(new HSlider {
            Width = 400, Maximum = 400, Height = 50, SkinClass = typeof(HSliderSkin2)
        });
        viewport.AddChild(new HSlider {
            PercentWidth = 50, Height = 80, SkinClass = typeof(HSliderSkin3)
        });
        viewport.AddChild(new HSlider {
            PercentWidth = 100, Maximum = 1000, Height = 80, SkinClass = typeof(HSliderSkin3)
        });

        #endregion
    }
コード例 #10
0
ファイル: ViewportDemo.cs プロジェクト: iwaken71/ActivityGame
    override protected void CreateChildren()
    {
        base.CreateChildren();

        /**
         * Note: this demo HAS the overall scroller, but the stage itself SEEMS not to scroll
         * That's because we pushed the scrolled 150 px from both right and bottom
         * so we could place additional scrollbars there.
         * */

        #region Scroller + viewport

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

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

        #endregion

        #region Horizontal scrollers

        HGroup hGroup = new HGroup {
            Gap = 10
        };
        viewport.AddChild(hGroup);

        VGroup hScrollers = new VGroup
        {
            PercentWidth = 100,
            Gap          = 10,
            Left         = 10,
            Right        = 150,
            Bottom       = 10
        };
        AddChild(hScrollers);

        HScrollBar hScroll = new HScrollBar
        {
            SkinClass    = typeof(HScrollBarSkin3),
            PercentWidth = 100,
            Maximum      = 600,
            Viewport     = viewport,
            MouseWheelScrollsHorizontally = true
        };
        hScrollers.AddChild(hScroll);

        hScroll = new HScrollBar
        {
            SkinClass    = typeof(HScrollBarSkin2),
            PercentWidth = 100,
            Maximum      = 600,
            Viewport     = viewport,
        };
        hScrollers.AddChild(hScroll);

        hScroll = new HScrollBar
        {
            PercentWidth = 100,
            Maximum      = 600,
            Viewport     = viewport,
        };
        hScrollers.AddChild(hScroll);

        #endregion

        #region Vertical scrollers

        HGroup vScrollers = new HGroup
        {
            PercentHeight = 100,
            Gap           = 10,
            Right         = 10,
            Top           = 10,
            Bottom        = 150
        };
        AddChild(vScrollers);

        VScrollBar vScroll = new VScrollBar
        {
            SkinClass = typeof(VScrollBarSkin3), PercentHeight = 100, Maximum = 600,
            Viewport  = viewport
        };
        vScrollers.AddChild(vScroll);

        vScroll = new VScrollBar
        {
            SkinClass     = typeof(VScrollBarSkin2),
            PercentHeight = 100,
            Maximum       = 600,
            Viewport      = viewport
        };
        vScrollers.AddChild(vScroll);

        vScroll = new VScrollBar
        {
            PercentHeight = 100,
            Maximum       = 600,
            Viewport      = viewport
        };
        vScrollers.AddChild(vScroll);

        #endregion

        #region Content

        VGroup vGroup = new VGroup
        {
            Id               = "vGroup",
            VerticalAlign    = VerticalAlign.Middle,
            HorizontalCenter = 0,
            VerticalCenter   = 0,
            PaddingLeft      = 10,
            PaddingRight     = 10,
            PaddingTop       = 10,
            PaddingBottom    = 10,
            Gap              = 10
        };

        vGroup.SetStyle("showBackground", true);
        vGroup.SetStyle("backgroundColor", Color.white);
        hGroup.AddChild(vGroup);

        HGroup hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        _btn = new Button
        {
            Text         = "Default button",
            FocusEnabled = false,
            Icon         = ImageLoader.Instance.Load("Icons/page_white_text"),
            MinWidth     = 200,
            MinHeight    = 150
        };
        /* Let's just add a panel to the bottom row on double-clicking this button */
        _btn.DoubleClick += delegate { AddPanel(); };
        hgroup.AddChild(_btn);

        _btn = new Button
        {
            Text         = "Default toggle",
            FocusEnabled = false,
            ToggleMode   = true,
            Selected     = true,
            Icon         = ImageLoader.Instance.Load("Icons/page_white_text")
        };
        hgroup.AddChild(_btn);

        _btn = new Button
        {
            Text         = "Styled button",
            SkinClass    = typeof(ButtonSkin2),
            FocusEnabled = false,
            Icon         = ImageLoader.Instance.Load("Icons/page_white_text"),
            MinWidth     = 200,
            MinHeight    = 150
        };
        hgroup.AddChild(_btn);

        _btn = new Button
        {
            Text         = "Styled toggle",
            SkinClass    = typeof(ButtonSkin2),
            FocusEnabled = false,
            ToggleMode   = true,
            Selected     = true,
            Icon         = ImageLoader.Instance.Load("Icons/page_white_text")
        };
        hgroup.AddChild(_btn);

        // nice buttons 1st row

        hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        _btn = new Button
        {
            Text         = "Option 1",
            SkinClass    = typeof(ButtonSkin4),
            FocusEnabled = false,
            Icon         = ImageLoader.Instance.Load("IconsBig/arkshany-bookmarks"),
            MinWidth     = 200,
            MinHeight    = 200
        };
        hgroup.AddChild(_btn);

        _btn = new Button
        {
            Text         = "Option 2",
            SkinClass    = typeof(ButtonSkin4),
            FocusEnabled = false,
            Icon         = ImageLoader.Instance.Load("IconsBig/arkshany-bookmarks"),
            MinWidth     = 200,
            MinHeight    = 200
        };
        hgroup.AddChild(_btn);

        _btn = new Button
        {
            Text         = "Option 3",
            SkinClass    = typeof(ButtonSkin4),
            FocusEnabled = false,
            Icon         = ImageLoader.Instance.Load("IconsBig/arkshany-bookmarks"),
            MinWidth     = 200,
            MinHeight    = 200,
            ToggleMode   = true,
            Selected     = true
        };
        hgroup.AddChild(_btn);

        // nice buttons 2nd row

        hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        _btn = new MyButton
        {
            Text         = "Option 1",
            SkinClass    = typeof(ButtonSkin5),
            FocusEnabled = false,
            Icon         = ImageLoader.Instance.Load("IconsBig/applications-games"),
            MinWidth     = 200,
            MinHeight    = 200
        };
        hgroup.AddChild(_btn);

        _btn = new MyButton2
        {
            Text         = "Option 2",
            SkinClass    = typeof(ButtonSkin5),
            FocusEnabled = false,
            Icon         = ImageLoader.Instance.Load("IconsBig/gconfeditor"),
            MinWidth     = 200,
            MinHeight    = 200
        };
        hgroup.AddChild(_btn);

        _btn = new Button
        {
            Text         = "Option 3 (disabled)",
            SkinClass    = typeof(ButtonSkin5),
            FocusEnabled = false,
            Icon         = ImageLoader.Instance.Load("IconsBig/gtk-floppy"),
            MinWidth     = 200,
            MinHeight    = 200,
            Enabled      = false
        };
        hgroup.AddChild(_btn);

        // new row
        hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        // image
        var image = new Image
        {
            Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        // panel 1
        _panel = new Panel
        {
            Title     = "Panel 1",
            MinWidth  = 200,
            MinHeight = 300
        };
        hgroup.AddChild(_panel);

        // panel 2
        _panel = new Panel
        {
            SkinClass = typeof(PanelSkin3),
            Title     = "Panel 2",
            MinWidth  = 200,
            MinHeight = 300
        };
        hgroup.AddChild(_panel);

        // panel 3
        _panel = new Panel
        {
            SkinClass = typeof(PanelSkin4),
            Title     = "Panel 3",
            MinWidth  = 200,
            MinHeight = 300
        };
        hgroup.AddChild(_panel);

        #endregion

        // new row (placeholder)
        _hgroup = new HGroup();
        vGroup.AddChild(_hgroup);
    }
コード例 #11
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Scroller and viewport

        Scroller scroller = new Scroller
        {
            SkinClass = typeof(ScrollerSkin2),
            Left      = 0,
            Right     = 0,
            Top       = 0,
            Bottom    = 0,
        };
        AddChild(scroller);

        Group viewport = new Group
        {
            Id     = "viewport",
            Layout = new AbsoluteLayout()
        };
        scroller.Viewport = viewport;

        Group g = new Group();
        viewport.AddChild(g);

        var image = new Image
        {
            Mode         = ImageMode.Tiled,
            TilingAnchor = Anchor.BottomRight,
            Texture      = (Texture)Resources.Load("stripes3"),
            Left         = 10,
            Right        = 10,
            Top          = 10,
            Bottom       = 10,
            Tooltip      = "Original size"
        };
        g.AddChild(image);

        #endregion

        #region VGroup

        VGroup vGroup = new VGroup
        {
            Id            = "vGroup",
            PaddingLeft   = 10,
            PaddingRight  = 10,
            PaddingTop    = 10,
            PaddingBottom = 10,
            Left          = 10,
            Right         = 10,
            Top           = 10,
            Bottom        = 10,
            Gap           = 10
        };
        g.AddChild(vGroup);

        #endregion

        #region Images

        var hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        image = new Image
        {
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2"),
            ScaleMode = ImageScaleMode.OriginalSize
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 600,
            Height    = 400,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2"),
            ScaleMode = ImageScaleMode.OriginalSize
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 300,
            Height    = 150,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2"),
            ScaleMode = ImageScaleMode.OriginalSize
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 150,
            Height    = 300,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2"),
            ScaleMode = ImageScaleMode.OriginalSize
        };
        hgroup.AddChild(image);

        hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        image = new Image
        {
            Width     = 350,
            Height    = 200,
            ScaleMode = ImageScaleMode.ScaleToWidth,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 350,
            Height    = 200,
            ScaleMode = ImageScaleMode.ScaleToHeight,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 350,
            Height    = 200,
            ScaleMode = ImageScaleMode.ScaleToFit,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 350,
            Height    = 200,
            ScaleMode = ImageScaleMode.ScaleToFill,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 350,
            Height    = 200,
            ScaleMode = ImageScaleMode.StretchToFit,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        image = new Image
        {
            Width     = 200,
            Height    = 350,
            ScaleMode = ImageScaleMode.ScaleToWidth,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 200,
            Height    = 350,
            ScaleMode = ImageScaleMode.ScaleToHeight,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 200,
            Height    = 350,
            ScaleMode = ImageScaleMode.ScaleToFit,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 200,
            Height    = 350,
            ScaleMode = ImageScaleMode.ScaleToFill,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        image = new Image
        {
            Width     = 200,
            Height    = 350,
            ScaleMode = ImageScaleMode.StretchToFit,
            Texture   = (Texture)Resources.Load("eDriven/Editor/Logo/logo2")
        };
        hgroup.AddChild(image);

        hgroup = new HGroup();
        vGroup.AddChild(hgroup);

        #endregion

        #region Panels

        _panel = new Panel
        {
            Title     = "Panel 1",
            MinWidth  = 200,
            MinHeight = 350
        };
        hgroup.AddChild(_panel);

        _panel = new Panel
        {
            SkinClass = typeof(PanelSkin3),
            Title     = "Panel 2",
            MinWidth  = 200,
            MinHeight = 350
        };
        hgroup.AddChild(_panel);

        _panel = new Panel
        {
            SkinClass = typeof(PanelSkin4),
            Title     = "Panel 3",
            MinWidth  = 200,
            MinHeight = 350
        };
        hgroup.AddChild(_panel);

        #endregion
    }
コード例 #12
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            _rect = new RectShape();
            AddChild(_rect);

            _hgroup = new HGroup {
                VerticalAlign = VerticalAlign.Middle, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10
            };
            AddChild(_hgroup);

            if (null == FirstNameLabel)
            {
                FirstNameLabel = new Label
                {
                    Width = 80
                };
                _hgroup.AddChild(FirstNameLabel);
            }

            if (null == LastNameLabel)
            {
                LastNameLabel = new Label
                {
                    Width = 80
                };
                _hgroup.AddChild(LastNameLabel);
            }

            if (null == AgeLabel)
            {
                AgeLabel = new Label
                {
                    Width = 20
                };
                _hgroup.AddChild(AgeLabel);
            }

            if (null == NsAge)
            {
                NsAge = new NumericStepper {
                    Width = 60, FocusEnabled = false
                };
                NsAge.ValueCommit += delegate
                {
                    // update item
                    ExampleItem item = (ExampleItem)Data;
                    item.Age = (int)NsAge.Value;
                };
                _hgroup.AddChild(NsAge);
            }

            if (null == ChkDrivingLicense)
            {
                ChkDrivingLicense = new CheckBox {
                    FocusEnabled = false
                };
                ChkDrivingLicense.Change += delegate
                {
                    // update item
                    ExampleItem item = (ExampleItem)Data;
                    item.DrivingLicense = ChkDrivingLicense.Selected;
                };
                _hgroup.AddChild(ChkDrivingLicense);
            }

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

            if (null == _buttonInfo)
            {
                _buttonInfo = new Button {
                    Text         = "Info",
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Icon         = ImageLoader.Instance.Load("Icons/information")
                };
                _buttonInfo.Click += delegate
                {
                    DispatchEvent(new Event(ADD_BUTTON_CLICKED, true)); // bubbles
                };
                _hgroup.AddChild(_buttonInfo);
            }

            if (null == _buttonEdit)
            {
                _buttonEdit = new Button
                {
                    Text         = "Edit",
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Icon         = ImageLoader.Instance.Load("Icons/edit")
                };
                _buttonEdit.Click += delegate
                {
                    DispatchEvent(new Event(EDIT_BUTTON_CLICKED, true)); // bubbles
                };
                _hgroup.AddChild(_buttonEdit);
            }

            if (null == _buttonRemove)
            {
                _buttonRemove = new Button
                {
                    Text         = "Remove",
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Icon         = ImageLoader.Instance.Load("Icons/cancel")
                };
                _buttonRemove.ButtonDown += delegate
                {
                    var parentList = Owner as List;
                    if (null != parentList)
                    {
                        //Debug.Log("Removing at " + parentList.DataProvider.GetItemIndex(Data));
                        parentList.DataProvider.RemoveItemAt(parentList.DataProvider.GetItemIndex(Data));
                    }
                    else
                    {
                        Debug.LogError("Owner of item renderer is not a list");
                    }
                };
                _hgroup.AddChild(_buttonRemove);
            }
        }
コード例 #13
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            /*#region Background
             *
             * _background = new RectShape
             *                {
             *                    Id = "background",
             *                    Left = 0,
             *                    Right = 0,
             *                    Top = 0,
             *                    Bottom = 0
             *                };
             * AddChild(_background);
             *
             #endregion*/

            #region Background image

            _backgroundImage = new Image
            {
                //Id = "background_image",
                Left    = 0,
                Right   = 0,
                Top     = 0,
                Bottom  = 0,
                Visible = false,
                Mode    = ImageMode.Tiled
            };
            AddChild(_backgroundImage);

            #endregion

            #region Border

            _border = new RectShape
            {
                Id           = "overlay",
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = false
            };
            AddChild(_border);

            #endregion

            #region Header background

            _headerBackground = new RectShape
            {
                Id     = "headerBackground",
                Left   = 1,
                Right  = 1,
                Top    = 1,
                Height = 50
            };
            AddChild(_headerBackground);

            #endregion

            #region Header group

            HeaderGroup = new Group
            {
                Id           = "headerGroup",
                Layout       = new AbsoluteLayout(),
                Left         = 1,
                Right        = 1,
                Top          = 1,
                Height       = 50,
                MouseEnabled = true
            };
            AddChild(HeaderGroup);

            #endregion

            #region Icon + label group

            _labelGroup = new HGroup
            {
                Left                   = 10,
                VerticalCenter         = 0,
                Gap                    = 6,
                VerticalAlign          = VerticalAlign.Middle,
                ClipAndEnableScrolling = true
            };
            HeaderGroup.AddChild(_labelGroup);

            #endregion

            #region Icon display

            HeaderIconDisplay = new Image();
            _labelGroup.AddChild(HeaderIconDisplay);

            #endregion

            #region Label display

            TitleDisplay = new Label();
            _labelGroup.AddChild(TitleDisplay);

            #endregion

            #region Move area

            MoveArea = new Group
            {
                Id           = "move_area",
                Layout       = new AbsoluteLayout(),
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = true
            };
            HeaderGroup.AddChild(MoveArea);

            #endregion

            #region Tools

            ToolGroup = new Group
            {
                Id     = "toolGroup",
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4
                },
                Right          = 6,
                VerticalCenter = 0,
                MouseEnabled   = true               // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            HeaderGroup.AddChild(ToolGroup);

            #endregion

            #region Content background

            _contentGroupBackground = new RectShape
            {
                Id = "contentGroupBackground",
                //Color = Color.white,
                Left   = 6,
                Right  = 6,
                Top    = 50,
                Bottom = 50
            };
            AddChild(_contentGroupBackground);

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                Left   = 6,
                Right  = 6,
                Top    = 50,
                Bottom = 50
            };
            AddChild(_scroller);

            #endregion

            #region Content group

            ContentGroup = new Group
            {
                Id = "contentGroup",
                //Left = 6,
                //Right = 6,
                //Top = 50,
                //Bottom = 50
            };
            AddChild(ContentGroup);
            _scroller.Viewport = ContentGroup;

            #endregion

            #region Control bar background

            _controlBarBackground = new RectShape
            {
                Id           = "controlBarBackground",
                Left         = 1,
                Right        = 1,
                Bottom       = 1,
                Height       = 50,
                Alpha        = 0.5f,
                MouseEnabled = false
            };
            AddChild(_controlBarBackground);

            #endregion

            #region Control bar

            ControlBarGroup = new Group
            {
                Id = "controlBar",
                ClipAndEnableScrolling = true,
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Bottom,
                    Gap             = 4,
                    PaddingLeft     = 6,
                    PaddingRight    = 6,
                    PaddingTop      = 6,
                    PaddingBottom   = 6
                },
                Left         = 1,
                Right        = 1,
                Bottom       = 1,
                Height       = 50,
                MouseEnabled = true
            };
            AddChild(ControlBarGroup);

            #endregion
        }
コード例 #14
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);
    }
コード例 #15
0
ファイル: PanelDemo.cs プロジェクト: iwaken71/ActivityGame
    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
    }
コード例 #16
0
ファイル: GridDemo.cs プロジェクト: iwaken71/ActivityGame
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        Button button = new Button
        {
            Text       = "Add data",
            SkinClass  = typeof(ImageButtonSkin),
            Icon       = ImageLoader.Instance.Load("Icons/star"),
            AutoRepeat = true
        };
        button.ButtonDown += delegate
        {
            _dataProvider.AddItem(
                new ExampleItem
            {
                FirstName      = "First" + _random.Next(1, 100),
                LastName       = "Last" + _random.Next(1, 100),
                Age            = _random.Next(1, 80),
                DrivingLicense = _random.Next(0, 2) == 1
            }
                );
        };
        toolbar.AddContentChild(button);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass     = typeof(ScrollerSkin2),
            PercentWidth  = 100,
            PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        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 Fill the data provider

        List <string> names = new List <string>
        {
            "Failure",
            "Teaches",
            "Success",
            "One",
            "Two",
            "Three",
            "Four",
            "Five",
            "Six"
        };

        List <object> source = new List <object>();
        foreach (var theName in names)
        {
            source.Add(
                new ExampleItem
            {
                FirstName      = theName,
                LastName       = theName,
                Age            = _random.Next(1, 10),
                DrivingLicense = _random.Next(0, 2) == 1
            }
                );
        }

        _dataProvider = new ArrayList(source);

        #endregion

        HGroup hGroup = new HGroup {
            PercentWidth = 100, PercentHeight = 100
        };
        viewport.AddChild(hGroup);

        #region Grid (header + list + footer)

        VGroup vGroup = new VGroup {
            PercentWidth = 100, PercentHeight = 100, Gap = 0
        };
        hGroup.AddChild(vGroup);

        #region Header

        /* Implement your own header logic here */

        /*HGroup header = new HGroup {PercentWidth = 100, Gap = 0};
         * vGroup.AddChild(header);
         *
         * for (int i = 0; i < 5; i++)
         * {
         *  Button btnCol = new Button // example header
         *  {
         *      Text = "Column " + (i + 1),
         *      ToggleMode = true,
         *      PercentWidth = 100
         *  };
         *  btnCol.Click += delegate(Event e)
         *  {
         *      // sort, filder and refresh (do list.DataProvider = list.DataProvider)
         *  };
         *  header.AddChild(btnCol);
         * }*/

        #endregion

        #region List

        List list = new List
        {
            Id            = "list1",
            PercentWidth  = 100,
            PercentHeight = 100,
            DataProvider  = _dataProvider,
            LabelField    = "FirstName", // this must be set due to list logic legacy (the field must exist in DTO)
            SkinClass     = typeof(ListSkin2),
            ItemRenderer  = new ItemRendererFactory <MyGridItemRenderer>()
        };
        vGroup.AddChild(list);

        #endregion

        #region Footer

        HGroup footer = new HGroup {
            PercentWidth = 100, Gap = 30, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 0
        };
        vGroup.AddChild(footer);

        _lblSum = new Label {
            Text = "Age sum: ", StyleName = "footer"
        };
        footer.AddChild(_lblSum);

        _lblNumberOfSelectedItems = new Label {
            Text = "Driving licenses: ", StyleName = "footer"
        };
        footer.AddChild(_lblNumberOfSelectedItems);

        UpdateFooter();

        #endregion

        #endregion

        #region Process renderer click

        AddEventListener(MyGridItemRenderer.ADD_BUTTON_CLICKED, delegate(Event e)
        {
            IItemRenderer itemRenderer = (IItemRenderer)e.Target;
            Alert.Show("Info", itemRenderer.Data.ToString(), AlertButtonFlag.Ok,
                       new AlertOption(AlertOptionType.HeaderIcon, (object)ImageLoader.Instance.Load("Icons/information")));
        });

        AddEventListener(MyGridItemRenderer.EDIT_BUTTON_CLICKED, delegate(Event e)
        {
            var editor = new ExamplePopupEditor {
                Title      = "Edit",
                Icon       = ImageLoader.Instance.Load("Icons/edit"),
                Data       = ((MyGridItemRenderer)e.Target).Data,
                CloseOnEsc = true
            };
            editor.AddEventListener(CloseEvent.CLOSE, delegate
            {
                PopupManager.Instance.RemovePopup(editor);
            });

            PopupManager.Instance.AddPopup(editor, true);
        });

        #endregion

        #region Process property change

        _dataProvider.AddEventListener(PropertyChangeEvent.PROPERTY_CHANGE, delegate(Event e)
        {
            //PropertyChangeEvent pce = (PropertyChangeEvent) e;
            //Debug.Log(pce.NewValue);
            UpdateFooter();
        });

        #endregion
    }
コード例 #17
0
ファイル: PanelSkin.cs プロジェクト: onamoni/edriven-gui
// ReSharper restore MemberCanBePrivate.Global

        #endregion

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

            #region Background

            _background = new RectShape
            {
                Id   = "background",
                Left = 0, Right = 0, Top = 0, Bottom = 0
            };
            AddChild(_background);

            #endregion

            #region Border

            _border = new RectShape
            {
                Id           = "border",
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = false
            };
            AddChild(_border);

            #endregion

            #region Header background

            _headerBackground = new RectShape
            {
                Id     = "headerBackground",
                Left   = 1, Right = 1, Top = 1,
                Height = 50
            };
            AddChild(_headerBackground);

            #endregion

            #region Header group

            HeaderGroup = new Group
            {
                Id           = "headerGroup",
                Layout       = new AbsoluteLayout(),
                Left         = 1,
                Right        = 1,
                Top          = 1,
                Height       = 50,
                MouseEnabled = true
            };
            AddChild(HeaderGroup);

            #endregion

            #region Icon + label group

            _labelGroup = new HGroup
            {
                Left           = 10,
                VerticalCenter = 0,
                Gap            = 6,
                VerticalAlign  = VerticalAlign.Middle
            };
            HeaderGroup.AddChild(_labelGroup);

            #endregion

            #region Icon display

            HeaderIconDisplay = new Image
            {
                //Id = "titleLabel",
                //Text = "miki!",
                Left           = 10,
                VerticalCenter = 0
            };
            _labelGroup.AddChild(HeaderIconDisplay);

            #endregion

            #region Label display

            TitleDisplay = new Label
            {
                //Id = "titleLabel",
                //Text = "miki!",
                Left           = 10,
                VerticalCenter = 0
            };
            //TitleLabel.SetStyle("textColor", UnityEngine.Color.white);
            _labelGroup.AddChild(TitleDisplay);

            #endregion

            #region Tools

            ToolGroup = new Group
            {
                Id     = "toolGroup",
                Layout = new HorizontalLayout {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4
                },
                Right          = 6,
                VerticalCenter = 0,
                MouseEnabled   = true               // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            HeaderGroup.AddChild(ToolGroup);

            #endregion

            #region Content background

            _contentGroupBackground = new RectShape
            {
                Id = "contentGroupBackground",
                //Color = Color.white,
                Left   = 6,
                Right  = 6,
                Top    = 50,
                Bottom = 50
            };
            AddChild(_contentGroupBackground);

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                Left   = 6,
                Right  = 6,
                Top    = 50,
                Bottom = 50
            };
            AddChild(_scroller);

            #endregion

            #region Content group

            ContentGroup = new Group
            {
                Id = "contentGroup",
                //Left = 6,
                //Right = 6,
                //Top = 50,
                //Bottom = 50
            };
            //AddChild(ContentGroup);
            _scroller.Viewport = ContentGroup;

            #endregion

            #region Control bar background

            _controlBarBackground = new RectShape
            {
                Id     = "controlBarBackground",
                Left   = 1,
                Right  = 1,
                Bottom = 1,
                Height = 50,
                Alpha  = 0.5f
            };
            AddChild(_controlBarBackground);

            #endregion

            #region Control bar

            ControlBarGroup = new Group
            {
                Id     = "controlBar",
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4,
                    PaddingLeft     = 6, PaddingRight = 6, PaddingTop = 6, PaddingBottom = 6
                },
                Left         = 1,
                Right        = 1,
                Bottom       = 1,
                Height       = 50,
                MouseEnabled = true                       // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            AddChild(ControlBarGroup);

            #endregion
        }
コード例 #18
0
// ReSharper restore MemberCanBePrivate.Global

        #endregion

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

            #region Background

            _background = new RectShape
            {
                Id   = "background",
                Left = 0, Right = 0, Top = 0, Bottom = 0
            };
            AddChild(_background);

            #endregion

            #region Border

            _border = new RectShape
            {
                Id           = "overlay",
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = false
            };
            AddChild(_border);

            #region Header background

            _headerBackground = new RectShape
            {
                Id     = "headerBackground",
                Left   = 1, Right = 1, Top = 1,
                Height = 50
            };
            AddChild(_headerBackground);

            #endregion

            #region Header group

            HeaderGroup = new Group
            {
                Id           = "headerGroup",
                Layout       = new AbsoluteLayout(),
                Left         = 1,
                Right        = 1,
                Top          = 1,
                Height       = 50,
                MouseEnabled = true
            };
            AddChild(HeaderGroup);

            #endregion

            #region Icon + label group

            _labelGroup = new HGroup
            {
                Left                   = 10,
                VerticalCenter         = 0,
                Gap                    = 6,
                VerticalAlign          = VerticalAlign.Middle,
                ClipAndEnableScrolling = true
            };
            HeaderGroup.AddChild(_labelGroup);

            #endregion

            #region Icon display

            HeaderIconDisplay = new Image
            {
                /*Left = 10,
                 * VerticalCenter = 0*/
            };
            _labelGroup.AddChild(HeaderIconDisplay);

            #endregion

            #region Label display

            TitleDisplay = new Label
            {
                //Id = "titleLabel",
                //Left = 10,
                //VerticalCenter = 0
            };
            //TitleLabel.SetStyle("textColor", UnityEngine.Color.white);
            _labelGroup.AddChild(TitleDisplay);

            #endregion

            #region Move area

            MoveArea = new Group
            {
                Id           = "move_area",
                Layout       = new AbsoluteLayout(),
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = true
            };
            HeaderGroup.AddChild(MoveArea);

            #endregion

            #region Tools

            ToolGroup = new Group
            {
                Id     = "toolGroup",
                Layout = new HorizontalLayout {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4
                },
                Right          = 6,
                VerticalCenter = 0,
                MouseEnabled   = true               // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            HeaderGroup.AddChild(ToolGroup);

            #endregion

            #region Content background

            _contentGroupBackground = new RectShape
            {
                Id     = "contentGroupBackground",
                Left   = 6,
                Right  = 6,
                Top    = 50,
                Bottom = 50
            };
            AddChild(_contentGroupBackground);

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                Left   = 6,
                Right  = 6,
                Top    = 50,
                Bottom = 50
            };
            AddChild(_scroller);

            #endregion

            #region Content group

            ContentGroup = new Group
            {
                Id = "contentGroup",
                //Left = 6,
                //Right = 6,
                //Top = 50,
                //Bottom = 50
            };

            /**
             * Panel: in designer, children not focusable (textarea)
             * Problem je bio u WindowSkinu:
             * ContentGroup = new Group{ Id = "contentGroup" };
             * AddChild(ContentGroup); // -> ova linija radi problem (ako se izbaci, sve je ok)
             * _scroller.Viewport = ContentGroup;
             * */

            // AddChild(ContentGroup);
            _scroller.Viewport = ContentGroup;

            #endregion

            #region Control bar background

            _controlBarBackground = new RectShape
            {
                Id           = "controlBarBackground",
                Left         = 1,
                Right        = 1,
                Bottom       = 1,
                Height       = 50,
                Alpha        = 0.5f,
                MouseEnabled = false
            };
            AddChild(_controlBarBackground);

            #endregion

            #region Control bar

            ControlBarGroup = new Group
            {
                Id = "controlBar",
                ClipAndEnableScrolling = true,
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4,
                    PaddingLeft     = 6,
                    PaddingRight    = 6,
                    PaddingTop      = 6,
                    PaddingBottom   = 6
                },
                Left         = 1,
                Right        = 1,
                Bottom       = 1,
                Height       = 50,
                MouseEnabled = true
            };
            AddChild(ControlBarGroup);

            #endregion

            #endregion
        }
コード例 #19
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
    }
コード例 #20
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            _rect = new RectShape(); //{ Left = 0, Right = 0, Top = 0, Bottom = 0 //};
            AddChild(_rect);

            _hGroup = new HGroup
            {
                PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10
            };
            AddChild(_hGroup);

            // left group
            VGroup vGroup = new VGroup
            {
                VerticalAlign = VerticalAlign.Middle,
                Gap           = 10,
                PercentWidth  = 100,
                PercentHeight = 100
            };

            _hGroup.AddChild(vGroup);

            _image = new Image
            {
                Styles = ButtonStyles
            };
            _image.MouseDown += delegate
            {
                DispatchEvent(new Event("showImage", true)); // bubbling event
            };
            vGroup.AddChild(_image);

            LabelDisplay = new Label
            {
                Width = 150
            };
            //vGroup.AddChild(LabelDisplay);
            if (_text != string.Empty)
            {
                LabelDisplay.Text = _text;
            }

            // right group
            vGroup = new VGroup
            {
                VerticalAlign = VerticalAlign.Middle, Gap = 10, PercentWidth = 100, PercentHeight = 100
            };
            _hGroup.AddChild(vGroup);

            if (null == _buttonShow)
            {
                _buttonShow = new Button {
                    Text         = "Show",
                    PercentWidth = 100,
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Styles       = ButtonStyles,
                    Icon         = ImageLoader.Instance.Load("Icons/accept")
                };
                _buttonShow.ButtonDown += delegate
                {
                    DispatchEvent(new Event("showImage", true)); // bubbling!
                };
                vGroup.AddChild(_buttonShow);
            }

            if (null == _buttonRemove)
            {
                _buttonRemove = new Button
                {
                    Text         = "Remove",
                    PercentWidth = 100,
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Styles       = ButtonStyles,
                    Icon         = ImageLoader.Instance.Load("Icons/cancel")
                };
                _buttonRemove.ButtonDown += delegate
                {
                    var parentList = Owner as List;
                    if (null != parentList)
                    {
                        //Debug.Log("Removing at " + parentList.DataProvider.GetItemIndex(Data));
                        parentList.DataProvider.RemoveItemAt(parentList.DataProvider.GetItemIndex(Data));
                    }
                    else
                    {
                        Debug.LogError("Owner of item renderer is not a list");
                    }
                };
                vGroup.AddChild(_buttonRemove);
            }
        }
コード例 #21
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            _rect = new RectShape();
            //{
            //    Left = 0, Right = 0, Top = 0, Bottom = 0
            //};
            AddChild(_rect);

            _hgroup = new HGroup {
                VerticalAlign = VerticalAlign.Middle, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10
            };
            AddChild(_hgroup);

            if (null == LabelDisplay)
            {
                LabelDisplay = new Label
                {
                    PercentWidth = 100
                };
                _hgroup.AddChild(LabelDisplay);
                if (_text != string.Empty)
                {
                    LabelDisplay.Text = _text;
                }
            }

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

            if (null == _buttonAdd)
            {
                _buttonAdd = new Button {
                    Text         = "Info",
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Icon         = ImageLoader.Instance.Load("Icons/information")
                };
                _buttonAdd.ButtonDown += delegate
                {
                    DispatchEvent(new Event(ADD_BUTTON_CLICKED, true)); // bubbles
                };
                _hgroup.AddChild(_buttonAdd);
            }

            if (null == _buttonRemove)
            {
                _buttonRemove = new Button
                {
                    Text         = "Remove",
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Icon         = ImageLoader.Instance.Load("Icons/cancel")
                };
                _buttonRemove.ButtonDown += delegate
                {
                    var parentList = Owner as List;
                    if (null != parentList)
                    {
                        //Debug.Log("Removing at " + parentList.DataProvider.GetItemIndex(Data));
                        parentList.DataProvider.RemoveItemAt(parentList.DataProvider.GetItemIndex(Data));
                    }
                    else
                    {
                        Debug.LogError("Owner of item renderer is not a list");
                    }
                };
                _hgroup.AddChild(_buttonRemove);
            }
        }
コード例 #22
0
ファイル: AlertSkin.cs プロジェクト: onamoni/edriven-gui
        protected override void CreateChildren()
        {
            base.CreateChildren();

            #region Background

            _background = new RectShape
            {
                Id     = "background",
                Left   = 0,
                Right  = 0,
                Top    = 0,
                Bottom = 0
            };
            AddChild(_background);

            #endregion

            #region Border

            _border = new RectShape
            {
                Id           = "overlay",
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = false
            };
            AddChild(_border);

            #endregion

            #region Header background

            _headerBackground = new RectShape
            {
                Id = "headerBackground",
                //Color = (Color?)GetStyle("headerBackgroundColor"),
                Left   = 1,
                Right  = 1,
                Top    = 1,
                Height = 50
            };
            AddChild(_headerBackground);

            #endregion

            #region Header group

            HeaderGroup = new Group
            {
                Id           = "headerGroup",
                Layout       = new AbsoluteLayout(),
                Left         = 1,
                Right        = 1,
                Top          = 1,
                Height       = 50,
                MouseEnabled = true
            };
            AddChild(HeaderGroup);

            #endregion

            #region Icon + label group

            _labelGroup = new HGroup
            {
                Left                   = 10,
                VerticalCenter         = 0,
                Gap                    = 6,
                VerticalAlign          = VerticalAlign.Middle,
                ClipAndEnableScrolling = true
            };
            HeaderGroup.AddChild(_labelGroup);

            #endregion

            #region Icon display

            HeaderIconDisplay = new Image();
            _labelGroup.AddChild(HeaderIconDisplay);

            #endregion

            #region Label display

            TitleDisplay = new Label();
            _labelGroup.AddChild(TitleDisplay);

            #endregion

            #region Move area

            MoveArea = new Group
            {
                Id           = "move_area",
                Layout       = new AbsoluteLayout(),
                Left         = 0,
                Right        = 0,
                Top          = 0,
                Bottom       = 0,
                MouseEnabled = true
            };
            HeaderGroup.AddChild(MoveArea);

            #endregion

            #region Tools

            ToolGroup = new Group
            {
                Id     = "toolGroup",
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Middle,
                    Gap             = 4
                },
                Right          = 6,
                VerticalCenter = 0,
                MouseEnabled   = true // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            HeaderGroup.AddChild(ToolGroup);

            #endregion

            #region Content background

            _contentGroupBackground = new RectShape
            {
                Id = "contentGroupBackground",
                //Color = Color.white,
                Left   = 6,
                Right  = 6,
                Top    = 50,
                Bottom = 50
            };
            AddChild(_contentGroupBackground);

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                Left   = 6,
                Right  = 6,
                Top    = 50,
                Bottom = 50
            };
            AddChild(_scroller);

            #endregion

            #region Content group

            ContentGroup = new HGroup
            {
                Id              = "contentGroup",
                Gap             = 10,
                PaddingLeft     = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10,
                HorizontalAlign = HorizontalAlign.Center,
                VerticalAlign   = VerticalAlign.Middle
            };
            AddChild(ContentGroup);
            _scroller.Viewport = ContentGroup;

            #endregion

            #region Icon

            IconDisplay = new Image();
            ContentGroup.AddChild(IconDisplay);

            #endregion

            #region Message display

            MessageDisplay = new Label {
                Multiline = true,
                MaxWidth  = 800,
                MaxHeight = 600,
                Color     = Color.black,
            };
            MessageDisplay.SetStyle("labelStyle", GetStyle("labelStyle"));
            MessageDisplay.SetStyle("font", GetStyle("labelFont"));
            ContentGroup.AddChild(MessageDisplay);

            #endregion

            #region Control bar background

            _controlBarBackground = new RectShape
            {
                Id           = "controlBarBackground",
                Left         = 1,
                Right        = 1,
                Bottom       = 1,
                Height       = 50,
                Alpha        = 0.5f,
                MouseEnabled = false
            };
            AddChild(_controlBarBackground);

            #endregion

            #region Control bar

            ControlBarGroup = new Group
            {
                Id = "controlBar",
                //ClipAndEnableScrolling = true, // this introduces a child positioning bug
                Layout = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Right,
                    VerticalAlign   = VerticalAlign.Bottom,
                    Gap             = 4,
                    PaddingLeft     = 6,
                    PaddingRight    = 6,
                    PaddingTop      = 6,
                    PaddingBottom   = 6
                },
                ClipAndEnableScrolling = true,
                Left         = 1,
                Right        = 1,
                Bottom       = 1,
                Height       = 50,
                MouseEnabled = true // not draggable when clicking space between buttons --- false // to be draggable on possible tools label click
            };
            AddChild(ControlBarGroup);

            #endregion
        }
コード例 #23
0
ファイル: DataGroupDemo.cs プロジェクト: onamoni/edriven-gui
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Controls

        Toolbar toolbar = new Toolbar();
        AddChild(toolbar);

        Button button = new Button
        {
            Text       = "Add data",
            SkinClass  = typeof(ImageButtonSkin),
            Icon       = ImageLoader.Instance.Load("Icons/add"),
            AutoRepeat = true
        };
        button.ButtonDown += delegate
        {
            _dataProvider.AddItem("data " + _random.Next(1, 100));
        };
        toolbar.AddContentChild(button);

        #endregion

        #region Scroller

        Scroller scroller = new Scroller
        {
            SkinClass     = typeof(ScrollerSkin2),
            PercentWidth  = 100,
            PercentHeight = 100
        };
        //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
        //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
        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;
        //AddChild(viewport);

        #endregion

        #region Data controls

        List <object> source = new List <object> {
            "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six"
        };

        _dataProvider = new ArrayList(source);

        var factory = new ItemRendererFactory <DefaultItemRenderer>();

        /* LISTS */

        #region HGroup

        HGroup hGroup1 = new HGroup
        {
            PaddingLeft   = 10,
            PaddingRight  = 10,
            PaddingTop    = 10,
            PaddingBottom = 10,
            Gap           = 20
        };

        //hbox.SetStyle("showBackground", true);
        //hbox.SetStyle("backgroundColor", RgbColor.FromHex(0x004CFF).ToColor());
        viewport.AddChild(hGroup1);

        #endregion

        HGroup hGroup = new HGroup();
        viewport.AddChild(hGroup);

        /* DATA GROUPS */

        #region Data group 1

        hGroup1 = new HGroup
        {
            PaddingLeft   = 10,
            PaddingRight  = 10,
            PaddingTop    = 10,
            PaddingBottom = 10,
            Gap           = 50
        };
        hGroup.AddChild(hGroup1);

        DataGroup dataGroup = new DataGroup
        {
            Layout       = new VerticalLayout(),
            DataProvider = _dataProvider,
            //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            ItemRendererFunction = delegate(object item)
            {
                return(factory);
            }
        };
        hGroup1.AddChild(dataGroup);

        #endregion

        #region Data group 2

        hGroup1 = new HGroup
        {
            PaddingLeft   = 10,
            PaddingRight  = 10,
            PaddingTop    = 10,
            PaddingBottom = 10,
            Gap           = 50
        };
        hGroup.AddChild(hGroup1);

        dataGroup = new DataGroup
        {
            Layout = new TileLayout {
                RequestedColumnCount = 2
            },
            //Width = 200, Height = 200,
            DataProvider = _dataProvider,
            //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            ItemRendererFunction = delegate
            {
                return(factory);
            }
            //ClipAndEnableScrolling = true
        };
        hGroup1.AddChild(dataGroup);

        #endregion

        #region Data group 3

        hGroup1 = new HGroup
        {
            PaddingLeft   = 10,
            PaddingRight  = 10,
            PaddingTop    = 10,
            PaddingBottom = 10,
            Gap           = 50
        };
        hGroup.AddChild(hGroup1);

        dataGroup = new DataGroup
        {
            Layout = new TileLayout {
                RequestedColumnCount = 4
            },
            //Width = 200, Height = 200,
            DataProvider = _dataProvider,
            //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            ItemRendererFunction = delegate
            {
                return(factory);
            }
            //ClipAndEnableScrolling = true
        };
        hGroup1.AddChild(dataGroup);

        #endregion

        #endregion

        #region VGroup

        VGroup vgroup = new VGroup();
        hGroup.AddChild(vgroup);

        #endregion

        #region List 1

        List list = new List
        {
            //Layout = new TileLayout { RequestedColumnCount = 4 },
            Width        = 200,
            Height       = 200,
            DataProvider = _dataProvider,
            //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            ItemRendererFunction = delegate
            {
                return(factory);
            }
        };
        vgroup.AddChild(list);

        #endregion

        #region List 2

        list = new List
        {
            //Layout = new TileLayout { RequestedColumnCount = 3 },
            Width        = 200,
            Height       = 245,
            DataProvider = _dataProvider,
            //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            ItemRendererFunction = delegate
            {
                return(factory);
            }
        };
        vgroup.AddChild(list);

        #endregion

        #region List 3

        list = new List
        {
            Id           = "list3",
            Width        = 400,
            Height       = 600,
            DataProvider = _dataProvider,
            SkinClass    = typeof(ListSkin2),
            ItemRenderer = new ItemRendererFactory <BigItemRenderer>()
        };
        hGroup.AddChild(list);

        #endregion

        #region Process renderer click

        AddEventListener(BigItemRenderer.ADD_BUTTON_CLICKED, delegate(Event e)
        {
            BigItemRenderer itemRenderer = (BigItemRenderer)e.Target;
            Alert.Show("Info", itemRenderer.Data.ToString(), AlertButtonFlag.Ok,
                       new AlertOption(AlertOptionType.HeaderIcon, ImageLoader.Instance.Load("Icons/information")));
        });

        #endregion
    }
コード例 #24
0
ファイル: DataGroupDemo2.cs プロジェクト: onamoni/edriven-gui
        override protected void CreateChildren()
        {
            base.CreateChildren();

            //Scroller scroller = new Scroller
            //                        {
            //                            SkinClass = typeof(ScrollerSkin2),
            //                            Left = 0,
            //                            Right = 0,
            //                            Top = 0,
            //                            Bottom = 0
            //                        };
            ////scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.Off);
            ////scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.Off);
            //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;

            #region Controls

            HGroup hbox = new HGroup
            {
                VerticalAlign = VerticalAlign.Middle,
                PaddingLeft   = 10,
                PaddingRight  = 10,
                PaddingTop    = 10,
                PaddingBottom = 10,
                Gap           = 10
            };

            hbox.SetStyle("showBackground", true);
            hbox.SetStyle("backgroundColor", ColorMixer.FromHex(0x004CFF).ToColor());
            /*viewport.*/ AddChild(hbox);

            Button button = new Button
            {
                Text      = "Increase width",
                SkinClass = typeof(ImageButtonSkin),
                Icon      = ImageLoader.Instance.Load("Icons/shape_square_add")
            };
            button.Click += delegate
            {
                button.Width += 10;
                _dataProvider.AddItem("miki " + button.Width);
            };
            hbox.AddChild(button);

            Button btnWindow = new Button
            {
                Text         = "New window",
                FocusEnabled = false,
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/comment")
            };
            btnWindow.Click += delegate
            {
                //_container.RemoveAllChildren();
                //for (int i = _container.NumberOfChildren - 1; i >= 0; i--)
                //{
                //    _container.RemoveContentChildAt(i);
                //}
                //_container.RemoveAllContentChildren();
                //_count = 0;
                _count++;

                var window = new MyWindow
                {
                    Title     = "The Window " + _count,
                    Id        = "window_" + _count,
                    SkinClass = typeof(WindowSkin2),
                    Icon      = ImageLoader.Instance.Load("Icons/balloon_32"),
                    Width     = 400,
                    Height    = 600
                };

                //System.Random rnd = new System.Random();
                //if (rnd.Next(2) > 0)

                window.Plugins.Add(new Resizable {
                    ShowOverlay = false
                });
                window.AddEventListener(CloseEvent.CLOSE, delegate
                {
                    PopupManager.Instance.RemovePopup(window);
                });

                #region Cannot use plugin!

                // NOTE: We cannot use the plugin having a DragHandle because the placehoder group is being switched live
                // we just have to use the MoveArea skin part and do the dragging thing from inside the Dialog

                //var draggable = new Draggable
                //                    {
                //                        DragHandle = b.HeaderGroup
                //                    };
                //b.Plugins.Add(draggable);

                #endregion

                PopupManager.Instance.AddPopup(window, false);
                PopupManager.Instance.CenterPopUp(window);
            };
            hbox.AddChild(btnWindow);

            #endregion

            hbox = new HGroup
            {
                PaddingLeft   = 10,
                PaddingRight  = 10,
                PaddingTop    = 10,
                PaddingBottom = 10,
                Gap           = 10
            };

            //hbox.SetStyle("showBackground", true);
            //hbox.SetStyle("backgroundColor", RgbColor.FromHex(0x004CFF).ToColor());
            /*viewport.*/ AddChild(hbox);

            #region Data controls

            List <object> source = new List <object> {
                "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six"
            };

            _dataProvider = new ArrayList(source);

            var factory = new ItemRendererFactory <DefaultItemRenderer>();

            //DataGroup dataGroup = new DataGroup
            //                          {
            //                              Layout = new VerticalLayout(),
            //                              DataProvider = _dataProvider,
            //                              //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            //                              ItemRendererFunction = delegate(object item)
            //                                                         {
            //                                                             return factory;
            //                                                         }
            //                          };
            //hbox.AddChild(dataGroup);

            //dataGroup = new DataGroup
            //                {
            //                    Layout = new TileLayout { RequestedColumnCount = 4 },
            //                    //Width = 200, Height = 200,
            //                    DataProvider = _dataProvider,
            //                    //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
            //                    ItemRendererFunction = delegate
            //                                               {
            //                                                   return factory;
            //                                               },
            //                    //ClipAndEnableScrolling = true
            //                };
            //hbox.AddChild(dataGroup);

            List list = new List
            {
                //Layout = new TileLayout { RequestedColumnCount = 4 },
                Width        = 200, Height = 200,
                Left         = 100, Top = 50,
                DataProvider = _dataProvider,
                //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(),
                ItemRendererFunction = delegate
                {
                    return(factory);
                }
            };
            /*viewport.*/ AddChild(list);

            #endregion
        }
コード例 #25
0
ファイル: ScrollbarDemo.cs プロジェクト: onamoni/edriven-gui
    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
    }