Exemple #1
0
        public void Dock(DockObject requestor, DockPlacement position, object data)
        {
            if (requestor == null || requestor == this)
            {
                return;
            }

            if (master == null)
            {
                Console.WriteLine("Dock operation requested in a non-bound object {0}.", this);
                Console.WriteLine("This might break.");
            }

            if (!requestor.IsBound)
            {
                requestor.Bind(Master);
            }

            if (requestor.Master != Master)
            {
                Console.WriteLine("Cannot dock {0} to {1} as they belong to different masters.",
                                  requestor, this);
                return;
            }

            /* first, see if we can optimize things by reordering */
            if (position != DockPlacement.None)
            {
                DockObject parent = ParentObject;
                if (OnReorder(requestor, position, data) ||
                    (parent != null && parent.OnReorder(requestor, position, data)))
                {
                    return;
                }
            }

            /* freeze the object, since under some conditions it might
             * be destroyed when detaching the requestor */
            Freeze();

            /* detach the requestor before docking */
            if (requestor.IsAttached)
            {
                requestor.Detach(false);
            }

            /* notify interested parties that an object has been docked. */
            if (position != DockPlacement.None)
            {
                OnDocked(requestor, position, data);
                DockedHandler handler = Docked;
                if (handler != null)
                {
                    DockedArgs args = new DockedArgs(requestor, position);
                    handler(this, args);
                }
            }

            Thaw();
        }
Exemple #2
0
        public void DockTo(DockItem target, DockPlacement position)
        {
            if (target == null && position != DockPlacement.Floating)
            {
                return;
            }

            if (position == DockPlacement.Floating || target == null)
            {
                if (!IsBound)
                {
                    Console.WriteLine("Attempting to bind an unbound item");
                    return;
                }

                // FIXME: save previous docking position for later re-docking?

                dragoffX = dragoffY = 0;
                ((Dock)Master.Controller).AddFloatingItem(this, 0, 0, -1, -1);
            }
            else
            {
                target.Dock(this, position, null);
            }
        }
        public DockPlaceholder(string name, DockObject obj,
                               DockPlacement position, bool sticky)
        {
            WidgetFlags |= WidgetFlags.NoWindow;
            WidgetFlags &= ~(WidgetFlags.CanFocus);

            Sticky = sticky;
            Name   = name;

            if (obj != null)
            {
                Attach(obj);

                if (position == DockPlacement.None)
                {
                    position = DockPlacement.Center;
                }

                NextPlacement = position;

                //the top placement will be consumed by the toplevel dock, so add a dummy placement
                if (obj is Dock)
                {
                    NextPlacement = DockPlacement.Center;
                }

                // try a recursion
                DoExcursion();
            }
        }
        public DockPlaceholder(string name, DockObject obj,
					DockPlacement position, bool sticky)
        {
            WidgetFlags |= WidgetFlags.NoWindow;
            WidgetFlags &= ~(WidgetFlags.CanFocus);

            Sticky = sticky;
            Name = name;

            if (obj != null) {
                Attach (obj);

                if (position == DockPlacement.None)
                    position = DockPlacement.Center;

                NextPlacement = position;

                //the top placement will be consumed by the toplevel dock, so add a dummy placement
                if (obj is Dock)
                    NextPlacement = DockPlacement.Center;

                // try a recursion
                DoExcursion ();
            }
        }
Exemple #5
0
        protected override void OnAdded(Widget widget)
        {
            if (Child == null)
            {
                return;
            }

            Paned paned = Child as Paned;

            if (paned.Child1 != null && paned.Child2 != null)
            {
                return;
            }

            DockItem      item = widget as DockItem;
            DockPlacement pos  = DockPlacement.None;

            if (paned.Child1 == null)
            {
                pos = (Orientation == Orientation.Horizontal ?
                       DockPlacement.Left : DockPlacement.Top);
            }
            else
            {
                pos = (Orientation == Orientation.Horizontal ?
                       DockPlacement.Right : DockPlacement.Bottom);
            }

            if (pos != DockPlacement.None)
            {
                Dock(item, pos, null);
            }
        }
