public MenuPlugin(TPanel panel, PluginConfig cfg) : base(panel, cfg) { button = new ToggleButton(); button.Add(new Label("Menu")); button.Clicked += (s, e) => { if (button.Active) Open(); else Close(); }; }
public static ToggleButton create_togglebutton_stock_image(String stockid,String tooltip){ ToggleButton tb = new ToggleButton(stockid); tb.Remove(tb.Child); VBox v = new VBox(); v.Add(new Gtk.Image(tb.RenderIcon(stockid,IconSize.SmallToolbar,tooltip))); tb.Add(v); tb.WidthRequest = 30; tb.CanFocus = false; tb.TooltipText = tooltip; tb.HasTooltip = true; return tb; }
public ClockPlugin(TPanel panel, PluginConfig cfg) : base(panel, cfg) { button = new ToggleButton(); button.Add(new Label("DateTime")); /* button.Clicked += (s, e) => { if (button.Active) Open(); else Close(); };*/ button.Clicked += (s, e) => { CoreLib.Signal("test"); }; }
public new void Add(Widget widget) { ToggleButton toggle_button = new ToggleButton (); toggle_button.Relief = ReliefStyle.None; toggle_button.Add (widget); toggle_button.Show (); toggle_button.Toggled += delegate (object sender, EventArgs args) { if (toggle_button.Active) { foreach (ToggleButton tb in this) if (tb != sender) tb.Active = false; } }; base.PackStart (toggle_button, false, false, 0); }
protected override void BuildGui() { entry = new IconEntry(); entry.Changed += OnEntryChanged; if (entry.IconsSupported) { Pixbuf pb = Gdk.Pixbuf.LoadFromResource("Basenji.images.calendar.png"); entry.SetIconFromPixbuf(pb, EntryIconPosition.Secondary); entry.IconPress += OnIconPressEvent; this.Add(entry); } else { // no icons inside entries supported -> // add a fallback button to the right of the entry HBox hbox = new HBox(); hbox.Spacing = 2; hbox.PackStart(entry, true, true, 0); btn = new ToggleButton(); btn.Add(new Arrow(ArrowType.Down, ShadowType.None)); hbox.PackStart(btn, false, false, 0); this.Add(hbox); btn.Toggled += OnBtnToggled; } }
public ImageToolsControl(ImageCanvas ic) : base(1,6,false) { this.NRows = 1; this.NColumns = 10; this.ic = ic; tblButton = new Table(1,5,false); toolbutton = new HButtonBox(); toolbutton.LayoutStyle = ButtonBoxStyle.Start; btnShowHideBarier = new ToggleButton(); btnShowHideBarier.Add(MainClass.Tools.CreatePicLabelWidget("barier-show.png",MainClass.Languages.Translate("show_barier_layer"))); btnShowHideBarier.Name = "btnShowHideBarier"; btnShowHideBarier.Relief = ReliefStyle.None; btnShowHideBarier.CanFocus = false; btnShowHideBarier.BorderWidth = 1; //btnShowHideBarier.WidthRequest = 75; btnShowHideBarier.TooltipText = MainClass.Languages.Translate("show_barier_layer_tt"); btnShowHideBarier.Toggled+= delegate(object sender, EventArgs e) { this.ic.ShowBarierLayer = btnShowHideBarier.Active; SetSensitive(btnShowHideBarier.Active); }; btnEditBarierPoint = new ToggleButton(); btnEditBarierPoint.Name = "btnEditBarierPoint"; btnEditBarierPoint.Add(MainClass.Tools.CreatePicLabelWidget("barier-add.png",MainClass.Languages.Translate("edit_barier_point"))); btnEditBarierPoint.Relief = ReliefStyle.None; btnEditBarierPoint.CanFocus = false; btnEditBarierPoint.BorderWidth = 1; btnEditBarierPoint.TooltipText = MainClass.Languages.Translate("edit_barier_point_tt"); btnEditBarierPoint.Toggled+= delegate(object sender, EventArgs e) { if(btnEditBarierPoint.Active){ btnDeleteBarierPoint.Active = false; //btnMovieBarierPoint.Active = false; } }; btnDeleteBarierPoint = new ToggleButton(); btnDeleteBarierPoint.Name = "btnDeleteBarierPoint"; btnDeleteBarierPoint.Add(MainClass.Tools.CreatePicLabelWidget("barier-delete.png",MainClass.Languages.Translate("delete_barier_point"))); btnDeleteBarierPoint.Relief = ReliefStyle.None; btnDeleteBarierPoint.CanFocus = false; btnDeleteBarierPoint.BorderWidth = 1; btnDeleteBarierPoint.TooltipText = MainClass.Languages.Translate("delete_barier_point_tt"); btnDeleteBarierPoint.Toggled+= delegate(object sender, EventArgs e) { if(btnDeleteBarierPoint.Active){ btnEditBarierPoint.Active = false; //btnAddBarierPoint.Active = false; //btnMovieBarierPoint.Active = false; } }; btnDeleteBarier = new Button(); btnDeleteBarier.Name = "btnDeleteBarier"; btnDeleteBarier.Add(MainClass.Tools.CreatePicLabelWidget("barier-delete-all.png",MainClass.Languages.Translate("delete_barier"))); btnDeleteBarier.Relief = ReliefStyle.None; btnDeleteBarier.CanFocus = false; btnDeleteBarier.BorderWidth = 1; btnDeleteBarier.TooltipText = MainClass.Languages.Translate("delete_barier_tt"); btnDeleteBarier.Clicked += delegate(object sender, EventArgs e) { MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, "", MainClass.Languages.Translate("delete_barier_question"), Gtk.MessageType.Question); int result = md.ShowDialog(); if (result != (int)Gtk.ResponseType.Yes){ return; } if(DeleteBarierLayerEvent!= null) DeleteBarierLayerEvent(null,null); }; btnShowHideBarier.Active = false; //btnAddBarierPoint.Active = false; //btnMovieBarierPoint.Active = false; btnDeleteBarierPoint.Active = false; btnEditBarierPoint.Active = false; SetSensitive(false); tblButton.Attach(btnShowHideBarier,0,1,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); //tblButton.Attach(btnAddBarierPoint,1,2,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); //tblButton.Attach(btnMovieBarierPoint,2,3,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); tblButton.Attach(btnEditBarierPoint,1,2,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); tblButton.Attach(btnDeleteBarierPoint,2,3,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); tblButton.Attach(btnDeleteBarier,3,4,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); tblButton.ShowAll(); this.Attach(tblButton,0,1,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); this.Attach(new HSeparator(),1,2,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); Gtk.Button btnZoomIn = new Gtk.Button(new Image("zoom-in.png",IconSize.Button)); btnZoomIn.TooltipText = MainClass.Languages.Translate("zoom_in"); btnZoomIn.Relief = Gtk.ReliefStyle.None; btnZoomIn.CanFocus = false; btnZoomIn.Clicked+= delegate { ZoomIn(); }; //btnZoomIn.WidthRequest = btnZoomIn.HeightRequest = 19; Gtk.Button btnZoomOriginal = new Gtk.Button(new Image("zoom-original.png",IconSize.Button)); btnZoomOriginal.TooltipText = MainClass.Languages.Translate("zoom_original"); btnZoomOriginal.Relief = Gtk.ReliefStyle.None; btnZoomOriginal.CanFocus = false; btnZoomOriginal.Clicked+= delegate { cbeZoom.Active = 11; }; //btnZoomOriginal.WidthRequest = btnZoomOriginal.HeightRequest = 19; Gtk.Button btnZoomOut = new Gtk.Button(new Image("zoom-out.png",IconSize.Button)); btnZoomOut.TooltipText = MainClass.Languages.Translate("zoom_out"); btnZoomOut.Relief = Gtk.ReliefStyle.None; btnZoomOut.CanFocus = false; btnZoomOut.Clicked+= delegate { ZoomOut(); }; //btnZoomOut.WidthRequest = btnZoomOut.HeightRequest = 19; string[] zoomCollection = new string[] { "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%" }; cbeZoom = new ComboBoxEntry(zoomCollection); cbeZoom.Active = 11; cbeZoom.WidthRequest = 70; cbeZoom.Changed+= delegate(object sender, EventArgs e) { UpdateScale(); }; cbeZoom.Entry.FocusOutEvent+= delegate(object o, FocusOutEventArgs args) { //Console.WriteLine("FocusOutEvent"); UpdateScale(); }; cbeZoom.Entry.FocusInEvent+= delegate(object o, FocusInEventArgs args) { }; cbeZoom.Entry.Changed+= delegate(object sender, EventArgs e) { //UpdateScale(); }; this.Attach(btnZoomOut,2,3,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); this.Attach(cbeZoom,3,4,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); this.Attach(btnZoomIn,4,5,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); this.Attach(btnZoomOriginal,5,6,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0); //this.PackEnd(cbeZoom,false,false,1); }