Example #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;
        }
Example #2
0
 public Container(ControlBase parent) : base(parent)
 {
     m_Panel      = new ContainerPanel(null);
     m_Panel.Dock = Dock.Fill;
     PrivateChildren.Add(m_Panel);
     this.BoundsOutlineColor = Color.Cyan;
 }
Example #3
0
        // public string Text
        // {
        //     get
        //     {
        //         return _label.Text;
        //     }
        //     set
        //     {
        //         _label.Text = value;
        //     }
        // }
        // public string TitleText
        // {
        //     get
        //     {
        //         return _label.Text;
        //     }
        //     set
        //     {
        //         _label.Text = value;
        //     }
        // }
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupBox"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public Notification(ControlBase parent) : base(parent)
        {
            Dock = Dock.Bottom;
            Invalidate();
            IsHidden = true;
            SetSize(200, 100);

            m_TitleBar = new ControlBase(null)
            {
                Height            = 24,
                Dock              = Dock.Top,
                Margin            = new Margin(0, 0, 0, 6),
                MouseInputEnabled = false
            };
            PrivateChildren.Add(m_TitleBar);
            _title = new Label(m_TitleBar)
            {
                Dock   = Dock.Left,
                Text   = "Notification",
                Margin = new Margin(6, 3, 0, 0),
            };
            _label = new RichLabel(this)
            {
                Dock = Dock.Fill, AutoSizeToContents = true
            };
            //Margin = new Margin(5, 5, 5, 5);
            Clicked += (o, e) =>
            {
                CloseNotification();
            };
            m_Panel.Clicked += (o, e) =>
            {
                CloseNotification();
            };
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TabControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public TabControl(ControlBase parent)
            : base(parent)
        {
            m_Scroll       = new ScrollBarButton[2];
            m_ScrollOffset = 0;

            m_TabStrip = new TabStrip(null);
            m_TabStrip.StripPosition = Dock.Top;

            // Make this some special control?
            m_Scroll[0] = new ScrollBarButton(null);
            m_Scroll[0].SetDirectionLeft();
            m_Scroll[0].Clicked += ScrollPressedLeft;
            m_Scroll[0].SetSize(14, 16);

            m_Scroll[1] = new ScrollBarButton(null);
            m_Scroll[1].SetDirectionRight();
            m_Scroll[1].Clicked += ScrollPressedRight;
            m_Scroll[1].SetSize(14, 16);

            PrivateChildren.Add(m_TabStrip);
            PrivateChildren.Add(m_Scroll[0]);
            PrivateChildren.Add(m_Scroll[1]);

            IsTabable = false;
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public ScrollControl(ControlBase parent)
            : base(parent)
        {
            //todo scrollbars currently hide borders of our owner
            m_VerticalScrollBar = new VerticalScrollBar(null)
            {
                Dock        = Dock.Right,
                NudgeAmount = 30,
            };
            m_VerticalScrollBar.BarMoved += VBarMoved;
            m_CanScrollV = true;

            m_HorizontalScrollBar = new HorizontalScrollBar(null)
            {
                Dock        = Dock.Bottom,
                NudgeAmount = 30,
            };
            m_HorizontalScrollBar.BarMoved += HBarMoved;
            m_CanScrollH = true;
            PrivateChildren.Add(m_VerticalScrollBar);
            PrivateChildren.Add(m_HorizontalScrollBar);
            m_Panel.Dock = Dock.None;
            SendChildToBack(m_Panel);
            m_Panel.AutoSizeToContents = true;
            m_AutoHideBars             = true;
            m_HorizontalScrollBar.Hide();
            m_VerticalScrollBar.Hide();
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupBox"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public GroupBox(ControlBase parent) : base(parent)
 {
     m_Label                    = new Label(null);
     m_Label.TextPadding        = new Padding(10, 0, 10, 0);
     m_Label.Alignment          = Pos.Top | Pos.Left;
     m_Label.AutoSizeToContents = true;
     PrivateChildren.Add(m_Label);
     m_Panel.AutoSizeToContents = true;
     Invalidate();
     //Margin = new Margin(5, 5, 5, 5);
 }
Example #7
0
 // todo: rename?
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyTable"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public PropertyTable(ControlBase parent, int StartingBarPosition = 80)
     : base(parent)
 {
     Width         = StartingBarPosition + 50;
     m_SplitterBar = new SplitterBar(null);
     m_SplitterBar.SetPosition(StartingBarPosition, 0);
     m_SplitterBar.Cursor   = Cursors.SizeWE;
     m_SplitterBar.Dragged += OnSplitterMoved;
     m_SplitterBar.ShouldDrawBackground = false;
     PrivateChildren.Add(m_SplitterBar);
     m_Panel.AutoSizeToContents = true;
 }
Example #8
0
        public override void SendChildToBack(ControlBase control)
        {
            var privateidx = PrivateChildren.IndexOf(control);

            if (privateidx != -1)
            {
                PrivateChildren.SendToBack(privateidx);
            }
            else
            {
                base.SendChildToBack(control);
            }
        }
Example #9
0
        public override void BringChildToFront(ControlBase control)
        {
            var privateidx = PrivateChildren.IndexOf(control);

            if (privateidx != -1)
            {
                PrivateChildren.BringToFront(privateidx);
            }
            else
            {
                base.BringChildToFront(control);
            }
        }
Example #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CollapsibleCategory"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public CollapsibleCategory(CollapsibleList parent) : base(parent)
        {
            m_HeaderButton                    = new CategoryHeaderButton(null);
            m_HeaderButton.Text               = "Category Title"; // [omeg] todo: i18n
            m_HeaderButton.Dock               = Dock.Top;
            m_HeaderButton.Toggled           += OnHeaderToggle;
            m_HeaderButton.AutoSizeToContents = true;
            PrivateChildren.Add(m_HeaderButton);
            m_HeaderButton.SendToBack();

            m_List = parent;

            AutoSizeToContents         = true;
            m_Panel.Dock               = Dock.Fill;
            m_Panel.AutoSizeToContents = true;
            this.Dock = Dock.Top;
            Margin    = new Margin(2, 2, 2, 2);
        }
Example #11
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;
        }
Example #12
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
            };
        }