Exemple #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);
            }
        }
        /// <summary>
        /// Create children
        /// Use AddChild inside this method exclusively
        /// </summary>
        override protected void CreateChildren()
        {
            base.CreateChildren();

            _textField = new TextField {PercentWidth = 100, ProcessKeys = true, StyleName = "examplecontrol_textfield"};
            AddChild(_textField);

            _button = new Button { Text = "Click me", MinWidth = 150, StyleName = "examplecontrol_button" };
            AddChild(_button);
        }
        // ReSharper restore MemberCanBePrivate.Global
#pragma warning restore 1591

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

            // Create the down-arrow button, layered above the track.
            if (null == IncrementButton)
            {
                IncrementButton = new Button
                                      {
                                          Id = "increment",
                                          SkinClass = typeof(NumericStepperButtonSkin),
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          Right = 0,
                                          Top = 0,
                                          Width = 40,
                                          PercentHeight = 50,
                                          Icon = (Texture2D)Resources.Load("eDriven/Editor/Icons/arrow-090")
                                      };
                AddChild(IncrementButton);
            }

            // Create the up-arrow button, layered above the track.
            if (null == DecrementButton)
            {
                DecrementButton = new Button
                                      {
                                          Id = "decrement",
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          SkinClass = typeof(NumericStepperButtonSkin),
                                          Right = 0,
                                          Bottom = 0,
                                          Width = 40,
                                          PercentHeight = 50,
                                          Icon = (Texture2D)Resources.Load("eDriven/Editor/Icons/arrow-270")
                                      };
                AddChild(DecrementButton);
            }

            if (null == TextDisplay)
            {
                TextDisplay = new TextField
                                  {
                                      Id = "textDisplay",
                                      Left = 0,
                                      Top = 0,
                                      Bottom = 0,
                                      Right = 40,
                                      MinWidth = 30
                                  };
                TextDisplay.SetStyle("textFieldStyle", NumericStepperTextFieldStyle.Instance);
                AddChild(TextDisplay);
            }
        }
        // ReSharper restore MemberCanBePrivate.Global
#pragma warning restore 1591
        
        protected override void CreateChildren()
        {
            base.CreateChildren();

            // Create the down-arrow button, layered above the track.
            if (null == IncrementButton)
            {
                IncrementButton = new Button
                                      {
                                          Id = "increment",
                                          SkinClass = typeof(NumericStepperIncrementButtonSkin),
                                          /*Enabled = false, */
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          Right = 0,
                                          Top = 0,
                                          Width = 18,
                                          PercentHeight = 50
                                      };
                AddChild(IncrementButton);
            }

            // Create the up-arrow button, layered above the track.
            if (null == DecrementButton)
            {
                DecrementButton = new Button
                                  {
                                      Id = "decrement",
                                      /*Enabled = false, */
                                      AutoRepeat = true,
                                      FocusEnabled = false,
                                      SkinClass = typeof(NumericStepperDecrementButtonSkin),
                                      Right = 0,
                                      Bottom = 0,
                                      Width = 18,
                                      PercentHeight = 50
                                  };
                AddChild(DecrementButton);
            }

            if (null == TextDisplay)
            {
                TextDisplay = new TextField
                {
                    Id = "textDisplay",
                    Left = 0,
                    Top = 0,
                    Bottom = 0,
                    Right = 17,
                    MinWidth = 30
                };
                //TextDisplay.SetStyle("textFieldStyle", NumericStepperTextFieldStyle.Instance);
                AddChild(TextDisplay);
            }
        }
