public Toolbar CreateToolBar (string name) { main_toolbar = new Toolbar (); main_toolbar.Name = name; menu_layout.PackStart (main_toolbar, false, false, 0); main_toolbar.Show (); return main_toolbar; }
private void BuildHeader () { header_table = new Table (2, 2, false); header_table.Show (); primary_vbox.PackStart (header_table, false, false, 0); main_menu = new MainMenu (); if (!PlatformDetection.IsMac && !PlatformDetection.IsMeeGo) { main_menu.Show (); header_table.Attach (main_menu, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); } Alignment toolbar_alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f); toolbar_alignment.TopPadding = PlatformDetection.IsMeeGo ? 0u : 3u; toolbar_alignment.BottomPadding = PlatformDetection.IsMeeGo ? 0u : 3u; header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/HeaderToolbar"); header_toolbar.ShowArrow = false; header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; header_toolbar.Show (); if (PlatformDetection.IsMeeGo) { header_toolbar.IconSize = IconSize.LargeToolbar; header_toolbar.Name = "meego-toolbar"; } toolbar_alignment.Add (header_toolbar); toolbar_alignment.Show (); header_table.Attach (toolbar_alignment, 0, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); var next_button = new NextButton (ActionService, PlatformDetection.IsMeeGo); next_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/NextArrowButton", next_button); seek_slider = new ConnectedSeekSlider () { Resizable = ShowSeekSliderResizer.Get () }; seek_slider.SeekSlider.WidthRequest = SeekSliderWidth.Get (); seek_slider.SeekSlider.SizeAllocated += (o, a) => { SeekSliderWidth.Set (seek_slider.SeekSlider.Allocation.Width); }; seek_slider.ShowAll (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider); var track_info_display = new ClassicTrackInfoDisplay (); track_info_display.Show (); track_info_container = TrackInfoDisplay.GetEditable (track_info_display); track_info_container.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_container, true); if (PlatformDetection.IsMeeGo) { track_info_display.ArtworkSpacing = 5; seek_slider.LeftPadding = 20; seek_slider.RightPadding = 20; var menu = (Menu)(ActionService.UIManager.GetWidget ("/ToolbarMenu")); var menu_button = new Hyena.Widgets.MenuButton (new Image (Stock.Preferences, IconSize.LargeToolbar), menu, true); menu_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ToolbarMenuPlaceholder", menu_button); var close_button = new Button (Image.NewFromIconName ("window-close", IconSize.LargeToolbar)) { TooltipText = Catalog.GetString ("Close") }; close_button.Clicked += (o, e) => Hide (); close_button.ShowAll (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ClosePlaceholder", close_button); } else { var volume_button = new ConnectedVolumeButton (); volume_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/VolumeButton", volume_button); } }
public Toolbar CreateToolBar(string name) { m_mainToolbar = new Toolbar(); m_mainToolbar.Name = name; m_menuLayout.PackStart (m_mainToolbar, false, false, 0); m_mainToolbar.Show(); return m_mainToolbar; }
void CheckCreateSubViewToolbar () { if (subViewToolbar != null) return; subViewToolbar = new Toolbar (); subViewToolbar.IconSize = IconSize.SmallToolbar; subViewToolbar.ToolbarStyle = ToolbarStyle.BothHoriz; subViewToolbar.ShowArrow = false; subViewToolbar.Show (); CheckCreateToolbarBox (); toolbarBox.PackStart (subViewToolbar, false, false, 0); }
private void BuildHeader() { header_table = new Table (2, 2, false); header_table.Show (); header_table.Vexpand = false; primary_vbox.PackStart (header_table, false, false, 0); main_menu = new MainMenu (); if (!PlatformDetection.IsMac) { main_menu.Show (); header_table.Attach (main_menu, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); } Alignment toolbar_alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f); toolbar_alignment.TopPadding = 3u; toolbar_alignment.BottomPadding = 3u; header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/HeaderToolbar"); header_toolbar.ShowArrow = false; header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; header_toolbar.Show (); toolbar_alignment.Add (header_toolbar); toolbar_alignment.Show (); header_table.Attach (toolbar_alignment, 0, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); var next_button = new NextButton (ActionService); next_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/NextArrowButton", next_button); seek_slider = new ConnectedSeekSlider () { Resizable = ShowSeekSliderResizer.Get () }; seek_slider.SeekSlider.WidthRequest = SeekSliderWidth.Get (); seek_slider.SeekSlider.SizeAllocated += (o, a) => { SeekSliderWidth.Set (seek_slider.SeekSlider.Allocation.Width); }; seek_slider.ShowAll (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider); var track_info_display = new ClassicTrackInfoDisplay (); track_info_display.Show (); track_info_container = TrackInfoDisplay.GetEditable (track_info_display); track_info_container.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_container, true); var volume_button = new ConnectedVolumeButton (); volume_button.Show (); ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/VolumeButton", volume_button); }
// // Construct a window to display a note // // Currently a toolbar with Link, Search, Text, Delete buttons // and a Gtk.TextView as the body. // public NoteWindow (Note note) : base (note.Title) { this.note = note; this.IconName = "tomboy"; this.SetDefaultSize (450, 360); Resizable = true; accel_group = new Gtk.AccelGroup (); AddAccelGroup (accel_group); text_menu = new NoteTextMenu (accel_group, note.Buffer, note.Buffer.Undoer); // Add the Find menu item to the toolbar Text menu. It // should only show up in the toplevel Text menu, since // the context menu already has a Find submenu. Gtk.SeparatorMenuItem spacer = new Gtk.SeparatorMenuItem (); spacer.Show (); text_menu.Append (spacer); Gtk.ImageMenuItem find_item = new Gtk.ImageMenuItem (Catalog.GetString("Find in This Note")); find_item.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu); find_item.Activated += FindActivate; find_item.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.f, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); find_item.Show (); text_menu.Append (find_item); plugin_menu = MakePluginMenu (); toolbar = MakeToolbar (); toolbar.Show (); template_widget = MakeTemplateBar (); // The main editor widget editor = new NoteEditor (note.Buffer); editor.PopulatePopup += OnPopulatePopup; editor.Show (); // Sensitize the Link toolbar button on text selection mark_set_timeout = new InterruptableTimeout(); mark_set_timeout.Timeout += UpdateLinkButtonSensitivity; note.Buffer.MarkSet += OnSelectionMarkSet; // FIXME: I think it would be really nice to let the // window get bigger up till it grows more than // 60% of the screen, and then show scrollbars. editor_window = new Gtk.ScrolledWindow (); editor_window.HscrollbarPolicy = Gtk.PolicyType.Automatic; editor_window.VscrollbarPolicy = Gtk.PolicyType.Automatic; editor_window.Add (editor); editor_window.Show (); FocusChild = editor; find_bar = new NoteFindBar (note); find_bar.Visible = false; find_bar.NoShowAll = true; find_bar.Hidden += FindBarHidden; Gtk.VBox box = new Gtk.VBox (false, 2); box.PackStart (toolbar, false, false, 0); box.PackStart (template_widget, false, false, 0); box.PackStart (editor_window, true, true, 0); box.PackStart (find_bar, false, false, 0); box.Show (); // Don't set up Ctrl-W or Ctrl-N if Emacs is in use bool using_emacs = false; string gtk_key_theme = (string) Preferences.Get ("/desktop/gnome/interface/gtk_key_theme"); if (gtk_key_theme != null && gtk_key_theme.CompareTo ("Emacs") == 0) using_emacs = true; // NOTE: Since some of our keybindings are only // available in the context menu, and the context menu // is created on demand, register them with the // global keybinder global_keys = new GlobalKeybinder (accel_group); // Close window (Ctrl-W) if (!using_emacs) global_keys.AddAccelerator (new EventHandler (CloseWindowHandler), (uint) Gdk.Key.w, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Escape has been moved to be handled by a KeyPress Handler so that // Escape can be used to close the FindBar. // Close all windows on current Desktop (Ctrl-Q) global_keys.AddAccelerator (new EventHandler (CloseAllWindowsHandler), (uint) Gdk.Key.q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Find Next (Ctrl-G) global_keys.AddAccelerator (new EventHandler (FindNextActivate), (uint) Gdk.Key.g, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Find Previous (Ctrl-Shift-G) global_keys.AddAccelerator (new EventHandler (FindPreviousActivate), (uint) Gdk.Key.g, (Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask), Gtk.AccelFlags.Visible); // Open Help (F1) global_keys.AddAccelerator (new EventHandler (OpenHelpActivate), (uint) Gdk.Key.F1, 0, 0); // Create a new note if (!using_emacs) global_keys.AddAccelerator (new EventHandler (CreateNewNote), (uint) Gdk.Key.n, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Have Esc key close the find bar or note window KeyPressEvent += KeyPressed; // Increase Indent global_keys.AddAccelerator (new EventHandler (ChangeDepthRightHandler), (uint) Gdk.Key.Right, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); // Decrease Indent global_keys.AddAccelerator (new EventHandler (ChangeDepthLeftHandler), (uint) Gdk.Key.Left, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); this.Add (box); }
public SqlQueryView() : base() { control = new Frame (); control.Show (); VBox vbox = new VBox (); vbox.Show (); Tooltips tips = new Tooltips (); Toolbar toolbar = new Toolbar (); vbox.PackStart (toolbar, false, true, 0); toolbar.Show (); Image image = new Image (); image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Execute"); image.Show (); Button execute = new Button (image); execute.Clicked += new EventHandler (OnExecute); execute.Relief = ReliefStyle.None; tips.SetTip (execute, "Execute", ""); toolbar.Add (execute); execute.Show (); image = new Image (); image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.RunFromCursor"); image.Show (); Button run = new Button (image); run.Clicked += new EventHandler (OnRunFromCursor); run.Relief = ReliefStyle.None; tips.SetTip (run, "Run from cursor", ""); toolbar.Add (run); run.Show (); image = new Image (); image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Explain"); image.Show (); Button explain = new Button (image); explain.Clicked += new EventHandler (OnExplain); explain.Relief = ReliefStyle.None; tips.SetTip (explain, "Explain query", ""); toolbar.Add (explain); explain.Show (); image = new Image (); image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Stop"); image.Show (); Button stop = new Button (image); stop.Clicked += new EventHandler (OnStop); stop.Relief = ReliefStyle.None; stop.Sensitive = false; tips.SetTip (stop, "Stop", ""); toolbar.Add (stop); stop.Show (); VSeparator sep = new VSeparator (); toolbar.Add (sep); sep.Show (); model = new ListStore (typeof (string), typeof (DbProviderBase)); providers = new ComboBox (); providers.Model = model; CellRendererText ctext = new CellRendererText (); providers.PackStart (ctext, true); providers.AddAttribute (ctext, "text", 0); toolbar.Add (providers); providers.Show (); SourceLanguagesManager lm = new SourceLanguagesManager (); SourceLanguage lang = lm.GetLanguageFromMimeType ("text/x-sql"); SourceBuffer buf = new SourceBuffer (lang); buf.Highlight = true; sourceView = new SourceView (buf); sourceView.ShowLineNumbers = true; sourceView.Show (); ScrolledWindow scroller = new ScrolledWindow (); scroller.Add (sourceView); scroller.Show (); vbox.PackStart (scroller, true, true, 0); control.Add (vbox); service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService)); changedHandler = (EventHandler) Runtime.DispatchService.GuiDispatch ( new EventHandler (OnProvidersChanged)); service.Providers.Changed += changedHandler; foreach (DbProviderBase p in service.Providers) { model.AppendValues (p.Name, p); } }