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

            Button button;

            for (int i = 0; i < 14; i++)
            {
                button = new Button
                {
                    Text         = "Button " + (i + 1),
                    SkinClass    = typeof(ImageButtonSkin),
                    FocusEnabled = false,
                    Icon         = ImageLoader.Instance.Load("Icons/shape_square_add"),
                    Width        = 400,
                    Height       = 200
                };
                AddContentChild(button);
            }

            /*List<string> icons = new List<string> { "maximize", "cancel" };
             * for (int i = 0; i < icons.Count; i++)
             * {
             *  button = new Button
             *               {
             *                   FocusEnabled = false,
             *                   SkinClass = typeof(ImageButtonSkin),
             *                   Icon = ImageLoader.Instance.Load("Icons/" + icons[i])
             *               };
             *  button.Click += delegate(Event e) { Debug.Log("Clicked: " + e.Target); };
             *  ToolGroup.AddChild(button);
             * }*/

            button = new Button
            {
                Text         = "Toggle",
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/color_swatch"),
                ToggleMode   = true,
                FocusEnabled = false,
                Selected     = true
            };
            ControlBarGroup.AddChild(button);

            List <string> icons = new List <string> {
                "lock", "star", "accept"
            };

            for (int i = 0; i < 3; i++)
            {
                button = new Button
                {
                    Text         = UppercaseFirst(icons[i]),
                    SkinClass    = typeof(ImageButtonSkin),
                    FocusEnabled = false,
                    Icon         = ImageLoader.Instance.Load("Icons/" + icons[i])
                };
                ControlBarGroup.AddChild(button);
            }
        }
Ejemplo n.º 2
0
        override protected void CreateChildren()
        {
            base.CreateChildren();

            #region Tools

            Button button = new Button
            {
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = global::eDriven.Core.Caching.ImageLoader.Instance.Load("Icons/cancel"),
                FocusEnabled = false,
                Styles       = ButtonStyles
            };
            button.Click += delegate
            {
                DispatchEvent(new CloseEvent(CloseEvent.CLOSE));
            };
            ToolGroup.AddChild(button);

            #endregion

            #region Image

            _image = new Image {
                Id = "image", PercentWidth = 100, PercentHeight = 100, ScaleMode = ImageScaleMode.ScaleToFit
            };
            AddContentChild(_image);

            #endregion

            #region Control bar

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

            button = new Button
            {
                Text         = "Close preview",
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = global::eDriven.Core.Caching.ImageLoader.Instance.Load("Icons/color_swatch"),
                FocusEnabled = false,
                Styles       = ButtonStyles
            };
            button.Click += delegate
            {
                DispatchEvent(new CloseEvent(CloseEvent.CLOSE));
            };
            ControlBarGroup.AddChild(button);

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

            Button button;

            #region View + vertical scrollbar

            _view = new VGroup
            {
                Id = "view",
                ClipAndEnableScrolling = true,
                Left                      = 0, /*Right = 16, */ Top = 0, Bottom = 0,
                PaddingLeft               = 10,
                PaddingRight              = 10,
                PaddingTop                = 10,
                PaddingBottom             = 10,
                Gap                       = 6,
                StopMouseWheelPropagation = true
            };
            AddContentChild(_view);

            _vScrollBar = new VScrollBar
            {
                Left      = null,
                Right     = 0,
                Top       = 0,
                Bottom    = 0,
                Viewport  = _view,
                SkinClass = typeof(VScrollBarSkin3)
            };
            AddContentChild(_vScrollBar);

            //_vScrollBar.ValidateNow();
            //_view.Right = _vScrollBar.MeasuredWidth;

            #endregion

            for (int i = 0; i < 14; i++)
            {
                button = new Button
                {
                    Text         = "Button " + (i + 1),
                    SkinClass    = typeof(ImageButtonSkin),
                    FocusEnabled = false,
                    Icon         = ImageLoader.Instance.Load("Icons/shape_square_add")
                };
                //button.Click += delegate { AddButton(); };
                _view.AddChild(button);
            }

            List <string> icons = new List <string> {
                "maximize", "cancel"
            };
            for (int i = 0; i < icons.Count; i++)
            {
                button = new Button
                {
                    FocusEnabled = false,
                    SkinClass    = typeof(ImageButtonSkin),
                    Icon         = ImageLoader.Instance.Load("Icons/" + icons[i])
                };
                button.Click += delegate(Event e) { Debug.Log("Clicked: " + e.Target); };
                ToolGroup.AddChild(button);
            }

            button = new Button
            {
                Text         = "Clip",
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/color_swatch"),
                ToggleMode   = true,
                FocusEnabled = false,
                Selected     = true
            };
            button.Change += delegate(Event e)
            {
                Button btn = (Button)e.Target;
                //Debug.Log("Selected: " + btn.Selected);
                _view.ClipAndEnableScrolling = btn.Selected;
            };
            ControlBarGroup.AddChild(button);

            icons = new List <string> {
                "lock", "star", "accept"
            };
            for (int i = 0; i < 3; i++)
            {
                button = new Button
                {
                    Text         = UppercaseFirst(icons[i]),
                    SkinClass    = typeof(ImageButtonSkin),
                    FocusEnabled = false,
                    Icon         = ImageLoader.Instance.Load("Icons/" + icons[i])
                };
                //button.Click += delegate { AddButton(); };
                ControlBarGroup.AddChild(button);
            }
        }
