PHP-GTK
Thursday, April 17, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkVSeparator
GtkWidgetnext

Last updated: Sun, 12 May 2013
view this page in English

GtkVSeparator Constructor

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

<?php
//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;
$hsep->set_style($style_1);
$vsep->set_style($style_2);
 
//Let's assemble our widgets
$vbox->pack_start($label_top);
//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);
$vbox->pack_start($hbox);
$hbox->pack_start($label_br);
//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_position(Gtk::WIN_POS_CENTER);
$win->set_title('Separator demo');
$win->set_default_size(200, 100);
//Adding the GtkVBox to the window
$win->add($vbox);
//Connecting the destroy signal
$win->connect_simple('destroy', array('Gtk','main_quit'));
//Showing the window's content
$win->show_all();
//Main loop
Gtk::main();
?>


User Contributed Notes
gtk.gtkvseparator.constructor.php
add a note about notes
There are no user contributed notes for this page.


previousGtkVSeparator
GtkWidgetnext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:51:01 2013 CEST