Example #1
0
        DockObject SetupObject(XmlNode node)
        {
            DockObject obj = null;

            if (node.Name == "notebook")
            {
                DockNotebook dn = new DockNotebook();
                dn.Bind(master);
                dn.FromXml(node);
                return(dn);
            }
            if (node.Name == "paned")
            {
                DockPaned dp = new DockPaned();
                dp.Bind(master);
                dp.FromXml(node);
                return(dp);
            }

            string name = null;

            if (node.Attributes["name"] != null)
            {
                name = node.Attributes["name"].Value;
            }

            if (name != null && name.Length > 0)
            {
                obj = master.GetObject(name);
            }
            else
            {
                Console.WriteLine("While loading layout: don't know how to create a dock object whose nick is '{0}'", name);
            }

            if (obj != null)
            {
                obj.FromXml(node);
            }

            return(obj);
        }
Example #2
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 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 ();
        }
Example #4
0
        DockObject SetupObject(XmlNode node)
        {
            DockObject obj = null;
            if (node.Name == "notebook") {
                DockNotebook dn = new DockNotebook ();
                dn.Bind (master);
                dn.FromXml (node);
                return dn;
            }
            if (node.Name == "paned") {
                DockPaned dp = new DockPaned ();
                dp.Bind (master);
                dp.FromXml (node);
                return dp;
            }

            string name = null;
            if (node.Attributes["name"] != null)
                name = node.Attributes["name"].Value;

            if (name != null && name.Length > 0) {
                obj = master.GetObject (name);
            }
            else {
                Console.WriteLine ("While loading layout: don't know how to create a dock object whose nick is '{0}'", name);
            }

            if (obj != null)
                obj.FromXml (node);

            return obj;
        }