ardour
actions.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2007 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __libgtkmm2ext_actions_h__
21 #define __libgtkmm2ext_actions_h__
22 
23 #include <vector>
24 
25 #include <gtkmm/action.h>
26 #include <gtkmm/radioaction.h>
27 #include <gtkmm/toggleaction.h>
28 #include <gtkmm/actiongroup.h>
29 #include <gtkmm/accelkey.h>
30 
31 #include "gtkmm2ext/visibility.h"
32 
33 namespace Gtk {
34  class UIManager;
35 }
36 
37 namespace ActionManager {
38 
39  LIBGTKMM2EXT_API extern std::string unbound_string; /* the key string returned if an action is not bound */
40  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::UIManager> ui_manager;
41 
42  LIBGTKMM2EXT_API extern void set_sensitive (std::vector<Glib::RefPtr<Gtk::Action> >& actions, bool);
43  LIBGTKMM2EXT_API extern std::string get_key_representation (const std::string& accel_path, Gtk::AccelKey& key);
44 
45  LIBGTKMM2EXT_API extern Gtk::Widget* get_widget (const char * name);
46  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> get_action (const char* group, const char* name);
47  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> get_action (const char* path);
48  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> get_action_from_name (const char* name);
49  LIBGTKMM2EXT_API extern void do_action (const char* group, const char* name);
50  LIBGTKMM2EXT_API extern void set_toggle_action (const char* group, const char* name, bool);
51 
52  LIBGTKMM2EXT_API extern void add_action_group (Glib::RefPtr<Gtk::ActionGroup>);
54 
55  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
56  const char * name, const char * label);
57  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
58  const char * name, const char * label, sigc::slot<void> sl,
59  guint key, Gdk::ModifierType mods);
60  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
61  const char * name, const char * label, sigc::slot<void> sl);
62 
63  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&,
64  const char * name, const char * label, sigc::slot<void> sl,
65  guint key, Gdk::ModifierType mods);
66  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&,
67  const char * name, const char * label, sigc::slot<void> sl);
68  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&,
69  std::string const &, std::string const &, std::string const &, sigc::slot<void> sl);
70 
71  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group,
72  const char * name, const char * label, sigc::slot<void> sl,
73  guint key, Gdk::ModifierType mods);
74  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group,
75  std::string const &, std::string const &, std::string const &, sigc::slot<void> sl);
76  LIBGTKMM2EXT_API extern Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group,
77  const char * name, const char * label, sigc::slot<void> sl);
78 
79  LIBGTKMM2EXT_API extern bool lookup_entry (const Glib::ustring accel_path, Gtk::AccelKey& key);
80 
81  LIBGTKMM2EXT_API extern void get_all_actions (std::vector<std::string>& names,
82  std::vector<std::string>& paths,
83  std::vector<std::string>& tooltips,
84  std::vector<std::string>& keys,
85  std::vector<Gtk::AccelKey>& bindings);
86 
87  LIBGTKMM2EXT_API extern void get_all_actions (std::vector<std::string>& groups,
88  std::vector<std::string>& paths,
89  std::vector<std::string>& tooltips,
90  std::vector<Gtk::AccelKey>& bindings);
91 
92  LIBGTKMM2EXT_API extern void check_toggleaction (std::string);
93  LIBGTKMM2EXT_API extern void uncheck_toggleaction (std::string);
94  LIBGTKMM2EXT_API extern void set_toggleaction_state (std::string, bool);
95 
96 
97  LIBGTKMM2EXT_API extern void push_action_state ();
98  LIBGTKMM2EXT_API extern void pop_action_state ();
100 };
101 
102 #endif /* __libgtkmm2ext_actions_h__ */
LIBGTKMM2EXT_API Gtk::Widget * get_widget(const char *name)
Definition: actions.cc:366
LIBGTKMM2EXT_API void enable_accelerators()
Definition: actions.cc:241
Definition: ardour_ui.h:130
LIBGTKMM2EXT_API
LIBGTKMM2EXT_API Glib::RefPtr< Gtk::Action > get_action(const char *group, const char *name)
Definition: actions.cc:406
LIBGTKMM2EXT_API Glib::RefPtr< Gtk::Action > get_action_from_name(const char *name)
Definition: actions.cc:439
LIBGTKMM2EXT_API void set_toggle_action(const char *group, const char *name, bool)
Definition: actions.cc:541
LIBGTKMM2EXT_API void do_action(const char *group, const char *name)
Definition: actions.cc:532
LIBGTKMM2EXT_API void disable_all_actions()
Definition: actions.cc:349
LIBGTKMM2EXT_API void set_sensitive(std::vector< Glib::RefPtr< Gtk::Action > > &actions, bool)
LIBGTKMM2EXT_API Glib::RefPtr< Gtk::Action > register_radio_action(Glib::RefPtr< Gtk::ActionGroup > group, Gtk::RadioAction::Group &, const char *name, const char *label, sigc::slot< void > sl, guint key, Gdk::ModifierType mods)
LIBGTKMM2EXT_API void uncheck_toggleaction(std::string)
LIBGTKMM2EXT_API void set_toggleaction_state(std::string, bool)
LIBGTKMM2EXT_API std::string unbound_string
Definition: actions.cc:54
LIBGTKMM2EXT_API void check_toggleaction(std::string)
LIBGTKMM2EXT_API Glib::RefPtr< Gtk::UIManager > ui_manager
Definition: actions.cc:53
const char * name
LIBGTKMM2EXT_API Glib::RefPtr< Gtk::Action > register_toggle_action(Glib::RefPtr< Gtk::ActionGroup > group, const char *name, const char *label, sigc::slot< void > sl, guint key, Gdk::ModifierType mods)
LIBGTKMM2EXT_API std::string get_key_representation(const std::string &accel_path, Gtk::AccelKey &key)
LIBGTKMM2EXT_API bool lookup_entry(const Glib::ustring accel_path, Gtk::AccelKey &key)
LIBGTKMM2EXT_API void pop_action_state()
Definition: actions.cc:333
LIBGTKMM2EXT_API void get_all_actions(std::vector< std::string > &names, std::vector< std::string > &paths, std::vector< std::string > &tooltips, std::vector< std::string > &keys, std::vector< Gtk::AccelKey > &bindings)
LIBGTKMM2EXT_API void push_action_state()
Definition: actions.cc:327
LIBGTKMM2EXT_API void add_action_group(Glib::RefPtr< Gtk::ActionGroup >)
LIBGTKMM2EXT_API Glib::RefPtr< Gtk::Action > register_action(Glib::RefPtr< Gtk::ActionGroup > group, const char *name, const char *label)