Ejemplo n.º 1
0
        public BooleanCheckBoxPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.checkBox                 = new CheckBox();
            this.checkBox.Name            = "checkBox";
            this.checkBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
            this.checkBox.FlatStyle       = FlatStyle.System;
            this.checkBox.Text            = string.IsNullOrEmpty(this.Description) ? this.DisplayName : this.Description;

            this.Controls.AddRange(
                new Control[]
            {
                this.header,
                this.checkBox
            });

            ResumeLayout(false);
        }
Ejemplo n.º 2
0
 private PropertyControlInfo(PropertyControlInfo cloneMe)
     : base(cloneMe)
 {
     this.property          = cloneMe.property;
     this.controlType       = (StaticListChoiceProperty)cloneMe.controlType.Clone();
     this.valueDisplayNames = new Dictionary <object, string>(cloneMe.valueDisplayNames);
 }
Ejemplo n.º 3
0
        public StringTextBoxPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header      = new HeaderLabel();
            this.textBox     = new TextBox();
            this.description = new Label();

            this.header.Name        = "header";
            this.header.Text        = DisplayName;
            this.header.RightMargin = 0;

            this.description.Name = "description";
            this.description.Text = this.Description;

            this.textBox.Name         = "textBox";
            this.textBox.TextChanged += new EventHandler(TextBox_TextChanged);
            this.textBox.MaxLength    = Property.MaxLength;
            this.baseTextBoxHeight    = this.textBox.Height;
            this.Multiline            = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.Multiline].Value;

            this.Controls.AddRange(
                new Control[]
            {
                this.header,
                this.textBox,
                this.description
            });

            ResumeLayout(false);
        }
Ejemplo n.º 4
0
        public Int32IncrementButtonPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.Text        = this.DisplayName;
            this.header.RightMargin = 0;

            this.incrementButton           = new Button();
            this.incrementButton.Name      = "incrementButton";
            this.incrementButton.AutoSize  = true;
            this.incrementButton.FlatStyle = FlatStyle.System;
            this.incrementButton.Text      = (string)propInfo.ControlProperties[ControlInfoPropertyNames.ButtonText].Value;
            this.incrementButton.Click    += new EventHandler(IncrementButton_Click);

            this.descriptionText          = new Label();
            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            this.Controls.AddRange(
                new Control[]
            {
                this.header,
                this.incrementButton,
                this.descriptionText
            });

            ResumeLayout(false);
            PerformLayout();
        }
Ejemplo n.º 5
0
 internal PropertyControl(PropertyControlInfo propInfo)
 {
     this.property = propInfo.Property;
     this.property.ValueChanged    += new EventHandler(Property_ValueChanged);
     this.property.ReadOnlyChanged += new EventHandler(Property_ReadOnlyChanged);
     this.displayName = (string)propInfo.ControlProperties[ControlInfoPropertyNames.DisplayName].Value;
     this.description = (string)propInfo.ControlProperties[ControlInfoPropertyNames.Description].Value;
 }
Ejemplo n.º 6
0
 public Int32SliderPropertyControl(PropertyControlInfo propInfo)
     : base(propInfo)
 {
     SuspendLayout();
     SliderSmallChange = (int)propInfo.ControlProperties[ControlInfoPropertyNames.SliderSmallChange].Value;
     SliderLargeChange = (int)propInfo.ControlProperties[ControlInfoPropertyNames.SliderLargeChange].Value;
     UpDownIncrement   = (int)propInfo.ControlProperties[ControlInfoPropertyNames.UpDownIncrement].Value;
     ResumeLayout(false);
 }
