GtkMenuBar: GTK+ 2 Reference Manual

## GtkMenuBar GtkMenuBar — A subclass widget for GtkMenuShell which holds GtkMenuItem widgets |

## Functions

GtkWidget * | gtk_menu_bar_new ()
#define | gtk_menu_bar_append()
#define | gtk_menu_bar_prepend()
#define | gtk_menu_bar_insert()
void | gtk_menu_bar_set_pack_direction ()
GtkPackDirection | gtk_menu_bar_get_pack_direction ()
void | gtk_menu_bar_set_child_pack_direction ()
GtkPackDirection | gtk_menu_bar_get_child_pack_direction ()

## Properties

GtkPackDirection | child-pack-direction | Read / Write
GtkPackDirection | pack-direction | Read / Write

## Style Properties

gint | internal-padding | Read
GtkShadowType | shadow-type | Read

## Types and Values

struct | GtkMenuBar
enum | GtkPackDirection

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GtkContainer
                        ╰── GtkMenuShell
                            ╰── GtkMenuBar

## Implemented Interfaces

GtkMenuBar implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <gtk/gtk.h>

## Description

The GtkMenuBar is a subclass of GtkMenuShell which contains one to many GtkMenuItem. The result is a standard menu bar which can hold many menu items. GtkMenuBar allows for a shadow type to be set for aesthetic purposes. The shadow types are defined in the gtk_menu_bar_set_shadow_type function.

## Functions

### gtk_menu_bar_new ()

    GtkWidget *
    gtk_menu_bar_new (void);

Creates the new GtkMenuBar

#### Returns

the GtkMenuBar

### gtk_menu_bar_append()

    #define gtk_menu_bar_append(menu,child)	    gtk_menu_shell_append  ((GtkMenuShell *)(menu),(child))

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

Use `gtk_menu_shell_append()` instead.

Adds a new GtkMenuItem to the end of the GtkMenuBar

#### Parameters

menu | a GtkMenuBar |
child | the GtkMenuItem to add |

### gtk_menu_bar_prepend()

    #define gtk_menu_bar_prepend(menu,child)    gtk_menu_shell_prepend ((GtkMenuShell *)(menu),(child))

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

Use `gtk_menu_shell_prepend()` instead.

Adds a new GtkMenuItem to the beginning of the GtkMenuBar

#### Parameters

menu | a GtkMenuBar |
child | the GtkMenuItem to add |

### gtk_menu_bar_insert()

    #define gtk_menu_bar_insert(menu,child,pos) gtk_menu_shell_insert ((GtkMenuShell *)(menu),(child),(pos))

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

Use `gtk_menu_shell_insert()` instead.

Adds a new GtkMenuItem to the GtkMenuBar at the position defined by `position`

#### Parameters

menu | a GtkMenuBar |
child | the GtkMenuItem to add |
pos | the position in the item list where the `child` is added. |

### gtk_menu_bar_set_pack_direction ()

    void
    gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,
                                     GtkPackDirection pack_dir);

Sets how items should be packed inside a menubar.

#### Parameters

menubar | a GtkMenuBar |
pack_dir | a new GtkPackDirection |

Since: 2.8

### gtk_menu_bar_get_pack_direction ()

    GtkPackDirection
    gtk_menu_bar_get_pack_direction (GtkMenuBar *menubar);

Retrieves the current pack direction of the menubar. See `gtk_menu_bar_set_pack_direction()`.

#### Parameters

menubar | a GtkMenuBar |

#### Returns

the pack direction

Since: 2.8

### gtk_menu_bar_set_child_pack_direction ()

    void
    gtk_menu_bar_set_child_pack_direction (GtkMenuBar *menubar,
                                           GtkPackDirection child_pack_dir);

Sets how widgets should be packed inside the children of a menubar.

#### Parameters

menubar | a GtkMenuBar |
child_pack_dir | a new GtkPackDirection |

Since: 2.8

### gtk_menu_bar_get_child_pack_direction ()

    GtkPackDirection
    gtk_menu_bar_get_child_pack_direction (GtkMenuBar *menubar);

Retrieves the current child pack direction of the menubar. See `gtk_menu_bar_set_child_pack_direction()`.

#### Parameters

menubar | a GtkMenuBar |

#### Returns

the child pack direction

Since: 2.8

## Types and Values

### struct GtkMenuBar

    struct GtkMenuBar;

The GtkMenuBar struct contains the following fields. (These fields should be considered read-only. They should never be set by an application.)

### enum GtkPackDirection

Determines how widgets should be packed insided menubars and menuitems contained in menubars.

#### Members

GTK_PACK_DIRECTION_LTR | Widgets are packed left-to-right. |
GTK_PACK_DIRECTION_RTL | Widgets are packed right-to-left. |
GTK_PACK_DIRECTION_TTB | Widgets are packed top-to-bottom. |
GTK_PACK_DIRECTION_BTT | Widgets are packed bottom-to-top. |

## Property Details

### The `“child-pack-direction”` property

      “child-pack-direction”     GtkPackDirection

The child pack direction of the menubar. It determines how the widgets contained in child menuitems are arranged.

Flags: Read / Write

Default value: GTK_PACK_DIRECTION_LTR

Since: 2.8

### The `“pack-direction”` property

      “pack-direction”           GtkPackDirection

The pack direction of the menubar. It determines how menuitems are arranged in the menubar.

Flags: Read / Write

Default value: GTK_PACK_DIRECTION_LTR

Since: 2.8

## Style Property Details

### The `“internal-padding”` style property

      “internal-padding”         gint

Amount of border space between the menubar shadow and the menu items.

Flags: Read

Allowed values: >= 0

Default value: 1

### The `“shadow-type”` style property

      “shadow-type”              GtkShadowType

Style of bevel around the menubar.

Flags: Read

Default value: GTK_SHADOW_OUT

## See Also

GtkMenuShell, GtkMenu, GtkMenuItem