Example #1
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 ();
            }
        }
Example #2
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();
            }
        }