public int GetItemPosition(Gtk.ToolItem item) { int raw_ret = gtk_tool_item_group_get_item_position(Handle, item == null ? IntPtr.Zero : item.Handle); int ret = raw_ret; return(ret); }
public Gtk.ToolItem GetNthItem(uint index) { IntPtr raw_ret = gtk_tool_item_group_get_nth_item(Handle, index); Gtk.ToolItem ret = GLib.Object.GetObject(raw_ret) as Gtk.ToolItem; return(ret); }
public Gtk.ToolItem GetDropItem(int x, int y) { IntPtr raw_ret = gtk_tool_palette_get_drop_item(Handle, x, y); Gtk.ToolItem ret = GLib.Object.GetObject(raw_ret) as Gtk.ToolItem; return(ret); }
public Gtk.ToolItem GetNthItem(int n) { IntPtr raw_ret = gtk_toolbar_get_nth_item(Handle, n); Gtk.ToolItem ret = GLib.Object.GetObject(raw_ret) as Gtk.ToolItem; return(ret); }
public int GetItemIndex(Gtk.ToolItem item) { int raw_ret = gtk_toolbar_get_item_index(Handle, item == null ? IntPtr.Zero : item.Handle); int ret = raw_ret; return(ret); }
protected override void OnBuildToolBar (Gtk.Toolbar tb) { base.OnBuildToolBar (tb); if (mode_label == null) mode_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Flood Mode"))); tb.AppendItem (mode_label); if (mode_button == null) { mode_button = new ToolBarDropDownButton (); mode_button.AddItem (Catalog.GetString ("Contiguous"), "Tools.FreeformShape.png", true); mode_button.AddItem (Catalog.GetString ("Global"), "Menu.Help.Website.png", false); } tb.AppendItem (mode_button); if (mode_sep == null) mode_sep = new Gtk.SeparatorToolItem (); tb.AppendItem (mode_sep); if (tolerance_label == null) tolerance_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Tolerance"))); tb.AppendItem (tolerance_label); if (tolerance_slider == null) tolerance_slider = new ToolBarSlider (0, 100, 1, 0); tb.AppendItem (tolerance_slider); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (sampling_label == null) { sampling_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Sampling"))); } tb.AppendItem(sampling_label); if (sample_size == null) { sample_size = new ToolBarDropDownButton(true); sample_size.AddItem(Catalog.GetString("Single Pixel"), "Toolbar.Sampling.1x1.png", 1); sample_size.AddItem(Catalog.GetString("3 x 3 Region"), "Toolbar.Sampling.3x3.png", 3); sample_size.AddItem(Catalog.GetString("5 x 5 Region"), "Toolbar.Sampling.5x5.png", 5); sample_size.AddItem(Catalog.GetString("7 x 7 Region"), "Toolbar.Sampling.7x7.png", 7); sample_size.AddItem(Catalog.GetString("9 x 9 Region"), "Toolbar.Sampling.9x9.png", 9); } tb.AppendItem(sample_size); if (sample_type == null) { sample_type = new ToolBarDropDownButton(true); sample_type.AddItem(Catalog.GetString("Layer"), "Menu.Layers.MergeLayerDown.png", true); sample_type.AddItem(Catalog.GetString("Image"), "ResizeCanvas.Image.png", false); } tb.AppendItem(sample_type); if (sample_sep == null) { sample_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(sample_sep); if (tool_select_label == null) { tool_select_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("After select"))); } tb.AppendItem(tool_select_label); if (tool_select == null) { tool_select = new ToolBarDropDownButton(true); tool_select.AddItem(Catalog.GetString("Do not switch tool"), "Tools.ColorPicker.png", 0); tool_select.AddItem(Catalog.GetString("Switch to previous tool"), "Tools.ColorPicker.PreviousTool.png", 1); tool_select.AddItem(Catalog.GetString("Switch to Pencil tool"), "Tools.Pencil.png", 2); } tb.AppendItem(tool_select); }
// Insert widget at index, wrapping a ToolItem around it if needed void ToolItemize(Gtk.Widget widget, int index) { Gtk.ToolItem toolItem = widget as Gtk.ToolItem; if (toolItem == null) { toolItem = new Gtk.ToolItem(); toolItem.Show(); toolItem.Add(widget); } toolbar.Insert(toolItem, index); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (selection_sep == null) selection_sep = new Gtk.SeparatorToolItem(); tb.AppendItem(selection_sep); PintaCore.Workspace.SelectionHandler.BuildToolbar(tb); }
/// <summary> /// Creates the toolbar item for command. /// </summary> /// <param name="command">The command whose toolbar visual is created.</param> /// <returns>The toolbar visual for the given command.</returns> public virtual OSCommandVisual CreateToolbarItemForCommand(ICommand command) { Gtk.ToolItem toolItem = null; var visualCommand = command as VisualRelayCommand; if (visualCommand != null) { toolItem = visualCommand.CreateToolbarButtonForCommand(); } return(toolItem); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (selection_sep == null) { selection_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(selection_sep); PintaCore.Workspace.SelectionHandler.BuildToolbar(tb); }
void Initialize(ActionGroupDesignerFrontend frontend, Wrapper.ActionGroupCollection actionGroups, bool singleGroupMode) { this.frontend = frontend; this.singleGroupMode = singleGroupMode; IconSize = Gtk.IconSize.SmallToolbar; Orientation = Gtk.Orientation.Horizontal; ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; combo = Gtk.ComboBox.NewText(); if (!singleGroupMode) { combo.Changed += OnActiveChanged; Gtk.ToolItem comboItem = new Gtk.ToolItem(); Gtk.HBox cbox = new Gtk.HBox(); cbox.PackStart(new Gtk.Label(Catalog.GetString("Action Group:") + " "), false, false, 3); cbox.PackStart(combo, true, true, 3); comboItem.Add(cbox); comboItem.ShowAll(); Insert(comboItem, -1); internalButtons.Add(comboItem); addButton = new Gtk.ToolButton(Gtk.Stock.Add); addButton.Clicked += OnAddGroup; Insert(addButton, -1); internalButtons.Add(addButton); removeButton = new Gtk.ToolButton(Gtk.Stock.Remove); removeButton.Clicked += OnRemoveGroup; Insert(removeButton, -1); internalButtons.Add(removeButton); ActionGroups = actionGroups; if (actionGroups != null && actionGroups.Count > 0) { combo.Active = 0; } } else { UpdateActionCommands(null); } ShowAll(); }
// Remove widget (or its ToolItem parent), returning its position int ToolDeItemize(Gtk.Widget widget) { Gtk.ToolItem toolItem = widget as Gtk.ToolItem; if (toolItem == null) { toolItem = (Gtk.ToolItem)widget.Parent; toolItem.Remove(widget); } int index = toolbar.GetItemIndex(toolItem); toolbar.Remove(toolItem); if (toolItem != (widget as Gtk.ToolItem)) { toolItem.Destroy(); } return(index); }
public void AddToolItem(Gtk.ToolItem item, int position) { if (IsDisposing) { throw new InvalidOperationException("Add-in is disposing already"); } if (toolbar_items == null) { toolbar_items = new Dictionary <Gtk.ToolItem, int> (); } toolbar_items [item] = position; if (note.IsOpened) { Window.Toolbar.Insert(item, position); } }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (selection_sep == null) { selection_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(selection_sep); if (selection_label == null) { selection_label = new ToolBarLabel(Catalog.GetString(" Selection Mode: ")); } tb.AppendItem(selection_label); if (selection_combo_box == null) { selection_combo_box = new ToolBarComboBox(170, 0, false); selection_combo_box.ComboBox.Changed += (o, e) => { Gtk.TreeIter iter; if (selection_combo_box.ComboBox.GetActiveIter(out iter)) { SelectionMode = ((KeyValuePair <int, string>)selection_combo_box.Model.GetValue(iter, 1)).Key; } }; foreach (KeyValuePair <int, string> sel in selectionCombinations) { selection_combo_box.Model.AppendValues(sel.Value, sel); } selection_combo_box.ComboBox.Active = 0; } tb.AppendItem(selection_combo_box); }
void Initialize (ActionGroupDesignerFrontend frontend, Wrapper.ActionGroupCollection actionGroups, bool singleGroupMode) { this.frontend = frontend; this.singleGroupMode = singleGroupMode; IconSize = Gtk.IconSize.SmallToolbar; Orientation = Gtk.Orientation.Horizontal; ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; combo = Gtk.ComboBox.NewText (); if (!singleGroupMode) { combo.Changed += OnActiveChanged; Gtk.ToolItem comboItem = new Gtk.ToolItem (); Gtk.HBox cbox = new Gtk.HBox (); cbox.PackStart (new Gtk.Label (Catalog.GetString ("Action Group:") + " "), false, false, 3); cbox.PackStart (combo, true, true, 3); comboItem.Add (cbox); comboItem.ShowAll (); Insert (comboItem, -1); internalButtons.Add (comboItem); addButton = new Gtk.ToolButton (Gtk.Stock.Add); addButton.Clicked += OnAddGroup; Insert (addButton, -1); internalButtons.Add (addButton); removeButton = new Gtk.ToolButton (Gtk.Stock.Remove); removeButton.Clicked += OnRemoveGroup; Insert (removeButton, -1); internalButtons.Add (removeButton); ActionGroups = actionGroups; if (actionGroups != null && actionGroups.Count > 0) combo.Active = 0; } else { UpdateActionCommands (null); } ShowAll (); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (mode_label == null) { mode_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Flood Mode"))); } tb.AppendItem(mode_label); if (mode_button == null) { mode_button = new ToolBarDropDownButton(); mode_button.AddItem(Catalog.GetString("Contiguous"), "Tools.FreeformShape.png", true); mode_button.AddItem(Catalog.GetString("Global"), "Menu.Help.Website.png", false); } tb.AppendItem(mode_button); if (mode_sep == null) { mode_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(mode_sep); if (tolerance_label == null) { tolerance_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Tolerance"))); } tb.AppendItem(tolerance_label); if (tolerance_slider == null) { tolerance_slider = new ToolBarSlider(0, 100, 1, 0); } tb.AppendItem(tolerance_slider); }
void AddCreateItemLabel () { HideSpacerItem (); Gtk.EventBox ebox = new Gtk.EventBox (); ebox.VisibleWindow = false; Gtk.Label emptyLabel = new Gtk.Label (); emptyLabel.Xalign = 0; if (this.Orientation == Gtk.Orientation.Vertical) emptyLabel.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString ("New\nbutton") + "</span></i>"; else emptyLabel.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString ("New button") + "</span></i>"; ebox.BorderWidth = 3; ebox.Add (emptyLabel); Gtk.ToolItem mit = new Gtk.ToolItem (); mit.Child = ebox; ebox.ButtonPressEvent += OnNewItemPress; Insert (mit, -1); mit.ShowAll (); addLabel = mit; }
void AddSpacerItem() { if (spacerItem == null) { Gtk.ToolItem tb = new Gtk.ToolItem(); Gtk.Label emptyLabel = new Gtk.Label(); emptyLabel.Xalign = 0; emptyLabel.Xpad = 3; emptyLabel.Ypad = 3; if (this.Orientation == Gtk.Orientation.Vertical) { emptyLabel.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString("Empty\ntoolbar") + "</span></i>"; } else { emptyLabel.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString("Empty toolbar") + "</span></i>"; } tb.Child = emptyLabel; Insert(tb, -1); ShowAll(); spacerItem = tb; } }
void AddCreateItemLabel() { HideSpacerItem(); Gtk.EventBox ebox = new Gtk.EventBox(); ebox.VisibleWindow = false; Gtk.Label emptyLabel = new Gtk.Label(); emptyLabel.Xalign = 0; if (this.Orientation == Gtk.Orientation.Vertical) { emptyLabel.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString("New\nbutton") + "</span></i>"; } else { emptyLabel.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString("New button") + "</span></i>"; } ebox.BorderWidth = 3; ebox.Add(emptyLabel); Gtk.ToolItem mit = new Gtk.ToolItem(); mit.Child = ebox; ebox.ButtonPressEvent += OnNewItemPress; Insert(mit, -1); mit.ShowAll(); addLabel = mit; }
public void Insert(Gtk.ToolItem item, int pos) { gtk_toolbar_insert(Handle, item == null ? IntPtr.Zero : item.Handle, pos); }
public MenuWidget(Gtk.Window parent, ChatViewManager chatViewManager) { if (parent == null) { throw new ArgumentNullException("parent"); } if (chatViewManager == null) { throw new ArgumentNullException("chatViewManager"); } Parent = parent; MainWindow = parent as MainWindow; ChatViewManager = chatViewManager; Build(); // Smuxi Menu f_QuitAction.IconName = Gtk.Stock.Quit; // Chat f_JoinChatAction.IconName = Gtk.Stock.Open; f_FindGroupChatAction.IconName = Gtk.Stock.Find; f_OpenLogAction.IconName = Gtk.Stock.Open; f_CloseChatAction.IconName = Gtk.Stock.Close; // Engine f_AddRemoteEngineAction.IconName = Gtk.Stock.Add; f_SwitchRemoteEngineAction.IconName = Gtk.Stock.Refresh; // Toolbar f_ConnectToolAction.IconName = Gtk.Stock.Network; f_OpenLogToolAction.IconName = Gtk.Stock.Open; f_FindGroupChatToolAction.IconName = Gtk.Stock.Find; f_MenuBar.ShowAll(); f_MenuBar.NoShowAll = true; f_MenuBar.Visible = (bool) Frontend.FrontendConfig["ShowMenuBar"]; JoinWidget = new JoinWidget(); JoinWidget.NoShowAll = true; JoinWidget.Visible = (bool) Frontend.FrontendConfig["ShowQuickJoin"]; JoinWidget.Activated += OnJoinWidgetActivated; var joinToolItem = new Gtk.ToolItem(); joinToolItem.Add(JoinWidget); f_JoinToolbar.Add(joinToolItem); f_JoinToolbar.ShowAll(); f_ShowMenubarAction.Active = (bool) Frontend.FrontendConfig["ShowMenuBar"]; f_ShowStatusbarAction.Active = (bool) Frontend.FrontendConfig["ShowStatusBar"]; f_ShowJoinBarAction.Active = JoinWidget.Visible; if (Frontend.IsMacOSX) { // Smuxi menu is already shown as app menu f_SmuxiAction.Visible = false; // About item is already shown in app menu f_AboutAction.Visible = false; IgeMacMenu.GlobalKeyHandlerEnabled = true; IgeMacMenu.MenuBar = f_MenuBar; f_ShowMenubarAction.Active = false; var appGroup = IgeMacMenu.AddAppMenuGroup(); appGroup.AddMenuItem( (Gtk.MenuItem) f_AboutAction.CreateMenuItem(), _("About Smuxi") ); var prefItem = (Gtk.MenuItem) f_PreferencesAction.CreateMenuItem(); // TODO: add cmd+, accelerator appGroup.AddMenuItem(prefItem, _("Preferences")); IgeMacMenu.QuitMenuItem = (Gtk.MenuItem) f_QuitAction.CreateMenuItem(); } }
// Insert widget at index, wrapping a ToolItem around it if needed void ToolItemize (Gtk.Widget widget, int index) { Gtk.ToolItem toolItem = widget as Gtk.ToolItem; if (toolItem == null) { toolItem = new Gtk.ToolItem (); toolItem.Show (); toolItem.Add (widget); } toolbar.Insert (toolItem, index); }
internal protected virtual Gtk.ToolItem CreateToolItem(CommandManager manager) { if (cmdId == CommandManager.ToCommandId(Command.Separator)) { return(new Gtk.SeparatorToolItem()); } Command cmd = GetCommand(manager); if (cmd == null) { return(new Gtk.ToolItem()); } if (cmd is CustomCommand) { Gtk.Widget child = (Gtk.Widget)Activator.CreateInstance(((CustomCommand)cmd).WidgetType); Gtk.ToolItem ti; if (child is Gtk.ToolItem) { ti = (Gtk.ToolItem)child; } else { ti = new Gtk.ToolItem(); ti.Child = child; } if (cmd.Text != null && cmd.Text.Length > 0) { //strip "_" accelerators from tooltips string text = cmd.Text; while (true) { int underscoreIndex = text.IndexOf('_'); if (underscoreIndex > -1) { text = text.Remove(underscoreIndex, 1); } else { break; } } ti.TooltipText = text; } return(ti); } ActionCommand acmd = cmd as ActionCommand; if (acmd == null) { throw new InvalidOperationException("Unknown cmd type."); } if (acmd.CommandArray) { CommandMenu menu = new CommandMenu(manager); menu.Append(CreateMenuItem(manager)); return(new MenuToolButton(menu, acmd.Icon)); } else if (acmd.ActionType == ActionType.Normal) { return(new CommandToolButton(cmdId, manager)); } else { return(new CommandToggleToolButton(cmdId, manager)); } }
public MenuWidget(Gtk.Window parent, ChatViewManager chatViewManager) { if (parent == null) { throw new ArgumentNullException("parent"); } if (chatViewManager == null) { throw new ArgumentNullException("chatViewManager"); } Parent = parent; MainWindow = parent as MainWindow; ChatViewManager = chatViewManager; Build(); // Smuxi Menu f_QuitAction.IconName = Gtk.Stock.Quit; // Chat f_JoinChatAction.IconName = Gtk.Stock.Open; f_FindGroupChatAction.IconName = Gtk.Stock.Find; f_OpenLogAction.IconName = Gtk.Stock.Open; f_CloseChatAction.IconName = Gtk.Stock.Close; // Engine f_AddRemoteEngineAction.IconName = Gtk.Stock.Add; f_SwitchRemoteEngineAction.IconName = Gtk.Stock.Refresh; // Toolbar f_ConnectToolAction.IconName = Gtk.Stock.Network; f_OpenLogToolAction.IconName = Gtk.Stock.Open; f_FindGroupChatToolAction.IconName = Gtk.Stock.Find; // disable the open log buttons initially as they will only be // enabled for chats that have a log file in // MainWindow.OnNotebookSwitchPage() f_OpenLogAction.Sensitive = false; f_OpenLogToolAction.Sensitive = false; f_MenuToolbar.ShowAll(); f_MenuToolbar.NoShowAll = true; f_MenuToolbar.Visible = (bool)Frontend.FrontendConfig["ShowToolBar"]; f_MenuBar.ShowAll(); f_MenuBar.NoShowAll = true; f_MenuBar.Visible = (bool)Frontend.FrontendConfig["ShowMenuBar"]; JoinWidget = new JoinWidget(); JoinWidget.NoShowAll = true; JoinWidget.Activated += OnJoinWidgetActivated; var joinToolItem = new Gtk.ToolItem(); joinToolItem.Add(JoinWidget); f_JoinToolbar.Add(joinToolItem); f_JoinToolbar.ShowAll(); f_JoinToolbar.NoShowAll = true; f_JoinToolbar.Visible = f_MenuToolbar.Visible; f_ShowMenubarAction.Active = (bool)Frontend.FrontendConfig["ShowMenuBar"]; f_ShowToolbarAction.Active = (bool)Frontend.FrontendConfig["ShowToolBar"]; f_ShowStatusbarAction.Active = (bool)Frontend.FrontendConfig["ShowStatusBar"]; if (Frontend.IsMacOSX) { try { IgeMacMenu.GlobalKeyHandlerEnabled = true; IgeMacMenu.MenuBar = f_MenuBar; f_ShowMenubarAction.Active = false; // no need for the menu bar as have the app menu f_ShowMenubarAction.Visible = false; var appGroup = IgeMacMenu.AddAppMenuGroup(); appGroup.AddMenuItem( (Gtk.MenuItem)f_AboutAction.CreateMenuItem(), _("About Smuxi") ); var prefItem = (Gtk.MenuItem)f_PreferencesAction.CreateMenuItem(); // TODO: add cmd+, accelerator appGroup.AddMenuItem(prefItem, _("Preferences")); IgeMacMenu.QuitMenuItem = (Gtk.MenuItem) f_QuitAction.CreateMenuItem(); // Smuxi menu is already shown as app menu f_SmuxiAction.Visible = false; // About item is already shown in app menu f_AboutAction.Visible = false; } catch (EntryPointNotFoundException ex) { f_Logger.Error("Failed to initialize mac menu integration, disabling mac menu integration", ex); } } }
void AddSpacerItem () { if (spacerItem == null) { Gtk.ToolItem tb = new Gtk.ToolItem (); Gtk.Label emptyLabel = new Gtk.Label (); emptyLabel.Xalign = 0; emptyLabel.Xpad = 3; emptyLabel.Ypad = 3; if (this.Orientation == Gtk.Orientation.Vertical) emptyLabel.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString ("Empty\ntoolbar") + "</span></i>"; else emptyLabel.Markup = "<i><span foreground='darkgrey'>" + Catalog.GetString ("Empty toolbar") + "</span></i>"; tb.Child = emptyLabel; Insert (tb, -1); ShowAll (); spacerItem = tb; } }
public CueSheetsSource() : base(AddinManager.CurrentLocalizer.GetString("CueSheets"), AddinManager.CurrentLocalizer.GetString("CueSheets"), //"cuesheets", sort_order) //, //"hod-cuesheets-2013-01-06") { Hyena.Log.Information("CueSheetsSouce init"); DbConnection = ServiceManager.DbConnection; TM_Provider = DatabaseTrackInfo.Provider; _track_info_db = new CS_TrackInfoDb(DbConnection); _sheet = new CueSheet(); _sheets = new CueSheetCollection(); _view = new CueSheetsView(this); Properties.Set <ISourceContents> ("Nereid.SourceContents", _view); Properties.SetString("Icon.Name", "cueplay"); Hyena.Log.Information("CueSheets source has been instantiated."); Properties.Set <string> ("SearchEntryDescription", Catalog.GetString("Search albums and tracks")); try { Properties.SetString("GtkActionPath", "/CueSheetsPopup"); _actions = new CS_Actions(this); Hyena.Log.Information(_actions.ToString()); } catch (System.Exception ex) { Hyena.Log.Information(ex.ToString()); } InterfaceActionService action_service = ServiceManager.Get <InterfaceActionService> (); try { _track_search = new Gtk.CheckButton("Search Tracks"); _track_search.Clicked += delegate(object sender, EventArgs args) { this.DoFilter(); }; Gtk.Toolbar header_toolbar = (Gtk.Toolbar)action_service.UIManager.GetWidget("/HeaderToolbar"); int i, N, k; for (i = 0, k = -1, N = header_toolbar.NItems; i < N; i++) { Gtk.Widget w = header_toolbar.GetNthItem(i).Child; if (w != null) { if (w.GetType() == typeof(Banshee.Gui.Widgets.ConnectedVolumeButton)) { k = i; } } } if (k >= 0) { Hyena.Log.Information("Toolitem itm"); Gtk.ToolItem itm = new Gtk.ToolItem(); Hyena.Log.Information("Add cbk"); itm.Add(_track_search); Hyena.Log.Information("Insert cbk"); header_toolbar.Insert(itm, k); itm.Show(); } } catch (System.Exception ex) { Hyena.Log.Error(ex.ToString()); } Gtk.Menu viewMenu = (action_service.UIManager.GetWidget("/MainMenu/ViewMenu") as Gtk.MenuItem).Submenu as Gtk.Menu; _menuItem = new Gtk.MenuItem(Catalog.GetString("_Change Album View")); _menuItem.Activated += delegate { _view.ToggleGrid(); }; viewMenu.Insert(_menuItem, 2); _sep = new Gtk.SeparatorMenuItem(); viewMenu.Insert(_sep, 3); }
//, //"hod-cuesheets-2013-01-06") public CueSheetsSource() : base(AddinManager.CurrentLocalizer.GetString ("CueSheets"), AddinManager.CurrentLocalizer.GetString ("CueSheets"), //"cuesheets", sort_order) { Hyena.Log.Information ("CueSheetsSouce init"); DbConnection=ServiceManager.DbConnection; TM_Provider=DatabaseTrackInfo.Provider; _track_info_db=new CS_TrackInfoDb(DbConnection); _sheet=new CueSheet(); _sheets=new CueSheetCollection(); _view=new CueSheetsView(this); Properties.Set<ISourceContents> ("Nereid.SourceContents", _view); Properties.SetString ("Icon.Name", "cueplay"); Hyena.Log.Information ("CueSheets source has been instantiated."); Properties.Set<string> ("SearchEntryDescription", Catalog.GetString ("Search albums and tracks")); try { Properties.SetString("GtkActionPath","/CueSheetsPopup"); _actions = new CS_Actions (this); Hyena.Log.Information(_actions.ToString()); } catch (System.Exception ex) { Hyena.Log.Information(ex.ToString ()); } InterfaceActionService action_service = ServiceManager.Get<InterfaceActionService> (); try { _track_search=new Gtk.CheckButton("Search Tracks"); _track_search.Clicked+=delegate(object sender,EventArgs args) { this.DoFilter(); }; Gtk.Toolbar header_toolbar = (Gtk.Toolbar) action_service.UIManager.GetWidget ("/HeaderToolbar"); int i,N,k; for(i=0,k=-1,N=header_toolbar.NItems;i<N;i++) { Gtk.Widget w=header_toolbar.GetNthItem(i).Child; if (w!=null) { if (w.GetType()==typeof(Banshee.Gui.Widgets.ConnectedVolumeButton)) { k=i; } } } if (k>=0) { Hyena.Log.Information("Toolitem itm"); Gtk.ToolItem itm=new Gtk.ToolItem(); Hyena.Log.Information ("Add cbk"); itm.Add (_track_search); Hyena.Log.Information ("Insert cbk"); header_toolbar.Insert (itm,k); itm.Show (); } } catch (System.Exception ex) { Hyena.Log.Error (ex.ToString ()); } Gtk.Menu viewMenu = (action_service.UIManager.GetWidget ("/MainMenu/ViewMenu") as Gtk.MenuItem).Submenu as Gtk.Menu; _menuItem = new Gtk.MenuItem (Catalog.GetString ("_Change Album View")); _menuItem.Activated += delegate { _view.ToggleGrid(); }; viewMenu.Insert (_menuItem, 2); _sep=new Gtk.SeparatorMenuItem(); viewMenu.Insert (_sep,3); }
public void SetItemPosition(Gtk.ToolItem item, int position) { gtk_tool_item_group_set_item_position(Handle, item == null ? IntPtr.Zero : item.Handle, position); }
protected internal virtual Gtk.ToolItem CreateToolItem(CommandManager manager) { if (cmdId == Command.Separator) return new Gtk.SeparatorToolItem (); Command cmd = manager.GetCommand (cmdId); if (cmd is CustomCommand) { Gtk.Widget child = (Gtk.Widget) Activator.CreateInstance (((CustomCommand)cmd).WidgetType); Gtk.ToolItem ti = new Gtk.ToolItem (); ti.Child = child; if (cmd.Text != null && cmd.Text.Length > 0) { Gtk.Tooltips tips = new Gtk.Tooltips (); ti.SetTooltip (tips, cmd.Text, cmd.Text); tips.Enable (); } return ti; } ActionCommand acmd = cmd as ActionCommand; if (acmd == null) throw new InvalidOperationException ("Unknown cmd type."); if (acmd.CommandArray) { CommandMenu menu = new CommandMenu (manager); menu.Append (CreateMenuItem (manager)); return new MenuToolButton (menu, acmd.Icon); } else if (acmd.ActionType == ActionType.Normal) return new CommandToolButton (cmdId, manager); else return new CommandToggleToolButton (cmdId, manager); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar(tb); if (selection_sep == null) selection_sep = new Gtk.SeparatorToolItem(); tb.AppendItem(selection_sep); if (selection_label == null) selection_label = new ToolBarLabel(Catalog.GetString(" Selection Mode: ")); tb.AppendItem(selection_label); if (selection_combo_box == null) { selection_combo_box = new ToolBarComboBox(170, 0, false); selection_combo_box.ComboBox.Changed += (o, e) => { Gtk.TreeIter iter; if (selection_combo_box.ComboBox.GetActiveIter(out iter)) { SelectionMode = ((KeyValuePair<int, string>)selection_combo_box.Model.GetValue(iter, 1)).Key; } }; foreach(KeyValuePair<int, string> sel in selectionCombinations) { selection_combo_box.Model.AppendValues(sel.Value, sel); } selection_combo_box.ComboBox.Active = 0; } tb.AppendItem(selection_combo_box); }
public void SetDropHighlightItem(Gtk.ToolItem tool_item, int index_) { gtk_toolbar_set_drop_highlight_item(Handle, tool_item == null ? IntPtr.Zero : tool_item.Handle, index_); }
protected override void OnBuildToolBar(Gtk.Toolbar tb) { base.OnBuildToolBar (tb); if (sampling_label == null) sampling_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("Sampling"))); tb.AppendItem (sampling_label); if (sample_size == null) { sample_size = new ToolBarDropDownButton (true); // Change the cursor when the SampleSize is changed. sample_size.SelectedItemChanged += (sender, e) => SetCursor (DefaultCursor); sample_size.AddItem (Catalog.GetString ("Single Pixel"), "Toolbar.Sampling.1x1.png", 1); sample_size.AddItem (Catalog.GetString ("3 x 3 Region"), "Toolbar.Sampling.3x3.png", 3); sample_size.AddItem (Catalog.GetString ("5 x 5 Region"), "Toolbar.Sampling.5x5.png", 5); sample_size.AddItem (Catalog.GetString ("7 x 7 Region"), "Toolbar.Sampling.7x7.png", 7); sample_size.AddItem (Catalog.GetString ("9 x 9 Region"), "Toolbar.Sampling.9x9.png", 9); } tb.AppendItem (sample_size); if (sample_type == null) { sample_type = new ToolBarDropDownButton (true); sample_type.AddItem (Catalog.GetString ("Layer"), "Menu.Layers.MergeLayerDown.png", true); sample_type.AddItem (Catalog.GetString ("Image"), "ResizeCanvas.Image.png", false); } tb.AppendItem (sample_type); if (sample_sep == null) sample_sep = new Gtk.SeparatorToolItem (); tb.AppendItem (sample_sep); if (tool_select_label == null) tool_select_label = new ToolBarLabel (string.Format (" {0}: ", Catalog.GetString ("After select"))); tb.AppendItem (tool_select_label); if (tool_select == null) { tool_select = new ToolBarDropDownButton (true); tool_select.AddItem (Catalog.GetString ("Do not switch tool"), "Tools.ColorPicker.png", 0); tool_select.AddItem (Catalog.GetString ("Switch to previous tool"), "Tools.ColorPicker.PreviousTool.png", 1); tool_select.AddItem (Catalog.GetString ("Switch to Pencil tool"), "Tools.Pencil.png", 2); } tb.AppendItem (tool_select); }
public void Insert(Gtk.ToolItem item, int position) { gtk_tool_item_group_insert(Handle, item == null ? IntPtr.Zero : item.Handle, position); }
internal virtual Gtk.ToolItem CreateToolItem (CommandManager manager) { if (cmdId == CommandManager.ToCommandId (Command.Separator)) return new Gtk.SeparatorToolItem (); Command cmd = GetCommand (manager); if (cmd == null) return new Gtk.ToolItem (); if (cmd is CustomCommand) { Gtk.Widget child = (Gtk.Widget) Activator.CreateInstance (((CustomCommand)cmd).WidgetType); Gtk.ToolItem ti; if (child is Gtk.ToolItem) ti = (Gtk.ToolItem) child; else { ti = new Gtk.ToolItem (); ti.Child = child; } if (cmd.Text != null && cmd.Text.Length > 0) { //strip "_" accelerators from tooltips string text = cmd.Text; while (true) { int underscoreIndex = text.IndexOf ('_'); if (underscoreIndex > -1) text = text.Remove (underscoreIndex, 1); else break; } ti.TooltipText = text; } return ti; } ActionCommand acmd = cmd as ActionCommand; if (acmd == null) throw new InvalidOperationException ("Unknown cmd type."); if (acmd.CommandArray) { CommandMenu menu = new CommandMenu (manager); menu.Append (CreateMenuItem (manager)); return new MenuToolButton (menu, acmd.Icon); } else if (acmd.ActionType == ActionType.Normal) return new CommandToolButton (cmdId, manager); else return new CommandToggleToolButton (cmdId, manager); }
public MenuWidget(Gtk.Window parent, ChatViewManager chatViewManager) { if (parent == null) { throw new ArgumentNullException("parent"); } if (chatViewManager == null) { throw new ArgumentNullException("chatViewManager"); } Parent = parent; MainWindow = parent as MainWindow; ChatViewManager = chatViewManager; Build(); if (Frontend.IsMacOSX) { // Smuxi menu is already shown as app menu f_SmuxiAction.Visible = false; } // Chat f_JoinChatAction.IconName = Gtk.Stock.Open; f_FindGroupChatAction.IconName = Gtk.Stock.Find; f_OpenLogToolAction.IconName = Gtk.Stock.Open; // Engine f_AddRemoteEngineAction.IconName = Gtk.Stock.Add; f_SwitchRemoteEngineAction.IconName = Gtk.Stock.Refresh; // Toolbar f_FindGroupChatToolAction.IconName = Gtk.Stock.Find; f_MenuBar.ShowAll(); f_MenuBar.NoShowAll = true; f_MenuBar.Visible = (bool) Frontend.FrontendConfig["ShowMenuBar"]; JoinWidget = new JoinWidget(); JoinWidget.NoShowAll = true; JoinWidget.Visible = (bool) Frontend.FrontendConfig["ShowQuickJoin"]; JoinWidget.Activated += OnJoinWidgetActivated; var joinToolItem = new Gtk.ToolItem(); joinToolItem.Add(JoinWidget); f_JoinToolbar.Add(joinToolItem); f_JoinToolbar.ShowAll(); f_ShowMenubarAction.Active = (bool) Frontend.FrontendConfig["ShowMenuBar"]; f_ShowStatusbarAction.Active = (bool) Frontend.FrontendConfig["ShowStatusBar"]; f_ShowJoinBarAction.Active = JoinWidget.Visible; }