Ejemplo n.º 4
0
        override protected void CreateChildren()
        {
            base.CreateChildren();

            Form form = new Form {
                PercentWidth = 100                  /*, Padding = 0*/
            };

            AddContentChild(form);

            // full screen checkbox
            _chkFullScreen = new CheckBox
            {
                Text      = "Full screen",
                StyleName = "checkbox",
                Right     = 10,
                Top       = 10,
                //Padding = 0,
                ResizeWithContent = true,
                ToggleMode        = true,
                FocusEnabled      = false,
                Selected          = OptionsModel.Instance.FullScreen
            };
            _chkFullScreen.Change += delegate
            {
                _list.Enabled = _chkFullScreen.Selected;
                HandleSubmitButton();
            };
            form.AddField("fullScreen", "Full screen:", _chkFullScreen);

            // resolution list
            _list = new List
            {
                //PercentWidth = 100,
                RequireSelection = true,
                SelectedItem     = OptionsModel.Instance.Resolution,
                Enabled          = OptionsModel.Instance.FullScreen,
                DataProvider     = new ArrayList(Application.isEditor
                                               ? ResolutionHelper.GetDummyResolutionList()
                                               : ResolutionHelper.GetResolutionList())
            };

            /*_list.SelectedIndexChanged += delegate
             *                                {
             *                                    HandleSubmitButton();
             *                                };*/
            form.AddField("list", "Resolution:", _list);

            #region Buttons

            _btnSubmit = new Button
            {
                Text    = "Set resolution",
                Icon    = ImageLoader.Instance.Load("Icons/accept"),
                Enabled = false
            };
            _btnSubmit.Press += SetResolution;
            ControlBarGroup.AddChild(_btnSubmit);

            _btnCancel = new Button
            {
                Text = "Cancel",
                Icon = ImageLoader.Instance.Load("Icons/cancel")
            };
            _btnCancel.Press += delegate
            {
                ExecCallback(CANCEL);
            };
            ControlBarGroup.AddChild(_btnCancel);

            #endregion

            Plugins.Add(new TabManager());
        }