Ejemplo n.º 7
0
        public AngleChooserPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            DoubleProperty doubleProp = (DoubleProperty)propInfo.Property;

            if (!((doubleProp.MinValue == -180 && doubleProp.MaxValue == +180) ||
                  (doubleProp.MinValue == 0 && doubleProp.MaxValue == 360)))
            {
                throw new ArgumentException("Only two min/max ranges are allowed for the AngleChooser control type: [-180, +180] and [0, 360]");
            }

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.angleChooser               = new AngleChooserControl();
            this.angleChooser.Name          = "angleChooser";
            this.angleChooser.ValueChanged += new EventHandler(AngleChooser_ValueChanged);

            this.valueNud               = new NumericUpDown();
            this.valueNud.Name          = "numericUpDown";
            this.valueNud.Minimum       = (decimal)Property.MinValue;
            this.valueNud.Maximum       = (decimal)Property.MaxValue;
            this.valueNud.DecimalPlaces = 2;
            this.valueNud.ValueChanged += new EventHandler(ValueNud_ValueChanged);
            this.valueNud.TextAlign     = HorizontalAlignment.Right;

            this.resetButton           = new Button();
            this.resetButton.Name      = "resetButton";
            this.resetButton.FlatStyle = FlatStyle.Standard;
            this.resetButton.Click    += new EventHandler(ResetButton_Click);
            this.resetButton.Image     = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
            this.resetButton.Visible   = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            this.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));

            this.description          = new Label();
            this.description.Name     = "descriptionText";
            this.description.AutoSize = false;
            this.description.Text     = this.Description;

            SuspendLayout();

            this.Controls.AddRange(
                new Control[]
            {
                this.header,
                this.angleChooser,
                this.valueNud,
                this.resetButton,
                this.description
            });

            ResumeLayout(false);
            PerformLayout();
        }
Ejemplo n.º 8
0
 public DoubleSliderPropertyControl(PropertyControlInfo propInfo)
     : base(propInfo)
 {
     SuspendLayout();
     DecimalPlaces       = (int)propInfo.ControlProperties[ControlInfoPropertyNames.DecimalPlaces].Value;
     UseExponentialScale = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.UseExponentialScale].Value;
     SliderSmallChange   = (double)propInfo.ControlProperties[ControlInfoPropertyNames.SliderSmallChange].Value;
     SliderLargeChange   = (double)propInfo.ControlProperties[ControlInfoPropertyNames.SliderLargeChange].Value;
     UpDownIncrement     = (double)propInfo.ControlProperties[ControlInfoPropertyNames.UpDownIncrement].Value;
     ResumeLayout(false);
 }
Ejemplo n.º 9
0
 public DoubleVectorSliderPropertyControl(PropertyControlInfo propInfo)
     : base(propInfo)
 {
     DecimalPlaces       = (int)propInfo.ControlProperties[ControlInfoPropertyNames.DecimalPlaces].Value;
     SliderSmallChangeX  = (double)propInfo.ControlProperties[ControlInfoPropertyNames.SliderSmallChangeX].Value;
     SliderLargeChangeX  = (double)propInfo.ControlProperties[ControlInfoPropertyNames.SliderLargeChangeX].Value;
     UpDownIncrementX    = (double)propInfo.ControlProperties[ControlInfoPropertyNames.UpDownIncrementX].Value;
     SliderSmallChangeY  = (double)propInfo.ControlProperties[ControlInfoPropertyNames.SliderSmallChangeY].Value;
     SliderLargeChangeY  = (double)propInfo.ControlProperties[ControlInfoPropertyNames.SliderLargeChangeY].Value;
     UpDownIncrementY    = (double)propInfo.ControlProperties[ControlInfoPropertyNames.UpDownIncrementY].Value;
     UseExponentialScale = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.UseExponentialScale].Value;
     ResetUIRanges();
 }
Ejemplo n.º 10
0
        public bool SetPropertyControlType(object propertyName, PropertyControlType newControlType)
        {
            PropertyControlInfo pci = FindControlForPropertyName(propertyName);

            if (pci == null)
            {
                return(false);
            }

            if (-1 == Array.IndexOf(pci.ControlType.ValueChoices, newControlType))
            {
                return(false);
            }

            pci.ControlType.Value = newControlType;
            return(true);
        }
Ejemplo n.º 11
0
        public bool SetPropertyControlValue(object propertyName, object controlPropertyName, object propertyValue)
        {
            PropertyControlInfo pci = FindControlForPropertyName(propertyName);

            if (pci == null)
            {
                return(false);
            }

            Property prop = pci.ControlProperties[controlPropertyName];

            if (prop == null)
            {
                return(false);
            }

            prop.Value = propertyValue;
            return(true);
        }
