Ejemplo n.º 1
0
        void DockChanged(Base control)
        {
            Base             inner = (Base)control.UserData;
            RadioButtonGroup rbg   = (RadioButtonGroup)control;
            Base             gb    = inner.UserData as Base;

            Alt.GUI.Temporary.Gwen.Control.Slider w = gb.FindChildByName("Width", true) as Slider;
            Alt.GUI.Temporary.Gwen.Control.Slider h = gb.FindChildByName("Height", true) as Slider;

            switch (rbg.SelectedIndex)
            {
            case 0:
                inner.Dock = Alt.GUI.Temporary.Gwen.Pos.Left;
                break;

            case 1:
                inner.Dock = Alt.GUI.Temporary.Gwen.Pos.Top;
                break;

            case 2:
                inner.Dock = Alt.GUI.Temporary.Gwen.Pos.Right;
                break;

            case 3:
                inner.Dock = Alt.GUI.Temporary.Gwen.Pos.Bottom;
                break;

            case 4:
                inner.Dock = Alt.GUI.Temporary.Gwen.Pos.Fill;
                break;
            }
            inner.SetSize((int)w.Value, (int)h.Value);
            //inner.Invalidate();
            outer.Invalidate();
        }
Ejemplo n.º 2
0
        public RadioButtonTest(ControlBase parent)
            : base(parent)
        {
            VerticalLayout layout = new VerticalLayout(this);

            GroupBox group = new GroupBox(layout);

            group.Margin = Margin.Five;
            group.Text   = "Sample radio group";
            {
                RadioButtonGroup rbg = new RadioButtonGroup(group);

                rbg.AddOption("Option 1");
                rbg.AddOption("Option 2");
                rbg.AddOption("Option 3");
                rbg.AddOption("\u0627\u0644\u0622\u0646 \u0644\u062D\u0636\u0648\u0631");

                rbg.SelectionChanged += OnChange;
            }

            {
                EnumRadioButtonGroup <Choices> erbg = new EnumRadioButtonGroup <Choices>(layout);
                erbg.Margin        = Margin.Five;
                erbg.SelectedValue = Choices.HallC;
            }
        }
 public ActivityUi(UiBuilder uiBuilder)
 {
     FeedTextSource  = uiBuilder.CreateSpecificOrUpstreamValueChooser("Chatter Message", nameof(FeedTextSource), requestUpstream: true, availability: AvailabilityType.RunTime);
     ChatterSelector = new DropDownList
     {
         Name     = nameof(ChatterSelector),
         Label    = "Get which object?",
         Required = true,
         Events   = new List <ControlEvent> {
             ControlEvent.RequestConfig
         }
     };
     ChatterFilter = new QueryBuilder
     {
         Name     = nameof(ChatterFilter),
         Label    = "Meeting which conditions?",
         Required = true,
         Source   = new FieldSourceDTO
         {
             Label        = QueryFilterCrateLabel,
             ManifestType = CrateManifestTypes.StandardDesignTimeFields
         }
     };
     QueryForChatterOption = new RadioButtonOption
     {
         Name     = nameof(QueryForChatterOption),
         Value    = "Query for chatter objects",
         Controls = new List <ControlDefinitionDTO> {
             ChatterSelector, ChatterFilter
         }
     };
     IncomingChatterIdSelector = new UpstreamFieldChooser
     {
         Name   = nameof(IncomingChatterIdSelector),
         Source = new FieldSourceDTO
         {
             AvailabilityType = AvailabilityType.RunTime,
             ManifestType     = CrateManifestTypes.StandardDesignTimeFields
         }
     };
     UseIncomingChatterIdOption = new RadioButtonOption
     {
         Name     = nameof(UseIncomingChatterIdOption),
         Value    = "Use this incoming value as chatter Id",
         Controls = new List <ControlDefinitionDTO> {
             IncomingChatterIdSelector
         }
     };
     ChatterSelectionGroup = new RadioButtonGroup
     {
         Name      = nameof(ChatterSelectionGroup),
         GroupName = nameof(ChatterSelectionGroup),
         Label     = "Which chatter to post to?",
         Radios    = new List <RadioButtonOption> {
             QueryForChatterOption, UseIncomingChatterIdOption
         }
     };
     Controls.Add(FeedTextSource);
     Controls.Add(ChatterSelectionGroup);
 }
Ejemplo n.º 4
0
        void DockChanged(ControlBase control, EventArgs args)
        {
            ControlBase      inner = (ControlBase)control.UserData;
            RadioButtonGroup rbg   = (RadioButtonGroup)control;
            ControlBase      gb    = inner.UserData as ControlBase;
            int w = (int)(gb.FindChildByName("Width", true) as Net.Control.Internal.Slider).Value;
            int h = (int)(gb.FindChildByName("Height", true) as Net.Control.Internal.Slider).Value;

            inner.Dock = (Dock)rbg.Selected.UserData;

            switch (inner.Dock)
            {
            case Dock.Left:
                inner.Size = new Size(w, Util.Ignore);
                break;

            case Dock.Top:
                inner.Size = new Size(Util.Ignore, h);
                break;

            case Dock.Right:
                inner.Size = new Size(w, Util.Ignore);
                break;

            case Dock.Bottom:
                inner.Size = new Size(Util.Ignore, h);
                break;

            case Dock.Fill:
                inner.Size = new Size(Util.Ignore, Util.Ignore);
                break;
            }
        }
