Exemple #1
0
        public DockFrame()
        {
            paned1        = new Gtk.Paned(Orientation.Horizontal);
            paned1.Name   = "paned1";
            paned1.Expand = true;

            box2      = new Gtk.Box(Orientation.Vertical, 0);
            box2.Name = "box2";
            //box2.Expand = true;

            box1      = new Gtk.Box(Orientation.Vertical, 0);
            box1.Name = "box1";
            //box1.Expand = true;

            dock1 = new DockContainer(this);
            dock2 = new DockContainer(this);

            dock1.Name = "dock1";
            dock2.Name = "dock2";

            dock1.Expand = true;
            dock2.Expand = true;

            box1.PackEnd(dock1, true, true, 0);
            box2.PackEnd(dock2, true, true, 0);
            dock1.Expand = true;
            dock2.Expand = true;

            items        = new List <DockItemContainer>(100);
            lastposition = new Dictionary <string, DockFramePosition>(100);

            paned1.Add1(box1);
            paned1.Add2(box2);

            paned1.Position = 400;

            dock1.OnItemAdded += HandleDock1Added;
            dock1.OnPageAdded += HandleDock1Added;

            dock2.OnItemAdded += HandleDock2Added;
            dock2.OnPageAdded += HandleDock2Added;

            this.Add(paned1);
        }
Exemple #2
0
        public DockFrame()
        {
            paned1 = new Gtk.Paned(Orientation.Horizontal);
            paned1.Name ="paned1";
            paned1.Expand = true;

            box2 = new Gtk.Box(Orientation.Vertical,0);
            box2.Name ="box2";
            //box2.Expand = true;

            box1 = new Gtk.Box(Orientation.Vertical,0);
            box1.Name ="box1";
            //box1.Expand = true;

            dock1 = new DockContainer(this);
            dock2 = new DockContainer(this);

            dock1.Name = "dock1";
            dock2.Name = "dock2";

            dock1.Expand = true;
            dock2.Expand = true;

            box1.PackEnd(dock1,true,true,0);
            box2.PackEnd(dock2,true,true,0);
            dock1.Expand = true;
            dock2.Expand = true;

            items = new List<DockItemContainer>(100);
            lastposition = new Dictionary<string, DockFramePosition>(100);

            paned1.Add1(box1);
            paned1.Add2(box2);

            paned1.Position = 400;

            dock1.OnItemAdded += HandleDock1Added;
            dock1.OnPageAdded += HandleDock1Added;

            dock2.OnItemAdded += HandleDock2Added;
            dock2.OnPageAdded += HandleDock2Added;

            this.Add(paned1);
        }
Exemple #3
0
        protected void setPlaceholderWindowsize(int cX, int cY)
        {
            List<Widget> lst = new List<Widget>(100);
              addChildren(this,lst); //recursiv add all children in the list
              targetContainer = null;
            bool done = false;

            //foreach(Widget w in lst)
            for (int i=lst.Count-1;i>-1;i--)
              {
                    Widget w = lst[i];

                //Console.WriteLine("fe: " + w.Name);
                int rx = 0;
                int ry = 0;

                int sx,sy;
                this.Window.GetOrigin (out sx, out sy);
                if (w.Window != null)
                {
                    //Console.WriteLine("window:" + w.Window.ToString() + " sx: " + sx + " sy: " + sy);
                    w.Window.GetOrigin(out rx,out ry);
                    rx = rx - sx; //x of widget relativ to window
                    ry = ry - sy; //y of widget relative to window

                     if ( (rx <= cX) && (cX <= (rx+w.Allocation.Width)))
                     {
                        if ((ry <= cY) && (cY <= (ry+w.Allocation.Height)))
                        {
                          if (w is DockContainer)
                          {
                            //Console.WriteLine("tc:" + w.Name);
                            targetContainer = (DockContainer)w;
                            if (placeholderwindow != null)
                            {
                              int wd = w.Allocation.Width;
                              int wh = w.Allocation.Height / 2;
                              int wx = rx + sx;
                              int wy = ry + sy;

                              targetAlign = getAlignment(rx,ry,cX,cY,w.Allocation.Width,w.Allocation.Height);

                              //bool alignChanged = placeholderwindow.Alignment != targetAlign;
                              placeholderwindow.Alignment = targetAlign;
                              switch (targetAlign)
                              {
                                        case ItemAlignment.Top:
                                            wh = w.Allocation.Height / 3;
                                            break;
                                        case ItemAlignment.Left:
                                            wh = w.Allocation.Height;
                                            wd = w.Allocation.Width /3;
                                            break;
                                        case ItemAlignment.Right:
                                            wh = w.Allocation.Height;
                                            wd = w.Allocation.Width /3;
                                            wx = wx + (w.Allocation.Width -wd);
                                            break;
                                        case ItemAlignment.Bottom:
                                            wh = w.Allocation.Height / 3;
                                            wy = wy + (w.Allocation.Height - wh);
                                            break;
                                        case ItemAlignment.Center:
                                            wh = w.Allocation.Height / 3;
                                            wd = w.Allocation.Width / 3;
                                            wx = wx + wd;
                                            wy = wy + wh;
                                            break;
                                        default:
                                            break;
                              }

                              //if (alignChanged) {
                              placeholderwindow.Move(wx,wy);
                              placeholderwindow.Resize(wd,wh);
                              done = true;
                            //		}
                            }
                          }
                        }
                     }
                }

                if (done)
                {
                    break;
                }
              } //foreach
        }
        private void init()
        {
            VBox1 = new Gtk.Box(Orientation.Vertical,0);
            VBox1.Visible =true;
            this.Add(VBox1);

            dock = new DockContainer(null);
            //xxxdock.Name = "xxxdock";
            dock.Visible = true;
            dock.Expand = true;
            VBox1.PackEnd(dock,true,true,0);
        }
