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                 (GtkOrientation orientation,
                                             GtkToolbarStyle style);
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_space_size      (GtkToolbar *toolbar,
                                             gint space_size);
void        gtk_toolbar_set_space_style     (GtkToolbar *toolbar,
                                             GtkToolbarSpaceStyle space_style);
void        gtk_toolbar_set_tooltips        (GtkToolbar *toolbar,
                                             gint enable);
void        gtk_toolbar_set_button_relief   (GtkToolbar *toolbar,
                                             GtkReliefStyle relief);
GtkReliefStyle gtk_toolbar_get_button_relief
                                            (GtkToolbar *toolbar);

Object Hierarchy


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

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 visibily 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;

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

SPACE is just a space in the style of the toolbar's GtkToolbarSpaceStyle. BUTTON denotes a GtkButton. TOGGLEBUTTON denotes a GtkToggleButton, RADIOBUTTON denotes a GtkRadioButton, and WIDGET denotes a standard GtkWidget.


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                 (GtkOrientation orientation,
                                             GtkToolbarStyle style);

creates a new toolbar.

orientation :a GtkOrientation. It determines whether the toolbar appears horizontally or vertically.
style :a GtkToolbarStyle. It determines if the toolbar will contain buttons with just labels, just images, or both.
Returns :the newly created 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 beginning (left or top edges) of the given toolbar.

toolbar :a GtkToolbar.
text :give your toolbar button a label.
tooltip_text :a string that appears when the user holds the mouse over this item.
tooltip_private_text :use with GtkTipsQuery.
icon :a GtkWidget that should be used as the button's icon.
callback :the function to be executed when the button is pressed.
user_data :a pointer to any data you wish to be passed to the callback.
Returns :the new toolbar item as a GtkWidget.


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 of the given toolbar.

toolbar :a GtkToolbar.
text :give your toolbar button a label.
tooltip_text :a string that appears when the user holds the mouse over this item.
tooltip_private_text :use with GtkTipsQuery.
icon :a GtkWidget that should be used as the button's icon.
callback :the function to be executed when the button is pressed.
user_data :a pointer to any data you wish to be passed to the callback.
Returns :the new toolbar item as a GtkWidget.


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.

toolbar :a GtkToolbar.
text :give your toolbar button a label.
tooltip_text :a string that appears when the user holds the mouse over this item.
tooltip_private_text :use with GtkTipsQuery.
icon :a GtkWidget that should be used as the button's icon.
callback :the function to be executed when the button is pressed.
user_data :a pointer to any data you wish to be passed to the callback.
position :the number of widgets to insert this item after.
Returns :the new toolbar item as a GtkWidget.


gtk_toolbar_append_space ()

void        gtk_toolbar_append_space        (GtkToolbar *toolbar);

adds a new space to the end of the toolbar.

toolbar :a GtkToolbar.


gtk_toolbar_prepend_space ()

void        gtk_toolbar_prepend_space       (GtkToolbar *toolbar);

adds a new space to the beginning of the toolbar.

toolbar :a GtkToolbar.


gtk_toolbar_insert_space ()

void        gtk_toolbar_insert_space        (GtkToolbar *toolbar,
                                             gint position);

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

toolbar :a GtkToolbar
position :the number of widgets after which a space should be inserted.


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.

toolbar :a GtkToolbar.
type :a value of type GtkToolbarChildType that determines what widget will be.
widget :a GtkWidget to add to the toolbar. (FIXME: double check this).
text :the element's label.
tooltip_text :the element's tooltip.
tooltip_private_text :used for context-sensitive help about this toolbar element.
icon :a GtkWidget that provides pictorial representation of the element's function.
callback :the function to be executed when the button is pressed.
user_data :any data you wish to pass to the callback.
Returns :the new toolbar element as a GtkWidget.


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.

toolbar :a GtkToolbar.
type :a value of type GtkToolbarChildType that determines what widget will be.
widget :a GtkWidget to add to the toolbar. (FIXME: double check this).
text :the element's label.
tooltip_text :the element's tooltip.
tooltip_private_text :used for context-sensitive help about this toolbar element.
icon :a GtkWidget that provides pictorial representation of the element's function.
callback :the function to be executed when the button is pressed.
user_data :any data you wish to pass to the callback.
Returns :the new toolbar element as a GtkWidget.


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);

toolbar :a GtkToolbar.
type :a value of type GtkToolbarChildType that determines what widget will be.
widget :a GtkWidget to add to the toolbar. (FIXME: double check this).
text :the element's label.
tooltip_text :the element's tooltip.
tooltip_private_text :used for context-sensitive help about this toolbar element.
icon :a GtkWidget that provides pictorial representation of the element's function.
callback :the function to be executed when the button is pressed.
user_data :any data you wish to pass to the callback.
position :the number of widgets to insert this element after.
Returns :the new toolbar element as a GtkWidget.


gtk_toolbar_append_widget ()

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

toolbar : 
widget : 
tooltip_text : 
tooltip_private_text : 


gtk_toolbar_prepend_widget ()

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

toolbar : 
widget : 
tooltip_text : 
tooltip_private_text : 


gtk_toolbar_insert_widget ()

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

toolbar : 
widget : 
tooltip_text : 
tooltip_private_text : 
position : 


gtk_toolbar_set_orientation ()

void        gtk_toolbar_set_orientation     (GtkToolbar *toolbar,
                                             GtkOrientation orientation);

sets whether a toolbar should appear horizontally or vertically.

toolbar :a GtkToolbar.
orientation :a new GtkOrientation.


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.

toolbar :a GtkToolbar.
style :the new style for toolbar.


gtk_toolbar_set_space_size ()

void        gtk_toolbar_set_space_size      (GtkToolbar *toolbar,
                                             gint space_size);

should be used to set the number of pixels each item of space takes up in a toolbar.

toolbar :a GtkToolbar.
space_size :the new number of pixels that spaces should consume.


gtk_toolbar_set_space_style ()

void        gtk_toolbar_set_space_style     (GtkToolbar *toolbar,
                                             GtkToolbarSpaceStyle space_style);

sets whether a 'space' in the toolbar appears as a line or just plain empty space.

toolbar :a GtkToolbar.
space_style :the new style for the toolbar's spaces.


gtk_toolbar_set_tooltips ()

void        gtk_toolbar_set_tooltips        (GtkToolbar *toolbar,
                                             gint enable);

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

toolbar :a GtkToolbar.
enable :set to 0 to disable the tooltips, or 1 to enable them.


gtk_toolbar_set_button_relief ()

void        gtk_toolbar_set_button_relief   (GtkToolbar *toolbar,
                                             GtkReliefStyle relief);

toolbar : 
relief : 


gtk_toolbar_get_button_relief ()

GtkReliefStyle gtk_toolbar_get_button_relief
                                            (GtkToolbar *toolbar);

toolbar : 
Returns : 

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.

toolbar :the object which received the signal.
orientation :the new GtkOrientation of the toolbar.
user_data :user data set when the signal handler was connected.


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.

toolbar :the object which received the signal.
style :the new GtkToolbarStyle of toolbar.
user_data :user data set when the signal handler was connected.

See Also

GtkToolTips

Change the properties of a GtkToolbar's GtkTooltips.

GtkTipsQuery

Make use of the private tips of toolbar elements.