Exemple #6
0
        public override bool OnChildPlacement(DockObject child, ref DockPlacement placement)
        {
            DockPlacement pos = DockPlacement.None;

            if (this.Child != null)
            {
                Paned paned = this.Child as Paned;
                if (child == paned.Child1)
                {
                    pos = this.Orientation == Orientation.Horizontal ? DockPlacement.Left : DockPlacement.Top;
                }
                else if (child == paned.Child2)
                {
                    pos = this.Orientation == Orientation.Horizontal ? DockPlacement.Right : DockPlacement.Bottom;
                }
            }

            if (pos != DockPlacement.None)
            {
                placement = pos;
                return(true);
            }

            return(base.OnChildPlacement(child, ref pos));
        }
Exemple #7
0
        public bool ChildPlacement(DockObject child, ref DockPlacement placement)
        {
            if (!IsCompound)
            {
                return(false);
            }

            return(OnChildPlacement(child, ref placement));
        }
        public DockRequest(DockRequest copy)
        {
            applicant = copy.Applicant;
            target = copy.Target;
            x = copy.X;
            y = copy.Y;
            width = copy.Width;
            height = copy.Height;
            position = copy.Position;

            extra = copy.Extra;
        }
Exemple #9
0
        public DockRequest(DockRequest copy)
        {
            applicant = copy.Applicant;
            target    = copy.Target;
            x         = copy.X;
            y         = copy.Y;
            width     = copy.Width;
            height    = copy.Height;
            position  = copy.Position;

            extra = copy.Extra;
        }
        void OnHostDetached(object sender, DetachedArgs a)
        {
            // skip sticky objects
            if (sticky)
            {
                return;
            }

            // go up in the hierarchy
            DockObject newHost = host.ParentObject;

            while (newHost != null)
            {
                DockPlacement pos = DockPlacement.None;

                // get a placement hint from the new host
                if (newHost.ChildPlacement(host, ref pos))
                {
                    NextPlacement = pos;
                }
                else
                {
                    Console.WriteLine("Something weird happened while getting the child placement for {0} from parent {1}", host, newHost);
                }

                // we found a "stable" dock object
                if (newHost.InDetach)
                {
                    break;
                }

                newHost = newHost.ParentObject;
            }

            // disconnect host
            DisconnectHost();

            // the toplevel was detached: we attach ourselves to the
            // controller with an initial placement of floating
            if (newHost == null)
            {
                newHost       = this.Master.Controller;
                NextPlacement = DockPlacement.Floating;
            }

            if (newHost != null)
            {
                ConnectHost(newHost);
            }

            PrintPlacementStack();
        }
Exemple #11
0
        public void AddItem(DockItem item, DockPlacement placement)
        {
            switch (placement)
            {
            case DockPlacement.Center:
                pane.Pack1(item, resize: true, shrink: false);
                break;

            case DockPlacement.Right:
                right_panel.AddItem(item);
                break;
            }
        }
Exemple #12
0
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            if (Child == null)
            {
                return;
            }

            Paned paned = (Paned)Child;
            bool  done  = false;

            /* see if we can dock the item in our paned */
            switch (Orientation)
            {
            case Orientation.Horizontal:
                if (paned.Child1 == null && position == DockPlacement.Left)
                {
                    paned.Pack1(requestor, false, false);
                    done = true;
                }
                else if (paned.Child2 == null && position == DockPlacement.Right)
                {
                    paned.Pack2(requestor, true, true);
                    done = true;
                }
                break;

            case Orientation.Vertical:
                if (paned.Child1 == null && position == DockPlacement.Top)
                {
                    paned.Pack1(requestor, true, true);
                    done = true;
                }
                else if (paned.Child2 == null && position == DockPlacement.Bottom)
                {
                    paned.Pack2(requestor, false, false);
                    done = true;
                }
                break;
            }

            if (!done)
            {
                /* this will create another paned and reparent us there */
                base.OnDocked(requestor, position, data);
            }
            else
            {
                ((DockItem)requestor).ShowGrip();
                requestor.DockObjectFlags |= DockObjectFlags.Attached;
            }
        }
