---
name: "Gtk_Menu"
section: "3"
platform: "linux"
package: "libgtkmm-dev"
version: "1.0.3-1.1"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/Gtk_Menu"
---

# Gtk\_Menu(3)

## NAME - Gtk\_Menu

## HEADER REQUIRED

**#include \<gtk--/menu.h&gt;\>**

## BASE CLASSES

[Gtk\_MenuShell(3)](/Gtk_MenuShell/3.md)

## PROPERTIES

- *parent\_menu\_item*

  Type: Gtk\_Widget\*\
   Get:  none\
   Set:  **popup**()\

- *accel\_group*

  Type: GtkAccelGroup\*\
   Set:  **set\_accel\_group**()\

- *position\_func*

  Type: GtkMenuPositionFunc\
   Get:  none\
   Set:  **popup**()\

-

   A function taking a GtkMenu\* ({ NOTE! NOT a Gtk\_Menu!}), pointers to x and y gint coordinates and a pointer to some user data. The function should set x and y to where the menu will be positioned on the screen\

- *position\_func\_data*

  Type: gpointer\
   Get:  none\
   Set:  **popup**()\

-

   user data which will be passed to *position\_func*\

- *torn\_off*

  Type: bool\
   Get:  none\
   Set:  **set\_tearoff\_state**()\

-

   Whether the menu is torn off (detached) or not.

## PUBLIC MEMBER INDEX

```
Gtk_Menu();
~Gtk_Menu();
Gtk_Menu(GtkMenu *castitem);
void  append(const Gtk_MenuItem &child);
  append a menu item
void  prepend(const Gtk_MenuItem &child);
  insert a menu item in first position
void  insert(const Gtk_MenuItem &child, gint position);
  insert a menu item at specified position
void  append(const Gtk_ObjectHandle &child);
void  prepend(const Gtk_ObjectHandle &child);
void  insert(const Gtk_ObjectHandle &child, gint position);
void  popup(const Gtk_MenuShell &parent_menu_shell, const Gtk_MenuItem &parent_menu_item, GtkMenuPositionFunc func, gpointer data, gint button, guint32 activate_time);
  Display the menu on screen
void  popup(GtkMenuPositionFunc func, gpointer data, gint button, guint32 activate_time);
void  popdown();
  Hides the menu away
const Gtk_MenuItem*  get_active() const;
Gtk_MenuItem*  get_active();
void  set_active(gint index);
void  reposition();
void  set_accel_group(Gtk_AccelGroup &accel_group);
Gtk_AccelGroup*  get_accel_group();
Gtk_AccelGroup*  get_uline_accel_group() const;
Gtk_AccelGroup*  ensure_uline_accel_group() const;
void  set_tearoff_state(bool torn_off);
void  set_title(const _gtk_string &title);
void  reorder_child(const Gtk_MenuItem &child, gint position);
void  attach_to_widget(const Gtk_Widget &widget, GtkMenuDetachFunc detacher);
const Gtk_Widget*  get_attach_widget() const;
Gtk_Widget*  get_attach_widget();
void  detach();
GtkMenu*  gtkobj();
const GtkMenu*  gtkobj() const;
static bool  isGtkMenu(Gtk_Object *checkcast);
```

## PROTECTED MEMBER INDEX

```
friend  CppClassType;
typedef GtkMenu  BaseObjectType;
typedef GtkMenuClass  BaseClassType;
virtual void * get_parent_class();
mutable Gtk_ObjectHandle  active_widget_;
mutable Gtk_Widget * attach_widget_;
Gtk_ObjectHandle  accel_group_;
mutable Gtk_ObjectHandle  uline_accel_group_;
```

## PRIVATE MEMBER INDEX

```
static CppClassType  menu_class;
GtkType  get_type();
const Gtk_MenuItem*  _get_active() const;
```

## PUBLIC MEMBER DESCRIPTIONS

- void Gtk\_Menu::**append** (*const Gtk\_ObjectHandle &child*);

  same, except that the item will be "owned" by the menu widget. That is, the widget will destroy it along when it is deleted\

- const Gtk\_MenuItem\* Gtk\_Menu::**get\_active** () const;

  Keep track of the last menu item selected, for the purposes of the option menu\

- void Gtk\_Menu::**reposition** ();

  Position the menu according to it's position function. This wraps a function called by gtkmenuitem.c when a menu-item changes its allocation. You most likely don't need to care about it.\

- void Gtk\_Menu::**set\_title** (*const \_gtk\_string &title*);

  Sets the window manager title for the window that appears when a menu is torn off\

- void Gtk\_Menu::**attach\_to\_widget** (*const Gtk\_Widget &widget, GtkMenuDetachFunc detacher*);

  Attach the menu to a widget. *detacher* is a function which takes the attached GtkWidget\* and GtkMenu\* (**NOTE! NOT the Gtk\_Widget and Gtk\_Menu!**) This is mostly used by other widgets like Gtk\_MenuItem or Gtk\_NoteBook. You probably don't need to care about it.\

- void Gtk\_Menu::**detach** ();

  Detach the menu from the widget it was attached to (calls the passed *detacher* function)\

## PROTECTED MEMBER DESCRIPTIONS

## PRIVATE MEMBER DESCRIPTIONS
