コード例 #1
0
ファイル: RadioMenuItemHandler.cs プロジェクト: sami1971/Eto
        public void Create(RadioMenuItem controller)
        {
            if (controller != null)
            {
                Control         = new Gtk.RadioMenuItem((Gtk.RadioMenuItem)controller.ControlObject);
                this.controller = (RadioMenuItemHandler)controller.Handler;
            }
            else
            {
                this.controller = this;
                Control         = new Gtk.RadioMenuItem(string.Empty);
                foreach (Gtk.Widget w in Control.Children)
                {
                    Control.Remove(w);
                }
            }

            var hbox = new Gtk.HBox(false, 4);

            label              = new Gtk.AccelLabel(string.Empty);
            label.Xalign       = 0;
            label.UseUnderline = true;
            label.AccelWidget  = Control;
            hbox.Add(label);
            accelLabel         = new Gtk.Label();
            accelLabel.Xalign  = 1;
            accelLabel.Visible = false;
            hbox.Add(accelLabel);
            Control.Add(hbox);
        }
コード例 #2
0
        public ButtonHandler()
        {
            Control = new Gtk.Button();
            label   = new Gtk.AccelLabel(string.Empty);
            Control.Add(label);
            Control.Clicked += delegate { Widget.OnClick(EventArgs.Empty); };
            var defaultSize = Button.DefaultSize;

            Control.SizeAllocated += delegate(object o, Gtk.SizeAllocatedArgs args) {
                var size = args.Allocation;
                if (size.Width > 1 || size.Height > 1)
                {
                    if (defaultSize.Width > size.Width)
                    {
                        size.Width = defaultSize.Width;
                    }
                    if (defaultSize.Height > size.Height)
                    {
                        size.Height = defaultSize.Height;
                    }
                    if (args.Allocation != size)
                    {
                        Control.SetSizeRequest(size.Width, size.Height);
                    }
                }
            };
            //Control.SetSizeRequest(Button.DefaultSize.Width, Button.DefaultSize.Height);
        }
コード例 #3
0
 public RadioMenuItemHandler()
 {
     label              = new Gtk.AccelLabel(string.Empty);
     label.Xalign       = 0;
     label.UseUnderline = true;
     accelLabel         = new Gtk.Label();
     accelLabel.Xalign  = 1;
     accelLabel.Visible = false;
 }
コード例 #4
0
 public CheckMenuItemHandler()
 {
     Control            = new Gtk.CheckMenuItem();
     label              = new Gtk.AccelLabel(string.Empty);
     label.Xalign       = 0;
     label.UseUnderline = true;
     label.AccelWidget  = Control;
     Control.Add(label);
 }
コード例 #5
0
ファイル: ImageMenuItemHandler.cs プロジェクト: pcdummy/Eto
 public ImageMenuItemHandler()
 {
     Control            = new Gtk.ImageMenuItem();
     Control.Activated += control_Activated;
     label              = new Gtk.AccelLabel(string.Empty);
     label.Xalign       = 0;
     label.UseUnderline = true;
     label.AccelWidget  = Control;
     Control.Add(label);
 }
コード例 #6
0
ファイル: ButtonMenuItemHandler.cs プロジェクト: nzysoft/Eto
 public ButtonMenuItemHandler()
 {
     Control            = new Gtk.ImageMenuItem();
     label              = new Gtk.AccelLabel(string.Empty);
     label.Xalign       = 0;
     label.UseUnderline = true;
     label.AccelWidget  = Control;
     Control.Add(label);
     Control.ShowAll();
 }
コード例 #7
0
 public ButtonHandler()
 {
     // need separate widgets as the theme can (and usually) disables images on buttons
     // gtk3 can override the theme per button, but gtk2 cannot
     table = new Gtk.Table(3, 3, false);
     table.ColumnSpacing = 0;
     table.RowSpacing    = 0;
     label           = new Gtk.AccelLabel(string.Empty);
     label.NoShowAll = true;
     table.Attach(label, 1, 2, 1, 2, Gtk.AttachOptions.Expand, Gtk.AttachOptions.Expand, 0, 0);
     gtkimage           = new Gtk.Image();
     gtkimage.NoShowAll = true;
 }
