Exemple #1
0
            internal bool HasToolbar;            //small caption, maybe no splitter etc

            /// <summary>
            /// This ctor is used at startup, when adding from XML.
            /// </summary>
            internal _Panel(AuDockPanel manager, _Split parentSplit, XElement x, _Tab parentTab = null) : base(manager, parentSplit)
            {
                var name = x.Attr("name");
                var c    = manager._initControls[name];

                _manager._aPanel.Add(this);

                this.Content = c;
                Debug.Assert(c.Name == name);
                this.Name      = name;
                this.ParentTab = parentTab;

                if (c is ToolStrip ts)
                {
                    _InitToolstrip(ts);
                }
                else if (x.HasAttr("doc"))
                {
                    this.HasDocument = true;
                    //	c.AccessibleRole = AccessibleRole.Document; //no, its child is DOCUMENT
                    //} else {
                    //	c.AccessibleRole = AccessibleRole.Pane;
                }
                c.AccessibleRole = AccessibleRole.Pane;

                this.InitDockStateFromXML(x);
            }
Exemple #2
0
            internal _Float(AuDockPanel manager, _ContentNode gc)
            {
                _manager = manager;
                _gc      = gc;

                var gp = _gc as _Panel;

                //we'll use this to prevent window activation on click, for toolbar and menubar classes that support it
                _hasToolbar = (gp != null && gp.HasToolbar && (gp.Content is Util.AToolStrip || gp.Content is Util.AMenuStrip));

                this.SuspendLayout();
                this.Font            = _manager.Font;
                this.AutoScaleMode   = AutoScaleMode.None;
                this.StartPosition   = FormStartPosition.Manual;
                this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
                this.SetStyle(ControlStyles.ResizeRedraw | ControlStyles.Opaque | ControlStyles.OptimizedDoubleBuffer, true);
                this.MinimumSize = new Size(34, 30);
                this.Text        = gc.ToString();
                this.ResumeLayout();

                var f = _manager.TopLevelControl;

                f.VisibleChanged += ManagerForm_VisibleChanged;
                //f.EnabledChanged += ManagerForm_EnabledChanged; //in most cases does not work. Instead the main form on WM_ENABLE calls EnableDisableAllFloatingWindows.
            }
Exemple #3
0
            /// <summary>
            /// This ctor is used when a floating _Panel dropped on a docked non-tabbed _Panel caption.
            /// item1 or item2 must be docked, but not both.
            /// </summary>
            internal _Tab(AuDockPanel manager, _Split parentSplit, _Panel item1, _Panel item2) : base(manager, parentSplit)
            {
                manager._aTab.Add(this);

                this.Items = new List <_Panel>()
                {
                    item1, item2
                };
                item1.ParentTab = item2.ParentTab = this;
                Debug.Assert(item1.IsDocked != item2.IsDocked);
                _dockedItemCount = 1;
                this.SetActiveItem(item1.IsDocked ? item1 : item2);
            }
Exemple #4
0
            /// <summary>
            /// This ctor is used when a floating _ContentNode dropped on a docked _ContentNode.
            /// child1 or child2 must be docked, but not both.
            /// </summary>
            internal _Split(AuDockPanel manager, _Split parentSplit, _Node child1, _Node child2, bool isVertical) : base(manager, parentSplit)
            {
                manager._aSplit.Add(this);

                Child1             = child1;
                Child2             = child2;
                child1.ParentSplit = child2.ParentSplit = this;
                Debug.Assert(child1.IsDocked != child2.IsDocked);
                _dockedChildCount = 1;
                IsVerticalSplit   = isVertical;
                SplitterWidth     = _splitterWidth;
                _isFraction       = true;
                _fraction         = 0.5F;
            }
Exemple #5
0
                internal _DockIndicator(AuDockPanel manager, _Float gfloat)
                {
                    _manager = manager;
                    _float   = gfloat;
                    _target  = new DockTarget();

                    this.SuspendLayout();
                    this.AutoScaleMode   = AutoScaleMode.None;
                    this.FormBorderStyle = FormBorderStyle.None;
                    this.StartPosition   = FormStartPosition.Manual;
                    this.Bounds          = _manager._firstSplit.RectangleInScreen;
                    this.Opacity         = 0.3;
                    this.TransparencyKey = Color.Yellow;
                    this.SetStyle(ControlStyles.Opaque, true);
                    this.ResumeLayout(false);
                }