Exemple #5
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            // Create the scroll track.
            if (null == Track)
            {
                Track = new Button
                            {
                                Id = "track",
                                SkinClass = typeof(HSliderTrackSkin),
                                FocusEnabled = false,
                                //MinHeight = 30,
                                Top = 0,
                                Bottom = 0,
                                Left = 0,
                                Right = 0,
                                VerticalCenter = 0,
                                //CurrentState = "disabled"
                            };
                AddChild(Track);
            }

            _cover = new Button
            {
                SkinClass = typeof(HSliderButtonSkin),
                FocusEnabled = false,
                MouseEnabled = false,
                //MinHeight = 30,
                Top = 0,
                Bottom = 0,
                Left = 0,
                VerticalCenter = 0
            };
            AddChild(_cover);

            if (null == Thumb)
            {
                Thumb = new Button
                            {
                                Id = "thumb",
                                SkinClass = typeof(HSliderButtonSkin),
                                //MinHeight = 30,
                                Top = 0,
                                Bottom = 0,
                                MinWidth = 20,
                                FocusEnabled = false,
                                //ResizeWithStyleBackground = true,
                                VerticalCenter = 0
                            };
                Thumb.AddEventListener(FrameworkEvent.X_CHANGED, OnThumbPositionChanged);
                AddChild(Thumb);
            }
        }
Exemple #6
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            // Create the scroll track.
            if (null == Track)
            {
                Track = new Button
                            {
                                Id = "track",
                                SkinClass = typeof(VSliderTrackSkin),
                                FocusEnabled = false,
                                //MinWidth = 48,
                                Left = 0,
                                Right = 0,
                                Top = 0,
                                Bottom = 0,
                                HorizontalCenter = 0
                            };
                AddChild(Track);
            }

            _cover = new Button
            {
                SkinClass = typeof(VSliderButtonSkin),
                FocusEnabled = false,
                MouseEnabled = false,
                //MinWidth = 50,
                Left = 0,
                Right = 0,
                Bottom = 0,
                HorizontalCenter = 0
            };
            AddChild(_cover);

            if (null == Thumb)
            {
                Thumb = new Button
                            {
                                Id = "thumb",
                                SkinClass = typeof(VSliderButtonSkin),
                                //MinWidth = 50,
                                Left = 0,
                                Right = 0,
                                MinHeight = 30,
                                FocusEnabled = false,
                                HorizontalCenter = 0
                            };
                Thumb.AddEventListener(FrameworkEvent.Y_CHANGED, OnThumbPositionChanged);
                AddChild(Thumb);
            }
        }
Exemple #7
0
        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);
        }
        public ResolutionDialog()
        {
            Title = "Resolution";
            //Padding = 10;
            Width = 400;

            CloseOnEsc = true;
            //Resizable = true;
            //ScrollContent = true;
            //Layout = new AbsoluteLayoutOld();
            //MarginLeft = 10; // TODO

            var btnClose = new Button
                               {
                                   Icon = (Texture)Resources.Load("Icons/close_16"), 
                                   Width = 20, 
                                   Height = 20
                               };
            btnClose.Click += delegate { PopupManager.Instance.RemovePopup(this); };

            //ToolGroup.AddChild(btnClose);
        }
Exemple #9
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            // Create the scroll track.
            if (null == Track)
            {
                Track = new Button
                            {
                                Id = "track",
                                SkinClass = typeof(VSliderTrackSkin),
                                Left = 0,
                                Right = 0,
                                Top = 0,
                                Bottom = 0,
                                Height = 100
                            };

                AddChild(Track);
            }

            if (null == Thumb)
            {
                Thumb = new Button
                            {
                                Id = "thumb",
                                SkinClass = typeof(VSliderThumbSkin),
                                Left = 0,
                                Right = 0,
                                Width = 11,
                                Height = 11
                            };

                AddChild(Thumb);
            }
        }