Exemple #13
0
        public override bool OnReorder(DockObject requestor, DockPlacement position, object data)
        {
            if (Floating && position == DockPlacement.Floating && root == requestor)
            {
                if (window != null && data != null && data is Gdk.Rectangle)
                {
                    Gdk.Rectangle rect = (Gdk.Rectangle)data;
                    ((Window)window).Move(rect.X, rect.Y);
                    return(true);
                }
            }

            return(false);
        }
Exemple #14
0
        public override bool OnChildPlacement(DockObject child, ref DockPlacement placement)
        {
            if (root == child)
            {
                if (placement == DockPlacement.None ||
                    placement == DockPlacement.Floating)
                {
                    placement = DockPlacement.Top;
                }
                return(true);
            }

            return(false);
        }
        void OnHostDocked(object sender, DockedArgs a)
        {
            DockObject obj = sender as DockObject;

            // see if the given position is compatible for the stack's top element
            if (!sticky && placementStack != null)
            {
                DockPlacement pos = NextPlacement;
                if (obj.ChildPlacement(a.Requestor, ref pos))
                {
                    DoExcursion();
                }
            }

            PrintPlacementStack();
        }
Exemple #16
0
        public void AddItem(DockItem item, DockPlacement placement)
        {
            if (item == null)
            {
                return;
            }

            if (placement == DockPlacement.Floating)
            {
                AddFloatingItem(item, 0, 0, -1, -1);
            }
            else
            {
                Dock(item, placement, null);
            }
        }
 public override void OnDocked(DockObject requestor, DockPlacement position, object data)
 {
     if (host != null)
     {
         // we simply act as a placeholder for our host
         host.Dock(requestor, position, data);
     }
     else
     {
         if (!IsBound)
         {
             Console.WriteLine("Attempt to dock a dock object to an unbound placeholder");
             return;
         }
         // dock the item as a floating of the controller
         Master.Controller.Dock(requestor, DockPlacement.Floating, null);
     }
 }
Exemple #18
0
        public override bool OnReorder(DockObject requestor, DockPlacement position, object other_data)
        {
            bool handled = false;
            int  current_position, new_pos = -1;

            if (Child != null && position == DockPlacement.Center)
            {
                current_position = ((Notebook)Child).PageNum(requestor);
                if (current_position >= 0)
                {
                    handled = true;
                    if (other_data is Int32)
                    {
                        new_pos = Convert.ToInt32(other_data);
                    }
                    ((Notebook)Child).ReorderChild(requestor, new_pos);
                }
            }
            return(handled);
        }
Exemple #19
0
        public override bool OnChildPlacement(DockObject child, ref DockPlacement position)
        {
            DockPlacement pos = DockPlacement.None;

            if (Child != null)
            {
                foreach (Widget widget in ((Notebook)Child).Children)
                {
                    if (widget == child)
                    {
                        pos = DockPlacement.Center;
                        break;
                    }
                }
            }
            if (pos != DockPlacement.None)
            {
                position = pos;
                return(true);
            }
            return(false);
        }
        /*
         * Tries to shrink the placement stack by examining the host's
         * children and see if any of them matches the placement which is at
         * the top of the stack.  If this is the case, it tries again with the
         * new host.
         */
        public void DoExcursion()
        {
            if (host != null && !Sticky && placementStack != null && placementStack.Count > 0 && host.IsCompound)
            {
                DockPlacement pos;
                DockPlacement stack_pos = NextPlacement;
                foreach (Widget child in host.Children)
                {
                    DockObject item = child as DockObject;
                    if (item == null)
                    {
                        continue;
                    }
                    pos = stack_pos;

                    host.ChildPlacement(item, ref pos);
                    if (pos == stack_pos)
                    {
                        // remove the stack position
                        if (placementStack.Count > 1)
                        {
                            placementStack.Pop();
                        }
                        DisconnectHost();

                        // connect to the new host
                        ConnectHost(item);

                        // recurse ...
                        if (!item.InReflow)
                        {
                            DoExcursion();
                        }
                        break;
                    }
                }
            }
        }
