swamigui Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
SwamiguiItemMenuInfo; SwamiguiItemMenuEntry; void (*SwamiguiItemMenuCallback) (IpatchList *selection
,gpointer data
); void (*SwamiguiItemMenuHandler) (SwamiguiItemMenu *menu
,const char *action_id
); enum SwamiguiItemMenuFlags; SwamiguiItemMenu; extern GtkAccelGroup *swamigui_item_menu_accel_group; SwamiguiItemMenu * swamigui_item_menu_new (); GtkWidget * swamigui_item_menu_add (SwamiguiItemMenu *menu
,const SwamiguiItemMenuInfo *info
,const char *action_id
); GtkWidget * swamigui_item_menu_add_registered_info (SwamiguiItemMenu *menu
,const char *action_id
); void swamigui_item_menu_generate (SwamiguiItemMenu *menu
); void swamigui_register_item_menu_action (char *action_id
,SwamiguiItemMenuInfo *info
,SwamiguiItemMenuHandler handler
); gboolean swamigui_lookup_item_menu_action (const char *action_id
,SwamiguiItemMenuInfo **info
,SwamiguiItemMenuHandler *handler
); void swamigui_register_item_menu_include_type (const char *action_id
,GType type
,gboolean derived
); void swamigui_register_item_menu_exclude_type (const char *action_id
,GType type
,gboolean derived
); gboolean swamigui_test_item_menu_type (const char *action_id
,GType type
); gboolean swamigui_test_item_menu_include_type (const char *action_id
,GType type
); gboolean swamigui_test_item_menu_exclude_type (const char *action_id
,GType type
); GObject * swamigui_item_menu_get_selection_single (SwamiguiItemMenu *menu
); IpatchList * swamigui_item_menu_get_selection (SwamiguiItemMenu *menu
); void swamigui_item_menu_handler_single (SwamiguiItemMenu *menu
,const char *action_id
); void swamigui_item_menu_handler_multi (SwamiguiItemMenu *menu
,const char *action_id
); void swamigui_item_menu_handler_single_all (SwamiguiItemMenu *menu
,const char *action_id
); void swamigui_item_menu_handler_multi_all (SwamiguiItemMenu *menu
,const char *action_id
);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkMenuShell +----GtkMenu +----SwamiguiItemMenu
"creator" GObject* : Read / Write "right-click" GObject* : Read / Write "selection" IpatchList* : Read / Write
typedef struct { guint order; /* an integer used to sort items (lower values first) */ char *label; /* menu label text */ char *accel; /* key accelerator */ char *icon; /* stock ID of icon */ guint flags; /* SwamiguiItemMenuFlags */ SwamiguiItemMenuCallback func; /* function to call when item is activated */ gpointer data; /* data to pass to callback function */ } SwamiguiItemMenuInfo;
void (*SwamiguiItemMenuCallback) (IpatchList *selection
,gpointer data
);
A callback function type that is used when a menu item is activated.
|
Item selection |
|
Data defined by the menu item |
void (*SwamiguiItemMenuHandler) (SwamiguiItemMenu *menu
,const char *action_id
);
A handler for a menu item type. Called when generating a menu for an item selection and right click item. This function should determine if its action type (example: paste, delete, copy, new, etc) is valid for the given selection and add one or more menu items if so.
|
GUI menu object |
|
Menu action ID (set when action was registered) |
typedef enum /*< flags >*/ { SWAMIGUI_ITEM_MENU_INACTIVE = 1 << 0, /* set if menu item should be inactive */ SWAMIGUI_ITEM_MENU_PLUGIN = 1 << 1 /* set if menu item is for a plugin */ } SwamiguiItemMenuFlags;
SwamiguiItemMenu * swamigui_item_menu_new ();
Create a new Swami tree store.
Returns : |
New Swami tree store object with a ref count of 1. |
GtkWidget * swamigui_item_menu_add (SwamiguiItemMenu *menu
,const SwamiguiItemMenuInfo *info
,const char *action_id
);
Add a menu item to a GUI menu.
|
GUI menu to add item to |
|
Info describing new menu item to add |
|
The action ID string that is adding the menu item |
Returns : |
The new GtkMenuItem that was added to the menu. |
GtkWidget * swamigui_item_menu_add_registered_info (SwamiguiItemMenu *menu
,const char *action_id
);
Add a menu item to a GUI menu using the default info added when the
action_id
was registered.
|
GUI menu to add item to |
|
The action ID string that is adding the menu item |
Returns : |
The new GtkMenuItem that was added to the menu. |
void swamigui_item_menu_generate (SwamiguiItemMenu *menu
);
Generate a GUI menu by executing all registered item action handlers which add items to the menu. Any existing items are removed before generating the new menu.
|
GUI menu |
void swamigui_register_item_menu_action (char *action_id
,SwamiguiItemMenuInfo *info
,SwamiguiItemMenuHandler handler
);
Registers a menu action.
|
Menu item action ID (example: "paste", "new", "copy", etc), should be a static string since it is used directly. |
|
Menu item info (optional if handler specified). Structure is
used directly and so it should be static as well as the strings inside.
|
|
Function to call when generating a menu (may be NULL in which
case the default handler is used). Handler function should determine
whether the registered action is appropriate for the current item
selection and right click item and add menu items as appropriate.
|
gboolean swamigui_lookup_item_menu_action (const char *action_id
,SwamiguiItemMenuInfo **info
,SwamiguiItemMenuHandler *handler
);
Lookup item action information registered by action_id
.
void swamigui_register_item_menu_include_type (const char *action_id
,GType type
,gboolean derived
);
Adds a selection item type for inclusion for the given registered item action.
|
The registered action ID string |
|
The type to add |
|
Set to TRUE if derived types should match also
|
void swamigui_register_item_menu_exclude_type (const char *action_id
,GType type
,gboolean derived
);
Adds a selection item type for exclusion for the given registered item action.
|
The registered action ID string |
|
The type to add |
|
Set to TRUE if derived types should match also
|
gboolean swamigui_test_item_menu_type (const char *action_id
,GType type
);
Tests if a given item selection type
is in the include list and not in
the exclude list for action_id
.
gboolean swamigui_test_item_menu_include_type (const char *action_id
,GType type
);
Tests if a given item selection type
is in the include list for action_id
.
gboolean swamigui_test_item_menu_exclude_type (const char *action_id
,GType type
);
Tests if a given item selection type
is not in the exclude list for
action_id
.
GObject * swamigui_item_menu_get_selection_single
(SwamiguiItemMenu *menu
);
Test if a menu object has a single selected item and return it if so.
|
GUI menu object |
Returns : |
The single selected item object or NULL if not a single selection.
Returned object does NOT have a reference added and should be referenced
if used outside of calling function.
|
IpatchList * swamigui_item_menu_get_selection (SwamiguiItemMenu *menu
);
Test if a menu object has any selected items and return the selection list if so.
|
GUI menu object |
Returns : |
Selected items or NULL if no selection object. No reference is
added for caller, so caller must reference if used outside of calling
context.
|
void swamigui_item_menu_handler_single (SwamiguiItemMenu *menu
,const char *action_id
);
A SwamiguiItemMenuHandler type that can be used when registering a menu action. It will add a single menu item, using the info provided during action registration, if a single item is selected and is of a type found in the include type list and not found in exclude list.
|
The menu object |
|
The action ID |
void swamigui_item_menu_handler_multi (SwamiguiItemMenu *menu
,const char *action_id
);
A SwamiguiItemMenuHandler type that can be used when registering a menu action. It will add a single menu item, using the info provided during action registration, if a single item is selected and is of a type found in the include type list and not in exclude list or multiple items are selected.
|
The menu object |
|
The action ID |
void swamigui_item_menu_handler_single_all (SwamiguiItemMenu *menu
,const char *action_id
);
A SwamiguiItemMenuHandler type that can be used when registering a menu action. It will add a single menu item, using the info provided during action registration, if there is a single item selected of any type.
|
The menu object |
|
The action ID |
void swamigui_item_menu_handler_multi_all (SwamiguiItemMenu *menu
,const char *action_id
);
A SwamiguiItemMenuHandler type that can be used when registering a menu action. It will add a single menu item, using the info provided during action registration, if there is at least one item selected of any type.
|
The menu object |
|
The action ID |