Ejemplo n.º 12
0
        public StaticListDropDownPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.comboBox                       = new ComboBox();
            this.comboBox.Name                  = "comboBox";
            this.comboBox.FlatStyle             = FlatStyle.System;
            this.comboBox.SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
            this.comboBox.DropDownStyle         = ComboBoxStyle.DropDownList;

            foreach (object choice in Property.ValueChoices)
            {
                string valueText = propInfo.GetValueDisplayName(choice);
                this.comboBox.Items.Add(valueText);
            }

            this.descriptionText          = new Label();
            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            this.Controls.AddRange(
                new Control[]
            {
                this.header,
                this.comboBox,
                this.descriptionText
            });

            ResumeLayout(false);
            PerformLayout();
        }
Ejemplo n.º 13
0
        private static PropertyControlInfo FindControlForPropertyName(object propertyName, ControlInfo control)
        {
            PropertyControlInfo asPCI = control as PropertyControlInfo;

            if (asPCI != null && asPCI.Property.Name == propertyName.ToString())
            {
                return(asPCI);
            }
            else
            {
                foreach (ControlInfo childControl in control.GetChildControlsCore())
                {
                    PropertyControlInfo pci = FindControlForPropertyName(propertyName, childControl);

                    if (pci != null)
                    {
                        return(pci);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 14
0
        public StaticListRadioButtonPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            object[] valueChoices = Property.ValueChoices; // cache this to avoid making N copies
            this.radioButtons = new RadioButton[valueChoices.Length];

            for (int i = 0; i < this.radioButtons.Length; ++i)
            {
                this.radioButtons[i]                 = new RadioButton();
                this.radioButtons[i].Name            = "radioButton" + i.ToString(CultureInfo.InvariantCulture);
                this.radioButtons[i].FlatStyle       = FlatStyle.System;
                this.radioButtons[i].CheckedChanged += new EventHandler(RadioButton_CheckedChanged);

                string valueText = propInfo.GetValueDisplayName(valueChoices[i]);
                this.radioButtons[i].Text = valueText;
            }

            this.descriptionText          = new Label();
            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            this.Controls.Add(this.header);
            this.Controls.AddRange(this.radioButtons);
            this.Controls.Add(this.descriptionText);

            ResumeLayout(false);
            PerformLayout();
        }
Ejemplo n.º 15
0
        public DoubleVectorPanAndSliderPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.panControl      = new PixelDotNet.Core.PanControl();
            this.panControl.Name = "panControl";
            this.panControl.StaticImageUnderlay = (ImageResource)propInfo.ControlProperties[ControlInfoPropertyNames.StaticImageUnderlay].Value;
            this.panControl.PositionChanged    += new EventHandler(PanControl_PositionChanged);
            this.panControl.Size = new Size(1, 1);

            this.sliders             = new DoubleVectorSliderPropertyControl(propInfo);
            this.sliders.Name        = "sliders";
            this.sliders.DisplayName = "";
            this.sliders.Description = "";

            this.textDescription      = new Label();
            this.textDescription.Name = "textDescription";
            this.textDescription.Text = Description;

            this.Controls.AddRange(
                new Control[]
            {
                this.header,
                this.panControl,
                this.sliders,
                this.textDescription
            });

            ResumeLayout(false);
        }
Ejemplo n.º 16
0
        public SliderPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            this.header          = new HeaderLabel();
            this.slider          = new TrackBar();
            this.numericUpDown   = new PdnNumericUpDown();
            this.resetButton     = new Button();
            this.descriptionText = new Label();

            this.slider.BeginInit();

            SuspendLayout();

            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.numericUpDown.DecimalPlaces = 0;
            this.numericUpDown.Name          = "numericUpDown";
            this.numericUpDown.TextAlign     = HorizontalAlignment.Right;
            this.numericUpDown.TabIndex      = 1;

            this.slider.Name         = "slider";
            this.slider.AutoSize     = false;
            this.slider.Orientation  = Orientation.Horizontal;
            this.slider.TabIndex     = 0;
            this.SliderShowTickMarks = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarks].Value;

            this.resetButton.AutoSize  = false;
            this.resetButton.Name      = "resetButton";
            this.resetButton.FlatStyle = FlatStyle.Standard;
            this.resetButton.Click    += new EventHandler(ResetButton_Click);
            this.resetButton.Image     = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
            this.resetButton.TabIndex  = 2;
            this.resetButton.Visible   = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            this.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));

            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            // In order to make sure that setting the ranges on the controls doesn't affect the property in weird ways,
            // we don't set up our ValueChanged handlers until after we set up the controls.
            ValidateUIRanges();
            ResetUIRanges();

            this.numericUpDown.ValueChanged += new EventHandler(NumericUpDown_ValueChanged);
            this.slider.ValueChanged        += new EventHandler(Slider_ValueChanged);

            Controls.AddRange(
                new Control[]
            {
                this.header,
                this.slider,
                this.numericUpDown,
                this.resetButton,
                this.descriptionText
            });

            this.slider.EndInit();

            ResumeLayout(false);
        }