Exemple #21
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);
            }
        }
Exemple #22
0
        public override bool OnReorder(DockObject requestor, DockPlacement position, object data)
        {
            if (Floating && position == DockPlacement.Floating && root == requestor) {
                if (window != null && data != null && data is Gdk.Rectangle) {
                    Gdk.Rectangle rect = (Gdk.Rectangle)data;
                    ((Window)window).Move (rect.X, rect.Y);
                    return true;
                }
            }

            return false;
        }
Exemple #23
0
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            DockObject parent    = ParentObject;
            DockObject newParent = null;
            bool       addOurselvesFirst;

            switch (position)
            {
            case DockPlacement.Top:
            case DockPlacement.Bottom:
                newParent         = new DockPaned(Orientation.Vertical);
                addOurselvesFirst = (position == DockPlacement.Bottom);
                break;

            case DockPlacement.Left:
            case DockPlacement.Right:
                newParent         = new DockPaned(Orientation.Horizontal);
                addOurselvesFirst = (position == DockPlacement.Right);
                break;

            case DockPlacement.Center:
                newParent         = new DockNotebook();
                addOurselvesFirst = true;
                break;

            default:
                Console.WriteLine("Unsupported docking strategy");
                return;
            }

            if (parent != null)
            {
                parent.Freeze();
            }

            DockObjectFlags |= DockObjectFlags.InReflow;
            Detach(false);
            newParent.Freeze();
            newParent.Bind(Master);

            if (addOurselvesFirst)
            {
                newParent.Add(this);
                newParent.Add(requestor);
            }
            else
            {
                newParent.Add(requestor);
                newParent.Add(this);
            }

            if (parent != null)
            {
                parent.Add(newParent);
            }

            if (Visible)
            {
                newParent.Show();
            }

            if (position != DockPlacement.Center && data != null && data is System.Int32)
            {
                if (newParent is DockPaned)
                {
                    ((DockPaned)newParent).Position = (int)data;
                }
            }

            DockObjectFlags &= ~(DockObjectFlags.InReflow);

            newParent.Thaw();
            if (parent != null)
            {
                parent.Thaw();
            }
        }
 public DockedArgs(DockObject requestor, DockPlacement position)
 {
     this.requestor = requestor;
     this.position = position;
 }
        public override bool OnChildPlacement(DockObject child, ref DockPlacement placement)
        {
            DockPlacement pos = DockPlacement.None;
            if (this.Child != null) {
                Paned paned = this.Child as Paned;
                if (child == paned.Child1)
                    pos = this.Orientation == Orientation.Horizontal ? DockPlacement.Left : DockPlacement.Top;
                else if (child == paned.Child2)
                    pos = this.Orientation == Orientation.Horizontal ? DockPlacement.Right : DockPlacement.Bottom;
            }

            if (pos != DockPlacement.None) {
                placement = pos;
                return true;
            }

            return base.OnChildPlacement (child, ref pos);
        }
        public void Dock(DockObject requestor, DockPlacement position, object data)
        {
            if (requestor == null || requestor == this)
                return;

            if (master == null) {
                Console.WriteLine ("Dock operation requested in a non-bound object {0}.", this);
                Console.WriteLine ("This might break.");
            }

            if (!requestor.IsBound)
                requestor.Bind (Master);

            if (requestor.Master != Master) {
                Console.WriteLine ("Cannot dock {0} to {1} as they belong to different masters.",
                           requestor, this);
                return;
            }

            /* first, see if we can optimize things by reordering */
            if (position != DockPlacement.None) {
                DockObject parent = ParentObject;
                if (OnReorder (requestor, position, data) ||
                    (parent != null && parent.OnReorder (requestor, position, data)))
                    return;
            }

            /* freeze the object, since under some conditions it might
               be destroyed when detaching the requestor */
            Freeze ();

            /* detach the requestor before docking */
            if (requestor.IsAttached)
                requestor.Detach (false);

            /* notify interested parties that an object has been docked. */
            if (position != DockPlacement.None) {
                OnDocked (requestor, position, data);
                DockedHandler handler = Docked;
                if (handler != null) {
                    DockedArgs args = new DockedArgs (requestor, position);
                    handler (this, args);
                }
            }

            Thaw ();
        }
        public override bool OnReorder(DockObject requestor, DockPlacement position, object other_data)
        {
            bool handled = false;
            int current_position, new_pos = -1;

            if (Child != null && position == DockPlacement.Center) {
                current_position = ((Notebook)Child).PageNum (requestor);
                if (current_position >= 0) {
                    handled = true;
                    if (other_data is Int32)
                        new_pos = Convert.ToInt32 (other_data);
                    ((Notebook)Child).ReorderChild (requestor, new_pos);
                }
            }
            return handled;
        }
 public override bool OnChildPlacement(DockObject child, ref DockPlacement position)
 {
     DockPlacement pos = DockPlacement.None;
     if (Child != null) {
         foreach (Widget widget in ((Notebook)Child).Children) {
             if (widget == child) {
                 pos = DockPlacement.Center;
                 break;
             }
         }
     }
     if (pos != DockPlacement.None) {
         position = pos;
         return true;
     }
     return false;
 }
        void GetPlacement(string placementString, out DockPlacement dockPlacement, out DockItem originItem)
        {
            // placementString can be: left, right, top, bottom, or a relative
            // position, for example: "ProjectPad/left" would show the pad at
            // the left of the project pad. When using
            // relative placements several positions can be provided. If the
            // pad can be placed in the first position, the next one will be
            // tried. For example "ProjectPad/left; bottom".

            dockPlacement = DockPlacement.None;
            string[] placementOptions = placementString.Split (';');
            foreach (string placementOption in placementOptions) {
                int i = placementOption.IndexOf ('/');
                if (i == -1) {
                    dockPlacement = (DockPlacement) Enum.Parse (typeof(DockPlacement), placementOption, true);
                    break;
                } else {
                    string id = placementOption.Substring (0, i);
                    originItem = dock.GetItemByName (id);
                    if (originItem != null && originItem.IsAttached) {
                        dockPlacement = (DockPlacement) Enum.Parse (typeof(DockPlacement), placementOption.Substring (i+1), true);
                        return;
                    }
                }
            }

            if (dockPlacement != DockPlacement.None) {
                // If there is a pad in the same position, place the new one
                // over the existing one with a new tab.
                foreach (IPadContent pad in activePadCollection) {
                    string[] places = pad.DefaultPlacement.Split (';');
                    foreach (string p in places)
                        if (string.Compare (p.Trim(), dockPlacement.ToString(), true) == 0) {
                            originItem = GetDockItem (pad);
                            if (originItem != null && originItem.IsAttached) {
                                dockPlacement = DockPlacement.Center;
                                return;
                            }
                        }
                }
            }

            originItem = null;
        }