Ejemplo n.º 5
0
        override protected void CreateChildren()
        {
            base.CreateChildren();

            #region List 1

            List list1 = new List
            {
                PercentWidth  = 100,
                PercentHeight = 100,
                MinWidth      = 200,
                MinHeight     = 100,
                Height        = 200,
                DataProvider  = new ArrayList(EasingHelper.GetEasingList()),
                SelectedItem  = "Bounce"
            };
            AddContentChild(list1);

            #endregion

            #region List 2

            List list2 = new List
            {
                PercentWidth  = 100,
                PercentHeight = 100,
                MinHeight     = 100,
                Height        = 200,
                DataProvider  = new ArrayList(
                    Application.isWebPlayer
                                         ? ResolutionHelper.GetResolutionList()
                                         : ResolutionHelper.GetDummyResolutionList())
            };
            AddContentChild(list2);

            #endregion

            #region Drow down list

            DropDownList dropDownList = new DropDownList
            {
                PercentWidth = 100,
                MinWidth     = 200,
                DataProvider = new ArrayList(
                    Application.isWebPlayer
                                         ? ResolutionHelper.GetResolutionList()
                                         : ResolutionHelper.GetDummyResolutionList())
            };
            AddContentChild(dropDownList);

            dropDownList = new DropDownList
            {
                PercentWidth = 100,
                MinWidth     = 200,
                DataProvider = new ArrayList(new System.Collections.Generic.List <object>
                {
                    new ListItem(1, "Zagreb"),
                    new ListItem(2, "Osijek"),
                    new ListItem(3, "Rijeka"),
                    new ListItem(4, "Split"),
                    new ListItem(5, "Ljubljana"),
                    new ListItem(6, "Wiena"),
                    new ListItem(7, "Munich"),
                    new ListItem(8, "Berlin")
                })
            };
            AddContentChild(dropDownList);

            List list3 = new List
            {
                PercentWidth = 100,
                MinHeight    = 100,
                Height       = 200,
                DataProvider = new ArrayList(EasingHelper.GetEasingInOutList()),
                SelectedItem = "EaseIn"
            };
            AddContentChild(list3);

            #endregion

            #region Button

            Button btn = new Button
            {
                Text      = "Show alert",
                SkinClass = typeof(ImageButtonSkin),
                Icon      = Resources.Load <Texture>("Icons/tab-comment")
                            //StyleDeclaration = new StyleDeclaration(RectButtonSkin.Instance, "button"),
            };

            btn.Click += delegate
            {
                Alert.Show("Hi!", "This is the alert", AlertButtonFlag.Ok);
            };
            ControlBarGroup.AddChild(btn);

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

            Button button;

            for (var i = 0; i < 14; i++)
            {
                button = new Button
                {
                    Text         = "Button " + (i + 1),
                    SkinClass    = typeof(ImageButtonSkin),
                    FocusEnabled = false,
                    Icon         = Resources.Load <Texture>("Icons/shape_square_add"),
                    Width        = (_random.Next(2) == 1) ? 400 : 200,
                    Height       = (_random.Next(2) == 1) ? 200 : 150
                };
                AddContentChild(button);
            }

            button = new Button
            {
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/cancel"),
                FocusEnabled = false,
                Styles       = _buttonStyles
            };
            button.Click += delegate
            {
                DispatchEvent(new CloseEvent(CloseEvent.CLOSE));
            };
            ToolGroup.AddChild(button);

            _btnHoriz = new Button
            {
                Text         = "Horizontal",
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/color_swatch"),
                ToggleMode   = true,
                FocusEnabled = false,
                Styles       = _buttonStyles
            };
            _btnHoriz.Click += delegate
            {
                //AnimateToLayout(_horizontalLayout);
                SetCurrentState("horizontal");
                Defer(HandleButtons, 1);
            };
            ControlBarGroup.AddChild(_btnHoriz);

            _btnVert = new Button
            {
                Text         = "Vertical",
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/color_swatch"),
                ToggleMode   = true,
                FocusEnabled = false,
                Styles       = _buttonStyles
            };
            _btnVert.Click += delegate
            {
                //AnimateToLayout(_verticalLayout);
                SetCurrentState("vertical");
                Defer(HandleButtons, 1);
            };
            ControlBarGroup.AddChild(_btnVert);

            _btnTile = new Button
            {
                Text         = "Tile",
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/color_swatch"),
                ToggleMode   = true,
                FocusEnabled = false,
                Styles       = _buttonStyles,
                Selected     = true
            };
            _btnTile.Click += delegate
            {
                SetCurrentState("tile"); //tile
                Defer(HandleButtons, 1);
            };
            ControlBarGroup.AddChild(_btnTile);

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

            button = new Button
            {
                Text         = "Close window",
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/color_swatch"),
                FocusEnabled = false,
                Styles       = _buttonStyles
            };
            button.Click += delegate
            {
                DispatchEvent(new CloseEvent(CloseEvent.CLOSE));
            };
            ControlBarGroup.AddChild(button);

            List <string> icons = new List <string> {
                "lock", "star", "accept"
            };

            for (int i = 0; i < 3; i++)
            {
                button = new Button
                {
                    Text         = UppercaseFirst(icons[i]),
                    SkinClass    = typeof(ImageButtonSkin),
                    FocusEnabled = false,
                    Styles       = _buttonStyles,
                    Icon         = ImageLoader.Instance.Load("Icons/" + icons[i])
                };
                ControlBarGroup.AddChild(button);
            }
        }