Ejemplo n.º 17
0
 internal PropertyControl(PropertyControlInfo propInfo)
     : base(propInfo)
 {
 }
Ejemplo n.º 18
0
        public VectorSliderPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header          = new HeaderLabel();
            this.sliderX         = new TrackBar();
            this.numericUpDownX  = new PdnNumericUpDown();
            this.resetButtonX    = new Button();
            this.sliderY         = new TrackBar();
            this.numericUpDownY  = new PdnNumericUpDown();
            this.resetButtonY    = new Button();
            this.descriptionText = new Label();

            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.sliderX.Name          = "sliderX";
            this.sliderX.AutoSize      = false;
            this.sliderX.ValueChanged += new EventHandler(SliderX_ValueChanged);
            this.sliderX.Orientation   = Orientation.Horizontal;
            this.SliderShowTickMarksX  = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksX].Value;

            this.numericUpDownX.Name          = "numericUpDownX";
            this.numericUpDownX.ValueChanged += new EventHandler(NumericUpDownX_ValueChanged);
            this.numericUpDownX.TextAlign     = HorizontalAlignment.Right;

            this.resetButtonX.Name      = "resetButtonX";
            this.resetButtonX.AutoSize  = false;
            this.resetButtonX.FlatStyle = FlatStyle.Standard;
            this.resetButtonX.Click    += new EventHandler(ResetButtonX_Click);
            this.resetButtonX.Image     = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
            this.resetButtonX.Visible   = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            this.ToolTip.SetToolTip(this.resetButtonX, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));

            this.sliderY.Name          = "sliderY";
            this.sliderY.AutoSize      = false;
            this.sliderY.ValueChanged += new EventHandler(SliderY_ValueChanged);
            this.sliderY.Orientation   = Orientation.Horizontal;
            this.SliderShowTickMarksY  = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksY].Value;

            this.numericUpDownY.Name          = "numericUpDownY";
            this.numericUpDownY.ValueChanged += new EventHandler(NumericUpDownY_ValueChanged);
            this.numericUpDownY.TextAlign     = HorizontalAlignment.Right;

            this.resetButtonY.Name      = "resetButtonY";
            this.resetButtonY.AutoSize  = false;
            this.resetButtonY.FlatStyle = FlatStyle.Standard;
            this.resetButtonY.Click    += new EventHandler(ResetButtonY_Click);
            this.resetButtonY.Image     = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
            this.resetButtonY.Visible   = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            this.ToolTip.SetToolTip(this.resetButtonY, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));

            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            ValidateUIRanges();

            ResetUIRanges();

            Controls.AddRange(
                new Control[]
            {
                this.header,
                this.sliderX,
                this.numericUpDownX,
                this.resetButtonX,
                this.sliderY,
                this.numericUpDownY,
                this.resetButtonY,
                this.descriptionText
            });

            ResumeLayout(false);
        }
