private void updateUndo() { actions.GetAction("Undo").Sensitive = hasChanged = handwriting.CanUndo; actions.GetAction("Redo").Sensitive = handwriting.CanRedo; }
private void InstallInterfaceActions() { InterfaceActionService action_service = ServiceManager.Get <InterfaceActionService> (); lyrics_action_group = new ActionGroup("Lyrics"); lyrics_action_group.Add(new ActionEntry[] { new ActionEntry("LyricsAction", null, AddinManager.CurrentLocalizer.GetString("L_yrics"), null, AddinManager.CurrentLocalizer.GetString("Manage Lyrics"), null), new ActionEntry("FetchLyricsAction", null, AddinManager.CurrentLocalizer.GetString("_Download Lyrics"), null, AddinManager.CurrentLocalizer.GetString("Download lyrics for all tracks"), OnFetchLyrics) }); lyrics_action_group.Add(new ToggleActionEntry[] { new ToggleActionEntry("ShowLyricsAction", null, AddinManager.CurrentLocalizer.GetString("Show Lyrics"), "<control>T", AddinManager.CurrentLocalizer.GetString("Show Lyrics in a separate window"), null, false) }); lyrics_action_group.GetAction("ShowLyricsAction").Activated += OnToggleWindow; lyrics_action_group.GetAction("ShowLyricsAction").Sensitive = ServiceManager.PlayerEngine.CurrentTrack != null ? true : false; action_service.AddActionGroup(lyrics_action_group); ui_manager_id = action_service.UIManager.AddUiFromResource("LyricsMenu.xml"); }
private void OnPlayerEngineEventChanged(PlayerEventArgs args) { if (args.Event == PlayerEvent.EndOfStream) { lyrics_action_group.GetAction("ShowLyricsAction").Sensitive = false; return; } lyrics_action_group.GetAction("ShowLyricsAction").Sensitive = true; FetchLyrics(ServiceManager.PlayerEngine.CurrentTrack); }
static void OnToggleCnp(object obj, EventArgs args) { Gtk.Action action = (ToggleAction)obj; bool sensitive = ((ToggleAction)action).Active; action = group.GetAction("cut"); action.Sensitive = sensitive; action = group.GetAction("copy"); action.Sensitive = sensitive; action = group.GetAction("paste"); action.Sensitive = sensitive; action = group.GetAction("toggle-cnp"); if (sensitive) { action.Label = "Disable Cut and past ops"; } else { action.Label = "Enable Cut and paste ops"; } }
public Action FindAction(string actionId) { string [] parts = actionId.Split('.'); if (parts == null || parts.Length < 2) { return(null); } string group_name = parts[0]; string action_name = parts[1]; ActionGroup group = FindActionGroup(group_name); return(group == null ? null : group.GetAction(action_name)); }
private void EnableRefresh() { actions.GetAction("RefreshRadioAction").Sensitive = true; }
protected void EnableMainMenu(bool enable) { Actions.GetAction("menu-engine").Sensitive = enable; // Actions.GetAction("ScriptMenu").Sensitive = enable; }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); ActionEntry[] entries = new ActionEntry[] { new ActionEntry("menu-engine", null, "_Engine", null, null, null), new ActionEntry("unpause", null, "Unpause", "<ctrl>U", null, OnUnpause), new ActionEntry("menu-script", null, "_Script", null, null, null), new ActionEntry("rebuild-and-reload", null, "Rebuild And Reload", null, null, OnRebuildAndReload), new ActionEntry("menu-connect", null, "_Connect", null, null, null), new ActionEntry("reconnect", null, "Reconnect", "<ctrl>R", null, null) }; Actions = new ActionGroup("group"); Actions.Add(entries); UI.InsertActionGroup(Actions, 0); UI.AddUiFromResource("Menu.xml"); AddAccelGroup(UI.AccelGroup); MenuBar menuBar = (MenuBar)UI.GetWidget("/MenuBar"); vbox1.PackStart(menuBar, false, false, 0); // Create tags for color-formatted text TextTag tagInfo = new Gtk.TextTag("info"); tagInfo.BackgroundGdk = new Gdk.Color(255, 255, 255); TextTag tagWarning = new Gtk.TextTag("warning"); tagWarning.BackgroundGdk = new Gdk.Color(255, 255, 153); TextTag tagError = new Gtk.TextTag("error"); tagError.BackgroundGdk = new Gdk.Color(255, 153, 153); TextTag tagDebug = new Gtk.TextTag("debug"); tagDebug.BackgroundGdk = new Gdk.Color(224, 224, 224); textview1 = new TextView(); textview1.Editable = false; textview1.CanFocus = false; TextBuffer textbuffer1 = textview1.Buffer; textbuffer1.TagTable.Add(tagInfo); textbuffer1.TagTable.Add(tagWarning); textbuffer1.TagTable.Add(tagError); textbuffer1.TagTable.Add(tagDebug); scrolledwindow1 = new ScrolledWindow(); scrolledwindow1.Add(textview1); vbox1.PackStart(scrolledwindow1, true, true, 0); entry1 = new Entry(); entry1.KeyPressEvent += new KeyPressEventHandler(OnEntryKeyPressed); entry1.Activated += new EventHandler(OnEntryActivated); vbox1.PackStart(entry1, false, true, 0); EnableMainMenu(false); Actions.GetAction("menu-script").Sensitive = false; Client = new ConsoleClient(); Client.ConnectedEvent += OnConnected; Client.DisconnectedEvent += OnDisconnected; Client.MessageReceivedEvent += OnMessageReceived; Connect(Address, Port); ShowAll(); }