## GntMenuItem

GntMenuItem — An item within a menu

## Functions

#define | GNT_MENU_ITEM_FLAGS()
#define | GNT_MENU_ITEM_SET_FLAGS()
#define | GNT_MENU_ITEM_UNSET_FLAGS()
void | (*GntMenuItemCallback) ()
GType | gnt_menuitem_get_gtype ()
GntMenuItem * | gnt_menuitem_new ()
void | gnt_menuitem_set_callback ()
void | gnt_menuitem_set_submenu ()
GntMenu * | gnt_menuitem_get_submenu ()
void | gnt_menuitem_set_trigger ()
char | gnt_menuitem_get_trigger ()
void | gnt_menuitem_set_id ()
const char * | gnt_menuitem_get_id ()
gboolean | gnt_menuitem_activate ()

## Types and Values

struct | GntMenuItemPriv
struct | GntMenuItem

## Description

## Functions

### GNT_MENU_ITEM_FLAGS()

    #define             GNT_MENU_ITEM_FLAGS(obj)

`GNT_MENU_ITEM_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### GNT_MENU_ITEM_SET_FLAGS()

    #define             GNT_MENU_ITEM_SET_FLAGS(obj, flags)

`GNT_MENU_ITEM_SET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### GNT_MENU_ITEM_UNSET_FLAGS()

    #define             GNT_MENU_ITEM_UNSET_FLAGS(obj, flags)

`GNT_MENU_ITEM_UNSET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### GntMenuItemCallback ()

    void
    (*GntMenuItemCallback) (GntMenuItem *item,
                            gpointer data);

### gnt_menuitem_get_gtype ()

    GType
    gnt_menuitem_get_gtype (void);

#### Returns

GType for GntMenuItem.

### gnt_menuitem_new ()

    GntMenuItem *
    gnt_menuitem_new (const char *text);

Create a new menuitem.

#### Parameters

text | Label for the menuitem. |

#### Returns

The newly created menuitem.

### gnt_menuitem_set_callback ()

    void
    gnt_menuitem_set_callback (GntMenuItem *item,
                               GntMenuItemCallback callback,
                               gpointer data);

Set a callback function for a menuitem.

#### Parameters

item | The menuitem. |
callback | The callback function. | [scope call]
data | Data to send to the callback function. |

### gnt_menuitem_set_submenu ()

    void
    gnt_menuitem_set_submenu (GntMenuItem *item,
                              GntMenu *menu);

Set a submenu for a menuitem. A menuitem with a submenu cannot have a callback.

#### Parameters

item | The menuitem. |
menu | The submenu. |

### gnt_menuitem_get_submenu ()

    GntMenu *
    gnt_menuitem_get_submenu (GntMenuItem *item);

Get the submenu for a menuitem.

#### Parameters

item | The menuitem. |

#### Returns

The submenu, or `NULL`.

[transfer none]

Since: 2.3.0

### gnt_menuitem_set_trigger ()

    void
    gnt_menuitem_set_trigger (GntMenuItem *item,
                              char trigger);

Set a trigger key for the item.

#### Parameters

item | The menuitem |
trigger | The key that will trigger the item when the parent manu is visible |

### gnt_menuitem_get_trigger ()

    char
    gnt_menuitem_get_trigger (GntMenuItem *item);

Get the trigger key for a menuitem.

See `gnt_menuitem_set_trigger()`.

#### Parameters

item | The menuitem |

#### Returns

The trigger key for the menuitem.

### gnt_menuitem_set_id ()

    void
    gnt_menuitem_set_id (GntMenuItem *item,
                         const char *id);

Set an ID for the menuitem.

#### Parameters

item | The menuitem. |
id | The ID for the menuitem. |

Since: 2.3.0

### gnt_menuitem_get_id ()

    const char *
    gnt_menuitem_get_id (GntMenuItem *item);

Get the ID of the menuitem.

#### Parameters

item | The menuitem. |

#### Returns

The ID for the menuitem.

Since: 2.3.0

### gnt_menuitem_activate ()

    gboolean
    gnt_menuitem_activate (GntMenuItem *item);

Activate a menuitem. Activating the menuitem will first trigger the 'activate' signal for the menuitem. Then the callback for the menuitem is triggered, if there is one.

#### Parameters

item | The menuitem. |

#### Returns

Whether the callback for the menuitem was called.

Since: 2.3.0

## Types and Values

### struct GntMenuItemPriv

    struct GntMenuItemPriv {
    	/* These will be used to determine the position of the submenu */
    	int GNTSEAL(x);
    	int GNTSEAL(y);
    	char GNTSEAL(trigger); /* Use gnt_menuitem_get_trigger(). */
    	char *GNTSEAL(id);     /* Use gnt_menuitem_get_id(). */
    };

`GntMenuItemPriv` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail. See inline comments for replacements.

### struct GntMenuItem

    struct GntMenuItem {
    	GObject parent;
    	struct _GntMenuItemPriv GNTSEAL(priv);

    	char *GNTSEAL(text);

    	/* A GntMenuItem can have a callback associated with it.
    	 * The callback will be activated whenever the suer selects it and presses enter (or clicks).
    	 * However, if the GntMenuItem has some child, then the callback and callbackdata will be ignored. */
    	gpointer GNTSEAL(callbackdata);
    	GntMenuItemCallback GNTSEAL(callback);

    	GntMenu *GNTSEAL(submenu);
    };

Access to any fields is deprecated. See inline comments for replacements.

## See Also

GntMenu GntMenuItem