GtkItemFactory

Name

GtkItemFactory -- 

Synopsis


#include <gtk/gtk.h>


struct      GtkItemFactory;
void        (*GtkPrintFunc)                 (gpointer func_data,
                                             const gchar *str);
gchar*      (*GtkTranslateFunc)             (const gchar *path,
                                             gpointer func_data);
void        (*GtkItemFactoryCallback)       ();
void        (*GtkItemFactoryCallback1)      (gpointer callback_data,
                                             guint callback_action,
                                             GtkWidget *widget);
void        (*GtkItemFactoryCallback2)      (GtkWidget *widget,
                                             gpointer callback_data,
                                             guint callback_action);
struct      GtkItemFactoryEntry;
struct      GtkItemFactoryItem;
GtkItemFactory* gtk_item_factory_new        (GtkType container_type,
                                             const gchar *path,
                                             GtkAccelGroup *accel_group);
void        gtk_item_factory_construct      (GtkItemFactory *ifactory,
                                             GtkType container_type,
                                             const gchar *path,
                                             GtkAccelGroup *accel_group);
void        gtk_item_factory_add_foreign    (GtkWidget *accel_widget,
                                             const gchar *full_path,
                                             GtkAccelGroup *accel_group,
                                             guint keyval,
                                             GdkModifierType modifiers);
GtkItemFactory* gtk_item_factory_from_widget
                                            (GtkWidget *widget);
G_CONST_RETURN gchar* gtk_item_factory_path_from_widget
                                            (GtkWidget *widget);
GtkWidget*  gtk_item_factory_get_item       (GtkItemFactory *ifactory,
                                             const gchar *path);
GtkWidget*  gtk_item_factory_get_widget     (GtkItemFactory *ifactory,
                                             const gchar *path);
GtkWidget*  gtk_item_factory_get_widget_by_action
                                            (GtkItemFactory *ifactory,
                                             guint action);
GtkWidget*  gtk_item_factory_get_item_by_action
                                            (GtkItemFactory *ifactory,
                                             guint action);
void        gtk_item_factory_create_item    (GtkItemFactory *ifactory,
                                             GtkItemFactoryEntry *entry,
                                             gpointer callback_data,
                                             guint callback_type);
void        gtk_item_factory_create_items   (GtkItemFactory *ifactory,
                                             guint n_entries,
                                             GtkItemFactoryEntry *entries,
                                             gpointer callback_data);
void        gtk_item_factory_create_items_ac
                                            (GtkItemFactory *ifactory,
                                             guint n_entries,
                                             GtkItemFactoryEntry *entries,
                                             gpointer callback_data,
                                             guint callback_type);
void        gtk_item_factory_delete_item    (GtkItemFactory *ifactory,
                                             const gchar *path);
void        gtk_item_factory_delete_entry   (GtkItemFactory *ifactory,
                                             GtkItemFactoryEntry *entry);
void        gtk_item_factory_delete_entries (GtkItemFactory *ifactory,
                                             guint n_entries,
                                             GtkItemFactoryEntry *entries);
void        gtk_item_factory_popup          (GtkItemFactory *ifactory,
                                             guint x,
                                             guint y,
                                             guint mouse_button,
                                             guint32 time);
void        gtk_item_factory_popup_with_data
                                            (GtkItemFactory *ifactory,
                                             gpointer popup_data,
                                             GtkDestroyNotify destroy,
                                             guint x,
                                             guint y,
                                             guint mouse_button,
                                             guint32 time);
gpointer    gtk_item_factory_popup_data     (GtkItemFactory *ifactory);
gpointer    gtk_item_factory_popup_data_from_widget
                                            (GtkWidget *widget);
GtkItemFactory* gtk_item_factory_from_path  (const gchar *path);
void        gtk_item_factory_create_menu_entries
                                            (guint n_entries,
                                             GtkMenuEntry *entries);
void        gtk_item_factories_path_delete  (const gchar *ifactory_path,
                                             const gchar *path);
void        gtk_item_factory_set_translate_func
                                            (GtkItemFactory *ifactory,
                                             GtkTranslateFunc func,
                                             gpointer data,
                                             GtkDestroyNotify notify);


Object Hierarchy


  GObject
   +----GtkObject
         +----GtkItemFactory

Description

Details

struct GtkItemFactory

struct GtkItemFactory;


GtkPrintFunc ()

void        (*GtkPrintFunc)                 (gpointer func_data,
                                             const gchar *str);


GtkTranslateFunc ()

