GtkToolbar

Name

GtkToolbar -- create bars of buttons and other widgets.

Synopsis


#include <gtk/gtk.h>


struct      GtkToolbar;
enum        GtkToolbarChildType;
enum        GtkToolbarSpaceStyle;
struct      GtkToolbarChild;
GtkWidget*  gtk_toolbar_new                 (void);
GtkWidget*  gtk_toolbar_append_item         (GtkToolbar *toolbar,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data);
GtkWidget*  gtk_toolbar_prepend_item        (GtkToolbar *toolbar,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data);
GtkWidget*  gtk_toolbar_insert_item         (GtkToolbar *toolbar,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data,
                                             gint position);
void        gtk_toolbar_append_space        (GtkToolbar *toolbar);
void        gtk_toolbar_prepend_space       (GtkToolbar *toolbar);
void        gtk_toolbar_insert_space        (GtkToolbar *toolbar,
                                             gint position);
GtkWidget*  gtk_toolbar_append_element      (GtkToolbar *toolbar,
                                             GtkToolbarChildType type,
                                             GtkWidget *widget,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data);
GtkWidget*  gtk_toolbar_prepend_element     (GtkToolbar *toolbar,
                                             GtkToolbarChildType type,
                                             GtkWidget *widget,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data);
GtkWidget*  gtk_toolbar_insert_element      (GtkToolbar *toolbar,
                                             GtkToolbarChildType type,
                                             GtkWidget *widget,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data,
                                             gint position);
void        gtk_toolbar_append_widget       (GtkToolbar *toolbar,
                                             GtkWidget *widget,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text);
void        gtk_toolbar_prepend_widget      (GtkToolbar *toolbar,
                                             GtkWidget *widget,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text);
void        gtk_toolbar_insert_widget       (GtkToolbar *toolbar,
                                             GtkWidget *widget,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             gint position);
void        gtk_toolbar_set_orientation     (GtkToolbar *toolbar,
                                             GtkOrientation orientation);
void        gtk_toolbar_set_style           (GtkToolbar *toolbar,
                                             GtkToolbarStyle style);
void        gtk_toolbar_set_tooltips        (GtkToolbar *toolbar,
                                             gboolean enable);
GtkWidget*  gtk_toolbar_insert_stock        (GtkToolbar *toolbar,
                                             const gchar *stock_id,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkSignalFunc callback,
                                             gpointer user_data,
                                             gint position);
void        gtk_toolbar_set_icon_size       (GtkToolbar *toolbar,
                                             GtkIconSize icon_size);
GtkIconSize gtk_toolbar_get_icon_size       (GtkToolbar *toolbar);
GtkOrientation gtk_toolbar_get_orientation  (GtkToolbar *toolbar);
GtkToolbarStyle gtk_toolbar_get_style       (GtkToolbar *toolbar);
gboolean    gtk_toolbar_get_tooltips        (GtkToolbar *toolbar);
void        gtk_toolbar_remove_space        (GtkToolbar *toolbar,
                                             gint position);
void        gtk_toolbar_unset_icon_size     (GtkToolbar *toolbar);
void        gtk_toolbar_unset_style         (GtkToolbar *toolbar);


Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkContainer
                     +----GtkToolbar

Properties


  "orientation"          GtkOrientation       : Read / Write
  "toolbar-style"        GtkToolbarStyle      : Read / Write

Signal Prototypes


"orientation-changed"
            void        user_function      (GtkToolbar *toolbar,
                                            GtkOrientation orientation,
                                            gpointer user_data);
"style-changed"
            void        user_function      (GtkToolbar *toolbar,
                                            GtkToolbarStyle style,
                                            gpointer user_data);

Description

A toolbar is created with a call to gtk_toolbar_new().

Buttons with text and/or images are added with gtk_toolbar_append_item(), gtk_toolbar_prepend_item(), and gtk_toolbar_insert_item().

Any of GtkToggleButton, GtkRadioButton, or an arbitrary widget can be added to the toolbar with gtk_toolbar_append_element(), gtk_toolbar_prepend_element(), and gtk_toolbar_insert_element().

Widgets can be visibly grouped by adding gaps between widgets using gtk_toolbar_append_space(), gtk_toolbar_prepend_space(), and gtk_toolbar_insert_space().