Exemple #10
0
        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);
        }
        protected override void CreateChildren()
        {
            base.CreateChildren();

            // Create the scroll track.
            if (null == Track)
            {
                Track = new Button
                            {
                                Id = "track",
                                SkinClass = typeof(VScrollBarButtonSkin), // typeof(VScrollBarTrackSkin),
                                FocusEnabled = false,
                                //ResizeWithStyleBackground = true,
                                MinWidth = 30,
                                Top = 29,
                                Bottom = 29,
                                HorizontalCenter = 0
                            };
                AddChild(Track);
            }

            if (null == Thumb)
            {
                Thumb = new Button
                            {
                                Id = "thumb",
                                SkinClass = typeof(VScrollBarButtonSkin),
                                MinWidth = 30,
                                MinHeight = 10,
                                FocusEnabled = false,
                                //ResizeWithStyleBackground = true,
                                HorizontalCenter = 0
                            };
                AddChild(Thumb);
            }

            // Create the down-arrow button, layered above the track.
            if (null == DecrementButton)
            {
                //Debug.Log("Image: " + Resources.Load("eDriven/Editor/Icons/no"));
                DecrementButton = new Button
                                      {
                                          Id = "decrement",
                                          SkinClass = typeof(VScrollBarButtonSkin), // typeof(VScrollBarUpButtonSkin),
                                          MinWidth = 30,
                                          MinHeight = 30,
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          //ResizeWithStyleBackground = true,
                                          HorizontalCenter = 0,
                                          Top = 0,
                                          Icon = (Texture2D)Resources.Load("eDriven/Editor/Icons/arrow-090")
                                      };
                AddChild(DecrementButton);
            }

            // Create the up-arrow button, layered above the track.
            if (null == IncrementButton)
            {
                IncrementButton = new Button
                                      {
                                          Id = "increment",
                                          SkinClass = typeof(VScrollBarButtonSkin),
                                          MinWidth = 30,
                                          MinHeight = 30,
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          //ResizeWithStyleBackground = true,
                                          HorizontalCenter = 0,
                                          Bottom = 0,
                                          Icon = (Texture2D)Resources.Load("eDriven/Editor/Icons/arrow-270")
                                      };
                AddChild(IncrementButton);
            }
        }
        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);
        }
        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);
            }
        }
Exemple #14
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();
            }
        }
Exemple #15
0
 public void AddButton(string text)
 {
     var button = new Button
     {
         Text = text,
         SkinClass = typeof(ImageButtonSkin),
         FocusEnabled = false,
         Icon = ImageLoader.Instance.Load("Icons/shape_square_add"),
         Width = 400,
         Height = 200
     };
     AddContentChild(button);
 }
Exemple #16
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);
            }
        }
Exemple #17
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            // Create the scroll track.
            if (null == Track)
            {
                Track = new Button
                            {
                                Id = "track",
                                SkinClass = typeof(HScrollBarTrackSkin),
                                FocusEnabled = false,
                                //ResizeWithStyleBackground = true,
                                Left = 29,
                                Right = 29,
                                VerticalCenter = 0
                            };

                AddChild(Track);
            }

            if (null == Thumb)
            {
                Thumb = new Button
                            {
                                Id = "thumb",
                                SkinClass = typeof(HScrollBarThumbSkin),
                                //Width = 100,
                                FocusEnabled = false,
                                //ResizeWithStyleBackground = true,
                                VerticalCenter = 0
                            };

                AddChild(Thumb);
            }

            // Create the down-arrow button, layered above the track.
            if (null == DecrementButton)
            {
                DecrementButton = new Button
                                      {
                                          Id = "decrement",
                                          SkinClass = typeof(HScrollBarLeftButtonSkin),
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          VerticalCenter = 0,
                                          Left = 0
                                      };

                AddChild(DecrementButton);
            }

            // Create the up-arrow button, layered above the track.
            if (null == IncrementButton)
            {
                IncrementButton = new Button
                                      {
                                          Id = "increment",
                                          SkinClass = typeof(HScrollBarRightButtonSkin),
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          VerticalCenter = 0,
                                          Right = 0
                                      };

                AddChild(IncrementButton);
            }
        }
