Exemplo n.º 1
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());
        }
Exemplo n.º 2
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
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        protected override void CreateChildren()
        {
            base.CreateChildren();

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

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

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

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

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

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

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

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

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

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

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