예제 #1
0
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            /* we only add support for DockPlacement.Center docking
             * strategy here... for the rest use our parent class' method */
            if (position == DockPlacement.Center)
            {
                /* we can only dock simple (not compound) items */
                if (requestor.IsCompound)
                {
                    requestor.Freeze();
                    dockInfo = new DockInfo(position, data);
                    requestor.Foreach(new Callback(DockChild));
                    requestor.Thaw();
                }
                else
                {
                    DockItem requestorItem = requestor as DockItem;
                    Widget   label         = requestorItem.TabLabel;
                    if (label == null)
                    {
                        label = new Label(requestorItem.LongName);
                        requestorItem.TabLabel = label;
                    }

                    int tabPosition = -1;
                    if (data is Int32)
                    {
                        tabPosition = Convert.ToInt32(data);
                    }
                    ((Notebook)Child).InsertPage(requestor, label, tabPosition);
                    requestor.DockObjectFlags |= DockObjectFlags.Attached;
                }
            }
            else
            {
                base.OnDocked(requestor, position, data);
            }
        }
예제 #2
0
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            /* we only add support for DockPlacement.Center docking
               strategy here... for the rest use our parent class' method */
            if (position == DockPlacement.Center) {
                /* we can only dock simple (not compound) items */
                if (requestor.IsCompound) {
                    requestor.Freeze ();
                    dockInfo = new DockInfo (position, data);
                    requestor.Foreach (new Callback (DockChild));
                    requestor.Thaw ();
                } else {
                    DockItem requestorItem = requestor as DockItem;
                    Widget label = requestorItem.TabLabel;
                    if (label == null) {
                        label = new Label (requestorItem.LongName);
                        requestorItem.TabLabel = label;
                    }

                    int tabPosition = -1;
                    if (data is Int32)
                        tabPosition = Convert.ToInt32 (data);
                    ((Notebook)Child).InsertPage (requestor, label, tabPosition);
                    requestor.DockObjectFlags |= DockObjectFlags.Attached;
                }
            } else {
                base.OnDocked (requestor, position, data);
            }
        }