Ejemplo n.º 19
0
        public Int32ColorWheelPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            if (Property.MinValue != requiredMin || Property.MaxValue != requiredMax)
            {
                throw new ArgumentException("The only range allowed for this control is [" + requiredMin + ", " + requiredMax + "]");
            }

            SuspendLayout();

            this.header             = new HeaderLabel();
            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.colorRectangle          = new ColorRectangleControl();
            this.colorRectangle.Name     = "colorRectangle";
            this.colorRectangle.TabStop  = false;
            this.colorRectangle.TabIndex = 0;

            this.hsvColorWheel               = new ColorWheel();
            this.hsvColorWheel.Name          = "hsvColorWheel";
            this.hsvColorWheel.ColorChanged += new EventHandler(HsvColorWheel_ColorChanged);
            this.hsvColorWheel.TabStop       = false;
            this.hsvColorWheel.TabIndex      = 1;

            this.saturationSlider               = new ColorGradientControl();
            this.saturationSlider.Name          = "saturationSlider";
            this.saturationSlider.Orientation   = Orientation.Vertical;
            this.saturationSlider.ValueChanged += new IndexEventHandler(SaturationSlider_ValueChanged);
            this.saturationSlider.TabStop       = false;
            this.saturationSlider.TabIndex      = 2;

            this.valueSlider               = new ColorGradientControl();
            this.valueSlider.Name          = "valueSlider";
            this.valueSlider.Orientation   = Orientation.Vertical;
            this.valueSlider.ValueChanged += new IndexEventHandler(ValueSlider_ValueChanged);
            this.valueSlider.TabStop       = false;
            this.valueSlider.TabIndex      = 3;

            this.redLabel          = new Label();
            this.redLabel.Name     = "redLabel";
            this.redLabel.AutoSize = true;
            this.redLabel.Text     = PdnResources.GetString("ColorsForm.RedLabel.Text");

            this.redNud               = new PdnNumericUpDown();
            this.redNud.Name          = "redNud";
            this.redNud.Minimum       = 0;
            this.redNud.Maximum       = 255;
            this.redNud.TextAlign     = HorizontalAlignment.Right;
            this.redNud.ValueChanged += new EventHandler(RedNud_ValueChanged);
            this.redNud.TabIndex      = 4;

            this.greenLabel          = new Label();
            this.greenLabel.Name     = "greenLabel";
            this.greenLabel.AutoSize = true;
            this.greenLabel.Text     = PdnResources.GetString("ColorsForm.GreenLabel.Text");

            this.greenNud               = new PdnNumericUpDown();
            this.greenNud.Name          = "greenNud";
            this.greenNud.Minimum       = 0;
            this.greenNud.Maximum       = 255;
            this.greenNud.TextAlign     = HorizontalAlignment.Right;
            this.greenNud.ValueChanged += new EventHandler(GreenNud_ValueChanged);
            this.greenNud.TabIndex      = 5;

            this.blueLabel          = new Label();
            this.blueLabel.Name     = "blueLabel";
            this.blueLabel.AutoSize = true;
            this.blueLabel.Text     = PdnResources.GetString("ColorsForm.BlueLabel.Text");

            this.blueNud               = new PdnNumericUpDown();
            this.blueNud.Name          = "blueNud";
            this.blueNud.Minimum       = 0;
            this.blueNud.Maximum       = 255;
            this.blueNud.TextAlign     = HorizontalAlignment.Right;
            this.blueNud.ValueChanged += new EventHandler(BlueNud_ValueChanged);
            this.blueNud.TabIndex      = 6;

            this.resetButton           = new Button();
            this.resetButton.AutoSize  = true;
            this.resetButton.Name      = "resetButton";
            this.resetButton.FlatStyle = FlatStyle.Standard;
            this.resetButton.Click    += new EventHandler(ResetButton_Click);
            this.resetButton.Image     = PdnResources.GetImage("Icons.ResetIcon.png");
            this.resetButton.Width     = 1;
            this.resetButton.Visible   = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            this.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));
            this.resetButton.TabIndex = 7;

            this.description      = new Label();
            this.description.Name = "description";
            this.description.Text = this.Description;

            this.Controls.AddRange(
                new Control[]
            {
                this.header,
                this.hsvColorWheel,
                this.saturationSlider,
                this.valueSlider,
                this.colorRectangle,
                this.redLabel,
                this.redNud,
                this.greenLabel,
                this.greenNud,
                this.blueLabel,
                this.blueNud,
                this.resetButton,
                this.description
            });

            ResumeLayout(false);
        }