Exemple #18
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            // Create the scroll track.
            if (null == Track)
            {
                Track = new Button
                            {
                                Id = "track",
                                SkinClass = typeof(VScrollBarTrackSkin),
                                FocusEnabled = false,
                                Top = 29,
                                Bottom = 29,
                                HorizontalCenter = 0
                            };
                AddChild(Track);
            }

            if (null == Thumb)
            {
                Thumb = new Button
                            {
                                Id = "thumb",
                                SkinClass = typeof(VScrollBarThumbSkin),
                                FocusEnabled = false,
                                HorizontalCenter = 0
                            };
                AddChild(Thumb);
            }

            // Create the down-arrow button, layered above the track.
            if (null == DecrementButton)
            {
                DecrementButton = new Button
                                      {
                                          Id = "decrement",
                                          SkinClass = typeof(VScrollBarUpButtonSkin),
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          HorizontalCenter = 0,
                                          Top = 0
                                      };
                AddChild(DecrementButton);
            }

            // Create the up-arrow button, layered above the track.
            if (null == IncrementButton)
            {
                IncrementButton = new Button
                                      {
                                          Id = "increment",
                                          SkinClass = typeof(VScrollBarDownButtonSkin),
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          HorizontalCenter = 0,
                                          Bottom = 0
                                      };
                AddChild(IncrementButton);
            }
        }
Exemple #19
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

        }
Exemple #20
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);
            }
        }
        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
        }
Exemple #22
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            #region Dec

            _btnDec = new Button
                          {
                              Text = "<",
                              FocusEnabled = FocusEnabled,
                              ResizeWithContent = true,
                              ResizeWithStyleBackground = true,
                              Styles = _buttonStyles,
                              //Padding = 0
                          };

            _btnDec.SetStyle("paddingLeft", 0);
            _btnDec.SetStyle("paddingRight", 0);
            _btnDec.SetStyle("paddingTop", 0);
            _btnDec.SetStyle("paddingBottom", 0);

            _btnDec.SetStyle("buttonStyle", GetStyle("decButtonStyle"));
            _btnDec.Press += delegate { Browse(-1); };
            AddChild(_btnDec);

            #endregion

            _placeholder = new Group
                               {
                                   Layout = new HorizontalLayout { Gap = 2, VerticalAlign = VerticalAlign.Middle }
                               };
            _placeholder.AddEventListener(ButtonEvent.PRESS, delegate(Event e)
                                                            {
                                                                if (e.Target is Button)
                                                                {
                                                                    CurrentPageIndex = _placeholder.GetChildIndex((DisplayListMember) e.Target);
                                                                }
                                                            });
            AddChild(_placeholder);

            for (int i = 0; i < MaxButtons; i++)
            {
                _placeholder.AddChild(CreateButton(i));
            }

            //CreateButton(0);

            #region Text Field - old

//            _txtPage = new TextField
//                           {
//                               FocusEnabled = true,
//                               Width = 35,
//                               Text = (CurrentPage + 1).ToString(),
//                               //Styles = buttonStyles
//                           };
//            _txtPage.Change += delegate
//                                   {
//                                       Debug.Log("_txtPage.Text: " + _txtPage.Text);
//                                       int i = CurrentPage;
//                                       try {
//                                           i = Convert.ToInt32(_txtPage.Text);
//                                       }
//// ReSharper disable EmptyGeneralCatchClause
//                                       catch { /* silent fail */ }
//// ReSharper restore EmptyGeneralCatchClause

//                                       Debug.Log("i: " + i);
//                                       CurrentPage = Mathf.Clamp(i, 0, TotalPages);
//                                       Debug.Log("Change: " + CurrentPage);
//                                       _txtPage.Text = CurrentPage.ToString();
//                                   };
//            AddChild(_txtPage);

            #endregion

            #region Inc

            _btnInc = new Button
                          {
                              Text = ">",
                              FocusEnabled = FocusEnabled,
                              ResizeWithContent = true,
                              ResizeWithStyleBackground = true,
                              Styles = _buttonStyles,
                              //Padding = 0
                          };

            _btnInc.SetStyle("paddingLeft", 0);
            _btnInc.SetStyle("paddingRight", 0);
            _btnInc.SetStyle("paddingTop", 0);
            _btnInc.SetStyle("paddingBottom", 0);

            _btnInc.SetStyle("buttonStyle", GetStyle("incButtonStyle"));
            _btnInc.Press += delegate { Browse(1); };
            AddChild(_btnInc);

            #endregion
        }
Exemple #23
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
        }
        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());
        }