Ejemplo n.º 5
0
        private void InitializeViewElements()
        {
            DialogManager  = new DialogManager("NUnit Project Editor");
            MessageDisplay = new MessageDisplay("NUnit Project Editor");

            BrowseProjectBaseCommand  = new ButtonElement(projectBaseBrowseButton);
            EditConfigsCommand        = new ButtonElement(editConfigsButton);
            BrowseConfigBaseCommand   = new ButtonElement(configBaseBrowseButton);
            AddAssemblyCommand        = new ButtonElement(addAssemblyButton);
            RemoveAssemblyCommand     = new ButtonElement(removeAssemblyButton);
            MoveUpAssemblyCommand     = new ButtonElement(upAssemblyButton);
            MoveDownAssemblyCommand   = new ButtonElement(downAssemblyButton);
            BrowseAssemblyPathCommand = new ButtonElement(assemblyPathBrowseButton);

            ProjectPath      = new TextElement(projectPathLabel);
            ProjectBase      = new TextElement(projectBaseTextBox);
            ProcessModel     = new ComboBoxElement(processModelComboBox);
            DomainUsage      = new ComboBoxElement(domainUsageComboBox);
            Runtime          = new ComboBoxElement(runtimeComboBox);
            RuntimeVersion   = new ComboBoxElement(runtimeVersionComboBox);
            ActiveConfigName = new TextElement(activeConfigLabel);

            ConfigList = new ComboBoxElement(configComboBox);

            ApplicationBase   = new TextElement(applicationBaseTextBox);
            ConfigurationFile = new TextElement(configFileTextBox);
            BinPathType       = new RadioButtonGroup("BinPathType", autoBinPathRadioButton, manualBinPathRadioButton, noBinPathRadioButton);
            PrivateBinPath    = new TextElement(privateBinPathTextBox);
            AssemblyPath      = new TextElement(assemblyPathTextBox);
            AssemblyList      = new ListBoxElement(assemblyListBox);
        }
        public CollectionViewTest1()
        {
            InitializeComponent();
            BindingContext = new TestSourceModel();
            var RadioGroup = new RadioButtonGroup();

            RadioGroup.Add(ShowBar);
            RadioGroup.Add(HideBar);

            ColView.ItemTemplate = new DataTemplate(() =>
            {
                var item = new RecyclerViewItem()
                {
                    HeightSpecification = LayoutParamPolicies.MatchParent,
                    WidthSpecification  = 200,
                };
                item.SetBinding(View.BackgroundColorProperty, "BgColor");
                var label = new TextLabel()
                {
                    ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                    PivotPoint             = Tizen.NUI.PivotPoint.Center,
                    PositionUsesPivotPoint = true,
                };
                label.PixelSize = 30;
                label.SetBinding(TextLabel.TextProperty, "Index");
                item.Add(label);

                return(item);
            });
        }
Ejemplo n.º 7
0
        internal override void Apply(VisualElement container)
        {
            /// <sample>
            // You can provide the list of choices by code, or by comma separated values in UXML
            // <DropdownField .... choices="Option 1,Option 2,Option 3" .... />
            var choices = new List <string> {
                "Option 1", "Option 2", "Option 3"
            };

            // Get a reference to the radio button group field from UXML and assign it its value.
            var uxmlField = container.Q <RadioButtonGroup>("the-uxml-field");

            uxmlField.choices = choices;
            uxmlField.value   = 0;

            // Create a new field, disable it, and give it a style class.
            var csharpField = new RadioButtonGroup("C# Field", choices);

            csharpField.value = 0;
            csharpField.SetEnabled(false);
            csharpField.AddToClassList("some-styled-field");
            csharpField.value = uxmlField.value;
            container.Add(csharpField);

            // Mirror value of uxml field into the C# field.
            uxmlField.RegisterCallback <ChangeEvent <int> >((evt) =>
            {
                csharpField.value = evt.newValue;
            });
            /// </sample>
        }