gchar*      (*GtkTranslateFunc)             (const gchar *path,
                                             gpointer func_data);


GtkItemFactoryCallback ()

void        (*GtkItemFactoryCallback)       ();


GtkItemFactoryCallback1 ()

void        (*GtkItemFactoryCallback1)      (gpointer callback_data,
                                             guint callback_action,
                                             GtkWidget *widget);


GtkItemFactoryCallback2 ()

void        (*GtkItemFactoryCallback2)      (GtkWidget *widget,
                                             gpointer callback_data,
                                             guint callback_action);

Warning

GtkItemFactoryCallback2 is deprecated and should not be used in newly-written code.


struct GtkItemFactoryEntry

struct GtkItemFactoryEntry
{
  gchar *path;
  gchar *accelerator;

  GtkItemFactoryCallback callback;
  guint			 callback_action;

  /* possible values:
   * NULL		-> "<Item>"
   * ""			-> "<Item>"
   * "<Title>"		-> create a title item
   * "<Item>"		-> create a simple item
   * "<ImageItem>"	-> create an item holding an image
   * "<StockItem>"	-> create an item holding a stock image
   * "<CheckItem>"	-> create a check item
   * "<ToggleItem>"	-> create a toggle item
   * "<RadioItem>"	-> create a radio item
   * <path>		-> path of a radio item to link against
   * "<Separator>"	-> create a separator
   * "<Tearoff>"	-> create a tearoff separator
   * "<Branch>"		-> create an item to hold sub items
   * "<LastBranch>"	-> create a right justified item to hold sub items
   */
  gchar		 *item_type;

  /* Extra data for some item types:
   *  ImageItem  -> pointer to inlined pixbuf stream
   *  StockItem  -> name of stock item
   */
  gconstpointer extra_data;
};


struct GtkItemFactoryItem

struct GtkItemFactoryItem
{
  gchar *path;
  GSList *widgets;
};


gtk_item_factory_new ()

GtkItemFactory* gtk_item_factory_new        (GtkType container_type,
                                             const gchar *path,
                                             GtkAccelGroup *accel_group);

Creates a new GtkItemFactory.


gtk_item_factory_construct ()

void        gtk_item_factory_construct      (GtkItemFactory *ifactory,
                                             GtkType container_type,
                                             const gchar *path,
                                             GtkAccelGroup *accel_group);

Initializes an item factory.


gtk_item_factory_add_foreign ()

void        gtk_item_factory_add_foreign    (GtkWidget *accel_widget,
                                             const gchar *full_path,
                                             GtkAccelGroup *accel_group,
                                             guint keyval,
                                             GdkModifierType modifiers);

Installs an accelerator for accel_widget in accel_group, that causes the ::activate signal to be emitted if the accelerator is activated.

This function can be used to make widgets participate in the accel saving/restoring functionality provided by gtk_accel_map_save() and gtk_accel_map_load(), even if they haven't been created by an item factory. The recommended API for this purpose are the functions gtk_menu_item_set_accel_path() and gtk_widget_set_accel_path(); don't use gtk_item_factory_add_foreign() in new code, since it is likely to be removed in the future.


gtk_item_factory_from_widget ()

GtkItemFactory* gtk_item_factory_from_widget
                                            (GtkWidget *widget);

Obtains the item factory from which a widget was created.


gtk_item_factory_path_from_widget ()

G_CONST_RETURN gchar* gtk_item_factory_path_from_widget
                                            (GtkWidget *widget);

If widget has been created by an item factory, returns the full path to it. (The full path of a widget is the concatenation of the factory path specified in gtk_item_factory_new() with the path specified in the GtkItemFactoryEntry from which the widget was created.)


gtk_item_factory_get_item ()

GtkWidget*  gtk_item_factory_get_item       (GtkItemFactory *ifactory,
                                             const gchar *path);

Obtains the menu item which corresponds to path.

If the widget corresponding to path is a menu item which opens a submenu, then the item is returned. If you are interested in the submenu, use gtk_item_factory_get_widget() instead.


gtk_item_factory_get_widget ()

GtkWidget*  gtk_item_factory_get_widget     (GtkItemFactory *ifactory,
                                             const gchar *path);

Obtains the widget which corresponds to path.

If the widget corresponding to path is a menu item which opens a submenu, then the submenu is returned. If you are interested in the menu item, use gtk_item_factory_get_item() instead.


gtk_item_factory_get_widget_by_action ()

GtkWidget*  gtk_item_factory_get_widget_by_action
                                            (GtkItemFactory *ifactory,
                                             guint action);

