Exemple #1
0
        public GtkSharpChoice(Widget shellobject, params object[] entries)
            : base(shellobject)
        {
            //note: this function is somewhat hacky to get stupid gtk combos to behave like we want
            //the question is if we can guarantee default width of combos are same evrywhere?

            int xborder;


            combobox = new Gtk.ComboBox(); //TODO: support adding objects
            GtkSharpDriver.InitWidget(combobox, shellobject);

            var c = combobox.Child;

            Gtk.Requisition req_r    = c.SizeRequest();
            Gtk.Requisition req_c    = combobox.SizeRequest();
            int             btnwidth = req_c.Width - req_r.Width;

            xborder = req_c.Height - req_r.Height;

            c.SetSizeRequest(Guppy.DefaultEditWidth - xborder, -1);

            FitWidth();
            combobox.Show();
        }
Exemple #2
0
 public GtkSharpLabel(Widget shellobject, string caption) : base(shellobject)
 {
     label = new Gtk.Label(caption);
     GtkSharpDriver.InitWidget(label, shellobject);
     label.Show();
     label.SetAlignment(0.0f, 0.5f);
 }
Exemple #3
0
 public override Size2i GetNaturalSize()
 {
     if (image.Pixbuf == null)
     {
         return(new Size2i(16, 16));
     }
     return(GtkSharpDriver.DefaultGetNaturalSize(image));
 }
Exemple #4
0
        public GtkSharpEdit(Widget shellobject)
            : base(shellobject)
        {
            entry = new Gtk.Entry();
            GtkSharpDriver.InitWidget(entry, shellobject);
            entry.Show();

            shellobject.Size = new Size2i(Guppy.DefaultEditWidth, shellobject.Size.Height);
        }
Exemple #5
0
        public GtkSharpMemo(Widget shellobject)
            : base(shellobject)
        {
            textview = new Gtk.TextView();
            GtkSharpDriver.InitWidget(textview, shellobject);
            textview.Show();

            textview.Buffer.Changed += delegate { ((Memo)ShellObject).OnChanged(); };
            textview.AcceptsTab      = false; //dafault is to tab to next control
        }
Exemple #6
0
        public GtkSharpImageLabel(Widget shellobject, Image img)
            : base(shellobject)
        {
            // this.image = GtkSharpDriver.ImageToGtkImage(img);
            Gdk.Pixbuf pb = GtkSharpDriver.ImageToGtkPixbuf(img);
            this.image = new Gtk.Image(pb);

            GtkSharpDriver.InitWidget(this.image, shellobject);

            this.image.Show();
        }
Exemple #7
0
        public GtkSharpFrame(Widget shellobject, string caption)
            : base(shellobject)
        {
            frame = new Gtk.Frame(caption);
            GtkSharpDriver.InitWidget(frame, shellobject);
            frame.Show();

            fixchild = new Gtk.Fixed();
            frame.Add(fixchild);
            fixchild.Show();
        }
Exemple #8
0
        public override void Show()
        {
            Response = null;
            Gtk.Window parent = GtkSharpDriver.GetForegroundWindow();

            //Size = ShellObject.LayoutInfo.Size;

            window.TransientFor = null;
            window.Modal        = false;

            SolveWindowPosition(parent);

            window.Show();
        }
        public GtkSharpSeparator(Widget shellobject, bool vertical)
            : base(shellobject)
        {
            if (vertical)
            {
                sep = new Gtk.VSeparator();
            }
            else
            {
                sep = new Gtk.HSeparator();
            }

            GtkSharpDriver.InitWidget(sep, shellobject);

            sep.Show();
        }
Exemple #10
0
        //Gtk.Image image;

        public GtkSharpButton(Widget shellobject, string caption)
            : base(shellobject)
        {
            button = new Gtk.Button();
            GtkSharpDriver.InitWidget(button, shellobject);
            button.Show();

            label = new Gtk.Label(caption);
            label.Show();

            CreateContent(null);

            button.Show();

            button.Clicked += delegate { ((Button)ShellObject).OnClicked(); };
        }
Exemple #11
0
        public GtkSharpWindow(Widget shellobject, string caption)
            : base(shellobject)
        {
            window = new Gtk.Window(caption);
            GtkSharpDriver.InitWidget(window, shellobject);
            window.ResizeChecked += new EventHandler(EventResizeChecked);
            window.Hidden        += new EventHandler(EventClosed);

            //window.WindowPosition = Gtk.WindowPosition.Mouse;

            fixchild = new Gtk.Fixed();
            fixchild.Show();
            window.Add(fixchild);

            window.DeleteEvent   += new Gtk.DeleteEventHandler(window_DeleteEvent);
            window.KeyPressEvent += new Gtk.KeyPressEventHandler(window_KeyPressEvent);
        }
Exemple #12
0
        public override object ShowModal()
        {
            Response = null;
            Gtk.Window parent = GtkSharpDriver.GetForegroundWindow();

            window.TransientFor = parent;
            window.Modal        = true;

            SolveWindowPosition(parent);

            window.Show();

            while (window.Visible)
            {
                Gtk.Application.RunIteration(true);
            }

            return(Response);
        }
Exemple #13
0
        private bool sendclickevent = true;          //used to get rid of click event when setting checked in code

        public GtkSharpToggle(Widget shellobject, string caption, bool isbutton)
            : base(shellobject)
        {
            if (isbutton)
            {
                togglebtn = new Gtk.ToggleButton(caption);
            }
            else             //checkbox
            {
                togglebtn = new Gtk.CheckButton(caption);
            }

            GtkSharpDriver.InitWidget(togglebtn, shellobject);

            togglebtn.Show();

            togglebtn.Clicked += delegate { if (sendclickevent)
                                            {
                                                ((Toggle)shellobject).OnChanged();
                                            }
            };
        }
Exemple #14
0
        /* private Gtk.Widget TheWidget
         * {
         * get { return NativeObject as Gtk.Widget; }
         * }*/


        public override Size2i GetNaturalSize()
        {
            return(GtkSharpDriver.DefaultGetNaturalSize(entry));
        }
Exemple #15
0
 public override Size2i GetNaturalSize()
 {
     return(GtkSharpDriver.DefaultGetNaturalSize(togglebtn));
 }
Exemple #16
0
        public override Size2i GetNaturalSize()
        {
            var res = GtkSharpDriver.DefaultGetNaturalSize(sep);

            return(res);
        }
Exemple #17
0
 public override Size2i GetNaturalSize()
 {
     return(GtkSharpDriver.DefaultGetNaturalSize(combobox));
 }