private void createButtons() { FakeButtonCloseSerialPort = new Gtk.Button(); Gtk.Button button_close_serial_port = new Gtk.Button("Close serial port (debug)"); button_close_serial_port.Clicked += new EventHandler(on_button_close_serial_port_clicked); Gtk.Button button_OSX_readme = new Gtk.Button("MacOSX Readme"); button_OSX_readme.Clicked += new EventHandler(on_button_OSX_readme_clicked); //---- button close start ---> Gtk.Button button_close = new Gtk.Button("Close Window"); button_close.Clicked += new EventHandler(on_button_close_clicked); Gtk.AccelGroup ag = new Gtk.AccelGroup(); //button can be called clicking Escape key chronopic_register_win.AddAccelGroup(ag); button_close.AddAccelerator ("activate", ag, new Gtk.AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, Gtk.AccelFlags.Visible)); //<---- button close end //add buttons to containers Gtk.HButtonBox hbox = new Gtk.HButtonBox(); //hbox.Add(button_close_serial_port); if (UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX) { hbox.Add(button_OSX_readme); } hbox.Add(button_close); vbox_main.Add(hbox); }
void BuildLayout () { primary_vbox = new VBox (); var label = new Label ("Super duper test UI!"); label.Show (); primary_vbox.Add (label); var button_box = new HButtonBox (); button_box.Show (); primary_vbox.Add (button_box); var folder_button = new FileChooserButton ("Select import folder", FileChooserAction.SelectFolder); folder_button.FileSet += delegate { folder = folder_button.Uri; Log.Information ("Selected " + folder); }; folder_button.Show (); button_box.Add (folder_button); var import_button = new Button { Label = "Start Import" }; import_button.Activated += StartImport; import_button.Clicked += StartImport; import_button.Show (); button_box.Add (import_button); primary_vbox.Show (); Add (primary_vbox); }
private void createGui(Gtk.Window app1, ChronopicRegisterPort crp, string labelStr) { chronopic_contacts_real_win = new Window("Chronopic connection"); chronopic_contacts_real_win.AllowGrow = false; chronopic_contacts_real_win.Modal = true; chronopic_contacts_real_win.TransientFor = app1; chronopic_contacts_real_win.BorderWidth = 20; chronopic_contacts_real_win.DeleteEvent += on_delete_event; Gtk.VBox vbox_main = new Gtk.VBox(false, 20); chronopic_contacts_real_win.Add(vbox_main); LogB.Information("Connecting real (starting connection)"); LogB.Information("Press test button on Chronopic"); Gtk.Label labelMessage = new Gtk.Label(); labelMessage.Text = labelStr + "\n" + "\n" + Catalog.GetString("Port") + ": " + crp.Port + "\n" + Catalog.GetString("Serial Number") + ": " + crp.SerialNumber; vbox_main.Add(labelMessage); progressbar = new Gtk.ProgressBar(); vbox_main.Add(progressbar); Gtk.Button button_cancel = new Gtk.Button("Cancel"); button_cancel.Clicked += new EventHandler(on_button_cancel_clicked); Gtk.HButtonBox hbox = new Gtk.HButtonBox(); hbox.Add(button_cancel); vbox_main.Add(hbox); chronopic_contacts_real_win.ShowAll(); }
private void createButtons() { Frame frame = new Frame(); frame.ShadowType = ShadowType.In; frame.LabelXalign = 0f; frame.LabelYalign = 0.5f; frame.Label = Catalog.GetString("There is a known problem on macOS:"); Gtk.Label label_macOS = new Gtk.Label( Catalog.GetString("If Chronopic is disconnected after jumps or runs execution,\nthat port will be blocked until restart of machine.")); Gtk.VBox vbox_m = new Gtk.VBox(); vbox_m.PackStart(label_macOS, false, false, 8); Gtk.HBox hbox_m = new Gtk.HBox(); hbox_m.PackStart(vbox_m, false, false, 8); if (UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX) { frame.Add(hbox_m); vbox_main.Add(frame); } FakeButtonCloseSerialPort = new Gtk.Button(); Gtk.Button button_close_serial_port = new Gtk.Button("Close serial port (debug)"); button_close_serial_port.Clicked += new EventHandler(on_button_close_serial_port_clicked); //---- button close start ---> Gtk.Button button_close = new Gtk.Button("Close Window"); button_close.CanFocus = true; button_close.IsFocus = true; button_close.Clicked += new EventHandler(on_button_close_clicked); Gtk.AccelGroup ag = new Gtk.AccelGroup(); //button can be called clicking Escape key chronopic_register_win.AddAccelGroup(ag); button_close.AddAccelerator ("activate", ag, new Gtk.AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, Gtk.AccelFlags.Visible)); //<---- button close end //add buttons to containers Gtk.HButtonBox hbox = new Gtk.HButtonBox(); //hbox.Add(button_close_serial_port); hbox.Add(button_close); vbox_main.Add(hbox); }
public MainWindow() : base(WindowType.Toplevel) { VBox vBox = new VBox (); _swf = new Swfdec.GtkWidget (new Player (null)); _swf.SetSizeRequest (400, 300); vBox.PackStart (_swf); HButtonBox btnBox = new HButtonBox (); Button btnOpen = new Button (); btnOpen.Label = "Open"; btnOpen.Clicked += ButtonOpenClicked; btnBox.Add (btnOpen); vBox.PackStart (btnBox, false, false, 3); Add (vBox); WindowPosition = Gtk.WindowPosition.Center; DeleteEvent += OnDeleteEvent; }
private void createButtons() { label_macOSX = new Gtk.Label(); label_macOSX.Text = Catalog.GetString("There is a known problem with MacOSX:") + "\n" + Catalog.GetString("If Chronopic is disconnected after jumps or runs execution,\nthat port will be blocked until restart of machine.") + "\n\n" + Catalog.GetString("We are working on a solution."); if (UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX) { vbox_main.Add(label_macOSX); } FakeButtonCloseSerialPort = new Gtk.Button(); Gtk.Button button_close_serial_port = new Gtk.Button("Close serial port (debug)"); button_close_serial_port.Clicked += new EventHandler(on_button_close_serial_port_clicked); //---- button close start ---> Gtk.Button button_close = new Gtk.Button("Close Window"); button_close.Clicked += new EventHandler(on_button_close_clicked); Gtk.AccelGroup ag = new Gtk.AccelGroup(); //button can be called clicking Escape key chronopic_register_win.AddAccelGroup(ag); button_close.AddAccelerator ("activate", ag, new Gtk.AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, Gtk.AccelFlags.Visible)); //<---- button close end //add buttons to containers Gtk.HButtonBox hbox = new Gtk.HButtonBox(); //hbox.Add(button_close_serial_port); hbox.Add(button_close); vbox_main.Add(hbox); }
private void InitGui() { //genre button Gtk.Image square = new Gtk.Image(null,"Wikipedia-logo-small.png"); Gtk.HBox genre_hbox = new HBox(false,0); genre_hbox.Add(square); genre_hbox.Add(new Label(Catalog.GetString("Genre"))); genre_button = new Gtk.Button(genre_hbox); genre_button.Relief = ReliefStyle.None; // artist Gtk.HBox artist_hbox = new HBox(false,0); artist_hbox.Add(new Gtk.Image(null,"Wikipedia-logo-small.png")); artist_hbox.Add(new Label(Catalog.GetString("Artist"))); artist_button = new Gtk.Button(artist_hbox); artist_button.Relief = ReliefStyle.None; //album button Gtk.HBox album_hbox = new HBox(false,0); album_hbox.Add(new Gtk.Image(null,"Wikipedia-logo-small.png")); album_hbox.Add(new Label(Catalog.GetString("Album"))); album_button = new Gtk.Button(album_hbox); album_button.Relief = ReliefStyle.None; //lyrics button Gtk.HBox lyric_hbox = new HBox(false,0); lyric_hbox.Add(new Gtk.Image(null,"lyrics.png")); lyric_hbox.Add(new Label(Catalog.GetString("Lyrics"))); lyric_button = new Gtk.Button(lyric_hbox); lyric_button.Relief = ReliefStyle.None; // Button bar Gtk.HButtonBox hb = new Gtk.HButtonBox(); hb.Layout = Gtk.ButtonBoxStyle.Start; hb.Spacing = 5; hb.Add(artist_button); hb.Add(album_button); hb.Add(genre_button); hb.Add(lyric_button); // hide/show button hide_show_button = new Gtk.Button(new Gtk.Image(null,"minus.png")); hide_show_button.Relief = ReliefStyle.None; hide_show_button.Clicked += new EventHandler(OnHideShowClicked); this.minimized = false; //search label Gtk.Label search_l = new Gtk.Label(); search_l.Markup = "<b>"+Catalog.GetString("Search")+":</b>"; // upper hbox Gtk.HBox toolbar = new Gtk.HBox(false,5); toolbar.PackStart(new Gtk.Image(Stock.Info,IconSize.Menu),false,false,5); toolbar.PackStart(search_l,false,false,5); toolbar.PackStart(hb,true,true,0); toolbar.PackStart(hide_show_button,false,false,0); this.wb = new ContextBrowser(); //main = new Gtk.VBox(false,5); this.PackStart(toolbar,false,false,0); this.PackEnd(wb,true,true,5); //this.Add(main); this.HeightRequest = 400; //hb.Show(); //this.wb.Show(); //this.main.Show(); this.Show(); }
public SparkleLog(string path) : base("") { LocalPath = path; string name = System.IO.Path.GetFileName (LocalPath); SetDefaultSize (480, 640); SetPosition (WindowPosition.Center); BorderWidth = 0; // TRANSLATORS: {0} is a folder name, and {1} is a server address Title = String.Format(_("Recent Events in ‘{0}’"), name); IconName = "folder-sparkleshare"; DeleteEvent += delegate { Close (); }; // Adds a hidden menubar that contains to enable keyboard // shortcuts to close the log MenuBar = new MenuBar (); MenuItem file_item = new MenuItem ("File"); Menu file_menu = new Menu (); MenuItem close_1 = new MenuItem ("Close1"); MenuItem close_2 = new MenuItem ("Close2"); // adds specific Ctrl+W and Esc key accelerators to Log Window AccelGroup accel_group = new AccelGroup (); AddAccelGroup (accel_group); // Close on Esc close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); close_1.Activated += delegate { Close (); }; // Close on Ctrl+W close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, AccelFlags.Visible)); close_2.Activated += delegate { Close (); }; file_menu.Append (close_1); file_menu.Append (close_2); file_item.Submenu = file_menu; MenuBar.Append (file_item); // Hacky way to hide the menubar, but the accellerators // will simply be disabled when using Hide () MenuBar.HeightRequest = 1; MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); LayoutVertical = new VBox (false, 0); LayoutVertical.PackStart (CreateEventLog (), true, true, 0); HButtonBox dialog_buttons = new HButtonBox { Layout = ButtonBoxStyle.Edge, BorderWidth = 12 }; Button open_folder_button = new Button (_("_Open Folder")) { UseUnderline = true }; open_folder_button.Clicked += delegate (object o, EventArgs args) { Process process = new Process (); process.StartInfo.FileName = Defines.OPEN_COMMAND; process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters process.Start (); Close (); }; Button close_button = new Button (Stock.Close); close_button.Clicked += delegate { Close (); }; dialog_buttons.Add (open_folder_button); dialog_buttons.Add (close_button); LayoutVertical.PackStart (new HSeparator (), false, false, 0); // We have to hide the menubar somewhere... LayoutVertical.PackStart (MenuBar, false, false, 0); LayoutVertical.PackStart (dialog_buttons, false, false, 0); Add (LayoutVertical); }
void BuildLayout () { var primary_vbox = new VBox () { Spacing = 6 }; // Source selector var combo_align = new Alignment (0, .5f, 0, 0); var combo_hbox = new HBox (false, 6); combo_hbox.Add (new Label (Catalog.GetString ("Import from:"))); sources_combo = new ComboBox (sources_model); var render = new CellRendererText (); sources_combo.PackStart (render, true); sources_combo.SetAttributes (render, "text", 1); combo_hbox.Add (sources_combo); combo_align.Add (combo_hbox); combo_align.ShowAll (); primary_vbox.Add (combo_align); // Button row near the top var align = new Alignment (1, .5f, 0, 0); var button_box = new HButtonBox () { Spacing = 6 }; button_box.Add (cancel_button = new Button (Stock.Cancel)); button_box.Add (import_button = new Button (Stock.Add)); align.Add (button_box); align.ShowAll (); primary_vbox.Add (align); primary_vbox.Show (); Add (primary_vbox); }
private void ShowEditor(Editor editor) { SetupEditor (editor); current_editor = editor; buttons.Hide (); // Top label VBox vbox = new VBox (false, 4); Label label = new Label (); label.Markup = String.Format("<big><b>{0}</b></big>", editor.Label); vbox.PackStart (label, false, false, 5); // Optional config widget Widget config = editor.ConfigurationWidget (); if (config != null) { // This is necessary because GtkBuilder widgets need to be // reparented. if (config.Parent != null) { config.Reparent (vbox); } else { vbox.PackStart (config, false, false, 0); } } // Apply / Cancel buttons HButtonBox tool_buttons = new HButtonBox (); tool_buttons.LayoutStyle = ButtonBoxStyle.End; tool_buttons.Spacing = 5; tool_buttons.BorderWidth = 5; tool_buttons.Homogeneous = false; Button cancel = new Button (Stock.Cancel); cancel.Clicked += HandleCancel; tool_buttons.Add (cancel); Button apply = new Button (editor.ApplyLabel); apply.Image = new Image (GtkUtil.TryLoadIcon (FSpot.Core.Global.IconTheme, editor.IconName, 22, (Gtk.IconLookupFlags)0)); apply.Clicked += delegate { Apply (editor); }; tool_buttons.Add (apply); // Pack it all together vbox.PackEnd (tool_buttons, false, false, 0); active_editor = vbox; widgets.Add (active_editor); active_editor.ShowAll (); }
private void CreateAbout() { Gdk.Color color = Style.Foreground (StateType.Insensitive); string secondary_text_color = SparkleUIHelpers.GdkColorToHex (color); EventBox box = new EventBox (); box.ModifyBg (StateType.Normal, new TreeView ().Style.Base (StateType.Normal)); Label header = new Label () { Markup = "<span font_size='xx-large'>SparkleShare</span>\n<span fgcolor='" + secondary_text_color + "'><small>" + Defines.VERSION + "</small></span>", Xalign = 0, Xpad = 18, Ypad = 18 }; box.Add (header); this.version = new Label () { Markup = "<small>Checking for updates...</small>", Xalign = 0, Xpad = 18, Ypad = 22, }; Label license = new Label () { Xalign = 0, Xpad = 18, Ypad = 0, LineWrap = true, Wrap = true, LineWrapMode = Pango.WrapMode.Word, Markup = "<small>Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others\n" + "\n" + "SparkleShare is Free and Open Source Software. " + "You are free to use, modify, and redistribute it " + "under the terms of the GNU General Public License version 3 or later.</small>" }; VBox vbox = new VBox (false, 0) { BorderWidth = 0 }; HButtonBox button_bar = new HButtonBox () { BorderWidth = 12 }; Button credits_button = new Button (_("_Show Credits")) { UseUnderline = true }; credits_button.Clicked += delegate { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = "http://www.sparkleshare.org/credits"; process.Start (); }; Button website_button = new Button (_("_Visit Website")) { UseUnderline = true }; website_button.Clicked += delegate { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = "http://www.sparkleshare.org/"; process.Start (); }; button_bar.Add (website_button); button_bar.Add (credits_button); vbox.PackStart (box, true, true, 0); vbox.PackStart (this.version, false, false, 0); vbox.PackStart (license, true, true, 0); vbox.PackStart (new Label (""), true, true, 0); vbox.PackStart (button_bar, false, false, 0); Add (vbox); }
public Contact (Hashtable contact) : base (false, 10) { HBox hbox; Table table; Button button; HButtonBox hbuttonbox; this.contact = contact; // Create header containing an icon and display name hbox = new HBox (); hbox.Spacing = 10; hbox.PackStart (Beagle.Images.GetWidget ("person.png"), false, false, 0); hbox.PackStart (new VLabel (String.Format ("<b><span size='large'>{0} \"{1}\" {2}</span></b>", GetValue ("FirstName"), GetValue ("NickName"), GetValue ("LastName")), false)); PackStart (hbox, false, false, 0); PackStart (new HSeparator (), false, false, 0); // Create a table containing some user information table = new Table (5, 2, false); PackStart (table, false, false, 0); table.Attach (new VLabel (String.Format ("<b>{0}</b>", Catalog.GetString ("Primary E-Mail:")), false), 0, 1, 0, 1, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink, 10, 0); table.Attach (new VLabel (GetValue ("PrimaryEmail"), true), 1, 2, 0, 1); table.Attach (new VLabel (String.Format ("<b>{0}</b>", Catalog.GetString ("Screen name:")), false), 0, 1, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink, 10, 0); table.Attach (new VLabel (GetValue ("_AimScreenName"), true), 1, 2, 1, 2); table.Attach (new VLabel (String.Format ("<b>{0}</b>", Catalog.GetString ("Home phone:")), false), 0, 1, 2, 3, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink, 10, 0); table.Attach (new VLabel (GetValue ("HomePhone"), true), 1, 2, 2, 3); table.Attach (new VLabel (String.Format ("<b>{0}</b>", Catalog.GetString ("Mobile phone:")), false), 0, 1, 3, 4, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink, 10, 0); table.Attach (new VLabel (GetValue ("CellularNumber"), true), 1, 2, 3, 4); table.Attach (new VLabel (String.Format ("<b>{0}</b>", Catalog.GetString ("Web page:")), false), 0, 1, 4, 5, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink, 10, 0); table.Attach (new VLabel (GetValue ("WebPage2"), true), 1, 2, 4, 5); // Add a button row with some informational buttons hbuttonbox = new HButtonBox (); hbuttonbox.Layout = ButtonBoxStyle.End; PackEnd (hbuttonbox, false, false, 0); button = new Button (Catalog.GetString ("Send E-Mail")); button.Clicked += OnSendEmail; hbuttonbox.Add (button); button = new Button (Catalog.GetString ("Details...")); button.Clicked += OnDetails; hbuttonbox.Add (button); }
public SparkleDialog() : base("") { BorderWidth = 0; IconName = "folder-sparkleshare"; Resizable = true; WindowPosition = WindowPosition.Center; Title = "SparkleShare " + Defines.VERSION; Resizable = false; SetSizeRequest (480, 480); Label label = new Label () { Xalign = 0, Xpad = 12, Ypad = 12 }; Gdk.Color color = Style.Foreground (StateType.Insensitive); string secondary_text_color = SparkleUIHelpers.GdkColorToHex (color); label.Markup = "<b><span size='x-large'>SparkleShare</span></b>\n" + "<span fgcolor='" + secondary_text_color + "'>version " + Defines.VERSION + "</span>\n\n" + @"Copyright © 2010 Hylke Bons This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Maintainer: Hylke Bons ([email protected]) Contributors: Alex Hudson ([email protected]) Allan Day ([email protected]) Andreas Nilsson ([email protected]) Benjamin Podszun ([email protected]) Bertrand Lorentz ([email protected]) Garrett LeSage ([email protected]) Jakub Steiner ([email protected]) Lapo Calamandrei ([email protected]) Luis Cordova ([email protected]) Łukasz Jernaś ([email protected]) Michael Monreal ([email protected]) Oleg Khlystov ([email protected]) Paul Cutler ([email protected]) Philipp Gildein ([email protected]) Ruben Vermeersch ([email protected]) Sandy Armstrong ([email protected]) Simon Pither ([email protected]) Steven Harms ([email protected]) Vincent Untz ([email protected]) Thanks very much!"; /* Git# is Copyright © 2007-2009 by the Git Development Community See source file headers for specific contributor copyrights. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Git Development Community nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SmartIrc4net - The IRC library for .NET/C# Copyright © 2003-2005 Mirco Bauer ([email protected]) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details."; */ VBox wrapper = new VBox (false, 0); VBox vbox = new VBox (false, 0) { BorderWidth = 0 }; ScrolledWindow scrolled_window = new ScrolledWindow () { HscrollbarPolicy = PolicyType.Never, ShadowType = ShadowType.None, BorderWidth = 0 }; scrolled_window.AddWithViewport (label); (scrolled_window.Child as Viewport).ShadowType = ShadowType.None; (scrolled_window.Child as Viewport).ModifyBg (StateType.Normal, (new Entry () as Entry).Style.Base (StateType.Normal)); HButtonBox button_bar = new HButtonBox () { BorderWidth = 12 }; Button close_button = new Button (Stock.Close); close_button.Clicked += delegate { Destroy (); }; Button website_button = new Button (_("_Visit Website")) { UseUnderline = true }; website_button.Clicked += delegate { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = "http://www.sparkleshare.org/"; process.Start (); }; button_bar.Add (website_button); button_bar.Add (close_button); vbox.PackStart (scrolled_window, true, true, 0); vbox.PackStart (new HSeparator (), false, false, 0); vbox.PackStart (button_bar, false, false, 0); string image_path = SparkleHelpers.CombineMore (Defines.PREFIX, "share", "pixmaps", "sparkleshare-about.png"); wrapper.PackStart (new Image (image_path), false, false, 0); wrapper.PackStart (vbox, true, true, 0); Add (wrapper); }
private void InitGui() { //genre button Gtk.Image square = new Gtk.Image(null, "Wikipedia-logo-small.png"); Gtk.HBox genre_hbox = new HBox(false, 0); genre_hbox.Add(square); genre_hbox.Add(new Label(Catalog.GetString("Genre"))); genre_button = new Gtk.Button(genre_hbox); genre_button.Relief = ReliefStyle.None; // artist Gtk.HBox artist_hbox = new HBox(false, 0); artist_hbox.Add(new Gtk.Image(null, "Wikipedia-logo-small.png")); artist_hbox.Add(new Label(Catalog.GetString("Artist"))); artist_button = new Gtk.Button(artist_hbox); artist_button.Relief = ReliefStyle.None; //album button Gtk.HBox album_hbox = new HBox(false, 0); album_hbox.Add(new Gtk.Image(null, "Wikipedia-logo-small.png")); album_hbox.Add(new Label(Catalog.GetString("Album"))); album_button = new Gtk.Button(album_hbox); album_button.Relief = ReliefStyle.None; //lyrics button Gtk.HBox lyric_hbox = new HBox(false, 0); lyric_hbox.Add(new Gtk.Image(null, "lyrics.png")); lyric_hbox.Add(new Label(Catalog.GetString("Lyrics"))); lyric_button = new Gtk.Button(lyric_hbox); lyric_button.Relief = ReliefStyle.None; // Button bar Gtk.HButtonBox hb = new Gtk.HButtonBox(); hb.Layout = Gtk.ButtonBoxStyle.Start; hb.Spacing = 5; hb.Add(artist_button); hb.Add(album_button); hb.Add(genre_button); hb.Add(lyric_button); // hide/show button hide_show_button = new Gtk.Button(new Gtk.Image(null, "minus.png")); hide_show_button.Relief = ReliefStyle.None; hide_show_button.Clicked += new EventHandler(OnHideShowClicked); this.minimized = false; //search label Gtk.Label search_l = new Gtk.Label(); search_l.Markup = "<b>" + Catalog.GetString("Search") + ":</b>"; // upper hbox Gtk.HBox toolbar = new Gtk.HBox(false, 5); toolbar.PackStart(new Gtk.Image(Stock.Info, IconSize.Menu), false, false, 5); toolbar.PackStart(search_l, false, false, 5); toolbar.PackStart(hb, true, true, 0); toolbar.PackStart(hide_show_button, false, false, 0); this.wb = new ContextBrowser(); //main = new Gtk.VBox(false,5); this.PackStart(toolbar, false, false, 0); this.PackEnd(wb, true, true, 5); //this.Add(main); this.HeightRequest = 400; //hb.Show(); //this.wb.Show(); //this.main.Show(); this.Show(); }
public SparkleDiffWindow(string file_path, string [] revisions) : base("") { string file_name = System.IO.Path.GetFileName (file_path); Revisions = revisions; SetPosition (WindowPosition.Center); BorderWidth = 12; IconName = "image-x-generic"; FaceCollection face_collection = new FaceCollection (); face_collection.UseGravatar = true; DeleteEvent += Quit; Title = file_name; VBox layout_vertical = new VBox (false, 12); HBox layout_horizontal = new HBox (true, 6); Process process = new Process (); process.EnableRaisingEvents = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName (file_path); process.StartInfo.FileName = "git"; process.StartInfo.Arguments = "log --format=\"%ct\t%an\t%ae\" " + file_name; process.Start (); ViewLeft = new LeftRevisionView (); ViewRight = new RightRevisionView (); string output = process.StandardOutput.ReadToEnd (); string [] revisions_info = Regex.Split (output.Trim (), "\n"); int i = 0; foreach (string revision_info in revisions_info) { string [] parts = Regex.Split (revision_info.Trim (), "\t"); int timestamp = int.Parse (parts [0]); string author = parts [1]; string email = parts [2]; string date; // TRANSLATORS: This is a format specifier according to System.Globalization.DateTimeFormatInfo if (i == 0) date = "Latest Revision"; else date = String.Format (_("{0} at {1}"), UnixTimestampToDateTime (timestamp).ToString (_("ddd MMM d, yyyy")), UnixTimestampToDateTime (timestamp).ToString (_("H:mm"))); face_collection.AddFace (email); ViewLeft.AddRow (face_collection.GetFace (email, 32), author, date); ViewRight.AddRow (face_collection.GetFace (email, 32), author, date); i++; } ViewLeft.SetImage (new RevisionImage (file_path, Revisions [1])); ViewRight.SetImage (new RevisionImage (file_path, Revisions [0])); ViewLeft.IconView.SelectionChanged += delegate { ViewLeft.SetImage (new RevisionImage (file_path, Revisions [ViewLeft.GetSelected ()])); ViewLeft.ScrolledWindow.Hadjustment = ViewRight.ScrolledWindow.Hadjustment; ViewLeft.ScrolledWindow.Vadjustment = ViewRight.ScrolledWindow.Vadjustment; HookUpViews (); }; ViewRight.IconView.SelectionChanged += delegate { ViewRight.SetImage (new RevisionImage (file_path, Revisions [ViewRight.GetSelected ()])); ViewRight.ScrolledWindow.Hadjustment = ViewLeft.ScrolledWindow.Hadjustment; ViewRight.ScrolledWindow.Vadjustment = ViewLeft.ScrolledWindow.Vadjustment; HookUpViews (); }; ViewLeft.ToggleButton.Clicked += delegate { if (ViewLeft.ToggleButton.Active) DetachViews (); else HookUpViews (); }; ViewRight.ToggleButton.Clicked += delegate { if (ViewLeft.ToggleButton.Active) DetachViews (); else HookUpViews (); }; layout_horizontal.PackStart (ViewLeft); layout_horizontal.PackStart (ViewRight); ResizeToViews (); // Order time view according to the user's reading direction if (Direction == Gtk.TextDirection.Rtl) layout_horizontal.ReorderChild (ViewLeft, 1); HookUpViews (); HButtonBox dialog_buttons = new HButtonBox (); dialog_buttons.Layout = ButtonBoxStyle.End; dialog_buttons.BorderWidth = 0; Button close_button = new Button (Stock.Close); close_button.Clicked += delegate (object o, EventArgs args) { Environment.Exit (0); }; dialog_buttons.Add (close_button); layout_vertical.PackStart (layout_horizontal, true, true, 0); layout_vertical.PackStart (dialog_buttons, false, false, 0); Add (layout_vertical); }
private void createGui(Gtk.Window app1, string labelStr) { chronopic_contacts_real_win = new Window ("Chronopic connection"); chronopic_contacts_real_win.AllowGrow = false; chronopic_contacts_real_win.Modal = true; chronopic_contacts_real_win.TransientFor = app1; chronopic_contacts_real_win.BorderWidth= 20; chronopic_contacts_real_win.DeleteEvent += on_delete_event; Gtk.VBox vbox_main = new Gtk.VBox(false, 20); chronopic_contacts_real_win.Add(vbox_main); LogB.Information("Connecting real (starting connection)"); LogB.Information("Press test button on Chronopic"); Gtk.Label label = new Gtk.Label(); label.Text = labelStr; vbox_main.Add(label); progressbar = new Gtk.ProgressBar(); vbox_main.Add(progressbar); Gtk.Button button_cancel = new Gtk.Button("Cancel"); button_cancel.Clicked += new EventHandler(on_button_cancel_clicked); Gtk.HButtonBox hbox = new Gtk.HButtonBox (); hbox.Add(button_cancel); vbox_main.Add(hbox); chronopic_contacts_real_win.ShowAll(); }
public NoteRenameDialog (IList<Note> notes, string oldTitle, Note renamedNote) : base (Catalog.GetString ("Rename Note Links?"), renamedNote.Window, 0) { this.DefaultResponse = ResponseType.Cancel; this.BorderWidth = 10; var renameButton = (Button) AddButton (Catalog.GetString ("_Rename Links"), ResponseType.Yes); var dontRenameButton = (Button) AddButton (Catalog.GetString ("_Don't Rename Links"), ResponseType.No); this.notes = notes; notesModel = new Gtk.TreeStore (typeof (bool), typeof (string), typeof (Note)); foreach (var note in notes) notesModel.AppendValues (true, note.Title, note); var labelText = Catalog.GetString ("Rename links in other notes from \"<span underline=\"single\">{0}</span>\" " + "to \"<span underline=\"single\">{1}</span>\"?\n\n" + "If you do not rename the links, " + "they will no longer link to anything."); var label = new Label (); label.UseMarkup = true; label.Markup = String.Format (labelText, GLib.Markup.EscapeText (oldTitle), GLib.Markup.EscapeText (renamedNote.Title)); label.LineWrap = true; ContentArea.PackStart (label, false, true, 5); var notesView = new TreeView (notesModel); notesView.SetSizeRequest (-1, 200); var toggleCell = new CellRendererToggle (); toggleCell.Activatable = true; var column = new TreeViewColumn (Catalog.GetString ("Rename Links"), toggleCell, "active", 0); column.SortColumnId = 0; column.Resizable = true; notesView.AppendColumn (column); toggleCell.Toggled += (o, args) => { TreeIter iter; if (!notesModel.GetIterFromString (out iter, args.Path)) return; bool val = (bool) notesModel.GetValue (iter, 0); notesModel.SetValue (iter, 0, !val); }; column = new TreeViewColumn (Catalog.GetString ("Note Title"), new CellRendererText (), "text", 1); column.SortColumnId = 1; column.Resizable = true; notesView.AppendColumn (column); notesView.RowActivated += (o, args) => { TreeIter iter; if (!notesModel.GetIter (out iter, args.Path)) return; Note note = (Note) notesModel.GetValue (iter, 2); if (note != null) { note.Window.Present (); NoteFindBar find = note.Window.Find; find.ShowAll (); find.Visible = true; find.SearchText = "\"" + oldTitle + "\""; } }; var notesBox = new VBox (false, 5); var selectAllButton = new Button (); // Translators: This button causes all notes in the list to be selected selectAllButton.Label = Catalog.GetString ("Select All"); selectAllButton.Clicked += (o, e) => { notesModel.Foreach ((model, path, iter) => { notesModel.SetValue (iter, 0, true); return false; }); }; var selectNoneButton = new Button (); // Translators: This button causes all notes in the list to be unselected selectNoneButton.Label = Catalog.GetString ("Select None"); selectNoneButton.Clicked += (o, e) => { notesModel.Foreach ((model, path, iter) => { notesModel.SetValue (iter, 0, false); return false; }); }; var notesButtonBox = new HButtonBox (); notesButtonBox.Add (selectNoneButton); notesButtonBox.Add (selectAllButton); notesButtonBox.Spacing = 5; notesButtonBox.LayoutStyle = ButtonBoxStyle.End; var notesScroll = new ScrolledWindow (); notesScroll.Add (notesView); notesBox.PackStart (notesScroll, true, true, 0); notesBox.PackStart (notesButtonBox, false, true, 0); var advancedExpander = new Expander (Catalog.GetString ("Ad_vanced")); var expandBox = new VBox (); expandBox.PackStart (notesBox, true, true, 0); alwaysShowDlgRadio = new RadioButton (Catalog.GetString ("Always show this _window")); alwaysShowDlgRadio.Clicked += (o, e) => { selectAllButton.Click (); notesBox.Sensitive = true; renameButton.Sensitive = true; dontRenameButton.Sensitive = true; }; neverRenameRadio = new RadioButton (alwaysShowDlgRadio, Catalog.GetString ("Never rename _links")); neverRenameRadio.Clicked += (o, e) => { selectNoneButton.Click (); notesBox.Sensitive = false; renameButton.Sensitive = false; dontRenameButton.Sensitive = true; }; alwaysRenameRadio = new RadioButton (alwaysShowDlgRadio, Catalog.GetString ("Alwa_ys rename links")); alwaysRenameRadio.Clicked += (o, e) => { selectAllButton.Click (); notesBox.Sensitive = false; renameButton.Sensitive = true; dontRenameButton.Sensitive = false; }; expandBox.PackStart (alwaysShowDlgRadio, false, true, 0); expandBox.PackStart (neverRenameRadio, false, true, 0); expandBox.PackStart (alwaysRenameRadio, false, true, 0); advancedExpander.Add (expandBox); ContentArea.PackStart (advancedExpander, true, true, 5); advancedExpander.Activated += (o, e) => this.Resizable = advancedExpander.Expanded; this.Focus = dontRenameButton; ContentArea.ShowAll (); }
void AddItemToCurrentMarketGroup(ECM.EveItem item, TreeModel model, TreeIter iter) { if (vbbMarketGroups.IsRealized == false) vbbMarketGroups.Realize(); Image itemPic = new Image(); itemPic.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF); itemPic.WidthRequest = 64; itemPic.HeightRequest = 64; BackgroundWorker fetchImage = new BackgroundWorker(); fetchImage.DoWork += delegate(object sender, DoWorkEventArgs e) { itemPic.Pixbuf = ECM.API.ImageApi.GetItemImageGTK(item.ID, ECM.API.ImageApi.ImageRequestSize.Size64x64); }; fetchImage.RunWorkerAsync(); Gdk.Pixbuf buf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 22, 22); Gdk.Pixbuf book = new Gdk.Pixbuf(ECM.Core.Skillbook22PNG); EveItemUseability useability = Core.CurrentCharacter.GetItemUseability(item); if (useability == EveItemUseability.Untrainable) buf.Fill(m_Untrainable.ToUint()); else if (useability == EveItemUseability.Trainable) buf.Fill(m_Trainable.ToUint()); else buf.Fill(m_Useable.ToUint()); book.Composite(buf, 0, 0, buf.Width, buf.Height, 0, 0, 1, 1, Gdk.InterpType.Hyper, 255); Image skillsMet = new Image(buf); skillsMet.WidthRequest = 22; skillsMet.HeightRequest = 22; skillsMet.Xalign = 0; Pango.FontDescription font = new Pango.FontDescription(); font.Size = 24; Label itemName = new Label(); itemName.UseMarkup = true; itemName.Markup = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>", item.Name); itemName.Xalign = 0; //itemName.ModifyFont(font); Image infoPic = new Image(ECM.Core.Info16PNG); infoPic.WidthRequest = 16; infoPic.HeightRequest = 16; Button btnInfo = new Button(); btnInfo.Relief = ReliefStyle.None; btnInfo.Add(infoPic); btnInfo.Clicked += delegate(object sender, EventArgs e) { m_ViewDetails.ShowItemDetails(item); }; HBox itemNameHeader = new HBox(); itemNameHeader.PackStart(itemName, false, false, 0); itemNameHeader.PackStart(btnInfo, false, false, 3); WrapLabel itemDesc = new WrapLabel(item.Description); Frame picFrame = new Frame(); picFrame.Shadow = ShadowType.Out; picFrame.Add(itemPic); VBox heading = new VBox(); heading.Spacing = 6; heading.PackEnd(itemNameHeader, false, false, 0); if(item.HasRequirements) heading.PackEnd(skillsMet, false, false, 0); HBox inner = new HBox(); inner.PackStart(picFrame, false, false, 0); inner.PackStart(heading, true, true, 1); Button viewDets = new Button(new Label("View Market Details")); viewDets.Clicked += delegate(object sender, EventArgs e) { ShowItemMarketDetails(item, model, iter); }; HButtonBox itemButtons = new HButtonBox(); itemButtons.Layout = ButtonBoxStyle.End; itemButtons.BorderWidth = 3; itemButtons.Add(viewDets); itemButtons.ShowAll(); HSeparator sep = new HSeparator(); VBox itemBlock = new VBox(); itemBlock.Spacing = 10; itemBlock.PackStart(inner, false, false, 0); itemBlock.PackStart(itemDesc, true, true, 0); itemBlock.PackEnd(itemButtons, false, false, 0); itemBlock.ShowAll(); sep.ShowAll(); vbbMarketGroups.PackStart(itemBlock, false, false, 3); vbbMarketGroups.PackStart(sep, false, false, 3); }
public SettingsDialog() : base("Settings") { Modal = true; //Title = "Settings"; this.SetSizeRequest(400, 400); VBox vbox1 = new VBox(false, 0); Notebook nb = new Notebook(); ScrolledWindow sw = new ScrolledWindow(); VBox vbox2 = new VBox(false, 0); settingNames = new SettingsUtil.ConstSettingEntry[SettingsUtil.MainSettings.Count]; settingCtrls = new Widget[SettingsUtil.MainSettings.Count]; int i = 0; foreach(KeyValuePair<string, SettingsUtil.SettingEntry> entry in SettingsUtil.MainSettings) { //try { SettingsUtil.ConstSettingEntry constEntry = SettingsUtil.ValidSettings.Where(x => entry.Key == x.name).First(); string dispName = constEntry.displayName; Console.WriteLine(dispName); settingNames[i] = constEntry; switch(constEntry.type) { case SettingsUtil.SettingType.Text: case SettingsUtil.SettingType.Path: HBox hbox = new HBox(false, 0); Label lbl = new Label(dispName); hbox.PackStart(lbl, false, false, 0); vbox2.PackStart(hbox, false, false, 0); Entry textbox = new Entry(); textbox.Text = entry.Value.writetofile ? entry.Value.data.ToString() : ""; vbox2.PackStart(textbox, false, false, 0); settingCtrls[i] = textbox; break; case SettingsUtil.SettingType.Bool: CheckButton checkBtn = new CheckButton(dispName); checkBtn.Inconsistent = !entry.Value.writetofile; checkBtn.Active = (bool)entry.Value.data; checkBtn.Toggled += new EventHandler(OnToggle); vbox2.PackStart(checkBtn, false, false, 0); settingCtrls[i] = checkBtn; break; } //} //catch {} ++i; } sw.Add(vbox2); nb.AppendPage(sw, new Label("Main Settings")); sw = new ScrolledWindow(); vbox2 = new VBox(false, 0); foreach(PluginInfo pi in from p in PluginInfo.AllPlugins orderby p.Name select p) { HBox hbox = new HBox(false, 0); Label lbl = new Label(pi.Name); hbox.PackStart(lbl, false, false, 0); vbox2.PackStart(hbox, false, false, 0); hbox = new HBox(false, 0); lbl = new Label(string.Format("Version: {0}", pi.Revision)); hbox.PackStart(lbl, false, false, 0); vbox2.PackStart(hbox, false, false, 0); hbox = new HBox(false, 0); lbl = new Label(pi.Author); hbox.PackStart(lbl, false, false, 0); vbox2.PackStart(hbox, false, false, 0); hbox = new HBox(false, 0); lbl = new Label(pi.Description); hbox.PackStart(lbl, false, false, 0); vbox2.PackStart(hbox, false, false, 0); CheckButton checkBtn = new CheckButton("Enabled"); //checkBtn.Active = (bool)entry.Value.data; vbox2.PackStart(checkBtn, false, false, 0); vbox2.PackStart(new Label(""), false, false, 0); } sw.Add(vbox2); nb.AppendPage(sw, new Label("Plugins")); vbox1.Add(nb); HButtonBox hbtnbox = new HButtonBox(); Button cancelButton = new Button(Stock.Cancel); Button okButton = new Button(Stock.Ok); hbtnbox.Add(cancelButton); hbtnbox.Add(okButton); vbox1.PackStart(hbtnbox, false, false, 0); this.Add(vbox1); //this.Add(vbox1); cancelButton.Clicked += OnCancelClicked; okButton.Clicked += OnOkClicked; }
public AttributeEditorWidget() : base() { sw = new ScrolledWindow (); sw.HscrollbarPolicy = PolicyType.Automatic; sw.VscrollbarPolicy = PolicyType.Automatic; store = new ListStore (typeof (string), typeof(string)); store.SetSortColumnId (0, SortType.Ascending); tv = new TreeView (); tv.Model = store; TreeViewColumn col; col = tv.AppendColumn ("Name", new CellRendererText (), "text", 0); col.SortColumnId = 0; CellRendererText cell = new CellRendererText (); cell.Editable = true; cell.Edited += new EditedHandler (OnAttributeEdit); tv.AppendColumn ("Value", cell, "text", 1); tv.KeyPressEvent += new KeyPressEventHandler (OnKeyPress); tv.ButtonPressEvent += new ButtonPressEventHandler (OnRightClick); tv.RowActivated += new RowActivatedHandler (OnRowActivated); sw.AddWithViewport (tv); HButtonBox hb = new HButtonBox (); hb.Layout = ButtonBoxStyle.End; applyButton = new Button (); applyButton.Label = "Apply"; applyButton.Image = new Gtk.Image (Stock.Apply, IconSize.Button); applyButton.Clicked += new EventHandler (OnApplyClicked); applyButton.Sensitive = false; hb.Add (applyButton); this.PackStart (sw, true, true, 0); this.PackStart (hb, false, false, 5); this.ShowAll (); }
private void CreateEventLog() { LogContent = new EventBox (); VBox layout_vertical = new VBox (false, 0); ScrolledWindow = new ScrolledWindow (); WebView = new WebView () { Editable = false }; WebView.HoveringOverLink += delegate (object o, WebKit.HoveringOverLinkArgs args) { LinkStatus = args.Link; }; // FIXME: Use the right event, waiting for newer webkit bindings: NavigationPolicyDecisionRequested WebView.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) { if (args.Request.Uri == LinkStatus) { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = args.Request.Uri.Replace (" ", "\\ "); // Escape space-characters process.Start (); UpdateEventLog (); } }; ScrolledWindow.AddWithViewport (WebView); LogContent.Add (ScrolledWindow); layout_vertical.PackStart (LogContent, true, true, 0); HButtonBox dialog_buttons = new HButtonBox { Layout = ButtonBoxStyle.Edge, BorderWidth = 12 }; Button open_folder_button = new Button (_("_Open Folder")) { UseUnderline = true }; open_folder_button.Clicked += delegate (object o, EventArgs args) { SparkleShare.Controller.OpenSparkleShareFolder (LocalPath); }; Button close_button = new Button (Stock.Close); close_button.Clicked += delegate { HideAll (); }; dialog_buttons.Add (open_folder_button); dialog_buttons.Add (close_button); // We have to hide the menubar somewhere... layout_vertical.PackStart (CreateShortcutsBar (), false, false, 0); layout_vertical.PackStart (dialog_buttons, false, false, 0); Add (layout_vertical); ShowAll (); }
public override void LaunchDialogue() { //the Type in the collection IList collection = (IList) parentRow.PropertyValue; string displayName = parentRow.PropertyDescriptor.DisplayName; //populate list with existing items itemStore = new ListStore (typeof (object), typeof (int), typeof (string)); for (int i=0; i<collection.Count; i++) { itemStore.AppendValues(collection [i], i, collection [i].ToString ()); } #region Building Dialogue //dialogue and buttons Dialog dialog = new Dialog (); dialog.Title = displayName + " Editor"; dialog.Modal = true; dialog.AllowGrow = true; dialog.AllowShrink = true; dialog.Modal = true; dialog.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel); dialog.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok); //three columns for items, sorting, PropGrid HBox hBox = new HBox (); dialog.VBox.PackStart (hBox, true, true, 5); //propGrid at end grid = new PropertyGrid (parentRow.ParentGrid.EditorManager); grid.CurrentObject = null; grid.WidthRequest = 200; grid.ShowHelp = false; hBox.PackEnd (grid, true, true, 5); //followed by item sorting buttons in ButtonBox VButtonBox sortButtonBox = new VButtonBox (); sortButtonBox.LayoutStyle = ButtonBoxStyle.Start; Button upButton = new Button (); Image upImage = new Image (Stock.GoUp, IconSize.Button); upImage.Show (); upButton.Add (upImage); upButton.Show (); sortButtonBox.Add (upButton); Button downButton = new Button (); Image downImage = new Image (Stock.GoDown, IconSize.Button); downImage.Show (); downButton.Add (downImage); downButton.Show (); sortButtonBox.Add (downButton); hBox.PackEnd (sortButtonBox, false, false, 5); //Third column is a VBox VBox itemsBox = new VBox (); hBox.PackStart (itemsBox, false, false, 5); //which at bottom has add/remove buttons HButtonBox addRemoveButtons = new HButtonBox(); addRemoveButtons.LayoutStyle = ButtonBoxStyle.End; Button addButton = new Button (Stock.Add); addRemoveButtons.Add (addButton); if (types [0].IsAbstract) addButton.Sensitive = false; Button removeButton = new Button (Stock.Remove); addRemoveButtons.Add (removeButton); itemsBox.PackEnd (addRemoveButtons, false, false, 10); //and at top has list (TreeView) in a ScrolledWindow ScrolledWindow listScroll = new ScrolledWindow (); listScroll.WidthRequest = 200; listScroll.HeightRequest = 320; itemsBox.PackStart (listScroll, true, true, 0); itemTree = new TreeView (itemStore); itemTree.Selection.Mode = SelectionMode.Single; itemTree.HeadersVisible = false; listScroll.AddWithViewport (itemTree); //renderers and attribs for TreeView CellRenderer rdr = new CellRendererText (); itemTree.AppendColumn (new TreeViewColumn ("Index", rdr, "text", 1)); rdr = new CellRendererText (); itemTree.AppendColumn (new TreeViewColumn ("Object", rdr, "text", 2)); #endregion #region Events addButton.Clicked += new EventHandler (addButton_Clicked); removeButton.Clicked += new EventHandler (removeButton_Clicked); itemTree.Selection.Changed += new EventHandler (Selection_Changed); upButton.Clicked += new EventHandler (upButton_Clicked); downButton.Clicked += new EventHandler (downButton_Clicked); #endregion //show and get response dialog.ShowAll (); ResponseType response = (ResponseType) dialog.Run(); dialog.Destroy (); //if 'OK' put items back in collection if (response == ResponseType.Ok) { DesignerTransaction tran = CreateTransaction (parentRow.ParentGrid.CurrentObject); object old = collection; try { collection.Clear(); foreach (object[] o in itemStore) collection.Add (o[0]); EndTransaction (parentRow.ParentGrid.CurrentObject, tran, old, collection, true); } catch { EndTransaction (parentRow.ParentGrid.CurrentObject, tran, old, collection, false); throw; } } //clean up so we start fresh if launched again itemTree = null; itemStore = null; grid = null; previousIter = TreeIter.Zero; }
public StructureDatabaseView(string fileName) { this.filename = fileName; hbox = new HBox(); sqlLiteDal = new SqlLiteDal(fileName); lblTable = new Label( MainClass.Languages.Translate("tables")); hbox.PackStart(lblTable, false, false, 10); cbTable = new ComboBox(); cbTable.Changed += new EventHandler(OnComboProjectChanged); CellRendererText textRenderer = new CellRendererText(); cbTable.PackStart(textRenderer, true); cbTable.AddAttribute(textRenderer, "text", 0); cbTable.Model = tablesComboModel; cbTable.WidthRequest = 200; hbox.PackStart(cbTable, false, false, 2); hbox.PackEnd(new Label(""), true, true, 2); HButtonBox hbbAction = new HButtonBox(); hbbAction.LayoutStyle = Gtk.ButtonBoxStyle.Start; hbbAction.Spacing =6; Button btnAddTable = new Button(MainClass.Languages.Translate("add_table")); btnAddTable.Clicked+= delegate(object sender, EventArgs e) { SqlLiteAddTable addtable = new SqlLiteAddTable( filename ); int result = addtable.Run(); if (result == (int)ResponseType.Ok) { GetTables(); } addtable.Destroy(); }; Button btnDeleteTable = new Button(MainClass.Languages.Translate("delete_table")); btnDeleteTable.Clicked+= delegate(object sender, EventArgs e) { if(!CheckSelectTable()) return; MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo,MainClass.Languages.Translate("permanently_delete_table", curentTable), "", Gtk.MessageType.Question); int result = md.ShowDialog(); if (result != (int)Gtk.ResponseType.Yes) return; DropTable(); GetTables(); }; Button btnEditTable = new Button(MainClass.Languages.Translate("edit_table")); btnEditTable.Clicked+= delegate(object sender, EventArgs e) { if(!CheckSelectTable()) return; SqlLiteEditTable editTable = new SqlLiteEditTable(filename,curentTable); int result = editTable.Run(); if (result == (int)ResponseType.Ok) { GetTables(); } editTable.Destroy(); }; hbbAction.Add(btnAddTable); hbbAction.Add(btnDeleteTable); hbbAction.Add(btnEditTable); hbox.PackEnd(hbbAction, false, false, 10); this.PackStart(hbox, false, false, 5); ScrolledWindow sw = new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); treeView = new TreeView(tableModel); GenerateColumns(); treeView.RulesHint = true; //treeView.SearchColumn = (int) Column.Description; sw.Add(treeView); this.PackStart(sw, true, true, 5); ScrolledWindow sw2 = new ScrolledWindow (); sw2.ShadowType = ShadowType.EtchedIn; sw2.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); sw2.HeightRequest = 50; textControl = new TextView(); textControl.Editable = false; textControl.HeightRequest = 50; sw2.Add (textControl); this.PackEnd(sw2, false, false, 5); this.ShowAll(); GetTables(); //cbTable.Active = 0; }
public CoverArtPanel(AudioPlayer audioPlayer, params ITrackSelector[] trackSelectors) : base(false, 0) { ButtonBox buttonBox = new HButtonBox(); _selectedButton = new ToggleButton("Selected"); _playingButton = new ToggleButton("Playing"); buttonBox.Add(_playingButton); buttonBox.Add(_selectedButton); PackStart(buttonBox, false, false, 0); EventBox eventBox = new EventBox(); eventBox.Add(_picture); eventBox.ButtonPressEvent += (o, args) => { var window = new Gtk.Window(WindowType.Toplevel); var pixbuf = _currentPixbuf.Copy(); AutoScalingImage image = new AutoScalingImage(); window.Add(image); int left, top, right, bottom; window.GetFrameDimensions(out left, out top, out right, out bottom); int windowHeightWithFullImage = pixbuf.Height + top + bottom; if (windowHeightWithFullImage > Screen.Height) window.SetDefaultSize(((pixbuf.Width + left + right) * Screen.Height) / windowHeightWithFullImage, Screen.Height); else window.SetDefaultSize(pixbuf.Width + left + right, pixbuf.Height + top + bottom); window.AllowShrink = true; image.Pixbuf = pixbuf; Track track = _selectedButton.Active ? _selectedTrack : _playingTrack; window.Title = String.Format("{0} - {1}", string.Join("; ", track.Album.Artists.Select(a => a.Name)), track.Album.Title); window.ShowAll(); image.QueueResize(); window.SizeAllocated += (o1, allocatedArgs) => { Console.WriteLine("window: {0}", window.Allocation); Console.WriteLine("args: {0}", allocatedArgs.Allocation); if (window.Allocation.Width != allocatedArgs.Allocation.Width || window.Allocation.Height != allocatedArgs.Allocation.Height) { image.SizeAllocate(allocatedArgs.Allocation); image.QueueResize(); image.QueueDraw(); window.QueueDraw(); } }; }; PackStart(eventBox, true, true, 0); _selectedButton.Toggled += SelectedButtonOnToggled; _playingButton.Toggled += PlayingButtonOnToggled; foreach (var trackSelector in trackSelectors) { if (trackSelector.HasFocus) _selectedTrack = trackSelector.CurrentTrack; trackSelector.SelectedTrack += TrackSelectorOnSelectedTrack; } audioPlayer.TrackChanged += AudioPlayerOnTrackChanged; _selectedButton.Shown += (sender, args) => _selectedButton.Active = true; ShowAll(); }