Exemple #30
0
 public virtual void OnDocked(DockObject requestor, DockPlacement position, object data)
 {
 }
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            DockObject parent = ParentObject;
            DockObject newParent = null;
            bool addOurselvesFirst;

            switch (position) {
            case DockPlacement.Top:
            case DockPlacement.Bottom:
                newParent = new DockPaned (Orientation.Vertical);
                addOurselvesFirst = (position == DockPlacement.Bottom);
                break;
            case DockPlacement.Left:
            case DockPlacement.Right:
                newParent = new DockPaned (Orientation.Horizontal);
                addOurselvesFirst = (position == DockPlacement.Right);
                break;
            case DockPlacement.Center:
                newParent = new DockNotebook ();
                addOurselvesFirst = true;
                break;
            default:
                Console.WriteLine ("Unsupported docking strategy");
                return;
            }

            if (parent != null)
                parent.Freeze ();

            DockObjectFlags |= DockObjectFlags.InReflow;
            Detach (false);
            newParent.Freeze ();
            newParent.Bind (Master);

            if (addOurselvesFirst) {
                newParent.Add (this);
                newParent.Add (requestor);
            } else {
                newParent.Add (requestor);
                newParent.Add (this);
            }

            if (parent != null)
                parent.Add (newParent);

            if (Visible)
                newParent.Show ();

            if (position != DockPlacement.Center && data != null && data is System.Int32) {
                if (newParent is DockPaned)
                    ((DockPaned) newParent).Position = (int) data;
            }

            DockObjectFlags &= ~(DockObjectFlags.InReflow);

            newParent.Thaw ();
            if (parent != null)
                parent.Thaw ();
        }
        public void DockTo(DockItem target, DockPlacement position)
        {
            if (target == null && position != DockPlacement.Floating)
                return;

            if (position == DockPlacement.Floating || target == null) {
                if (!IsBound) {
                    Console.WriteLine ("Attempting to bind an unbound item");
                    return;
                }

                // FIXME: save previous docking position for later re-docking?

                dragoffX = dragoffY = 0;
                ((Dock)Master.Controller).AddFloatingItem (this, 0, 0, -1, -1);
            } else {
                target.Dock (this, position, null);
            }
        }
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            if (Child == null)
                return;

            Paned paned = (Paned)Child;
            bool done = false;

            /* see if we can dock the item in our paned */
            switch (Orientation) {
            case Orientation.Horizontal:
                if (paned.Child1 == null && position == DockPlacement.Left) {
                    paned.Pack1 (requestor, false, false);
                    done = true;
                } else if (paned.Child2 == null && position == DockPlacement.Right) {
                    paned.Pack2 (requestor, true, true);
                    done = true;
                }
                break;
            case Orientation.Vertical:
                if (paned.Child1 == null && position == DockPlacement.Top) {
                    paned.Pack1 (requestor, true, true);
                    done = true;
                } else if (paned.Child2 == null && position == DockPlacement.Bottom) {
                    paned.Pack2 (requestor, false, false);
                    done = true;
                }
                break;
            }

            if (!done) {
                /* this will create another paned and reparent us there */
                base.OnDocked (requestor, position, data);
            } else {
                ((DockItem)requestor).ShowGrip ();
                requestor.DockObjectFlags |= DockObjectFlags.Attached;
            }
        }
