BEAST/BSE - Better Audio System and Sound Engine
0.8.2
|
00001 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __BST_MENUS_H__ 00003 #define __BST_MENUS_H__ 00004 00005 #include "bstutils.hh" 00006 00007 G_BEGIN_DECLS 00008 00009 /* --- BstChoice --- */ 00010 /* BstChoice are simple inlined popup menus for modal selections. 00011 */ 00012 typedef struct _BstChoice BstChoice; 00013 00014 GtkWidget* bst_choice_menu_createv (const gchar *menu_path, 00015 BstChoice *first_choice, 00016 ...); 00017 void bst_choice_menu_add_choice_and_free (GtkWidget *menu, 00018 BstChoice *choice); 00019 void bst_choice_menu_set_item_sensitive (GtkWidget *menu, 00020 gulong id, 00021 gboolean sensitive); 00022 GtkWidget* bst_choice_dialog_createv (BstChoice *first_choice, 00023 ...) G_GNUC_NULL_TERMINATED; 00024 gboolean bst_choice_selectable (GtkWidget *widget); 00025 guint bst_choice_modal (GtkWidget *widget, 00026 guint mouse_button, 00027 guint32 time); 00028 guint bst_choice_get_last (GtkWidget *widget); 00029 void bst_choice_destroy (GtkWidget *choice); 00030 00031 00032 /* --- BstChoice shortcuts --- */ 00033 #define BST_CHOICE_TITLE(name) (bst_choice_alloc (BST_CHOICE_TYPE_TITLE, \ 00034 (name), NULL, BST_STOCK_NONE, 0)) 00035 #define BST_CHOICE(id, name, bst_icon) (bst_choice_alloc (BST_CHOICE_TYPE_ITEM, \ 00036 (name), (void*) (size_t) (id), \ 00037 BST_STOCK_ ## bst_icon, 0)) 00038 #define BST_CHOICE_D(id, name, bst_icon) (bst_choice_alloc (BST_CHOICE_TYPE_ITEM | \ 00039 BST_CHOICE_FLAG_DEFAULT, \ 00040 (name), (void*) (size_t) (id), \ 00041 BST_STOCK_ ## bst_icon, 0)) 00042 #define BST_CHOICE_S(id, name, icon, s) (bst_choice_alloc (BST_CHOICE_TYPE_ITEM | \ 00043 ((s) ? (BstChoiceFlags) 0 : BST_CHOICE_FLAG_INSENSITIVE), \ 00044 (name), (void*) (size_t) (id), \ 00045 BST_STOCK_ ## icon, 0)) 00046 #define BST_CHOICE_SUBMENU(nam,menu,icn) (bst_choice_alloc (BST_CHOICE_TYPE_SUBMENU, \ 00047 (nam), (menu), BST_STOCK_ ## icn, 0)) 00048 #define BST_CHOICE_TEXT(name) (bst_choice_alloc (BST_CHOICE_TYPE_TEXT, \ 00049 (name), NULL, BST_STOCK_NONE, 0)) 00050 #define BST_CHOICE_SEPERATOR (bst_choice_alloc (BST_CHOICE_TYPE_SEPARATOR, \ 00051 NULL, NULL, BST_STOCK_NONE, 0)) 00052 #define BST_CHOICE_END (NULL) 00053 00054 00055 /* --- private implementation stubs --- */ 00056 typedef enum 00057 { 00058 BST_CHOICE_TYPE_SEPARATOR = 0, 00059 BST_CHOICE_TYPE_TITLE = 1, 00060 BST_CHOICE_TYPE_TEXT = 2, 00061 BST_CHOICE_TYPE_ITEM = 3, 00062 BST_CHOICE_TYPE_SUBMENU = 4, 00063 BST_CHOICE_TYPE_MASK = 0xff, 00064 BST_CHOICE_FLAG_INSENSITIVE = (1 << 8), 00065 BST_CHOICE_FLAG_DEFAULT = (1 << 9), 00066 BST_CHOICE_FLAG_MASK = (~BST_CHOICE_TYPE_MASK) 00067 } BstChoiceFlags; 00068 BstChoice* bst_choice_alloc (BstChoiceFlags type, 00069 const gchar *choice_name, 00070 gpointer choice_id, 00071 const gchar *icon_stock_id, 00072 BseIcon *bse_icon); 00073 00074 G_END_DECLS 00075 00076 // == Flags Enumeration Operators in C++ == 00077 #ifdef __cplusplus 00078 constexpr BstChoiceFlags operator& (BstChoiceFlags s1, BstChoiceFlags s2) { return BstChoiceFlags (s1 & (long long unsigned) s2); } 00079 inline BstChoiceFlags& operator&= (BstChoiceFlags &s1, BstChoiceFlags s2) { s1 = s1 & s2; return s1; } 00080 constexpr BstChoiceFlags operator| (BstChoiceFlags s1, BstChoiceFlags s2) { return BstChoiceFlags (s1 | (long long unsigned) s2); } 00081 inline BstChoiceFlags& operator|= (BstChoiceFlags &s1, BstChoiceFlags s2) { s1 = s1 | s2; return s1; } 00082 constexpr BstChoiceFlags operator~ (BstChoiceFlags s1) { return BstChoiceFlags (~(long long unsigned) s1); } 00083 #endif // __cplusplus 00084 00085 #endif /* __BST_MENUS_H__ */