Exemple #25
0
        override protected void CreateChildren()
        {
            base.CreateChildren();

            #region Controls

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

            #region Text field

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

            };
            toolbar.AddContentChild(_txtSearch);

            #endregion

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

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

            #endregion

            #region Lower group

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

            #endregion

            #region Title label

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

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

            #endregion
            
            #region Scroller / viewport

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

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

            #endregion

            #region Data controls

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

            _dataProvider = new ArrayList(source);

            /* LISTS */

            #region HGroup

            #endregion

            #region List

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

            #endregion

            #endregion

            // bubbling event listener
            AddEventListener("showImage", ShowImageHandler);
        }
Exemple #26
0
        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
        }
Exemple #27
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

            _chkInspect = new CheckBox
                              {
                                  Text = "Inspector",
                                  StyleName = "checkbox",
                                  Right = 10,
                                  Top = 10,
                                  //Padding = 0,
                                  ResizeWithContent = true,
                                  ToggleMode = true,
                                  FocusEnabled = false, // true
                                  Selected = OptionsModel.Instance.InspectorActive
                              };
            _chkInspect.Click += delegate
                                     {
                                         OptionsModel.Instance.InspectorActive = _chkInspect.Selected;
                                     };
            AddContentChild(_chkInspect);

            _chkDetails = new CheckBox
                              {
                                  Text = "Details",
                                  StyleName = "checkbox",
                                  Right = 10,
                                  Top = 10,
                                  //Padding = 0,
                                  ResizeWithContent = true,
                                  ToggleMode = true,
                                  FocusEnabled = false,
                                  //Selected = OptionsModel.Instance.DetailsActive
                              };
            _chkDetails.Change += new EventHandler(delegate
                                      {
                                          //OptionsModel.Instance.DetailsActive = _chkDetails.Selected;
                                      });
            AddContentChild(_chkDetails);

            _chkRunInBackground = new CheckBox
                                      {
                                          Text = "Run in the background",
                                          StyleName = "checkbox",
                                          Right = 10,
                                          Top = 10,
                                          //Padding = 0,
                                          ResizeWithContent = true,
                                          ToggleMode = true,
                                          FocusEnabled = false,
                                          Selected = OptionsModel.Instance.RunInBackground
                                      };
            _chkRunInBackground.Change += delegate
                                              {
                                                  //Application.runInBackground = _chkRunInBackground.Selected;
                                                  OptionsModel.Instance.RunInBackground = _chkRunInBackground.Selected;
                                                  Logger.Log("Application.runInBackground changed to: " + OptionsModel.Instance.RunInBackground);
                                              };
            AddContentChild(_chkRunInBackground);

            AddChild(new Label {Text = "Volume: ", StyleName = "checkbox"});

            _sliderVolume = new HSlider
                                {
                                    Value = OptionsModel.Instance.Volume,
                                    Minimum = 0,
                                    Maximum = 1, 
                                    PercentWidth = 100, 
                                    Tooltip = "Volume",
                                    StyleName = "slider_volume"
                                };
            _sliderVolume.Change += new EventHandler(delegate //(Core.Events.Event e)
                                        {
                                            //ValueChangedEvent vce = (ValueChangedEvent) e;
                                            var tt = Math.Round(_sliderVolume.Value * 100) + " %";
                                            _sliderVolume.Tooltip = tt; 
                                            TooltipManagerStage.Instance.UpdateTooltip(tt);
                                            OptionsModel.Instance.Volume = _sliderVolume.Value;
                                        });
            AddChild(_sliderVolume);

            Button button = new Button
                                {
                                    Text = "Set resolution",
                                    FocusEnabled = false
                                };
            button.Click += delegate
                                {
                                    ResolutionDialog dialog = new ResolutionDialog();
                                    PopupManager.Instance.AddPopup(dialog);
                                };
            AddChild(button);
        }
        protected override void CreateChildren()
        {
            base.CreateChildren();

            #region Popup anchor

            _anchor = new PopUpAnchor
            {
                Id = "pop_up",
                Left = 0,
                Right = 0,
                Top = 0,
                Bottom = 0,
                PopupPosition = PopupPosition.Below,
                PopupWidthMatchesAnchorWidth = true
            };
            AddChild(_anchor);

            #endregion

            #region DropDown

            DropDown = new Group
            {
                Id = "drop_down",
                MaxHeight = 134, MinHeight = 22,
                Width = 150
            };
            //AddChild(DropDown);
            _anchor.Popup = DropDown;

            #endregion

            #region Background

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

            #endregion

            #region Scroller

            _scroller = new Scroller
            {
                Id = "scroller",
                SkinClass = EvaluateSkinClassFromStyle("scrollerSkin"),
                Left = 0,
                Right = 0,
                Top = 0,
                Bottom = 0,
                MinViewportInset = 1,
                HasFocusableChildren = false,
                Height = 100
            };
            DropDown.AddChild(_scroller);

            #endregion
            
            #region Data group

            DataGroup = new DataGroup
            {
                Id = "data_group",
                ItemRenderer = new ItemRendererFactory<DefaultItemRenderer>(),
                Layout = new VerticalLayout
                {
                    Gap = 0,
                    HorizontalAlign = HorizontalAlign.ContentJustify,
                    RequestedMinRowCount = 5
                }
            };
            _scroller.Viewport = DataGroup;

            #endregion

            #region Border

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

            #endregion

            #region OpenButton

            OpenButton = new Button
            {
                Left = 0,
                Right = 0,
                Top = 0,
                Bottom = 0,
                FocusEnabled = false,
                SkinClass = typeof(DropDownListButtonSkin)
            };
            AddChild(OpenButton);

            #endregion
            
            #region Label

            LabelDisplay = new Label
            {
                VerticalCenter = 0,
                Left = 7,
                Right = 32,
                Top = 2,
                Bottom = 2,
                Width = 75,
                MouseEnabled = false,
                Color = Color.black
            };
            //LabelDisplay.SetStyle("color", GetStyle("textColor"));
            AddChild(LabelDisplay);

            #endregion
        }
        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);
            }
        }
        protected override void CreateChildren()
        {
            base.CreateChildren();

            // Create the scroll track.
            if (null == Track)
            {
                Track = new Button
                            {
                                Id = "track",
                                SkinClass = typeof(HScrollBarTrackSkin),
                                FocusEnabled = false,
                                MinHeight = 50,
                                Left = 49,
                                Right = 49,
                                VerticalCenter = 0
                            };
                AddChild(Track);
            }

            if (null == Thumb)
            {
                Thumb = new Button
                            {
                                Id = "thumb",
                                SkinClass = typeof(HScrollBarButtonSkin),
                                MinHeight = 50,
                                MinWidth = 10,
                                FocusEnabled = false,
                                VerticalCenter = 0
                            };
                AddChild(Thumb);
            }

            // Create the down-arrow button, layered above the track.
            if (null == DecrementButton)
            {
                //Debug.Log("Image: " + Resources.Load("eDriven/Editor/Icons/no"));
                DecrementButton = new Button
                                      {
                                          Id = "decrement",
                                          SkinClass = typeof(HScrollBarButtonSkin), // typeof(VScrollBarUpButtonSkin),
                                          MinWidth = 50,
                                          MinHeight = 50,
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          VerticalCenter = 0,
                                          Left = 0,
                                          Icon = (Texture2D)Resources.Load("eDriven/Editor/Icons/arrow-180")
                                      };
                AddChild(DecrementButton);
            }

            // Create the up-arrow button, layered above the track.
            if (null == IncrementButton)
            {
                IncrementButton = new Button
                                      {
                                          Id = "increment",
                                          SkinClass = typeof(HScrollBarButtonSkin),
                                          MinWidth = 50,
                                          MinHeight = 50,
                                          AutoRepeat = true,
                                          FocusEnabled = false,
                                          VerticalCenter = 0,
                                          Right = 0,
                                          Icon = (Texture2D)Resources.Load("eDriven/Editor/Icons/arrow")
                                      };
                AddChild(IncrementButton);
            }
        }
        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);
            }
        }