Exemple #34
0
        public void AddItem(DockItem item, DockPlacement placement)
        {
            if (item == null)
                return;

            if (placement == DockPlacement.Floating)
                AddFloatingItem (item, 0, 0, -1, -1);
            else
                Dock (item, placement, null);
        }
 public virtual bool OnChildPlacement(DockObject child, ref DockPlacement placement)
 {
     return false;
 }
 public override void OnDocked(DockObject requestor, DockPlacement position, object data)
 {
     if (host != null) {
         // we simply act as a placeholder for our host
         host.Dock (requestor, position, data);
     } else {
         if (!IsBound) {
             Console.WriteLine ("Attempt to dock a dock object to an unbound placeholder");
             return;
         }
         // dock the item as a floating of the controller
         Master.Controller.Dock (requestor, DockPlacement.Floating, null);
     }
 }
Exemple #37
0
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            /* only dock items allowed at this time */
            if (!(requestor is DockItem))
                return;

            if (position == DockPlacement.Floating) {
                int x = 0, y = 0, width = -1, height = -1;
                if (data != null && data is Gdk.Rectangle) {
                    Gdk.Rectangle rect = (Gdk.Rectangle)data;
                    x = rect.X;
                    y = rect.Y;
                    width = rect.Width;
                    height = rect.Height;
                }

                AddFloatingItem ((DockItem)requestor, x, y, width, height);
            } else if (root != null) {
                /* This is somewhat a special case since we know
                   which item to pass the request on because we only
                   have one child */
                root.Dock (requestor, position, null);
                SetWindowTitle ();
            } else { /* Item about to be added is root item. */
                root = requestor;
                root.DockObjectFlags |= DockObjectFlags.Attached;
                root.Parent = this;
                ((DockItem)root).ShowGrip ();

                /* Realize the item (create its corresponding GdkWindow)
                       when the Dock has been realized. */
                if (IsRealized)
                    root.Realize ();

                /* Map the widget if it's visible and the parent is
                       visible and has been mapped. This is done to make
                       sure that the GdkWindow is visible. */
                if (Visible && root.Visible) {
                    if (IsMapped)
                        root.Map ();

                    /* Make the widget resize. */
                    root.QueueResize ();
                }

                SetWindowTitle ();
            }
        }