Details

struct GtkToolbar

struct GtkToolbar;

num_children is an integer specifying how many toolbar items the GtkToolbar contains. children is a GList of the child widgets of the toolbar.

orientation


enum GtkToolbarChildType

typedef enum
{
  GTK_TOOLBAR_CHILD_SPACE,
  GTK_TOOLBAR_CHILD_BUTTON,
  GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
  GTK_TOOLBAR_CHILD_RADIOBUTTON,
  GTK_TOOLBAR_CHILD_WIDGET
} GtkToolbarChildType;

GtkToolbarChildType is used to set the type of new elements that are added to a GtkToolbar.


enum GtkToolbarSpaceStyle

typedef enum
{
  GTK_TOOLBAR_SPACE_EMPTY,
  GTK_TOOLBAR_SPACE_LINE
} GtkToolbarSpaceStyle;


struct GtkToolbarChild

struct GtkToolbarChild
{
  GtkToolbarChildType type;
  GtkWidget *widget;
  GtkWidget *icon;
  GtkWidget *label;
};


gtk_toolbar_new ()

GtkWidget*  gtk_toolbar_new                 (void);

Creates a new toolbar.


gtk_toolbar_append_item ()

GtkWidget*  gtk_toolbar_append_item         (GtkToolbar *toolbar,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data);

Adds a new button to the end (right or bottom edges) of the given toolbar.


gtk_toolbar_prepend_item ()

GtkWidget*  gtk_toolbar_prepend_item        (GtkToolbar *toolbar,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data);

Adds a new button to the beginning (top or left edges) of the given toolbar.


gtk_toolbar_insert_item ()

GtkWidget*  gtk_toolbar_insert_item         (GtkToolbar *toolbar,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data,
                                             gint position);

Inserts a new item into the toolbar. You must specify the position in the toolbar where it will be inserted.


gtk_toolbar_append_space ()

void        gtk_toolbar_append_space        (GtkToolbar *toolbar);

Adds a new space to the end of the toolbar.


gtk_toolbar_prepend_space ()

void        gtk_toolbar_prepend_space       (GtkToolbar *toolbar);

Adds a new space to the beginning of the toolbar.


gtk_toolbar_insert_space ()

void        gtk_toolbar_insert_space        (GtkToolbar *toolbar,
                                             gint position);

Inserts a new space in the toolbar at the specified position.


gtk_toolbar_append_element ()

GtkWidget*  gtk_toolbar_append_element      (GtkToolbar *toolbar,
                                             GtkToolbarChildType type,
                                             GtkWidget *widget,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data);

Adds a new element to the end of a toolbar.

If type == GTK_TOOLBAR_CHILD_WIDGET, widget is used as the new element. If type == GTK_TOOLBAR_CHILD_RADIOBUTTON, widget is used to determine the radio group for the new element. In all other cases, widget must be NULL.


gtk_toolbar_prepend_element ()

GtkWidget*  gtk_toolbar_prepend_element     (GtkToolbar *toolbar,
                                             GtkToolbarChildType type,
                                             GtkWidget *widget,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data);

Adds a new element to the beginning of a toolbar.

If type == GTK_TOOLBAR_CHILD_WIDGET, widget is used as the new element. If type == GTK_TOOLBAR_CHILD_RADIOBUTTON, widget is used to determine the radio group for the new element. In all other cases, widget must be NULL.


gtk_toolbar_insert_element ()

GtkWidget*  gtk_toolbar_insert_element      (GtkToolbar *toolbar,
                                             GtkToolbarChildType type,
                                             GtkWidget *widget,
                                             const char *text,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkWidget *icon,
                                             GtkSignalFunc callback,
                                             gpointer user_data,
                                             gint position);

Inserts a new element in the toolbar at the given position.

If type == GTK_TOOLBAR_CHILD_WIDGET, widget is used as the new element. If type == GTK_TOOLBAR_CHILD_RADIOBUTTON, widget is used to determine the radio group for the new element. In all other cases, widget must be NULL.


gtk_toolbar_append_widget ()

void        gtk_toolbar_append_widget       (GtkToolbar *toolbar,
                                             GtkWidget *widget,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text);

Adds a widget to the end of the given toolbar.


gtk_toolbar_prepend_widget ()

