Example #1
0
        public void Create(RadioButton controller)
        {
            var controllerHandler = controller?.Handler as RadioButtonHandler;

            Group = controllerHandler?.Group ?? new RadioGroup();

            Group.Add(this);
        }
Example #2
0
        private static View CreateToolsControls(IEnumerable <ITool> tools, TrainsDelegate controlDelegate)
        {
            var controlsGroup = new RadioGroup(Orientation.Vertical);

            foreach (ITool tool in tools)
            {
                controlsGroup.Add(new RadioButton(() => tool.Name, () => controlDelegate.CurrentTool.Value == tool, () => controlDelegate.CurrentTool.Value = tool));
            }

            return(controlsGroup);
        }
Example #3
0
        private static View CreateToolsControls(IEnumerable <ITool> tools, TrainsDelegate controlDelegate, bool buildMode)
        {
            var controlsGroup = new RadioGroup(Orientation.Vertical);

            foreach (ITool?tool in tools.Where(t => ShouldShowTool(buildMode, t)))
            {
                if (controlDelegate.CurrentTool.Value == null)
                {
                    controlDelegate.CurrentTool.Value = tool;
                }

                controlsGroup.Add(new RadioButton(() => tool.Name, () => controlDelegate.CurrentTool.Value == tool, () => controlDelegate.CurrentTool.Value = tool));
            }

            return(controlsGroup);
        }
Example #4
0
        private View CreateToolsControls(IEnumerable <ITool> tools, bool buildMode)
        {
            var controlsGroup = new RadioGroup(Orientation.Vertical);

            foreach (ITool?tool in tools.Where(t => ShouldShowTool(buildMode, t)))
            {
                if (_interactionManager.CurrentTool == null)
                {
                    _interactionManager.CurrentTool = tool;
                }

                controlsGroup.Add(new RadioButton(() => tool.Name, () => _interactionManager.CurrentTool == tool, () => _interactionManager.CurrentTool = tool));
            }

            return(controlsGroup);
        }
        void KeyDownFunction(KeyEventArgs args)
        {
            if (args.Key == Keys.Enter)
            {
                Window window = new Window(this, gui);
                window.Width  = 320;
                window.Height = 380;
                window.Close += new CloseHandler(WindowCloseFunction);

                string text = "Test Window " + windowNumber;
                window.TitleText = text;
                windowNumber++;

                ComboBox comboBox = new ComboBox(this, gui);
                comboBox.IsEditable = true;
                comboBox.ZOrder     = 1.0f;
                comboBox.X          = 20;
                comboBox.Y          = 54;

                for (int i = 0; i < 3; i++)
                {
                    comboBox.AddEntry("Test");
                }

                window.Add(comboBox);

                RadioButton radio1 = new RadioButton(this, gui);
                radio1.X    = 0;
                radio1.Y    = 0;
                radio1.Text = "Radio Test 1";

                RadioButton radio2 = new RadioButton(this, gui);
                radio2.X    = 0;
                radio2.Y    = 16;
                radio2.Text = "Radio Test 2";

                RadioButton radio3 = new RadioButton(this, gui);
                radio3.X    = 0;
                radio3.Y    = 32;
                radio3.Text = "Radio Test 3";

                RadioGroup group = new RadioGroup(this, gui);
                group.X      = 20;
                group.Y      = 89;
                group.Width  = 200;
                group.Height = 48;
                group.ZOrder = 1.0f;
                group.Add(radio1);
                group.Add(radio2);
                group.Add(radio3);

                window.Add(group);

                ListBox listBox = new ListBox(this, gui);
                listBox.X      = 20;
                listBox.Y      = 144;
                listBox.ZOrder = 1.0f;

                for (int i = 0; i < 15; i++)
                {
                    listBox.AddEntry("List Box Test " + (i + 1));
                }

                window.Add(listBox);

                MenuBar    menuBar = new MenuBar(this, gui);
                MenuButton item1   = new MenuButton(this, gui);
                item1.Text = "File";
                menuBar.Add(item1);
                MenuButton item2 = new MenuButton(this, gui);
                item2.Text      = "Edit";
                item2.IsEnabled = false;
                item2.IsEnabled = true;
                menuBar.Add(item2);

                MenuButton fileItem1 = new MenuButton(this, gui);
                fileItem1.Text       = "New";
                fileItem1.IconSource = new Rectangle(1, 189, 14, 14);
                fileItem1.IsEnabled  = false;
                item1.Add(fileItem1);
                MenuSeparator fileItem2 = new MenuSeparator(this, gui);
                item1.Add(fileItem2);
                MenuButton fileItem3 = new MenuButton(this, gui);
                fileItem3.Text       = "Close";
                fileItem3.IconSource = new Rectangle(16, 189, 15, 13);
                item1.Add(fileItem3);

                MenuButton item4 = new MenuButton(this, gui);
                item4.Text      = "Community";
                item4.IsEnabled = true;
                item2.Add(item4);
                MenuSeparator sep2 = new MenuSeparator(this, gui);
                item2.Add(sep2);
                MenuButton item5 = new MenuButton(this, gui);
                item5.Text = "Next Test";
                item4.Add(item5);
                MenuButton item6 = new MenuButton(this, gui);
                item6.Text            = "The Next Level!";
                item6.ShowMarginImage = false;
                item2.Add(item6);
                MenuButton item7 = new MenuButton(this, gui);
                item7.Text = "Booyeah ;-)";
                item6.Add(item7);
                window.Add(menuBar);

                gui.Add(window);

                MessageBox dialog = new MessageBox(this, gui, "Message box asking user a question.", "Message Box", MessageBoxButtons.Yes_No_Cancel, MessageBoxType.Question);
                dialog.Show(false);

                if (before == 1)
                {
                    gui.ApplySkin(skin, true, true);
                }

                before++;
            }
            else if (args.Key == Keys.A)
            {
                SkinnedComponent skin = new SkinnedComponent(this, gui);
            }
        }