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; } }
protected void Construct(Widget buttonWidget, Menu menu, bool showArrow) { WidgetFlags |= WidgetFlags.NoWindow; button_widget = buttonWidget; Menu = menu; toggle_button.Parent = this; toggle_button.FocusOnClick = false; toggle_button.Relief = ReliefStyle.None; toggle_button.Pressed += delegate { ShowMenu(); toggle_button.Active = true; }; toggle_button.Activated += delegate { ShowMenu(); }; box.Parent = this; if (showArrow) { box.PackStart(button_widget, true, true, 0); alignment = new Alignment(0f, 0.5f, 0f, 0f); arrow = new Arrow(ArrowType.Down, ShadowType.None); alignment.Add(arrow); box.PackStart(alignment, false, false, 5); size_widget = box; FocusChain = new Widget[] { toggle_button, box }; alignment.ShowAll(); alignment.NoShowAll = true; } else { toggle_button.Add(button_widget); size_widget = toggle_button; } ShowAll(); }
private ToggleButton AddButton(string text, Image image, bool active) { Label label = new Label(text); label.UseMarkup = true; if (active) { label.Markup = "<b>" + text.Replace("&", "&") + "</b>"; } ToggleButton newButton = new ToggleButton(); if (image == null) { newButton.Add(label); } else { HBox hbox = new HBox(); hbox.Spacing = 2; hbox.PackStart(image); hbox.PackEnd(label); newButton.Add(hbox); } newButton.CanFocus = false; newButton.FocusOnClick = false; newButton.Active = active; newButton.Released += on_button_clicked; mainHBox.PackStart(newButton, false, false, 0); newButton.ShowAll(); base.Hadjustment.Value = base.Hadjustment.Upper; base.Hadjustment.Change(); return(newButton); }
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 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 override void Initialize() { if (t_leftUp == null) { LoadTextures(); } WasInitialized = true; size = new Vector2(155, 172); title = new Label(0, 5, AssociatedComponent.Graphics.GetCSToolTip()); title.font = TitleFont; title.UpdateSizeToTextSize(); title.TextAlignment = Renderer.TextAlignment.Center; title.foreground = Color.White; controls.Add(title); Size = new Vector2(Math.Max(title.font.MeasureString(title.text).X + 80, Size.X), Size.Y); title.Size = new Vector2(Size.X - 20, title.Size.Y); removable = new CheckBox(5, 55, (int)size.X - 10, 20, "Removable: ", false); removable.foreground = Color.White; removable.onCheckedChanged += new CheckBox.CheckBoxCheckedHandler(removable_onCheckedChanged); controls.Add(removable); leftUp = new MenuButton(5, 80, 20, 20, ""); leftUp.onClicked += new Button.ClickedEventHandler(leftUp_onClicked); leftUp.LeftTexture = t_leftUp; controls.Add(leftUp); leftRight = new MenuButton(30, 80, 20, 20, ""); leftRight.onClicked += new Button.ClickedEventHandler(leftRight_onClicked); leftRight.LeftTexture = t_leftRight; controls.Add(leftRight); leftDown = new MenuButton(55, 80, 20, 20, ""); leftDown.onClicked += new Button.ClickedEventHandler(leftDown_onClicked); leftDown.LeftTexture = t_leftDown; controls.Add(leftDown); upRight = new MenuButton(80, 80, 20, 20, ""); upRight.onClicked += new Button.ClickedEventHandler(upRight_onClicked); upRight.LeftTexture = t_upRight; controls.Add(upRight); upDown = new MenuButton(105, 80, 20, 20, ""); upDown.onClicked += new Button.ClickedEventHandler(upDown_onClicked); upDown.LeftTexture = t_upDown; controls.Add(upDown); rightDown = new MenuButton(130, 80, 20, 20, ""); rightDown.onClicked += new Button.ClickedEventHandler(rightDown_onClicked); rightDown.LeftTexture = t_rightDown; controls.Add(rightDown); portLeft = new ToggleButton((int)size.X / 2 - 30, 125, 20, 20); portLeft.Add(arrowLeftRight, "IO"); portLeft.Add(arrowLeft, "O"); portLeft.Add(arrowRight, "I"); portLeft.onSelectedChanged += new ToggleButton.SelectedChanged(portLeft_onSelectedChanged); controls.Add(portLeft); portRight = new ToggleButton((int)size.X / 2 + 10, 125, 20, 20); portRight.Add(arrowLeftRight, "IO"); portRight.Add(arrowRight, "O"); portRight.Add(arrowLeft, "I"); portRight.onSelectedChanged += new ToggleButton.SelectedChanged(portRight_onSelectedChanged); controls.Add(portRight); portUp = new ToggleButton((int)size.X / 2 - 10, 105, 20, 20); portUp.Add(arrowUpDown, "IO"); portUp.Add(arrowUp, "O"); portUp.Add(arrowDown, "I"); portUp.onSelectedChanged += new ToggleButton.SelectedChanged(portUp_onSelectedChanged); controls.Add(portUp); portDown = new ToggleButton((int)size.X / 2 - 10, 145, 20, 20); portDown.Add(arrowUpDown, "IO"); portDown.Add(arrowDown, "O"); portDown.Add(arrowUp, "I"); portDown.onSelectedChanged += new ToggleButton.SelectedChanged(portDown_onSelectedChanged); controls.Add(portDown); base.Initialize(); }
public void Update(Wrappers.Node grp) { if (d_active == grp) { return; } // Check if the group is already in the path if (grp != null && d_pathWidgets.ContainsKey(grp)) { SetActive(d_active, false); SetActive(grp, true); d_active = grp; } else { // Construct a new path Clear(); if (grp == null) { return; } List <Wrappers.Node> groups = Collect(grp); for (int i = 0; i < groups.Count; ++i) { if (i != 0) { Arrow ar = new Arrow(ArrowType.Right, ShadowType.None); ar.Show(); PackStart(ar, false, false, 0); } ToggleButton but = new ToggleButton(); but.Show(); HBox hbox = new HBox(false, 0); hbox.Show(); Label lbl = new Label(i == 0 ? RootName(groups[i]) : groups[i].ToString()); lbl.Show(); if (i == 0) { List <Wrappers.Node> roots = new List <Wrappers.Node>(d_roots); roots.Remove(groups[0]); if (roots.Count != 0) { Arrow arrow = new Arrow(ArrowType.Down, ShadowType.None); arrow.Show(); hbox.PackStart(arrow, false, false, 0); } } hbox.PackStart(lbl, false, false, 0); but.Add(hbox); PackStart(but, false, false, 0); but.Data["WrappedGroup"] = groups[i]; d_pathWidgets[groups[i]] = but; d_pathGroups.Add(groups[i]); but.Toggled += HandleGroupToggled; bool last = (i == groups.Count - 1); SetActive(groups[i], last); groups[i].ChildRemoved += HandleChildRemoved; } } }
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); }
public GladeApp(string[] args) { program = new Gnome.Program ("mCatalog", "1.0", Gnome.Modules.UI, args); Mono.Posix.Catalog.Init ("mcatalog", Defines.GNOME_LOCALE_DIR); // Proxy Setup bool use_proxy = Conf.Get ("/system/http_proxy/use_http_proxy", false); if (use_proxy) { string proxy_host = Conf.Get ("/system/http_proxy/host", ""); int proxy_port = Conf.Get ("/system/http_proxy/port", 8080); string proxy = string.Format("http://{0}:{1}/", proxy_host, proxy_port); WebProxy proxyObject = new WebProxy(proxy, true); System.Net.GlobalProxySelection.Select = proxyObject; } database = new Database (Conf.HomeDir+"/db.db"); database.Debug = true; Glade.XML gxml = new Glade.XML (null, "mainwindow.glade", "app1", "mcatalog"); gxml.Autoconnect (this); app1.DeleteEvent += OnWindowDeleteEvent; presentation = new Presentation (); itemShelf = new ItemShelf (presentation); swPresentation.AddWithViewport (presentation); presentation.Init (); searchEntry.Activated += OnSearchEntryActivated; itemListPaned.SizeRequested += OnItemListPanedResized; // Fill the list hbox HBox hBoxList = (HBox)gxml["hBoxList"]; buttonList = new ToggleButton (); buttonList.Clicked += OnButtonListClicked; Gtk.Image image1 = new Gtk.Image (new Gdk.Pixbuf (null, "list.png")); image1.Visible = true; buttonList.Add (image1); buttonList.Relief = ReliefStyle.Half; hBoxList.PackStart (buttonList, false, true, 0); buttonShelf = new ToggleButton (); buttonShelf.Clicked += OnButtonShelfClicked; Gtk.Image image2 = new Gtk.Image (new Gdk.Pixbuf (null, "shelf.png")); image2.Visible = true; buttonShelf.Add (image2); buttonShelf.Relief = ReliefStyle.Half; hBoxList.PackStart (buttonShelf, false, true, 0); titleWidget = new TitleWidget (); titleWidget.OnOrderChanged += OnOrderChanged; hBoxList.PackStart (titleWidget, true, true, 4); hBoxList.ShowAll(); // Get the menu items we need to handle menuItemAddItem.Sensitive = false; menuItemRemoveItem.Sensitive = false; menuItemShelfView.Data["view"] = View.Shelf; menuItemListView.Data["view"] = View.List; menuItemShelfView.Toggled += OnViewToggled; // Buttons addItemButton.Sensitive = false; removeItemButton.Sensitive = false; lendItemButton.Sensitive = false; editItemButton.Sensitive = false; lendItemButton.Clicked += LendOrReturnItem; editItemButton.Clicked += EditItem; // Populate the catalog tree PopulateCatalogs (); PopulateBorrowers (); app1.ShowAll(); RestoreWindowState (); program.Run(); }