Exemplo n.º 1
0
        public override void DefaultDispose(object target)
        {
            /*IDisposable disp = target as IDisposable;
             * if (disp != null)
             *  disp.Dispose();*/

            DriverWidget dw = target as DriverWidget;

            if (dw != null)
            {
                Gtk.Widget w = dw.NativeObject as Gtk.Widget;
                if (w != null)
                {
                    w.Destroy();
                    w.Dispose();
                }
            }
            else
            {
                IDisposable di = target as IDisposable;
                if (di != null)
                {
                    di.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        private void PhysicalDetach(DriverCompositeWidget parent, Widget child)
        {
            if (parent == null)
            {
                return;
            }

            if (child.DriverObject == null)
            {
                //no driver object to detach, but it might be a composite container so apply recursivly
                CompositeWidget cw = child as CompositeWidget;
                if (cw != null)
                {
                    foreach (Widget wi in cw.Children)
                    {
                        PhysicalDetach(parent, wi);
                    }
                }
            }
            else
            {
                DriverWidget ch = child.DriverObject as DriverWidget;
                if (ch != null)
                {
                    parent.Detach(ch);
                }
            }
        }
Exemplo n.º 3
0
 public override void Append(DriverWidget dw)
 {
     System.Windows.Forms.Control ctrl = dw.NativeObject as System.Windows.Forms.Control;
     if (ctrl != null)
     {
         tabpage.Controls.Add(ctrl);
     }
 }
Exemplo n.º 4
0
 public override void Append(DriverWidget dw)
 {
     Gtk.Widget w = dw.NativeObject as Gtk.Widget;
     if (w != null)
     {
         fixchild.Put(w, 0, 0);
     }
 }
Exemplo n.º 5
0
        public override void Append(DriverWidget dw)
        {
            Control ctrl = dw.NativeObject as Control;

            if (ctrl != null)
            {
                form.Controls.Add(ctrl);
            }
        }
Exemplo n.º 6
0
 public override void Detach(DriverWidget chld)
 {
     //TODO: this does not work, shy??
     Gtk.Widget child = chld.NativeObject as Gtk.Widget;
     if (fixchild != null && child != null)
     {
         fixchild.Remove(child);
     }
 }
Exemplo n.º 7
0
        virtual public void CalcPositionsRecursive(int left, int top, int width, int height)
        {
            DriverWidget w = DriverObject as DriverWidget;

            if (w != null)
            {
                w.Place(left, top, width, height);
            }
        }
Exemplo n.º 8
0
        virtual protected Size2i CalcNaturalSize()
        {
            DriverWidget w = (DriverObject as DriverWidget);

            if (w == null)
            {
                return(Size2i.Natural);
            }
            return(w.GetNaturalSize());
        }
Exemplo n.º 9
0
 virtual protected void AttachDriverObject(CompositeWidget parent, DriverWidget w)
 {
     //use this function from inheriting constructor with driver object
     DriverObject = w;
     // this.Parent = parent;
     if (parent != null)
     {
         parent.Children.Append(this);
     }
 }
Exemplo n.º 10
0
        public override void Append(DriverWidget dw)
        {
            DriverTabPage page = dw as DriverTabPage;

            if (page == null)
            {
                throw new Exception("Only tabpages can have tab control as parent");
            }
            WinFormsTabPage wpage = page as WinFormsTabPage;

            tabctrl.TabPages.Add(dw.NativeObject as System.Windows.Forms.TabPage);
        }
Exemplo n.º 11
0
        public override void Detach(DriverWidget child)
        {
            WinFormsMenuItem mi = child as WinFormsMenuItem;

            if (mi == null)
            {
                throw new Exception("Trying to detach invalid object to popup menu:" + child.ToString());
            }

            var item = child.NativeObject as System.Windows.Forms.ToolStripItem;

            strip.Items.Remove(item);
        }
Exemplo n.º 12
0
        /*public override MenuItem Add(string caption, Image image, MenuFlags flags)
         * {
         *  System.Windows.Forms.ToolStripItem item=null;
         *  if ((flags & MenuFlags.Separator) != 0)
         *      item = new System.Windows.Forms.ToolStripSeparator();
         *  else
         *  {
         *      System.Windows.Forms.ToolStripMenuItem mi = new System.Windows.Forms.ToolStripMenuItem();
         *      item = mi;
         *      mi.Image = WinFormsDriver.ImageToWinFormsImage(image);
         *      mi.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
         *
         *      //parse shortkey text
         *      if (caption == null) caption = "";
         *      string[] capts=caption.Split('\t');
         *      if(capts.Length>0)
         *          mi.Text = capts[0];
         *      if (capts.Length > 1)
         *          mi.ShortcutKeyDisplayString = capts[1];
         *
         *      if ((flags & MenuFlags.Checkable) != 0)
         *      {
         *          mi.CheckOnClick = true;
         *          mi.CheckState = (((flags & MenuFlags.Checked) != 0) ? System.Windows.Forms.CheckState.Checked : System.Windows.Forms.CheckState.Unchecked);
         *      }
         *
         *      strip.Items.Add(mi);
         *  }
         *
         *  return new MenuItem(item, caption, image, flags);
         * }*/



        public override void Append(DriverWidget dw)
        {
            WinFormsMenuItem mi = dw as WinFormsMenuItem;

            if (mi == null)
            {
                throw new Exception("Trying to append invalid object to popup menu:" + dw.ToString());
            }

            var item = dw.NativeObject as System.Windows.Forms.ToolStripItem;



            strip.Items.Add(item);
        }
Exemplo n.º 13
0
        public override void Append(DriverWidget dw)
        {
            WinFormsMenuItem mi = dw as WinFormsMenuItem;

            if (mi == null)
            {
                throw new Exception("Trying to append invalid object to popup menu:" + dw.ToString());
            }

            var child = dw.NativeObject as System.Windows.Forms.ToolStripItem;
            var par   = item as System.Windows.Forms.ToolStripMenuItem;

            if (item != null && par != null)
            {
                par.DropDownItems.Add(child);
            }
        }
Exemplo n.º 14
0
 public override void Append(DriverWidget dw)
 {
     //append for splitter does nothing, we have to use one of its children
 }