Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TreeNode"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public TreeNode(ControlBase parent)
            : base(parent)
        {
            m_ToggleButton = new TreeToggleButton(null);
            m_ToggleButton.ToolTipProvider = false;
            m_ToggleButton.SetBounds(0, 0, 15, 15);
            m_ToggleButton.Toggled += OnToggleButtonPress;
            // m_ToggleButton.Dock = Dock.Left;

            m_Title = new TreeNodeLabel(null);
            m_Title.ToolTipProvider = false;
            m_Title.DoubleClicked  += OnDoubleClickName;

            m_Title.Clicked += OnClickName;
            m_Title.Dock     = Dock.Top;
            m_Title.Margin   = new Margin(16, 0, 0, 0);
            // m_Title.BoundsChanged +=
            PrivateChildren.Insert(0, m_ToggleButton);
            PrivateChildren.Insert(0, m_Title);
            m_Panel.Dock = Dock.Fill;
            m_Panel.Hide();
            m_ToggleButton.Hide();

            m_Root       = parent is TreeControl;
            m_Selected   = false;
            m_Selectable = true;

            Dock = Dock.Top;
            AutoSizeToContents         = true;
            m_Panel.AutoSizeToContents = true;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WindowControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        /// <param name="caption">Window caption.</param>
        /// <param name="modal">Determines whether the window should be modal.</param>
        public WindowControl(ControlBase parent, string title = "")
            : base(parent)
        {
            m_TitleBar = new Dragger(null)
            {
                Height = 24,
                Target = this,
                Dock   = Dock.Top,
                Margin = new Margin(0, 0, 0, 6)
            };
            PrivateChildren.Insert(0, m_TitleBar);

            m_Title = new TitleLabel(m_TitleBar, this)
            {
                Alignment   = Pos.Left | Pos.Top,
                Text        = title,
                Dock        = Dock.Fill,
                TextPadding = new Padding(8, 4, 0, 0),
                TextColor   = Skin.Colors.Text.AccentForeground,
            };

            m_CloseButton = new CloseButton(m_TitleBar, this)
            {
                Width     = 24,
                Height    = 24,
                Dock      = Dock.Right,
                IsTabable = false,
                Name      = "closeButton"
            };
            m_CloseButton.Clicked += CloseButtonPressed;
            //Create a blank content control, dock it to the top - Should this be a ScrollControl?
            // GetResizer(8).Hide();
            _resizer_top.Hide();
            IsTabable                  = false;
            MinimumSize                = new Size(100, 50);
            ClampMovement              = true;
            KeyboardInputEnabled       = false;
            m_Panel.Dock               = Dock.Fill;
            m_Panel.AutoSizeToContents = true;
            IsHidden = true;
            HideResizersOnDisable = false;
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResizableControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public ResizableControl(ControlBase parent)
            : base(parent)
        {
            MinimumSize     = new Size(5, 5);
            m_ClampMovement = false;

            _resizer_bottom           = new Resizer(null);
            _resizer_bottom.Dock      = Dock.Bottom;
            _resizer_bottom.ResizeDir = Pos.Bottom;
            _resizer_bottom.Resized  += OnResized;
            _resizer_bottom.Target    = this;

            _resizer_top           = new Resizer(null);
            _resizer_top.Dock      = Dock.Top;
            _resizer_top.ResizeDir = Pos.Top;
            _resizer_top.Resized  += OnResized;
            _resizer_top.Target    = this;

            _resizer_left           = new Resizer(null);
            _resizer_left.Dock      = Dock.Left;
            _resizer_left.ResizeDir = Pos.Left;
            _resizer_left.Resized  += OnResized;
            _resizer_left.Target    = this;

            _resizer_right           = new Resizer(null);
            _resizer_right.Dock      = Dock.Right;
            _resizer_right.ResizeDir = Pos.Right;
            _resizer_right.Resized  += OnResized;
            _resizer_right.Target    = this;



            var sizebl = new Resizer(_resizer_bottom);

            sizebl.Dock      = Dock.Left;
            sizebl.ResizeDir = Pos.Bottom | Pos.Left;
            sizebl.Resized  += OnResized;
            sizebl.Target    = this;

            var sizebr = new Resizer(_resizer_bottom);

            sizebr.Dock      = Dock.Right;
            sizebr.ResizeDir = Pos.Bottom | Pos.Right;
            sizebr.Resized  += OnResized;
            sizebr.Target    = this;

            var sizetl = new Resizer(_resizer_top);

            sizetl.Dock      = Dock.Left;
            sizetl.ResizeDir = Pos.Left | Pos.Top;
            sizetl.Resized  += OnResized;
            sizetl.Target    = this;

            var sizetr = new Resizer(_resizer_top);

            sizetr.Dock      = Dock.Right;
            sizetr.ResizeDir = Pos.Right | Pos.Top;
            sizetr.Resized  += OnResized;
            sizetr.Target    = this;

            PrivateChildren.Insert(0, _resizer_top);
            PrivateChildren.Insert(1, _resizer_bottom);
            PrivateChildren.Insert(2, _resizer_right);
            PrivateChildren.Insert(3, _resizer_left);
            m_Resizers = new Resizer[]
            {
                _resizer_top,
                _resizer_bottom,
                _resizer_left,
                _resizer_right,
                sizetr,
                sizetl,
                sizebr,
                sizebl
            };
        }