Exemple #38
0
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            /* only dock items allowed at this time */
            if (!(requestor is DockItem))
            {
                return;
            }

            if (position == DockPlacement.Floating)
            {
                int x = 0, y = 0, width = -1, height = -1;
                if (data != null && data is Gdk.Rectangle)
                {
                    Gdk.Rectangle rect = (Gdk.Rectangle)data;
                    x      = rect.X;
                    y      = rect.Y;
                    width  = rect.Width;
                    height = rect.Height;
                }

                AddFloatingItem((DockItem)requestor, x, y, width, height);
            }
            else if (root != null)
            {
                /* This is somewhat a special case since we know
                 * which item to pass the request on because we only
                 * have one child */
                root.Dock(requestor, position, null);
                SetWindowTitle();
            }
            else                 /* Item about to be added is root item. */
            {
                root = requestor;
                root.DockObjectFlags |= DockObjectFlags.Attached;
                root.Parent           = this;
                ((DockItem)root).ShowGrip();

                /* Realize the item (create its corresponding GdkWindow)
                 * when the Dock has been realized. */
                if (IsRealized)
                {
                    root.Realize();
                }

                /* Map the widget if it's visible and the parent is
                 * visible and has been mapped. This is done to make
                 * sure that the GdkWindow is visible. */
                if (Visible && root.Visible)
                {
                    if (IsMapped)
                    {
                        root.Map();
                    }

                    /* Make the widget resize. */
                    root.QueueResize();
                }

                SetWindowTitle();
            }
        }
        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);
            }
        }
Exemple #40
0
 public DockInfo(DockPlacement position, object data)
 {
     this.position = position;
     this.data     = data;
 }
 public DockInfo(DockPlacement position, object data)
 {
     this.position = position;
     this.data = data;
 }
        public bool ChildPlacement(DockObject child, ref DockPlacement placement)
        {
            if (!IsCompound)
                return false;

            return OnChildPlacement (child, ref placement);
        }
Exemple #43
0
 public virtual bool OnReorder(DockObject child, DockPlacement new_position, object data)
 {
     return(false);
 }
Exemple #44
0
        public override bool OnChildPlacement(DockObject child, ref DockPlacement placement)
        {
            if (root == child) {
                if (placement == DockPlacement.None ||
                    placement == DockPlacement.Floating)
                    placement = DockPlacement.Top;
                return true;
            }

            return false;
        }
 public virtual void OnDocked(DockObject requestor, DockPlacement position, object data)
 {
 }
Exemple #46
0
 public virtual bool OnChildPlacement(DockObject child, ref DockPlacement placement)
 {
     return(false);
 }
 public virtual bool OnReorder(DockObject child, DockPlacement new_position, object data)
 {
     return false;
 }
Exemple #48
0
 public DockedArgs(DockObject requestor, DockPlacement position)
 {
     this.requestor = requestor;
     this.position  = position;
 }