Ejemplo n.º 7
0
        /*protected override void CreateChildren()
         * {
         *  base.CreateChildren();
         *
         *  // hbox for icon and label
         *  _contentBox = new HGroup
         *                    {
         *                        MinHeight = 60,
         *                        VerticalAlign = VerticalAlign.Middle
         *                    };
         *  AddContentChild(_contentBox); // adding hbox as CONTENT child
         *
         *  // label
         *  _lblText = new Label
         *                 {
         *                     Id = "message",
         *                     Text = string.Empty,
         *                     //Multiline = true,
         *                     //WordWrap = true,
         *                     MaxWidth = MaxLabelWidth,
         *                     MaxHeight = MaxLabelHeight,
         *                     Color = Color.black,
         *                 };
         *  _lblText.SetStyle("labelStyle", GetStyle("labelStyle"));
         *  _lblText.SetStyle("font", GetStyle("labelFont"));
         *  _contentBox.AddChild(_lblText);
         * }*/

        #endregion

        #region Lifecycle methods

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

            if (_optionsChanged)
            {
                _optionsChanged = false;
                var len = _options.Length;
                for (var i = 0; i < len; i++)
                {
                    var option = _options[i];
                    switch (option.Type)
                    {
                    case AlertOptionType.Message:
                        Message = (string)option.Value;
                        break;

                    case AlertOptionType.Title:
                        Title = (string)option.Value;
                        break;

                    case AlertOptionType.Icon:
                        Icon = (Texture)option.Value;
                        break;

                    case AlertOptionType.HeaderIcon:
                        HeaderIconDisplay.Texture = (Texture)option.Value;     // 20131206 IconDisplay
                        break;

                    case AlertOptionType.Flags:
                        ProcessFlags((AlertButtonFlag)option.Value);
                        break;

                    case AlertOptionType.Button:
                        AddButton((AlertButtonDescriptor)option.Value);
                        break;

                    case AlertOptionType.DefaultButton:
                        //Debug.Log("Applying: " + option.Value);
                        DefaultButtonId = option.Value;
                        break;

                    case AlertOptionType.SkinClass:
                        SetStyle("skinClass", option.Value);
                        break;

                    case AlertOptionType.AddedEffect:
                        SetStyle("addedEffect", option.Value);
                        break;

                    case AlertOptionType.RemovedEffect:
                        SetStyle("removedEffect", option.Value);
                        break;
                    }
                }
            }

            /*if (_iconChanged)
             * {
             *  if (null != _icon)
             *  {
             *      if (null == _imgIcon)
             *      {
             *          _imgIcon = new Image {Texture = _icon/*, AlphaBlend = false#1#};
             *          _contentBox.AddChildAt(_imgIcon, 0);
             *          //_contentBox.ValidateNow();
             *      }
             *  }
             *  else if (null != _imgIcon)
             *  {
             *      _contentBox.RemoveChild(_imgIcon);
             *      //_contentBox.ValidateNow();
             *  }
             *  _iconChanged = false;
             * }*/

            /*if (_messageChanged)
             * {
             *  _messageChanged = false;
             *  MessageDisplay.Text = _message;
             * }*/

            if (_flagsChanged)
            {
                _flagsChanged = false;
                ProcessFlags(_flags);
            }

            if (_descriptorsChanged)
            {
                _descriptorsChanged = false;

                string buttonStyleMapper = (string)GetStyle("buttonStyleMapper");

                _descriptors.ForEach(
                    delegate(AlertButtonDescriptor descriptor)
                {
                    Button btn = new Button
                    {
                        Text = descriptor.Text
                    };

                    var skinClass = EvaluateSkinClassFromStyle("buttonSkin");
                    if (null != skinClass)
                    {
                        btn.SkinClass = skinClass;
                    }

                    if (null != descriptor.Icon)
                    {
                        btn.Icon = descriptor.Icon;
                    }

                    if (!string.IsNullOrEmpty(buttonStyleMapper))
                    {
                        btn.StyleName = buttonStyleMapper;
                    }

                    if (!btn.HasStyle("buttonStyle"))
                    {
                        btn.SetStyle("buttonStyle", GetStyle("buttonStyle"));
                    }
                    if (!btn.HasStyle("buttonCursor"))
                    {
                        btn.SetStyle("cursor", GetStyle("buttonCursor"));
                    }

                    //btn.SetStyle("cursor", "pointer");
                    ControlBarGroup.AddChild(btn);

                    if (descriptor.Focused)
                    {
                        //btn.SetFocus();
                        DefaultButtonId = descriptor.Id;
                    }

                    DictId2Button.Add(descriptor.Id, btn);
                    DictButton2Id.Add(btn, descriptor.Id);
                }
                    );
                //ControlBarGroup.ValidateNow();
            }
        }
