GtkVSeparator Constructor

GtkVSeparator ();

Constructing a GtkVSeparator will allow you to separate one or a groups of widgets on the screen. Use the container's packing methods (for example, pack_start() ) to organise spacing around the separators. Check the script below for some examples.

Example 148. Usage demonstration for GtkHSeparator and GtkVSeparator

//The GtkBoxes we'll be using to arrange our demonstration
$vbox = new GtkVBox();
$hbox = new GtkHBox();

//Labels that will identify each portion of the window
$label_top = new GtkLabel('Top');
$label_br = new GtkLabel('Bottom right');
$label_bl = new GtkLabel('Bottom left');

//Our separators
$vsep = new GtkVSeparator();
$hsep = new GtkHSeparator();

//Let's colour our separators. This is, of course, optional
$green = new GdkColor(0, 65000, 0);
$red = new GdkColor(65000,0,0);
$style_1 = new GtkStyle();
$style_2 = new GtkStyle();
$style_1->bg[GTK::STATE_NORMAL] = $red;
$style_2->bg[GTK::STATE_NORMAL] = $green;

//Let's assemble our widgets
//Here we're adding the horizontal separator, the "false, false, 3" means we
//don't want it to extend or fill, and that it should have a padding of 3 px.
//Check pack_start() in the manual for more info
$vbox->pack_start($hsep, false, false, 3);
//Same thing for the vertical separator. Note that you don't have to define 
//this extra arguments, they're just here because I like it better this way =)
$hbox->pack_start($vsep, false, false, 3);
$hbox->pack_start($label_bl, true, true);

//Preparing the window
$win = new GtkWindow();
$win->set_title('Separator demo');
$win->set_default_size(200, 100);
//Adding the GtkVBox to the window
//Connecting the destroy signal
$win->connect_simple('destroy', array('Gtk','main_quit'));
//Showing the window's content
//Main loop