Exemple #5
0
        protected void setPlaceholderWindowsize(int cX, int cY)
        {
            List <Widget> lst = new List <Widget>(100);

            addChildren(this, lst);      //recursiv add all children in the list
            targetContainer = null;
            bool done = false;

            //foreach(Widget w in lst)
            for (int i = lst.Count - 1; i > -1; i--)
            {
                Widget w = lst[i];

                //Console.WriteLine("fe: " + w.Name);
                int rx = 0;
                int ry = 0;

                int sx, sy;
                this.Window.GetOrigin(out sx, out sy);
                if (w.Window != null)
                {
                    //Console.WriteLine("window:" + w.Window.ToString() + " sx: " + sx + " sy: " + sy);
                    w.Window.GetOrigin(out rx, out ry);
                    rx = rx - sx;                     //x of widget relativ to window
                    ry = ry - sy;                     //y of widget relative to window

                    if ((rx <= cX) && (cX <= (rx + w.Allocation.Width)))
                    {
                        if ((ry <= cY) && (cY <= (ry + w.Allocation.Height)))
                        {
                            if (w is DockContainer)
                            {
                                //Console.WriteLine("tc:" + w.Name);
                                targetContainer = (DockContainer)w;
                                if (placeholderwindow != null)
                                {
                                    int wd = w.Allocation.Width;
                                    int wh = w.Allocation.Height / 2;
                                    int wx = rx + sx;
                                    int wy = ry + sy;

                                    targetAlign = getAlignment(rx, ry, cX, cY, w.Allocation.Width, w.Allocation.Height);

                                    //bool alignChanged = placeholderwindow.Alignment != targetAlign;
                                    placeholderwindow.Alignment = targetAlign;
                                    switch (targetAlign)
                                    {
                                    case ItemAlignment.Top:
                                        wh = w.Allocation.Height / 3;
                                        break;

                                    case ItemAlignment.Left:
                                        wh = w.Allocation.Height;
                                        wd = w.Allocation.Width / 3;
                                        break;

                                    case ItemAlignment.Right:
                                        wh = w.Allocation.Height;
                                        wd = w.Allocation.Width / 3;
                                        wx = wx + (w.Allocation.Width - wd);
                                        break;

                                    case ItemAlignment.Bottom:
                                        wh = w.Allocation.Height / 3;
                                        wy = wy + (w.Allocation.Height - wh);
                                        break;

                                    case ItemAlignment.Center:
                                        wh = w.Allocation.Height / 3;
                                        wd = w.Allocation.Width / 3;
                                        wx = wx + wd;
                                        wy = wy + wh;
                                        break;

                                    default:
                                        break;
                                    }

                                    //if (alignChanged) {
                                    placeholderwindow.Move(wx, wy);
                                    placeholderwindow.Resize(wd, wh);
                                    done = true;
                                    //		}
                                }
                            }
                        }
                    }
                }

                if (done)
                {
                    break;
                }
            }               //foreach
        }