Exemple #6
0
 internal _PainTools(AuDockPanel manager)
 {
     if (!_inited)
     {
         brushSplitter               = new SolidBrush(manager.BackColor);
         brushCaptionBack            = Brushes.LightSteelBlue;
         brushInactiveTabBack        = Brushes.Gainsboro;
         brushCaptionText            = Brushes.Black;
         brushActiveTabBack          = Brushes.WhiteSmoke;
         txtFormatHorz               = new StringFormat(StringFormatFlags.NoWrap);
         txtFormatVert               = new StringFormat(StringFormatFlags.NoWrap | StringFormatFlags.DirectionVertical);
         txtFormatHorz.LineAlignment = txtFormatVert.LineAlignment = StringAlignment.Center;
         //txtFormatVert.Trimming = StringTrimming.EllipsisCharacter; //.NET bug with vertical: displays a rectangle or nothing, instead of ...
         //txtFormatHorz.Trimming = StringTrimming.EllipsisCharacter; //no. The string is short, and the ... just hides useful characters.
         _inited = true;
     }
 }
Exemple #7
0
            bool _onlyIcons;              //display only icons in tab buttons (too small to display text)

            /// <summary>
            /// This ctor is used at startup, when adding from XML.
            /// </summary>
            internal _Tab(AuDockPanel manager, _Split parentSplit, XElement x) : base(manager, parentSplit)
            {
                manager._aTab.Add(this);

                int iAct    = x.Attr("active", 0);
                var xPanels = x.Elements("panel");

                this.Items = new List <_Panel>();

                int i = 0;

                foreach (var xx in xPanels)
                {
                    var gp = new _Panel(manager, parentSplit, xx, this);
                    this.Items.Add(gp);
                    if (gp.IsDocked)
                    {
                        _dockedItemCount++;
                        if (i == iAct || this.ActiveItem == null)
                        {
                            this.ActiveItem = gp;                                                              //if iAct invalid, let the first docked panel be active
                        }
                    }
                    i++;
                }

                foreach (var gp in this.Items)
                {
                    if (gp.IsDocked && gp != this.ActiveItem)
                    {
                        gp.Content.Visible = false;
                    }
                }

                this.InitDockStateFromXML(x);
            }
Exemple #8
0
 internal _Node(AuDockPanel manager, _Split parentSplit)
 {
     _manager    = manager;
     ParentSplit = parentSplit;
     //manager._nodes.Add(this);
 }
Exemple #9
0
            internal _DockState SavedVisibleDockState;                 //when hidden, in what state to show

            internal _ContentNode(AuDockPanel manager, _Split parentSplit) : base(manager, parentSplit)
            {
                _parentControl = manager;
            }
Exemple #10
0
 internal _DummyNode(AuDockPanel manager, _Split parentSplit) : base(manager, parentSplit)
 {
     this.DockState = _DockState.Hidden;
 }
Exemple #11
0
 public _AccContainer(Control ownerControl, AuDockPanel manager) : base(ownerControl)
 {
     _manager = manager;
     _control = ownerControl;
     _gf      = ownerControl as _Float;
 }
Exemple #12
0
            int _width;             //used if !_isFraction; if _isWidth1, it is Child1 width, else Child2 with

            /// <summary>
            /// This ctor is used at startup, when adding from XML.
            /// </summary>
            internal _Split(AuDockPanel manager, _Split parentSplit, XElement x) : base(manager, parentSplit)
            {
                manager._aSplit.Add(this);

                if (!x.HasAttr("hor"))
                {
                    IsVerticalSplit = true;
                }
                int k = x.Attr("splitter", -1); if (k < 0 || k > 20)

                {
                    k = _splitterWidth;
                }

                this.SplitterWidth = k;

                //SHOULDDO: use DPI-dependent units, not pixels. Especially if form size depends on DPI.
                if (!(_isFraction = x.Attr(out _fraction, "f")) && !(_isWidth1 = x.Attr(out _width, "w1")))
                {
                    _width = x.Attr("w2", 1);
                }

                foreach (var xe in x.Elements())
                {
                    _Node gn = null;
                    switch (xe.Name.LocalName)
                    {
                    case "panel":
                        gn = new _Panel(manager, this, xe);
                        break;

                    case "split":
                        gn = new _Split(manager, this, xe);
                        break;

                    case "tab":
                        gn = new _Tab(manager, this, xe);
                        break;

                    case "dummy":
                        gn = new _DummyNode(_manager, this);
                        break;

                    default: continue;
                    }

                    if (gn.IsDocked)
                    {
                        _dockedChildCount++;
                    }

                    if (Child1 == null)
                    {
                        Child1 = gn;
                    }
                    else
                    {
                        Child2 = gn; break;
                    }
                }
                if (Child2 == null)
                {
                    throw new Exception();
                }

                if (_dockedChildCount == 0)
                {
                    this.DockState = _DockState.Hidden;
                }
            }