cvs: php-gtk /test gtk.php
| From: | Andrei Zmievski | Date: | Wed, 28 Feb 2001 16:53:24 +0000 |
| Subject: | cvs: php-gtk /test gtk.php | ||
| Groups: | php.gtk | ||
| Request: | Send a blank email to php-gtk+get-63@lists.php.net to get a copy of this message | ||
andrei Wed Feb 28 08:53:24 2001 EDT
Modified files:
/php-gtk/test gtk.php
Log:
Add labels test.
Index: php-gtk/test/gtk.php
diff -u php-gtk/test/gtk.php:1.4 php-gtk/test/gtk.php:1.5
--- php-gtk/test/gtk.php:1.4 Tue Feb 27 20:47:06 2001
+++ php-gtk/test/gtk.php Wed Feb 28 08:53:24 2001
@@ -1,5 +1,5 @@
<?php
-/* $Id: gtk.php,v 1.4 2001/02/28 04:47:06 andrei Exp $ */
+/* $Id: gtk.php,v 1.5 2001/02/28 16:53:24 andrei Exp $ */
if (strtoupper(substr(PHP_OS, 1, 3)) == 'WIN')
dl('php_gtk.dll');
@@ -88,11 +88,105 @@
}
+function create_labels()
+{
+ global $windows;
+
+ if (!isset($windows['labels'])) {
+ $window = &new GtkWindow;
+ $windows['labels'] = $window;
+ $window->connect('delete-event', delete_event);
+ $window->set_title('GtkLabel');
+
+ $vbox = &new GtkVBox(false, 5);
+ $hbox = &new GtkHBox(false, 5);
+ $window->add($hbox);
+ $hbox->show();
+ $hbox->pack_start($vbox, false, false);
+ $vbox->show();
+ $window->set_border_width(5);
+
+ $frame = &new GtkFrame('Normal Label');
+ $label = &new GtkLabel('This is a Normal label');
+ $frame->add($label);
+ $label->show();
+ $vbox->pack_start($frame, false, false);
+ $frame->show();
+
+ $frame = &new GtkFrame('Multi-line Label');
+ $label = &new GtkLabel("This is a Multi-line label.\nSecond line\nThird line");
+ $frame->add($label);
+ $label->show();
+ $vbox->pack_start($frame, false, false);
+ $frame->show();
+
+ $frame = &new GtkFrame('Left Justified Label');
+ $label = &new GtkLabel("This is a Left-Justified\nMulti-line label.\nThird line");
+ $label->set_justify(GTK_JUSTIFY_LEFT);
+ $frame->add($label);
+ $label->show();
+ $vbox->pack_start($frame, false, false);
+ $frame->show();
+
+ $frame = &new GtkFrame('Right Justified Label');
+ $label = &new GtkLabel("This is a Right-Justified\nMulti-line label.\nThird line");
+ $label->set_justify(GTK_JUSTIFY_RIGHT);
+ $frame->add($label);
+ $label->show();
+ $vbox->pack_start($frame, false, false);
+ $frame->show();
+
+ $vbox = &new GtkVBox(false, 5);
+ $hbox->pack_start($vbox);
+ $vbox->show();
+
+ $frame = &new GtkFrame('Line wrapped label');
+ $label = &new GtkLabel("This is an example of a line-wrapped label. It should not be
taking ".
+ "up the entire ".
+ "width allocated to it, but automatically wraps the words to fit. ".
+ "The time has come, for all good men, to come to the aid of their party. ".
+ "The sixth sheik's six sheep's sick.\n".
+ " It supports multiple paragraphs correctly, and correctly adds ".
+ "many extra spaces. ");
+ $label->set_line_wrap(true);
+ $frame->add($label);
+ $label->show();
+ $vbox->pack_start($frame, false, false);
+ $frame->show();
+
+ $frame = &new GtkFrame('Filled, wrapped label');
+ $label = &new GtkLabel("This is an example of a line-wrapped, filled label. It should
be taking ".
+ "up the entire width allocated to it. Here is a seneance to prove
".
+ "my point. Here is another sentence. ".
+ "Here comes the sun, do de do de do.\n".
+ " This is a new paragraph.\n".
+ " This is another newer, longer, better paragraph. It is coming to an end, ".
+ "unfortunately.");
+ $label->set_line_wrap(true);
+ $label->set_justify(GTK_JUSTIFY_FILL);
+ $frame->add($label);
+ $label->show();
+ $vbox->pack_start($frame, false, false);
+ $frame->show();
+
+ $frame = &new GtkFrame('Underlined label');
+ $label = &new GtkLabel("This label is underlined!\n".
+ "This one is underlined in ÆüËܸì¤ÎÆþÍÑquite a funky fashion");
+ $label->set_justify(GTK_JUSTIFY_LEFT);
+ $label->set_pattern('_________________________ _ _________ _ _____ _ __ __ ___ ____
_____');
+ $frame->add($label);
+ $label->show();
+ $vbox->pack_start($frame, false, false);
+ $frame->show();
+ }
+ $windows['labels']->show();
+}
+
function create_main_window()
{
$buttons = array(
'buttons' => create_buttons,
- 'labels' => null,
+ 'labels' => create_labels,
);
$window = &new GtkWindow();
@@ -117,7 +211,6 @@
$box2->set_border_width(10);
$scrolled_window->add_with_viewport($box2);
$box2->set_focus_vadjustment($scrolled_window->get_vadjustment());
- $box2->show();
ksort($buttons);
foreach ($buttons as $label => $function) {