Ejemplo n.º 8
0
        override protected void CreateChildren()
        {
            base.CreateChildren();

            Form form = new Form {
                PercentWidth = 100, Left = 10, Right = 10, Top = 10, Bottom = 10
            };

            AddContentChild(form);

            #region Text Fields

            _txtFirstName = new TextField {
                PercentWidth = 100                            /*, Optimized = true*/
            };
            _txtFirstName.TextChange += delegate
            {
                // update item
                _item.FirstName = _txtFirstName.Text;
            };
            form.AddField("first_name", "First name:", _txtFirstName);

            _txtLastName = new TextField {
                PercentWidth = 100                           /*, Optimized = true*/
            };
            _txtLastName.TextChange += delegate
            {
                // update item
                _item.LastName = _txtLastName.Text;
            };
            form.AddField("last_name", "Last name:", _txtLastName);

            _nsAge = new NumericStepper {
                Width = 60, FocusEnabled = true, HighlightOnFocus = true
            };
            _nsAge.ValueCommit += delegate
            {
                // update item
                _item.Age = (int)_nsAge.Value;
            };
            form.AddField("age", "Age:", _nsAge);

            _chkDrivingLicense         = new CheckBox();
            _chkDrivingLicense.Change += delegate
            {
                // update item
                _item.DrivingLicense = _chkDrivingLicense.Selected;
            };
            form.AddField("driving_license", "Driving license:", _chkDrivingLicense);

            #endregion

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

            #region Close button

            var button = new Button
            {
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/cancel"),
                FocusEnabled = false,
                Styles       = _buttonStyles
            };
            button.Click += delegate
            {
                DispatchEvent(new CloseEvent(CloseEvent.CLOSE));
            };
            ToolGroup.AddChild(button);

            #endregion

            #region Control bar buttons

            button = new Button
            {
                Text         = "Close dialog",
                SkinClass    = typeof(ImageButtonSkin),
                Icon         = ImageLoader.Instance.Load("Icons/color_swatch"),
                FocusEnabled = false,
                Styles       = _buttonStyles
            };
            button.Click += delegate
            {
                DispatchEvent(new CloseEvent(CloseEvent.CLOSE));
            };
            ControlBarGroup.AddChild(button);

            #endregion
        }