コード例 #8
0
 public void Create(RadioButton controller)
 {
     if (controller != null)
     {
         Control = new Gtk.RadioButton((Gtk.RadioButton)controller.ControlObject);
     }
     else
     {
         Control = new Gtk.RadioButton((Gtk.RadioButton)null);
     }
     label = new Gtk.AccelLabel("");
     Control.Add(label);             //control.AddMnemonicLabel(label);
     Control.Toggled += control_Toggled;
 }
コード例 #9
0
ファイル: RadioButtonHandler.cs プロジェクト: sami1971/Eto
 public void Create(RadioButton controller)
 {
     if (controller != null)
     {
         Control = new Gtk.RadioButton(RadioButtonHandler.GetControl(controller));
     }
     else
     {
         Control = new Gtk.RadioButton((Gtk.RadioButton)null);
         // make gtk work like others in that no radio button is initially selected
         var inactive = new Gtk.RadioButton(Control);
         inactive.Active = true;
     }
     label = new Gtk.AccelLabel("");
     Control.Add(label);             //control.AddMnemonicLabel(label);
     Control.Toggled += Connector.HandleCheckedChanged;
 }
コード例 #10
0
 ///
 MenuItemType ISolidIDE.GetMenuItem <MenuItemType>(params string[] names)
 {
     Gtk.MenuShell menu = (this as ISolidIDE).GetMainMenu();
     Gtk.MenuItem  item = null;
     for (int i = 0; i < names.Length; i++)
     {
         item = null;
         foreach (Gtk.Widget w in menu.Children)
         {
             if (w.Name == names[i] + "Action")
             {
                 item = w as Gtk.ImageMenuItem;
                 if (i < names.Length - 1)
                 {
                     if (item.Submenu == null)
                     {
                         item.Submenu = new Gtk.Menu();
                     }
                     menu = item.Submenu as Gtk.MenuShell;
                 }
                 break;
             }
         }
         if (item == null)
         {
             item = new MenuItemType();
             Gtk.AccelLabel accelLabel = new Gtk.AccelLabel("");
             accelLabel.TextWithMnemonic = names[i];
             accelLabel.SetAlignment(0f, 0.5f);
             item.Add(accelLabel);
             accelLabel.AccelWidget = item;
             item.Name = names[i] + "Action";
             menu.Append(item);
             if (i < names.Length - 1)
             {
                 item.Submenu = new Gtk.Menu();
             }
             menu = item.Submenu as Gtk.MenuShell;
         }
     }
     return(item as MenuItemType);
 }
コード例 #11
0
ファイル: ButtonHandler.cs プロジェクト: pcdummy/Eto
        public ButtonHandler()
        {
            Control = new Gtk.Button();

            // need separate widgets as the theme can (and usually) disables images on buttons
            // gtk3 can override the theme per button, but gtk2 cannot
            table = new Gtk.Table(3, 3, false);
            table.ColumnSpacing = 0;
            table.RowSpacing    = 0;
            label           = new Gtk.AccelLabel(string.Empty);
            label.NoShowAll = true;
            table.Attach(label, 1, 2, 1, 2, Gtk.AttachOptions.Expand, Gtk.AttachOptions.Expand, 0, 0);
            gtkimage           = new Gtk.Image();
            gtkimage.NoShowAll = true;
            SetImagePosition(false);
            Control.Add(table);

            Control.Clicked += delegate {
                Widget.OnClick(EventArgs.Empty);
            };
            var defaultSize = Button.DefaultSize;

            Control.SizeAllocated += delegate(object o, Gtk.SizeAllocatedArgs args) {
                var size = args.Allocation;
                if (size.Width > 1 || size.Height > 1)
                {
                    if (defaultSize.Width > size.Width)
                    {
                        size.Width = defaultSize.Width;
                    }
                    if (defaultSize.Height > size.Height)
                    {
                        size.Height = defaultSize.Height;
                    }
                    if (args.Allocation != size)
                    {
                        Control.SetSizeRequest(size.Width, size.Height);
                    }
                }
            };
        }
コード例 #12
0
 public RadioMenuItemHandler()
 {
     label              = new Gtk.AccelLabel(string.Empty);
     label.Xalign       = 0;
     label.UseUnderline = true;
 }
コード例 #13
0
 public ButtonHandler()
 {
     label           = new Gtk.AccelLabel(string.Empty);
     label.Ellipsize = Pango.EllipsizeMode.End;
     label.Show();
 }