Ejemplo n.º 8
0
        public void RadioButtonGroupGetItem()
        {
            tlog.Debug(tag, $"RadioButtonGroupGetItem START");

            var testingTarget = new RadioButtonGroup();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <RadioButtonGroup>(testingTarget, "Should return RadioButtonGroup instance.");

            RadioButton button = new RadioButton();

            testingTarget.Add(button);
            var result = testingTarget.GetItem(0);

            tlog.Debug(tag, "GetItem : " + result);

            button.IsSelected = true;
            tlog.Debug(tag, "GetSelectedItem : " + testingTarget.GetSelectedItem());

            try
            {
                testingTarget.Remove(button);
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            button.Dispose();
            tlog.Debug(tag, $"RadioButtonGroupGetItem END (OK)");
        }
Ejemplo n.º 9
0
        protected WallType GetNewWallType(Autodesk.Revit.UI.UIApplication app)
        {
            RibbonPanel      myPanel = app.GetRibbonPanels()[0];
            RadioButtonGroup radioGroupTypeSelector =
                GetRibbonItemByName(myPanel, "WallTypeSelector") as RadioButtonGroup;

            if (null == radioGroupTypeSelector)
            {
                throw new InvalidCastException("Cannot get Wall Type selector!");
            }
            String   wallTypeName = radioGroupTypeSelector.Current.ItemText;
            WallType newWallType  = null;
            FilteredElementCollector collector = new FilteredElementCollector(app.ActiveUIDocument.Document);
            ICollection <Element>    founds    = collector.OfClass(typeof(WallType)).ToElements();

            foreach (Element elem in founds)
            {
                WallType wallType = elem as WallType;
                if (wallType.Name.StartsWith(wallTypeName))
                {
                    newWallType = wallType; break;
                }
            }

            return(newWallType);
        }
Ejemplo n.º 10
0
        void OnChange(ControlBase control, EventArgs args)
        {
            RadioButtonGroup   rbc = control as RadioButtonGroup;
            LabeledRadioButton rb  = rbc.Selected;

            UnitPrint(String.Format("RadioButton: SelectionChanged: {0}", rb.Text));
        }
Ejemplo n.º 11
0
        public Result OnStartup(UIControlledApplication application)
        {
            PublicVariables.UpperValue = 10000;
            PublicVariables.LowerValue = 0;
            application.CreateRibbonTab("Updater Tool");
            string appData       = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string dllPath       = Path.Combine(appData, @"Autodesk\REVIT\Addins\2020\UpdaterTool.dll");
            string appFolderPath = Path.Combine(appData, @"Autodesk\REVIT\Addins\2020");

            RibbonPanel ribbonPanel = application.CreateRibbonPanel("Updater Tool", "Updater");

            TextBoxData textBoxData1 = new TextBoxData("textBox1");
            TextBox     textBox1     = ribbonPanel.AddItem(textBoxData1) as TextBox;

            textBox1.PromptText    = "Enter a Reference Value";
            textBox1.EnterPressed += TextBoxEnterClicked;
            ribbonPanel.AddSeparator();
            RadioButtonGroupData radioButtonGroupData1 = new RadioButtonGroupData("radioButtonGroup1");
            RadioButtonGroup     radioButtonGroup1     = ribbonPanel.AddItem(radioButtonGroupData1) as RadioButtonGroup;

            ToggleButtonData toggleButton1 = new ToggleButtonData("toggleButton1", "Deactivate", dllPath, "UpdaterTool.Deactivated");
            BitmapImage      img1          = new BitmapImage(new Uri(Path.Combine(appFolderPath, "Stop.png")));

            toggleButton1.LargeImage = img1;

            ToggleButtonData toggleButton2 = new ToggleButtonData("toggleButton2", "Activate", dllPath, "UpdaterTool.Activated");
            BitmapImage      img2          = new BitmapImage(new Uri(Path.Combine(appFolderPath, "Check.png")));

            toggleButton2.LargeImage = img2;

            radioButtonGroup1.AddItem(toggleButton1);
            radioButtonGroup1.AddItem(toggleButton2);

            return(Result.Succeeded);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Radio/toggle button for "Command Data", "DB Element" and "Element Filtering"
        /// </summary>
        public void AddRadioButton(RibbonPanel panel)
        {
            // Create three toggle buttons for radio button group

            // #1
            ToggleButtonData toggleButtonData1 = new ToggleButtonData("RadioCommandData", "Command" + "\n Data", _introLabPath, _introLabName + ".CommandData");

            toggleButtonData1.LargeImage = NewBitmapImage("Basics.ico");

            // #2
            ToggleButtonData toggleButtonData2 = new ToggleButtonData("RadioDbElement", "DB" + "\n Element", _introLabPath, _introLabName + ".DBElement");

            toggleButtonData2.LargeImage = NewBitmapImage("Basics.ico");

            // #3
            ToggleButtonData toggleButtonData3 = new ToggleButtonData("RadioElementFiltering", "Filtering", _introLabPath, _introLabName + ".ElementFiltering");

            toggleButtonData3.LargeImage = NewBitmapImage("Basics.ico");

            // Make a radio button group now
            RadioButtonGroupData radioBtnGroupData = new RadioButtonGroupData("RadioButton");
            RadioButtonGroup     radioBtnGroup     = panel.AddItem(radioBtnGroupData) as RadioButtonGroup;

            radioBtnGroup.AddItem(toggleButtonData1);
            radioBtnGroup.AddItem(toggleButtonData2);
            radioBtnGroup.AddItem(toggleButtonData3);
        }
Ejemplo n.º 13
0
        void DockChanged(Base control)
        {
            Base             inner = control.UserData.Get <Base>("test");
            RadioButtonGroup rbg   = (RadioButtonGroup)control;
            Base             gb    = inner.UserData.Get <Base>("test");

            Control.Slider w = gb.FindChildByName("Width", true) as Control.Slider;
            Control.Slider h = gb.FindChildByName("Height", true) as Control.Slider;

            switch (rbg.SelectedIndex)
            {
            case 0:
                inner.Dock = Pos.Left;
                break;

            case 1:
                inner.Dock = Pos.Top;
                break;

            case 2:
                inner.Dock = Pos.Right;
                break;

            case 3:
                inner.Dock = Pos.Bottom;
                break;

            case 4:
                inner.Dock = Pos.Fill;
                break;
            }
            inner.SetSize((int)w.Value, (int)h.Value);
            //inner.Invalidate();
            outer.Invalidate();
        }
Ejemplo n.º 14
0
        private void OpenWindow(ControlBase control, EventArgs args)
        {
            Window window = new Window(this);

            window.Title   = String.Format("Window ({0})", ++m_WindowCount);
            window.Size    = new Size(m_Rand.Next(200, 400), m_Rand.Next(200, 400));
            window.Left    = m_Rand.Next(700);
            window.Top     = m_Rand.Next(400);
            window.Padding = new Padding(6, 3, 6, 6);

            RadioButtonGroup rbg = new RadioButtonGroup(window);

            rbg.Dock = Dock.Top;
            rbg.AddOption("Resize disabled", "None").Checked += (c, a) => window.Resizing = Resizing.None;
            rbg.AddOption("Resize width", "Width").Checked   += (c, a) => window.Resizing = Resizing.Width;
            rbg.AddOption("Resize height", "Height").Checked += (c, a) => window.Resizing = Resizing.Height;
            rbg.AddOption("Resize both", "Both").Checked     += (c, a) => window.Resizing = Resizing.Both;
            rbg.SetSelectionByName("Both");

            LabeledCheckBox dragging = new LabeledCheckBox(window);

            dragging.Dock          = Dock.Top;
            dragging.Text          = "Dragging";
            dragging.IsChecked     = true;
            dragging.CheckChanged += (c, a) => window.IsDraggingEnabled = dragging.IsChecked;
        }
Ejemplo n.º 15
0
        private void PopulateCamera(ControlBase parent)
        {
            var camtype  = GwenHelper.CreateHeaderPanel(parent, "Camera Type");
            var camprops = GwenHelper.CreateHeaderPanel(parent, "Camera Properties");
            RadioButtonGroup rbcamera = new RadioButtonGroup(camtype)
            {
                Dock = Dock.Top,
                ShouldDrawBackground = false,
            };
            var soft       = rbcamera.AddOption("Soft Camera");
            var predictive = rbcamera.AddOption("Predictive Camera");
            var legacy     = rbcamera.AddOption("Legacy Camera");
            var round      = GwenHelper.AddCheckbox(camprops, "Round Legacy Camera", Settings.RoundLegacyCamera, (o, e) =>
            {
                Settings.RoundLegacyCamera = ((Checkbox)o).IsChecked;
                Settings.Save();
            });

            if (Settings.SmoothCamera)
            {
                if (Settings.PredictiveCamera)
                {
                    predictive.Select();
                }
                else
                {
                    soft.Select();
                }
            }
            else
            {
                legacy.Select();
            }
            soft.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = true;
                Settings.PredictiveCamera = false;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            predictive.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = true;
                Settings.PredictiveCamera = true;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            legacy.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = false;
                Settings.PredictiveCamera = false;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            predictive.Tooltip = "This is the camera that was added in 1.03\nIt moves relative to the future of the track";
        }
Ejemplo n.º 16
0
        public void buttonPressedTest()
        {
            RadioButtonGroup target = new RadioButtonGroup(); // TODO: Initialize to an appropriate value
            RadioButton      b      = null;                   // TODO: Initialize to an appropriate value

            target.buttonPressed(b);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public void Given_a_drop_down_exists()
        {
            _componentFactory = SubstituteFor<IComponentFactory>();
            _radioButtonGroup = Substitute.For<RadioButtonGroup>();

            _componentFactory
                .HtmlControlFor<RadioButtonGroup>(_radioButtonGroupPropertySelector)
                .Returns(_radioButtonGroup);    
        }
Ejemplo n.º 18
0
 private Func <string, FormItem> getRadioGroup(
     string label, RadioButtonSetup setup, bool noSelection = false, bool singleButton = false, FormAction selectionChangedAction = null,
     PageModificationValue <bool> pageModificationValue     = null) =>
 id => {
     var group = new RadioButtonGroup(noSelection, disableSingleButtonDetection: singleButton, selectionChangedAction: selectionChangedAction);
     return(new StackList(
                group
                .CreateRadioButton(
                    !noSelection,
                    "First".ToComponents(),
                    setup: setup,
                    validationMethod: (postBackValue, validator) => AddStatusMessage(
                        StatusMessageType.Info,
                        "{0}-1: {1}".FormatWith(id, postBackValue.Value.ToString())))
                .ToFormItem()
                .ToListItem()
                .ToCollection()
                .Concat(
                    singleButton
                                                         ? Enumerable.Empty <ComponentListItem>()
                                                         : group.CreateFlowRadioButton(
                        false,
                        "Second".ToComponents(),
                        setup: FlowRadioButtonSetup.Create(
                            nestedContentGetter: () => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sit.".ToComponents()),
                        validationMethod: (postBackValue, validator) => AddStatusMessage(
                            StatusMessageType.Info,
                            "{0}-2: {1}".FormatWith(id, postBackValue.Value.ToString())))
                    .ToFormItem()
                    .ToListItem()
                    .ToCollection()
                    .Append(
                        group.CreateRadioButton(
                            false,
                            "Third".ToComponents(),
                            setup: RadioButtonSetup.Create(),
                            validationMethod: (postBackValue, validator) => AddStatusMessage(
                                StatusMessageType.Info,
                                "{0}-3: {1}".FormatWith(id, postBackValue.Value.ToString())))
                        .ToFormItem()
                        .ToListItem()))).ToFormItem(
                label: "{0}. {1}".FormatWith(id, label)
                .ToComponents()
                .Concat(
                    pageModificationValue != null
                                                         ? new LineBreak().ToCollection <PhrasingComponent>()
                    .Append(
                        new SideComments(
                            "First button value: ".ToComponents()
                            .Concat(
                                pageModificationValue.ToGenericPhrasingContainer(
                                    v => v.ToString(),
                                    valueExpression => "{0} ? 'True' : 'False'".FormatWith(valueExpression)))
                            .Materialize()))
                                                         : Enumerable.Empty <PhrasingComponent>())
                .Materialize()));
 };
Ejemplo n.º 19
0
        public LayoutTypeView()
        {
            InitializeComponent();

            layoutTypeGroup = new RadioButtonGroup();
            layoutTypeGroup.Add(layoutTypeLinear);
            layoutTypeGroup.EnableMultiSelection = false;
            layoutTypeLinear.IsSelected          = true;
        }
Ejemplo n.º 20
0
        public void Given_a_drop_down_exists()
        {
            _componentFactory = SubstituteFor <IComponentFactory>();
            _radioButtonGroup = Substitute.For <RadioButtonGroup>();

            _componentFactory
            .HtmlControlFor <RadioButtonGroup>(_radioButtonGroupPropertySelector)
            .Returns(_radioButtonGroup);
        }
Ejemplo n.º 21
0
        public blur()
        {
            m_rbuf2                 = new ImageBuffer();
            m_shape_bounds          = new RectangleDouble();
            m_method                = new RadioButtonGroup(new Vector2(10.0, 10.0), new Vector2(130.0, 60.0));
            m_radius                = new Slider(new Vector2(130 + 10.0, 10.0 + 4.0), new Vector2(290, 8.0));
            m_shadow_ctrl           = new PolygonEditWidget(4);
            m_channel_r             = new CheckBox(10.0, 80.0, "Red");
            m_channel_g             = new CheckBox(10.0, 95.0, "Green");
            m_channel_b             = new CheckBox(10.0, 110.0, "Blue");
            m_FlattenCurves         = new CheckBox(10, 315, "Convert And Flatten Curves");
            m_FlattenCurves.Checked = true;

            AddChild(m_method);
            m_method.AddRadioButton("Stack Blur");
            m_method.AddRadioButton("Recursive Blur");
            m_method.AddRadioButton("Channels");
            m_method.SelectedIndex = 1;

            AddChild(m_radius);
            m_radius.SetRange(0.0, 40.0);
            m_radius.Value = 15.0;
            m_radius.Text  = "Blur Radius={0:F2}";

            AddChild(m_shadow_ctrl);

            AddChild(m_channel_r);
            AddChild(m_channel_g);
            AddChild(m_channel_b);
            AddChild(m_FlattenCurves);
            m_channel_g.Checked = true;

            m_sl = new ScanlineCachePacked8();

            StyledTypeFace typeFaceForLargeA = new StyledTypeFace(LiberationSansFont.Instance, 300, flatenCurves: false);

            m_path = typeFaceForLargeA.GetGlyphForCharacter('a');

            Affine shape_mtx = Affine.NewIdentity();

            shape_mtx *= Affine.NewTranslation(150, 100);
            m_path     = new VertexSourceApplyTransform(m_path, shape_mtx);
            m_shape    = new FlattenCurves(m_path);

            bounding_rect.bounding_rect_single(m_shape, 0, ref m_shape_bounds);

            m_shadow_ctrl.SetXN(0, m_shape_bounds.Left);
            m_shadow_ctrl.SetYN(0, m_shape_bounds.Bottom);
            m_shadow_ctrl.SetXN(1, m_shape_bounds.Right);
            m_shadow_ctrl.SetYN(1, m_shape_bounds.Bottom);
            m_shadow_ctrl.SetXN(2, m_shape_bounds.Right);
            m_shadow_ctrl.SetYN(2, m_shape_bounds.Top);
            m_shadow_ctrl.SetXN(3, m_shape_bounds.Left);
            m_shadow_ctrl.SetYN(3, m_shape_bounds.Top);
            m_shadow_ctrl.line_color(new ColorF(0, 0.3, 0.5, 0.3));
        }
Ejemplo n.º 22
0
        public LinearOrientationView()
        {
            InitializeComponent();

            linearOrientGroup = new RadioButtonGroup();
            linearOrientGroup.Add(linearOrientH);
            linearOrientGroup.Add(linearOrientV);
            linearOrientGroup.EnableMultiSelection = false;
            linearOrientH.IsSelected = true;
        }
Ejemplo n.º 23
0
        public HorizontalAlignmentView()
        {
            InitializeComponent();

            hAlignGroup = new RadioButtonGroup();
            hAlignGroup.Add(hAlignBegin);
            hAlignGroup.Add(hAlignCenter);
            hAlignGroup.Add(hAlignEnd);
            hAlignGroup.EnableMultiSelection = false;
            hAlignBegin.IsSelected           = true;
        }
Ejemplo n.º 24
0
        public VerticalAlignmentView()
        {
            InitializeComponent();

            vAlignGroup = new RadioButtonGroup();
            vAlignGroup.Add(vAlignTop);
            vAlignGroup.Add(vAlignCenter);
            vAlignGroup.Add(vAlignBottom);
            vAlignGroup.EnableMultiSelection = false;
            vAlignTop.IsSelected             = true;
        }
Ejemplo n.º 25
0
        void HAlignChanged(ControlBase control, EventArgs args)
        {
            ControlBase      inner = control.UserData as ControlBase;
            RadioButtonGroup rbg   = (RadioButtonGroup)control;

            inner.HorizontalAlignment = (HorizontalAlignment)rbg.Selected.UserData;
            if (inner.HorizontalAlignment == HorizontalAlignment.Stretch)
            {
                inner.Width = Util.Ignore;
            }
        }
Ejemplo n.º 26
0
        void VAlignChanged(ControlBase control, EventArgs args)
        {
            ControlBase      inner = control.UserData as ControlBase;
            RadioButtonGroup rbg   = (RadioButtonGroup)control;

            inner.VerticalAlignment = (VerticalAlignment)rbg.Selected.UserData;
            if (inner.VerticalAlignment == VerticalAlignment.Stretch)
            {
                inner.Height = Util.Ignore;
            }
        }
        public void Given_a_radio_group_has_a_selected_radio_button()
        {
            _componentFactory = SubstituteFor <IComponentFactory>();
            _radioButtonGroup = Substitute.For <RadioButtonGroup>();

            _componentFactory
            .HtmlControlFor <RadioButtonGroup>(_radioGroupPropertySelector)
            .Returns(_radioButtonGroup);


            _radioButtonGroup.SelectedElementAs <ChoiceType>().Returns(ChoiceType.Another);
        }
Ejemplo n.º 28
0
        public CollectionViewTest4Page()
        {
            InitializeComponent();
            BindingContext = new TestSourceModel();

            var RadioGroup = new RadioButtonGroup();

            RadioGroup.Add(Linear);
            RadioGroup.Add(Grid);

            ColView.ItemTemplate = LinearTemplate;
        }
Ejemplo n.º 29
0
        private void CreateCheckables()
        {
            var row = _layout.CreateRow();
            var box = new Checkbox(row.GetCell(0));

            row = _layout.CreateRow();
            box = new Checkbox(row.GetCell(0))
            {
                Text      = "Checked",
                IsChecked = true
            };
            row = _layout.CreateRow();
            box = new Checkbox(row.GetCell(0))
            {
                Text      = "Checkbox",
                IsChecked = false
            };
            row = _layout.CreateRow();
            box = new Checkbox(row.GetCell(0))
            {
                Text       = "Disabled",
                IsChecked  = false,
                IsDisabled = true,
            };
            box = new Checkbox(row.GetCell(1))
            {
                Text       = "Disabled",
                IsChecked  = true,
                IsDisabled = true,
            };
            row = _layout.CreateRow();
            var radiogroup = new RadioButtonGroup(row.GetCell(0));

            radiogroup.AddOption("Radio 1").Tooltip = "tooltip 1";
            radiogroup.AddOption("Radio 2").Tooltip = "tooltip 2";
            var dc = radiogroup.AddOption("disabledChecked");

            dc.IsChecked = true;
            dc.Disable();
            radiogroup.AddOption("disabled").Disable();

            row = _layout.CreateRow();
            var radio = new RadioButton(row.GetCell(0))
            {
                Text = "ungrouped 1",
                Dock = Dock.Top
            }; radio = new RadioButton(row.GetCell(0))

            {
                Text = "ungrouped 2",
                Dock = Dock.Top
            };
        }
Ejemplo n.º 30
0
        public static void CreateUI(RadioButtonGroup radioButtonGroup)
        {
            var buttonData = NewToggleButtonData <CommandGrasshopperPreviewOff, Availability>("Off");

            if (radioButtonGroup.AddItem(buttonData) is ToggleButton pushButton)
            {
                pushButton.ToolTip    = "Don't draw any preview geometry";
                pushButton.Image      = ImageBuilder.LoadBitmapImage("RhinoInside.Resources.GH.Toolbar.Preview_Off_24x24.png", true);
                pushButton.LargeImage = ImageBuilder.LoadBitmapImage("RhinoInside.Resources.GH.Toolbar.Preview_Off_24x24.png");
                pushButton.Visible    = PlugIn.PlugInExists(PluginId, out bool loaded, out bool loadProtected);
            }
        }
Ejemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        JsonData        jd = Winter.Utils.Str2Json("skin3.txt");
        WinterComponent wc = new WinterComponent();

        wc.m_Entity = GameObject.Find("wPanel");
        wc.skin     = jd;
        Container        c = wc.children["RadioButtonGroup"] as Container;
        RadioButtonGroup r = c.children["tabs"] as RadioButtonGroup;

        r.RadioButtonGroupDispatch += DoSomething;
    }
        public void Given_a_radio_group_has_a_selected_radio_button()
        {

            _componentFactory = SubstituteFor<IComponentFactory>();
            _radioButtonGroup = Substitute.For<RadioButtonGroup>();

            _componentFactory
                .HtmlControlFor<RadioButtonGroup>(_radioGroupPropertySelector)
                .Returns(_radioButtonGroup);

            
            _radioButtonGroup.SelectedElementAs<ChoiceType>().Returns(ChoiceType.Another);
        }
Ejemplo n.º 33
0
        public override void Initialize()
        {
            base.Initialize();

            SetBackground(Color.White);

            lbl = new Label("Select one");
            AddComponent(lbl, 50, 50);

            lblBlue = new Label("Blue Pill");
            rbBlue = new RadioButton();
            AddComponent(rbBlue, 50, 100);
            AddComponent(lblBlue, 90, 100);

            lblRed = new Label("Red Pill");
            rbRed = new RadioButton();
            AddComponent(rbRed, 50, 150);
            AddComponent(lblRed, 90, 150);

            group = new RadioButtonGroup();
            group.Add(rbBlue);
            group.Add(rbRed);

            check = new CheckBox();
            lblmessage = new Label("Remember: all I'm offering is the truth,\n nothing more");
            lblWhiteRabbit = new Label(ResourceManager.CreateImage("whiteRabbit"));

            AddComponent(check, 10, 300);
            AddComponent(lblmessage, 10, 350);
            AddComponent(lblWhiteRabbit, 10, 500);

            lblWhiteRabbit.Visible = lblmessage.Visible = check.Visible = false;

            //Events
            rbRed.Released += rbRed_Released;
            rbBlue.Released += rbBlue_Released;
            check.Released += check_Released;
        }
        /// <summary>
        /// Call this during LoadData.
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="vl"></param>
        /// <param name="availableRoles">Pass a restricted list of <see cref="Role"/>s the user may select. Otherwise, Roles available 
        /// in the System Provider are used.</param>
        /// <param name="validationPredicate">If the function returns true, validation continues.</param>
        public void LoadData( int? userId, ValidationList vl, List<Role> availableRoles = null, Func<bool> validationPredicate = null )
        {
            availableRoles = ( availableRoles != null ? availableRoles.OrderBy( r => r.Name ) : UserManagementStatics.SystemProvider.GetRoles() ).ToList();

            user = userId.HasValue ? UserManagementStatics.GetUser( userId.Value, true ) : null;
            if( includePasswordControls() && user != null )
                facUser = FormsAuthStatics.GetUser( user.UserId, true );

            Func<bool> validationShouldRun = () => validationPredicate == null || validationPredicate();

            var b = FormItemBlock.CreateFormItemTable( heading: "Security Information" );

            b.AddFormItems(
                FormItem.Create(
                    "Email address",
                    new EwfTextBox( user != null ? user.Email : "" ),
                    validationGetter: control => new EwfValidation(
                                                     ( pbv, validator ) => {
                                                         if( validationShouldRun() )
                                                             Email = validator.GetEmailAddress( new ValidationErrorHandler( "email address" ), control.GetPostBackValue( pbv ), false );
                                                     },
                                                     vl ) ) );

            if( includePasswordControls() ) {
                var group = new RadioButtonGroup( false );

                var keepPassword = FormItem.Create(
                    "",
                    group.CreateInlineRadioButton( true, label: userId.HasValue ? "Keep the current password" : "Do not create a password" ),
                    validationGetter: control => new EwfValidation(
                                                     ( pbv, validator ) => {
                                                         if( !validationShouldRun() || !control.IsCheckedInPostBack( pbv ) )
                                                             return;
                                                         if( user != null ) {
                                                             Salt = facUser.Salt;
                                                             SaltedPassword = facUser.SaltedPassword;
                                                             MustChangePassword = facUser.MustChangePassword;
                                                         }
                                                         else
                                                             genPassword( false );
                                                     },
                                                     vl ) );

                var generatePassword = FormItem.Create(
                    "",
                    group.CreateInlineRadioButton( false, label: "Generate a " + ( userId.HasValue ? "new, " : "" ) + "random password and email it to the user" ),
                    validationGetter: control => new EwfValidation(
                                                     ( pbv, validator ) => {
                                                         if( validationShouldRun() && control.IsCheckedInPostBack( pbv ) )
                                                             genPassword( true );
                                                     },
                                                     vl ) );

                var newPassword = new DataValue<string>();
                var confirmPassword = new DataValue<string>();
                var newPasswordTable = EwfTable.Create( style: EwfTableStyle.StandardExceptLayout );
                newPasswordTable.AddItem(
                    new EwfTableItem(
                        "Password",
                        FormItem.Create(
                            "",
                            new EwfTextBox( "", masksCharacters: true, disableBrowserAutoComplete: true ) { Width = Unit.Pixel( 200 ) },
                            validationGetter: control => new EwfValidation( ( pbv, v ) => newPassword.Value = control.GetPostBackValue( pbv ), vl ) ).ToControl() ) );
                newPasswordTable.AddItem(
                    new EwfTableItem(
                        "Password again",
                        FormItem.Create(
                            "",
                            new EwfTextBox( "", masksCharacters: true, disableBrowserAutoComplete: true ) { Width = Unit.Pixel( 200 ) },
                            validationGetter: control => new EwfValidation( ( pbv, v ) => confirmPassword.Value = control.GetPostBackValue( pbv ), vl ) ).ToControl() ) );

                var providePasswordRadio = group.CreateBlockRadioButton( false, label: "Provide a " + ( userId.HasValue ? "new " : "" ) + "password" );
                providePasswordRadio.NestedControls.Add( newPasswordTable );
                var providePassword = FormItem.Create(
                    "",
                    providePasswordRadio,
                    validationGetter: control => new EwfValidation(
                                                     ( pbv, validator ) => {
                                                         if( !validationShouldRun() || !control.IsCheckedInPostBack( pbv ) )
                                                             return;
                                                         FormsAuthStatics.ValidatePassword( validator, newPassword, confirmPassword );
                                                         var p = new Password( newPassword.Value );
                                                         Salt = p.Salt;
                                                         SaltedPassword = p.ComputeSaltedHash();
                                                         MustChangePassword = false;
                                                     },
                                                     vl ) );

                b.AddFormItems(
                    FormItem.Create( "Password", ControlStack.CreateWithControls( true, keepPassword.ToControl(), generatePassword.ToControl(), providePassword.ToControl() ) ) );
            }

            b.AddFormItems(
                FormItem.Create(
                    "Role",
                    SelectList.CreateDropDown(
                        from i in availableRoles select SelectListItem.Create( i.RoleId as int?, i.Name ),
                        user != null ? user.Role.RoleId as int? : null ),
                    validationGetter: control => new EwfValidation(
                                                     ( pbv, validator ) => {
                                                         if( validationShouldRun() )
                                                             RoleId = control.ValidateAndGetSelectedItemIdInPostBack( pbv, validator ) ?? default ( int );
                                                     },
                                                     vl ) ) );

            Controls.Add( b );
        }
Ejemplo n.º 35
0
        public override void Initialize()
        {
            base.Initialize();

            SetBackground(ResourceManager.CreateImage("metalBG"), Adjustment.FILL);

            Button button = new Button("Button");

            ToggleButton toggleButton = new ToggleButton("Toggle");
            toggleButton.Scalable = true;
            toggleButton.Rotable = true;
            toggleButton.Draggable = true;

            Label label = new Label("Label");

            CheckBox checkbox1 = new CheckBox();
            CheckBox checkbox2 = new CheckBox();
            CheckBox checkbox3 = new CheckBox();

            RadioButton radioButton1 = new RadioButton();
            RadioButton radioButton2 = new RadioButton();
            RadioButton radioButton3 = new RadioButton();

            RadioButtonGroup group = new RadioButtonGroup();
            group.Add(radioButton1);
            group.Add(radioButton2);
            group.Add(radioButton3);

            ProgressBar progressBar = new ProgressBar();
            progressBar.Value = 50;

            Slider slider = new Slider();

            string[] array = new string[] { "Listbox1", "Listbox2", "Listbox3", "Listbox4", "Listbox5",
                                            "Listbox6", "Listbox7", "Listbox8", "Listbox9", "Listbox10" };
            ListBox listbox = new ListBox(array, 460, 200, ListBox.Orientation.VERTICAL);

            TextArea text = new TextArea("Text", 1, 10);
            ////Buttons & Toggle
            AddComponent(button, 10, 10);
            AddComponent(toggleButton, 100, 10);

            ////Label
            AddComponent(label, 10, 80);

            ////Checkbox
            AddComponent(checkbox1, 300, 10);
            AddComponent(checkbox2, 300, 50);
            AddComponent(checkbox3, 300, 90);

            ////RadioButton
            AddComponent(radioButton1, 350, 10);
            AddComponent(radioButton2, 350, 50);
            AddComponent(radioButton3, 350, 90);

            //ProgressBar
            AddComponent(progressBar, 10, 150);

            //Slider
            AddComponent(slider, 10, 200);

            //ListBox
            AddComponent(listbox, 10, 250);

            AddComponent(text, 10, 500);
        }