void        gtk_toolbar_prepend_widget      (GtkToolbar *toolbar,
                                             GtkWidget *widget,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text);

Adds a widget to the beginning of the given toolbar.


gtk_toolbar_insert_widget ()

void        gtk_toolbar_insert_widget       (GtkToolbar *toolbar,
                                             GtkWidget *widget,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             gint position);

Inserts a widget in the toolbar at the given position.


gtk_toolbar_set_orientation ()

void        gtk_toolbar_set_orientation     (GtkToolbar *toolbar,
                                             GtkOrientation orientation);

Sets whether a toolbar should appear horizontally or vertically.


gtk_toolbar_set_style ()

void        gtk_toolbar_set_style           (GtkToolbar *toolbar,
                                             GtkToolbarStyle style);

Alters the view of toolbar to display either icons only, text only, or both.


gtk_toolbar_set_tooltips ()

void        gtk_toolbar_set_tooltips        (GtkToolbar *toolbar,
                                             gboolean enable);

Sets if the tooltips of a toolbar should be active or not.


gtk_toolbar_insert_stock ()

GtkWidget*  gtk_toolbar_insert_stock        (GtkToolbar *toolbar,
                                             const gchar *stock_id,
                                             const char *tooltip_text,
                                             const char *tooltip_private_text,
                                             GtkSignalFunc callback,
                                             gpointer user_data,
                                             gint position);

Inserts a stock item at the specified position of the toolbar. If stock_id is not a known stock item ID, it's inserted verbatim, except that underscores are used to mark mnemonics (see gtk_label_new_with_mnemonic()).


gtk_toolbar_set_icon_size ()

void        gtk_toolbar_set_icon_size       (GtkToolbar *toolbar,
                                             GtkIconSize icon_size);

This function sets the size of stock icons in the toolbar. You can call it both before you add the icons and after they've been added. The size you set will override user preferences for the default icon size.


gtk_toolbar_get_icon_size ()

GtkIconSize gtk_toolbar_get_icon_size       (GtkToolbar *toolbar);

Retrieves the icon size fo the toolbar. See gtk_toolbar_set_icon_size().


gtk_toolbar_get_orientation ()

GtkOrientation gtk_toolbar_get_orientation  (GtkToolbar *toolbar);

Retrieves the current orientation of the toolbar. See gtk_toolbar_set_orientation().


gtk_toolbar_get_style ()

GtkToolbarStyle gtk_toolbar_get_style       (GtkToolbar *toolbar);

Retrieves whether the toolbar has text, icons, or both . See gtk_toolbar_set_style().


gtk_toolbar_get_tooltips ()

gboolean    gtk_toolbar_get_tooltips        (GtkToolbar *toolbar);

Retrieves whether tooltips are enabled. See gtk_toolbar_set_tooltips().


gtk_toolbar_remove_space ()

void        gtk_toolbar_remove_space        (GtkToolbar *toolbar,
                                             gint position);

Removes a space from the specified position.


gtk_toolbar_unset_icon_size ()

void        gtk_toolbar_unset_icon_size     (GtkToolbar *toolbar);

Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that user preferences will be used to determine the icon size.


gtk_toolbar_unset_style ()

void        gtk_toolbar_unset_style         (GtkToolbar *toolbar);

Unsets a toolbar style set with gtk_toolbar_set_style(), so that user preferences will be used to determine the toolbar style.

Properties

"orientation" (GtkOrientation : Read / Write)

"toolbar-style" (GtkToolbarStyle : Read / Write)

Signals

The "orientation-changed" signal

void        user_function                  (GtkToolbar *toolbar,
                                            GtkOrientation orientation,
                                            gpointer user_data);

Should be used if you wish to perform an action when the orientation of a toolbar is changed.


The "style-changed" signal

void        user_function                  (GtkToolbar *toolbar,
                                            GtkToolbarStyle style,
                                            gpointer user_data);

Should be used if you wish to perform an action when ever the style of a toolbar is adjusted. For example, this would be a useful signal to connect to if you want to display more items on the toolbar when it is in icon-only mode; each item takes less space on the bar.

See Also

GtkToolTips

Change the properties of a GtkToolbar's GtkTooltips.

GtkTipsQuery

Make use of the private tips of toolbar elements.