bbox
buttonbox is an abstract  type, so you may not instantiate
it; however you can create a bbox using the derived types,
hbbox and vbbox types. hbbox is horizontal bbox, while vbbox
is a vertical bbox.

This bbox API is used to work on the derived types hbbox, and 
vbbox, which contain a button box.

Button boxes can have layouts defined by
/* Button box styles */
typedef enum 
{
  GTK_BUTTONBOX_DEFAULT_STYLE,
  GTK_BUTTONBOX_SPREAD,
  GTK_BUTTONBOX_EDGE,
  GTK_BUTTONBOX_START,
  GTK_BUTTONBOX_END
} GtkButtonBoxStyle;

in both hbbox, vbbox.  This is store/set in the "layout-style",
property.

The layout-style property says how to layout the buttons in the box.
 Possible values are default, spread, edge, start and end.
Values are set from  GTK_TYPE_BUTTON_BOX_STYLE enum.

Accessor functions:
GtkButtonBoxStyle gtk_button_box_get_layout (GtkButtonBox      *widget);
void              gtk_button_box_set_layout (GtkButtonBox      *widget,
					     GtkButtonBoxStyle  layout_style);

An interesting thing about bbox is you can set some child
widget to be of secondary types; this means, these widggets
will be grouped separately, from the rest of child widget,
even though in a same box.

The "secondary" property puts a button in a new group. It is a 
boolean property, if set TRUE, the child appears in a secondary group 
of children, suitable for, e.g., help buttons

Accessor functions are: 

gboolean    gtk_button_box_get_child_secondary (GtkButtonBox      *widget,
		  			         GtkWidget         *child);s
  Returns whether a child should appear in a secondary group of children.


void       gtk_button_box_set_child_secondary (GtkButtonBox      *widget,
					      GtkWidget         *child,
					      gboolean           is_secondary);

 if is_secondary: if TRUE, the child appears in a secondary group of the
 button box.

  Sets whether @child should appear in a secondary group of children.
  A typical use of a secondary child is the help button in a dialog.

  This group appears after the other children if the style
  is GTK_BUTTONBOX_START, GTK_BUTTONBOX_SPREAD or
  GTK_BUTTONBOX_EDGE, and before the other children if the style
  is GTK_BUTTONBOX_END. For horizontal button boxes, the definition
  of before/after depends on direction of the widget (see
  gtk_widget_set_direction()). If the style is GTK_BUTTONBOX_START
  or GTK_BUTTONBOX_END, then the secondary children are aligned at
  the other end of the button box from the main children. For the
  other styles, they appear immediately next to the main children.


Also remember GTK+ libraries are all based on GObject, and have Object Oriented
interfaces to prorgammers. So if a function is not in here, you can
you the parent 'box' types function, even if not there, its parent type
ad-nauseum. Hence avoid using deprecated functions in your program, when
exploring the type system will give results.

Example
{		GtkWidget *wid[10];
		bbox=gtk_hbbox_new();
		/* add some items */
		for(i=0;i<10;i++) {
		wid[i]=gtk_label_new(g_strdup_printf("%d",i));
		gtk_box_pack_start(GTK_BOX(bbox),
			wid[i],FALSE,FLASE,0);
		}
				
		/* change layout */
		gtk_button_box_set_layout(GTK_BBOX(bbox),GTK_BUTTONBOX_START);

		/* set some widgets as secondary */
		for(i=0;i<5;i++){
		gtk_bbox_set_secondary(GTK_BBOX(bbox),wid[i],TRUE);
		}

		/* show widgets */
		gtk_widget_show_all(bbox);
	
}		



see: hbbox, vbbox, box



Last Modified on Fri Jul 1 19:51:43 IST 2005
This is part of the GtkBook project Hosted Here
This code, documents and images are © Muthiah Annamalai
This document is under Creative Commons License given by LICENSE