コード例 #1
0
        /// <summary>
        /// Color changed handler.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void OnColorChanged(Gwen.Controls.ControlBase control, EventArgs args)
        {
            HSVColorPicker picker = control as HSVColorPicker;

            SetTextFromColor(picker.SelectedColor);
            DoChanged();
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Text"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public Text(Gwen.Controls.ControlBase parent) : base(parent)
 {
     m_TextBox      = new TextBox(this);
     m_TextBox.Dock = Pos.Fill;
     m_TextBox.ShouldDrawBackground = false;
     m_TextBox.TextChanged         += OnValueChanged;
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Color"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public Color(Gwen.Controls.ControlBase parent) : base(parent)
 {
     m_Button          = new ColorButton(m_TextBox);
     m_Button.Dock     = Pos.Right;
     m_Button.Width    = 20;
     m_Button.Margin   = new Margin(1, 1, 1, 2);
     m_Button.Clicked += OnButtonPressed;
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextProperty"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public TextProperty(Gwen.Controls.ControlBase parent) : base(parent)
 {
     m_TextBox      = new TextBox(this);
     this.Height    = m_TextBox.TextHeight;
     m_TextBox.Dock = Dock.Fill;
     m_TextBox.ShouldDrawBackground = false;
     m_TextBox.TextChanged         += OnValueChanged;
     AutoSizeToContents             = false;
 }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LabelProperty"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public LabelProperty(Gwen.Controls.ControlBase parent) : base(parent)
        {
            m_text = new Gwen.Controls.Label(this);
            var marg = m_text.Margin;

            marg.Left     = 2;
            m_text.Margin = marg;
            m_text.Dock   = Pos.Fill;
            m_text.ShouldDrawBackground = false;
        }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Text"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public KeyProperty(Gwen.Controls.ControlBase parent) : base(parent)
 {
     keytxt = new Label(this);
     keytxt.KeyboardInputEnabled = false;
     keytxt.MouseInputEnabled    = false;
     keytxt.Dock = Pos.Fill;
     keytxt.ShouldDrawBackground = false;
     KeyboardInputEnabled        = true;
     MouseInputEnabled           = true;
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextProperty"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public NumberProperty(Gwen.Controls.ControlBase parent) : base(parent)
 {
     Padding                        = Padding.One;
     m_Spinner                      = new Spinner(this);
     m_Spinner.MinimumSize          = m_Spinner.Size;
     this.Height                    = m_Spinner.Height;
     m_Spinner.Dock                 = Dock.Fill;
     m_Spinner.ShouldDrawBackground = false;
     m_Spinner.ValueChanged        += OnValueChanged;
     AutoSizeToContents             = true;
 }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Check"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public Check(Gwen.Controls.ControlBase parent)
            : base(parent)
        {
            m_CheckBox = new Gwen.Controls.CheckBox(this);
            m_CheckBox.ShouldDrawBackground = false;
            m_CheckBox.CheckChanged        += OnValueChanged;
            m_CheckBox.IsTabable            = true;
            m_CheckBox.KeyboardInputEnabled = true;
            m_CheckBox.SetPosition(2, 1);

            Height = 18;
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LabelProperty"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public LabelProperty(Gwen.Controls.ControlBase parent) : base(parent)
 {
     m_text = new Gwen.Controls.Label(this)
     {
         Dock = Dock.Fill,
         ShouldDrawBackground = false,
         AutoSizeToContents   = true,
         Alignment            = Pos.CenterV | Pos.Left,
         TextPadding          = new Padding(2, 2, 2, 2),
     };
     AutoSizeToContents = true;
 }
コード例 #10
0
        /// <summary>
        /// Color-select button press handler.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void OnButtonPressed(Gwen.Controls.ControlBase control, EventArgs args)
        {
            Menu menu = new Menu(GetCanvas());

            menu.SetSize(256, 180);
            menu.DeleteOnClose      = true;
            menu.IconMarginDisabled = true;

            HSVColorPicker picker = new HSVColorPicker(menu);

            picker.Dock = Pos.Fill;
            picker.SetSize(256, 128);

            string[] split = m_TextBox.Text.Split(' ');

            picker.SetColor(GetColorFromText(), false, true);
            picker.ColorChanged += OnColorChanged;

            menu.Open(Pos.Right | Pos.Top);
        }
コード例 #11
0
        public MessageBox(Gwen.Controls.ControlBase ctrl, string text, string title, ButtonType buttons) : base(ctrl, title)
        {
            Text                         = text;
            _buttons                     = buttons;
            DeleteOnClose                = true;
            Container                    = new ControlBase(m_Panel);
            Container.Margin             = new Margin(0, Skin.DefaultFont.LineHeight, 0, 0);
            Container.Dock               = Dock.Bottom;
            Container.AutoSizeToContents = true;
            switch (buttons)
            {
            case ButtonType.Ok:
                AddButton("Okay", DialogResult.OK);
                break;

            case ButtonType.OkCancel:
                AddButton("Cancel", DialogResult.Cancel);
                AddButton("Okay", DialogResult.OK);
                break;

            case ButtonType.YesNo:
                AddButton("No", DialogResult.No);
                AddButton("Yes", DialogResult.Yes);
                break;

            case ButtonType.YesNoCancel:
                AddButton("Cancel", DialogResult.Cancel);
                AddButton("No", DialogResult.No);
                AddButton("Yes", DialogResult.Yes);
                break;
            }
            Setup();
            Align.Center(this);
            DisableResizing();
            Invalidate();
        }
コード例 #12
0
 protected virtual void OnValueChanged(Gwen.Controls.ControlBase control, EventArgs args)
 {
     DoChanged();
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyBase"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public PropertyBase(Gwen.Controls.ControlBase parent) : base(parent)
 {
     Height = 17;
     Dock   = Dock.Fill;
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyBase"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public PropertyBase(Gwen.Controls.ControlBase parent) : base(parent)
 {
     Height = 17;
 }
コード例 #15
0
 public Window(Gwen.Controls.ControlBase ctrl, string title = "") : base(ctrl, title)
 {
 }