Clickable label (for checkboxes etc).
Inheritance: Button
Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LabeledCheckBox"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public LabeledCheckBox(Control parent)
            : base(parent)
        {
            m_CheckBox = new CheckBox(this);
            m_CheckBox.Dock = Pos.Left;
            m_CheckBox.Margin = new Margin(0, 2, 2, 2);
            m_CheckBox.IsTabable = false;
            m_CheckBox.CheckChanged += OnCheckChanged;

            m_Label = new LabelClickable(this);
            m_Label.Dock = Pos.Fill;
            m_Label.Clicked += m_CheckBox.Press;
            m_Label.IsTabable = false;

            IsTabable = false;
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LabeledCheckBox"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public LabeledCheckBox(Control parent)
            : base(parent)
        {
            SetSize(200, 19);
            m_CheckBox               = new CheckBox(this);
            m_CheckBox.Dock          = Pos.Left;
            m_CheckBox.Margin        = new Margin(0, 2, 2, 2);
            m_CheckBox.IsTabable     = false;
            m_CheckBox.CheckChanged += OnCheckChanged;

            m_Label           = new LabelClickable(this);
            m_Label.Dock      = Pos.Fill;
            m_Label.Clicked  += m_CheckBox.Press;
            m_Label.IsTabable = false;

            IsTabable = false;
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LabeledRadioButton"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public LabeledRadioButton(Control parent)
            : base(parent)
        {
            SetSize(100, 20);

            m_RadioButton = new RadioButton(this);
            //m_RadioButton.Dock = Pos.Left; // no docking, it causes resizing
            //m_RadioButton.Margin = new Margin(0, 2, 2, 2);
            m_RadioButton.IsTabable = false;
            m_RadioButton.KeyboardInputEnabled = false;

            m_Label = new LabelClickable(this);
            m_Label.Alignment = Pos.Bottom | Pos.Left;
            m_Label.Text = "Radio Button";
            //m_Label.Dock = Pos.Fill;
            m_Label.Clicked += m_RadioButton.Press;
            m_Label.IsTabable = false;
            m_Label.KeyboardInputEnabled = false;
            m_Label.AutoSizeToContents = true;
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LabeledRadioButton"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public LabeledRadioButton(Control parent)
            : base(parent)
        {
            SetSize(100, 20);

            m_RadioButton = new RadioButton(this);
            //m_RadioButton.Dock = Pos.Left; // no docking, it causes resizing
            //m_RadioButton.Margin = new Margin(0, 2, 2, 2);
            m_RadioButton.IsTabable            = false;
            m_RadioButton.KeyboardInputEnabled = false;

            m_Label           = new LabelClickable(this);
            m_Label.Alignment = Pos.Bottom | Pos.Left;
            m_Label.Text      = "Radio Button";
            //m_Label.Dock = Pos.Fill;
            m_Label.Clicked             += m_RadioButton.Press;
            m_Label.IsTabable            = false;
            m_Label.KeyboardInputEnabled = false;
            m_Label.AutoSizeToContents   = true;
        }
Example #5
0
        public void TestLabelClickable()
        {
            var control = new LabelClickable(canvas);
            control.Text = "LabelClickable";

            GUI.Test(control, "LabelClickable1");
        }