Obtains the widget which was constructed from the GtkItemFactoryEntry with the given action.

If there are multiple items with the same action, the result is undefined.


gtk_item_factory_get_item_by_action ()

GtkWidget*  gtk_item_factory_get_item_by_action
                                            (GtkItemFactory *ifactory,
                                             guint action);

Obtains the menu item which was constructed from the first GtkItemFactoryEntry with the given action.


gtk_item_factory_create_item ()

void        gtk_item_factory_create_item    (GtkItemFactory *ifactory,
                                             GtkItemFactoryEntry *entry,
                                             gpointer callback_data,
                                             guint callback_type);

Creates an item for entry.


gtk_item_factory_create_items ()

void        gtk_item_factory_create_items   (GtkItemFactory *ifactory,
                                             guint n_entries,
                                             GtkItemFactoryEntry *entries,
                                             gpointer callback_data);

Creates the menu items from the entries.


gtk_item_factory_create_items_ac ()

void        gtk_item_factory_create_items_ac
                                            (GtkItemFactory *ifactory,
                                             guint n_entries,
                                             GtkItemFactoryEntry *entries,
                                             gpointer callback_data,
                                             guint callback_type);

Warning

gtk_item_factory_create_items_ac is deprecated and should not be used in newly-written code.

Creates the menu items from the entries.


gtk_item_factory_delete_item ()

void        gtk_item_factory_delete_item    (GtkItemFactory *ifactory,
                                             const gchar *path);

Deletes the menu item which was created for path by the given item factory.


gtk_item_factory_delete_entry ()

void        gtk_item_factory_delete_entry   (GtkItemFactory *ifactory,
                                             GtkItemFactoryEntry *entry);

Deletes the menu item which was created from entry by the given item factory.


gtk_item_factory_delete_entries ()

void        gtk_item_factory_delete_entries (GtkItemFactory *ifactory,
                                             guint n_entries,
                                             GtkItemFactoryEntry *entries);

Deletes the menu items which were created from the entries by the given item factory.


gtk_item_factory_popup ()

void        gtk_item_factory_popup          (GtkItemFactory *ifactory,
                                             guint x,
                                             guint y,
                                             guint mouse_button,
                                             guint32 time);

Pops up the menu constructed from the item factory at (x, y).


gtk_item_factory_popup_with_data ()

void        gtk_item_factory_popup_with_data
                                            (GtkItemFactory *ifactory,
                                             gpointer popup_data,
                                             GtkDestroyNotify destroy,
                                             guint x,
                                             guint y,
                                             guint mouse_button,
                                             guint32 time);

Pops up the menu constructed from the item factory at (x, y). Callbacks can access the popup_data while the menu is posted via gtk_item_factory_popup_data() and gtk_item_factory_popup_data_from_widget().


gtk_item_factory_popup_data ()

gpointer    gtk_item_factory_popup_data     (GtkItemFactory *ifactory);

Obtains the popup_data which was passed to gtk_item_factory_popup_with_data(). This data is available until the menu is popped down again.


gtk_item_factory_popup_data_from_widget ()

gpointer    gtk_item_factory_popup_data_from_widget
                                            (GtkWidget *widget);

Obtains the popup_data which was passed to gtk_item_factory_popup_with_data(). This data is available until the menu is popped down again.


gtk_item_factory_from_path ()

GtkItemFactory* gtk_item_factory_from_path  (const gchar *path);

Warning

gtk_item_factory_from_path is deprecated and should not be used in newly-written code.

Finds an item factory which has been constructed using the "<name>" prefix of path as the path argument for gtk_item_factory_new().


gtk_item_factory_create_menu_entries ()

void        gtk_item_factory_create_menu_entries
                                            (guint n_entries,
                                             GtkMenuEntry *entries);

Warning

gtk_item_factory_create_menu_entries is deprecated and should not be used in newly-written code.

Creates the menu items from the entries.


gtk_item_factories_path_delete ()

void        gtk_item_factories_path_delete  (const gchar *ifactory_path,
                                             const gchar *path);

Warning

gtk_item_factories_path_delete is deprecated and should not be used in newly-written code.

Deletes all widgets constructed from the specified path.


gtk_item_factory_set_translate_func ()

void        gtk_item_factory_set_translate_func
                                            (GtkItemFactory *ifactory,
                                             GtkTranslateFunc func,
                                             gpointer data,
                                             GtkDestroyNotify notify);

Sets a function to be used for translating the path elements before they are displayed.