com gtk/php-gtk: Moving the components of the phpgtk2-demo.php script into components/: demos/buttonbox.php demos/colorselector.php demos/combobox.php demos/components/buttonbox.php demos/components/colorselector.php demos/components/combobox.php demos/components/dialogmessage.php demos/components/entrycompletion.php demos/components/expander.php demos/components/scribble.php demos/components/sizegroup.php demos/components/stock-browser2.php demo

[email protected] (David Soria Parra)
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    473e497937d6b62409de894031724a06913144b3
Author:    Christian Weiske <[email protected]>         Sun, 18 Jun 2006 19:58:07 +0000
Parents:   9779111ab9c7f169aac98cac30def523b684f6d5
Branches:  master

Link:       http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=473e497937d6b62409de894031724a06913144b3

Log:
Moving the components of the phpgtk2-demo.php script into components/

Changed paths:
  D  demos/buttonbox.php
  D  demos/colorselector.php
  D  demos/combobox.php
  A  demos/components/buttonbox.php
  A  demos/components/colorselector.php
  A  demos/components/combobox.php
  A  demos/components/dialogmessage.php
  A  demos/components/entrycompletion.php
  A  demos/components/expander.php
  A  demos/components/scribble.php
  A  demos/components/sizegroup.php
  A  demos/components/stock-browser2.php
  D  demos/dialogmessage.php
  D  demos/entrycompletion.php
  D  demos/expander.php
  M  demos/phpgtk2-demo.php
  D  demos/scribble.php
  D  demos/sizegroup.php
  D  demos/stock-browser2.php
diff_473e497937d6b62409de894031724a06913144b3.txt (text/plain, 69.5 KB)
473e497937d6b62409de894031724a06913144b3
diff --git a/demos/buttonbox.php b/demos/buttonbox.php
deleted file mode 100644
index be7b2e2..0000000
--- a/demos/buttonbox.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-if( !class_exists('gtk')) {
-	die('Please load the php-gtk2 module in your php.ini' . "\r\n");
-}
-
-
-class ButtonBox extends GtkWindow
-{
-	function __construct($parent = null)
-	{
-		parent::__construct();
-
-		if (@$GLOBALS['framework']) {
-			return;
-		}
-
-		if ($parent)
-			$this->set_screen($parent->get_screen());
-		else
-			$this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-		$this->set_title(__CLASS__);
-		$this->set_position(Gtk::WIN_POS_CENTER);
-		$this->set_default_size(-1, 500);
-		$this->set_border_width(8);
-		
-		$this->add($this->__create_box());
-		$this->show_all();
-	}
-
-	
-	
-	function __create_box()
-	{
-		$box = new GtkVBox();
-		
-		$frame_horiz = new GtkFrame("Horizontal Button Boxes");
-		$box->pack_start($frame_horiz, true, true, 10);
-		
-		$vbox = new GtkVBox();
-		$vbox->set_border_width(10);
-		
-		$frame_horiz->add($vbox);
-		
-		$vbox->pack_start($this->create_framedbox(true, "Spread", 40, Gtk::BUTTONBOX_SPREAD));
-		$vbox->pack_start($this->create_framedbox(true, "Edge"	, 40, Gtk::BUTTONBOX_EDGE));
-		$vbox->pack_start($this->create_framedbox(true, "Start"	, 40, Gtk::BUTTONBOX_START));
-		$vbox->pack_start($this->create_framedbox(true, "End"	, 40, Gtk::BUTTONBOX_END));
-		
-		$frame_vert = new GtkFrame("Vertical Button Boxes");
-		$box->pack_start($frame_vert, true, true, 10);
-		
-		$hbox = new GtkHBox();
-		$hbox->set_border_width(10);
-		
-		$frame_vert->add($hbox);
-		
-		$hbox->pack_start($this->create_framedbox(false, "Spread"	, 40, Gtk::BUTTONBOX_SPREAD));
-		$hbox->pack_start($this->create_framedbox(false, "Edge"		, 40, Gtk::BUTTONBOX_EDGE));
-		$hbox->pack_start($this->create_framedbox(false, "Start"	, 40, Gtk::BUTTONBOX_START));
-		$hbox->pack_start($this->create_framedbox(false, "End"		, 40, Gtk::BUTTONBOX_END));
-		
-		return $box;
-	}
-	
-	
-	
-	function create_framedbox($horizontal, $title, $spacing, $layout)
-	{
-		$frame = new GtkFrame($title);
-		if ($horizontal) {
-			$box = new GtkHButtonBox();
-		} else {
-			$box = new GtkVButtonBox();
-		}
-		
-		$box->set_border_width(5);
-		$box->set_layout($layout);
-		$box->set_spacing($spacing);
-		
-		$frame->add($box);
-		
-		$button = GtkButton::new_from_stock(Gtk::STOCK_OK);
-		$box->add($button);
-
-		$button = GtkButton::new_from_stock(Gtk::STOCK_CANCEL);
-		$box->add($button);
-		
-		$button = GtkButton::new_from_stock(Gtk::STOCK_HELP);
-		$box->add($button);
-
-		return $frame;
-	}
-}
-
-$GLOBALS['class']		= 'ButtonBox';
-$GLOBALS['description']	= 'This demo shows various button box configurations available.  It also
-uses stock buttons, and use of mnemonics for navigation.';
-
-if (!@$GLOBALS['framework']) {
-	new ButtonBox();
-	Gtk::main();
-}
-
-?>
\ No newline at end of file
diff --git a/demos/colorselector.php b/demos/colorselector.php
deleted file mode 100644
index bd76996..0000000
--- a/demos/colorselector.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-if( !class_exists('gtk')) {
-	die('Please load the php-gtk2 module in your php.ini' . "\r\n");
-}
-
-
-class ColorSelector extends GtkWindow
-{
-	protected $d_area;
-	protected $color;
-	
-	function __construct($parent = null)
-	{
-		parent::__construct();
-
-		if (@$GLOBALS['framework']) {
-			return;
-		}
-
-		if ($parent)
-			$this->set_screen($parent->get_screen());
-		else
-			$this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-		$this->set_title(__CLASS__);
-		$this->set_position(Gtk::WIN_POS_CENTER);
-		$this->set_border_width(8);
-		
-		$this->add($this->__create_box());
-		$this->show_all();
-	}
-
-	
-	
-	function __create_box()
-	{
-		$vbox = new GtkVBox(false, 5);
-		$vbox->set_border_width(8);
-		
-		//Create the color swatch area
-		$frame = new GtkFrame();
-		$frame->set_shadow_type(Gtk::SHADOW_IN);
-		$vbox->pack_start($frame, true, true, 8);
-		
-		$this->d_area = new GtkDrawingArea();
-		$this->d_area->set_size_request(200, 200);
-		
-//		$this->d_area->modify_bg(Gtk::STATE_NORMAL, $this->color);
-		
-		$frame->add($this->d_area);
-		
-		$alignment = new GtkAlignment(1.0, 0.5, 0.0, 0.0);
-		
-		$button = new GtkButton('_Change the above color');
-		$alignment->add($button);
-		
-		$vbox->pack_start($alignment, true, true);
-		
-		$button->connect('clicked', array($this, 'on_change_color_clicked'));
-		$button->set_flags(Gtk::CAN_DEFAULT);
-		
-		return $vbox;
-	}
-	
-	
-	
-	function on_change_color_clicked($button)
-	{
-		$dialog = new GtkColorSelectionDialog('Changing color');
-		$dialog->set_transient_for($this);
-		
-		$colorsel = $dialog->colorsel;
-		
-		if ($this->color !== null) {
-			$colorsel->set_previous_color($this->color);
-			$colorsel->set_current_color($this->color);
-		}
-		$colorsel->set_has_palette(true);
-		
-		$response = $dialog->run();
-		
-		if ($response == Gtk::RESPONSE_OK) {
-			$this->color = $colorsel->get_current_color();
-			$this->d_area->modify_bg(Gtk::STATE_NORMAL, $this->color);
-		}
-		
-		$dialog->destroy();
-		return true;
-	}
-}
-
-$GLOBALS['class']		= 'ColorSelector';
-$GLOBALS['description']	= 'GtkColorSelection lets the user choose a color. GtkColorSelectionDialog is a
-prebuilt dialog containing a GtkColorSelection.';
-
-if (!@$GLOBALS['framework']) {
-	new ColorSelector();
-	Gtk::main();
-}
-
-?>
\ No newline at end of file
diff --git a/demos/combobox.php b/demos/combobox.php
deleted file mode 100644
index ac6a675..0000000
--- a/demos/combobox.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-if( !class_exists('gtk')) {
-    die('Please load the php-gtk2 module in your php.ini' . "\r\n");
-}
-
-
-class ComboBox extends GtkWindow
-{
-    function __construct($parent = null)
-    {
-        parent::__construct();
-
-        if (@$GLOBALS['framework']) {
-            return;
-        }
-
-        if ($parent)
-            $this->set_screen($parent->get_screen());
-        else
-            $this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-        $this->set_title(__CLASS__);
-        $this->set_position(Gtk::WIN_POS_CENTER);
-        $this->set_default_size(-1, -1);
-        $this->set_border_width(8);
-        
-        $this->add($this->__create_box());
-        $this->show_all();
-    }
-
-    
-    
-    function __create_box()
-    {
-        $vbox = new GtkVBox(false, 5);
-        $vbox->set_border_width(5);
-        
-
-        $combo = GtkComboBox::new_text();
-        
-        $data = array(
-            'PHP-Gtk2',
-            'is',
-            'really',
-            'cool'
-        );
-        foreach ($data as $string) {
-            $combo->append_text($string);
-        }
-        $combo->set_active(2);
-        
-        
-        $button = new GtkButton('Check this');
-        
-        $vbox->pack_start($combo, false, true);
-        $vbox->pack_start($button, false, true);
-        
-        $button->connect('clicked', array($this, 'onClickedButton'), $combo);
-        
-        
-        
-        //GtkComboBoxEntry
-        $vbox->pack_start(new GtkHSeparator(), false, true);
-        
-        
-        $comboentry = GtkComboBoxEntry::new_text();
-        $data2 = array('You', 'can', 'edit', 'this', 'box');
-        foreach ($data2 as $string) {
-            $comboentry->append_text($string);
-        }
-        $comboentry->get_child()->set_text('That\'s an own text for the entry');
-        $vbox->pack_start($comboentry, false, true);
-        
-        $button2 = new GtkButton('Check that');
-        $vbox->pack_start($button2, false, true);
-        $button2->connect('clicked', array($this, 'onClickedButton'), $comboentry);
-        
-        return $vbox;
-    }
-    
-    
-    
-    function onClickedButton($button, $combo)
-    {
-        $number = $combo->get_active();
-        $text   = $combo->get_active_text();
-        
-        if ($combo instanceof GtkComboBoxEntry) {
-            $owntext = "\r\n\r\nAs this is an GtkComboBoxEntry, we have an extra text:\r\n" . $combo->get_child()->get_text();
-        } else {
-            $owntext = '';
-        }
-        $dialog = new GtkMessageDialog($this, Gtk::DIALOG_MODAL | Gtk::DIALOG_DESTROY_WITH_PARENT,
-                        Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK,
-                        sprintf(
-                            'The %s displays "%s" which is item #%d.%s',
-                            get_class($combo),
-                            $text, 
-                            $number,
-                            $owntext
-                        )
-                    );
-        $dialog->run();
-        $dialog->destroy();
-
-    }
-    
-    
-    //FIXME: use real list models
-}
-
-$GLOBALS['class']       = 'ComboBox';
-$GLOBALS['description'] = 'Demonstrates the use of GtkComboBox and how to get the options';
-
-if (!@$GLOBALS['framework']) {
-    new ComboBox();
-    Gtk::main();
-}
-
-?>
\ No newline at end of file
diff --git a/demos/components/buttonbox.php b/demos/components/buttonbox.php
new file mode 100644
index 0000000..be7b2e2
--- /dev/null
+++ b/demos/components/buttonbox.php
@@ -0,0 +1,105 @@
+<?php
+if( !class_exists('gtk')) {
+	die('Please load the php-gtk2 module in your php.ini' . "\r\n");
+}
+
+
+class ButtonBox extends GtkWindow
+{
+	function __construct($parent = null)
+	{
+		parent::__construct();
+
+		if (@$GLOBALS['framework']) {
+			return;
+		}
+
+		if ($parent)
+			$this->set_screen($parent->get_screen());
+		else
+			$this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+		$this->set_title(__CLASS__);
+		$this->set_position(Gtk::WIN_POS_CENTER);
+		$this->set_default_size(-1, 500);
+		$this->set_border_width(8);
+		
+		$this->add($this->__create_box());
+		$this->show_all();
+	}
+
+	
+	
+	function __create_box()
+	{
+		$box = new GtkVBox();
+		
+		$frame_horiz = new GtkFrame("Horizontal Button Boxes");
+		$box->pack_start($frame_horiz, true, true, 10);
+		
+		$vbox = new GtkVBox();
+		$vbox->set_border_width(10);
+		
+		$frame_horiz->add($vbox);
+		
+		$vbox->pack_start($this->create_framedbox(true, "Spread", 40, Gtk::BUTTONBOX_SPREAD));
+		$vbox->pack_start($this->create_framedbox(true, "Edge"	, 40, Gtk::BUTTONBOX_EDGE));
+		$vbox->pack_start($this->create_framedbox(true, "Start"	, 40, Gtk::BUTTONBOX_START));
+		$vbox->pack_start($this->create_framedbox(true, "End"	, 40, Gtk::BUTTONBOX_END));
+		
+		$frame_vert = new GtkFrame("Vertical Button Boxes");
+		$box->pack_start($frame_vert, true, true, 10);
+		
+		$hbox = new GtkHBox();
+		$hbox->set_border_width(10);
+		
+		$frame_vert->add($hbox);
+		
+		$hbox->pack_start($this->create_framedbox(false, "Spread"	, 40, Gtk::BUTTONBOX_SPREAD));
+		$hbox->pack_start($this->create_framedbox(false, "Edge"		, 40, Gtk::BUTTONBOX_EDGE));
+		$hbox->pack_start($this->create_framedbox(false, "Start"	, 40, Gtk::BUTTONBOX_START));
+		$hbox->pack_start($this->create_framedbox(false, "End"		, 40, Gtk::BUTTONBOX_END));
+		
+		return $box;
+	}
+	
+	
+	
+	function create_framedbox($horizontal, $title, $spacing, $layout)
+	{
+		$frame = new GtkFrame($title);
+		if ($horizontal) {
+			$box = new GtkHButtonBox();
+		} else {
+			$box = new GtkVButtonBox();
+		}
+		
+		$box->set_border_width(5);
+		$box->set_layout($layout);
+		$box->set_spacing($spacing);
+		
+		$frame->add($box);
+		
+		$button = GtkButton::new_from_stock(Gtk::STOCK_OK);
+		$box->add($button);
+
+		$button = GtkButton::new_from_stock(Gtk::STOCK_CANCEL);
+		$box->add($button);
+		
+		$button = GtkButton::new_from_stock(Gtk::STOCK_HELP);
+		$box->add($button);
+
+		return $frame;
+	}
+}
+
+$GLOBALS['class']		= 'ButtonBox';
+$GLOBALS['description']	= 'This demo shows various button box configurations available.  It also
+uses stock buttons, and use of mnemonics for navigation.';
+
+if (!@$GLOBALS['framework']) {
+	new ButtonBox();
+	Gtk::main();
+}
+
+?>
\ No newline at end of file
diff --git a/demos/components/colorselector.php b/demos/components/colorselector.php
new file mode 100644
index 0000000..bd76996
--- /dev/null
+++ b/demos/components/colorselector.php
@@ -0,0 +1,101 @@
+<?php
+if( !class_exists('gtk')) {
+	die('Please load the php-gtk2 module in your php.ini' . "\r\n");
+}
+
+
+class ColorSelector extends GtkWindow
+{
+	protected $d_area;
+	protected $color;
+	
+	function __construct($parent = null)
+	{
+		parent::__construct();
+
+		if (@$GLOBALS['framework']) {
+			return;
+		}
+
+		if ($parent)
+			$this->set_screen($parent->get_screen());
+		else
+			$this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+		$this->set_title(__CLASS__);
+		$this->set_position(Gtk::WIN_POS_CENTER);
+		$this->set_border_width(8);
+		
+		$this->add($this->__create_box());
+		$this->show_all();
+	}
+
+	
+	
+	function __create_box()
+	{
+		$vbox = new GtkVBox(false, 5);
+		$vbox->set_border_width(8);
+		
+		//Create the color swatch area
+		$frame = new GtkFrame();
+		$frame->set_shadow_type(Gtk::SHADOW_IN);
+		$vbox->pack_start($frame, true, true, 8);
+		
+		$this->d_area = new GtkDrawingArea();
+		$this->d_area->set_size_request(200, 200);
+		
+//		$this->d_area->modify_bg(Gtk::STATE_NORMAL, $this->color);
+		
+		$frame->add($this->d_area);
+		
+		$alignment = new GtkAlignment(1.0, 0.5, 0.0, 0.0);
+		
+		$button = new GtkButton('_Change the above color');
+		$alignment->add($button);
+		
+		$vbox->pack_start($alignment, true, true);
+		
+		$button->connect('clicked', array($this, 'on_change_color_clicked'));
+		$button->set_flags(Gtk::CAN_DEFAULT);
+		
+		return $vbox;
+	}
+	
+	
+	
+	function on_change_color_clicked($button)
+	{
+		$dialog = new GtkColorSelectionDialog('Changing color');
+		$dialog->set_transient_for($this);
+		
+		$colorsel = $dialog->colorsel;
+		
+		if ($this->color !== null) {
+			$colorsel->set_previous_color($this->color);
+			$colorsel->set_current_color($this->color);
+		}
+		$colorsel->set_has_palette(true);
+		
+		$response = $dialog->run();
+		
+		if ($response == Gtk::RESPONSE_OK) {
+			$this->color = $colorsel->get_current_color();
+			$this->d_area->modify_bg(Gtk::STATE_NORMAL, $this->color);
+		}
+		
+		$dialog->destroy();
+		return true;
+	}
+}
+
+$GLOBALS['class']		= 'ColorSelector';
+$GLOBALS['description']	= 'GtkColorSelection lets the user choose a color. GtkColorSelectionDialog is a
+prebuilt dialog containing a GtkColorSelection.';
+
+if (!@$GLOBALS['framework']) {
+	new ColorSelector();
+	Gtk::main();
+}
+
+?>
\ No newline at end of file
diff --git a/demos/components/combobox.php b/demos/components/combobox.php
new file mode 100644
index 0000000..ac6a675
--- /dev/null
+++ b/demos/components/combobox.php
@@ -0,0 +1,120 @@
+<?php
+if( !class_exists('gtk')) {
+    die('Please load the php-gtk2 module in your php.ini' . "\r\n");
+}
+
+
+class ComboBox extends GtkWindow
+{
+    function __construct($parent = null)
+    {
+        parent::__construct();
+
+        if (@$GLOBALS['framework']) {
+            return;
+        }
+
+        if ($parent)
+            $this->set_screen($parent->get_screen());
+        else
+            $this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+        $this->set_title(__CLASS__);
+        $this->set_position(Gtk::WIN_POS_CENTER);
+        $this->set_default_size(-1, -1);
+        $this->set_border_width(8);
+        
+        $this->add($this->__create_box());
+        $this->show_all();
+    }
+
+    
+    
+    function __create_box()
+    {
+        $vbox = new GtkVBox(false, 5);
+        $vbox->set_border_width(5);
+        
+
+        $combo = GtkComboBox::new_text();
+        
+        $data = array(
+            'PHP-Gtk2',
+            'is',
+            'really',
+            'cool'
+        );
+        foreach ($data as $string) {
+            $combo->append_text($string);
+        }
+        $combo->set_active(2);
+        
+        
+        $button = new GtkButton('Check this');
+        
+        $vbox->pack_start($combo, false, true);
+        $vbox->pack_start($button, false, true);
+        
+        $button->connect('clicked', array($this, 'onClickedButton'), $combo);
+        
+        
+        
+        //GtkComboBoxEntry
+        $vbox->pack_start(new GtkHSeparator(), false, true);
+        
+        
+        $comboentry = GtkComboBoxEntry::new_text();
+        $data2 = array('You', 'can', 'edit', 'this', 'box');
+        foreach ($data2 as $string) {
+            $comboentry->append_text($string);
+        }
+        $comboentry->get_child()->set_text('That\'s an own text for the entry');
+        $vbox->pack_start($comboentry, false, true);
+        
+        $button2 = new GtkButton('Check that');
+        $vbox->pack_start($button2, false, true);
+        $button2->connect('clicked', array($this, 'onClickedButton'), $comboentry);
+        
+        return $vbox;
+    }
+    
+    
+    
+    function onClickedButton($button, $combo)
+    {
+        $number = $combo->get_active();
+        $text   = $combo->get_active_text();
+        
+        if ($combo instanceof GtkComboBoxEntry) {
+            $owntext = "\r\n\r\nAs this is an GtkComboBoxEntry, we have an extra text:\r\n" . $combo->get_child()->get_text();
+        } else {
+            $owntext = '';
+        }
+        $dialog = new GtkMessageDialog($this, Gtk::DIALOG_MODAL | Gtk::DIALOG_DESTROY_WITH_PARENT,
+                        Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK,
+                        sprintf(
+                            'The %s displays "%s" which is item #%d.%s',
+                            get_class($combo),
+                            $text, 
+                            $number,
+                            $owntext
+                        )
+                    );
+        $dialog->run();
+        $dialog->destroy();
+
+    }
+    
+    
+    //FIXME: use real list models
+}
+
+$GLOBALS['class']       = 'ComboBox';
+$GLOBALS['description'] = 'Demonstrates the use of GtkComboBox and how to get the options';
+
+if (!@$GLOBALS['framework']) {
+    new ComboBox();
+    Gtk::main();
+}
+
+?>
\ No newline at end of file
diff --git a/demos/components/dialogmessage.php b/demos/components/dialogmessage.php
new file mode 100644
index 0000000..5cac5a2
--- /dev/null
+++ b/demos/components/dialogmessage.php
@@ -0,0 +1,155 @@
+<?php
+if( !class_exists('gtk')) {
+    die('Please load the php-gtk2 module in your php.ini' . "\r\n");
+}
+
+
+class DialogMessagebox extends GtkWindow
+{
+    protected $entry1;
+    protected $entry2;
+    
+    protected $counter = 1;
+    
+    function __construct($parent = null)
+    {
+        parent::__construct();
+
+        if (@$GLOBALS['framework']) {
+            return;
+        }
+
+        if ($parent)
+            $this->set_screen($parent->get_screen());
+        else
+            $this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+        $this->set_title(__CLASS__);
+        $this->set_position(Gtk::WIN_POS_CENTER);
+        $this->set_border_width(8);
+        
+        $this->add($this->__create_box());
+        $this->show_all();
+    }
+
+    
+    
+    function __create_box()
+    {
+        $mvbox = new GtkVBox(false);
+        
+        $frame = new GtkFrame('Dialogs');
+        
+        $vbox = new GtkVBox(false, 8);
+        $vbox->set_border_width(8);
+        $frame->add($vbox);
+        
+        # Standard message dialog
+        $hbox = new GtkHBox(false, 8);
+        $vbox->pack_start($hbox);
+        $button = new GtkButton('_Message Dialog');
+        $button->connect('clicked', array($this, 'on_message_dialog_clicked'));
+        $hbox->pack_start($button, false, false, 0);
+        $vbox->pack_start(new GtkHSeparator(), false, false, 0);
+        
+        # Interactive dialog
+        $hbox = new GtkHBox(false, 8);
+        $vbox->pack_start($hbox, false, false, 0);
+        $vbox2 = new GtkVBox();
+        
+        $button = new GtkButton('_Interactive Dialog');
+        $button->connect('clicked', array($this, 'on_interactive_dialog_clicked'));
+        $hbox->pack_start($vbox2, false, false, 0);
+        $vbox2->pack_start($button, false, false, 0);
+        
+        $table = new GtkTable(2, 2);
+        $table->set_row_spacings(4);
+        $table->set_col_spacings(4);
+        $hbox->pack_start($table, false, false, 0);
+        
+        $label = new GtkLabel('Entry _1');
+        $label->set_use_underline(true);
+        $table->attach($label, 0, 1, 0, 1);
+        
+        $this->entry1 = new GtkEntry();
+        $table->attach($this->entry1, 1, 2, 0, 1);
+        $label->set_mnemonic_widget($this->entry1);
+        
+        $label = new GtkLabel('Entry _2');
+        $label->set_use_underline(true);
+        $table->attach($label, 0, 1, 1, 2);
+        
+        $this->entry2 = new GtkEntry();
+        $table->attach($this->entry2, 1, 2, 1, 2);
+        $label->set_mnemonic_widget($this->entry2);
+        
+        return $frame;
+    }
+    
+    
+    function on_message_dialog_clicked($button)
+    {
+        $dialog = new GtkMessageDialog($this, Gtk::DIALOG_MODAL | Gtk::DIALOG_DESTROY_WITH_PARENT,
+                        Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK,
+                        sprintf('This message box has been popped up %d time%s.', $this->counter, $this->counter == 1 ? '' : 's'));
+        $dialog->run();
+        $dialog->destroy();
+        $this->counter++;
+    }
+    
+    
+    function on_interactive_dialog_clicked($button)
+    {
+        $dialog = new GtkDialog('Interactive Dialog', $this, 0, array( Gtk::STOCK_OK, Gtk::RESPONSE_OK, '_Non-stock button', Gtk::RESPONSE_CANCEL));
+    
+        $hbox = new GtkHBox(false, 8);
+        $hbox->set_border_width(8);
+        $dialog->vbox->pack_start($hbox, false, false, 0);
+    
+        $stock = GtkImage::new_from_stock(
+                Gtk::STOCK_DIALOG_QUESTION,
+                Gtk::ICON_SIZE_DIALOG);
+        $hbox->pack_start($stock, false, false, 0);
+    
+        $table = new GtkTable(2, 2);
+        $table->set_row_spacings(4);
+        $table->set_col_spacings(4);
+        $hbox->pack_start($table, true, true, 0);
+    
+        $label = new GtkLabel('Entry _1');
+        $label->set_use_underline(true);
+        $table->attach($label, 0, 1, 0, 1);
+        $local_entry1 = new GtkEntry();
+        $local_entry1->set_text($this->entry1->get_text());
+        $table->attach($local_entry1, 1, 2, 0, 1);
+        $label->set_mnemonic_widget($local_entry1);
+    
+        $label = new GtkLabel('Entry _2');
+        $label->set_use_underline(true);
+        $table->attach($label, 0, 1, 1, 2);
+        $local_entry2 = new GtkEntry();
+        $local_entry2->set_text($this->entry2->get_text());
+        $table->attach($local_entry2, 1, 2, 1, 2);
+        $label->set_mnemonic_widget($local_entry2);
+    
+        $dialog->show_all();
+    
+        $response = $dialog->run();
+    
+        if ($response == Gtk::RESPONSE_OK) {
+            $this->entry1->set_text($local_entry1->get_text());
+            $this->entry2->set_text($local_entry2->get_text());
+        }
+        $dialog->destroy();
+    }
+}
+
+$GLOBALS['class']       = 'DialogMessagebox';
+$GLOBALS['description'] = 'Dialog widgets are used to pop up a transient window for user feedback.';
+
+if (!@$GLOBALS['framework']) {
+    new DialogMessagebox();
+    Gtk::main();
+}
+
+?>
\ No newline at end of file
diff --git a/demos/components/entrycompletion.php b/demos/components/entrycompletion.php
new file mode 100644
index 0000000..38d3435
--- /dev/null
+++ b/demos/components/entrycompletion.php
@@ -0,0 +1,91 @@
+<?php
+if( !class_exists('gtk')) {
+    die('Please load the php-gtk2 module in your php.ini' . "\r\n");
+}
+
+
+class EntryCompletion extends GtkWindow
+{
+    function __construct($parent = null)
+    {
+        parent::__construct();
+
+        if (@$GLOBALS['framework']) {
+            return;
+        }
+
+        if ($parent)
+            $this->set_screen($parent->get_screen());
+        else
+            $this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+        $this->set_title(__CLASS__);
+        $this->set_position(Gtk::WIN_POS_CENTER);
+        $this->set_default_size(-1, -1);
+        $this->set_border_width(8);
+        
+        $this->add($this->__create_box());
+        $this->show_all();
+    }
+
+    
+    
+    function __create_box()
+    {
+        $vbox = new GtkVBox(false, 5);
+        $vbox->set_border_width(5);
+        
+        $label = new GtkLabel();
+        $label->set_markup('Completion demo, try writing <b>total</b> or <b>gnome</b> for example.');
+        
+        $vbox->pack_start($label, false, false, 0);
+        
+        $entry = new GtkEntry();
+        $vbox->pack_start($entry, false, false, 0);
+        
+        $completion = new GtkEntryCompletion();
+        $completion_model = $this->__create_completion_model();
+        $completion->set_model($completion_model);
+        $completion->set_text_column(0);
+        
+        $entry->set_completion($completion);
+        
+        
+        return $vbox;
+    }
+    
+    
+    
+    function __create_completion_model()
+    {
+        $store = new GtkListStore(Gtk::TYPE_STRING);
+        
+        $iter = $store->append();
+        $store->set($iter, 0, 'GNOME');
+        
+        $iter = $store->append();
+        $store->set($iter, 0, 'total');
+        
+        $iter = $store->append();
+        $store->set($iter, 0, 'totally');
+        
+        $iter = $store->append();
+        $store->set($iter, 0, 'PHP');
+        
+        $iter = $store->append();
+        $store->set($iter, 0, 'PHP-Gtk2');
+        
+        return $store;
+    }
+}
+
+$GLOBALS['class']       = 'EntryCompletion';
+$GLOBALS['description'] = 'GtkEntryCompletion provides a mechanism for adding support for
+completion in GtkEntry.';
+
+if (!@$GLOBALS['framework']) {
+    new EntryCompletion();
+    Gtk::main();
+}
+
+?>
\ No newline at end of file
diff --git a/demos/components/expander.php b/demos/components/expander.php
new file mode 100644
index 0000000..298e10c
--- /dev/null
+++ b/demos/components/expander.php
@@ -0,0 +1,61 @@
+<?php
+if( !class_exists('gtk')) {
+	die('Please load the php-gtk2 module in your php.ini' . "\r\n");
+}
+
+
+class Expander extends GtkWindow
+{
+	function __construct($parent = null)
+	{
+		parent::__construct();
+
+		if (@$GLOBALS['framework']) {
+			return;
+		}
+
+		if ($parent)
+			$this->set_screen($parent->get_screen());
+		else
+			$this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+		$this->set_title(__CLASS__);
+		$this->set_position(Gtk::WIN_POS_CENTER);
+		$this->set_default_size(-1, 500);
+		$this->set_border_width(8);
+		
+		$this->add($this->__create_box());
+		$this->show_all();
+	}
+
+	
+	
+	function __create_box()
+	{
+		$vbox = new GtkVBox(false, 5);
+		$vbox->set_border_width(5);
+		
+		$label = new GtkLabel();
+		$label->set_markup('Expander demo. Click on the triangle for details.');
+		$vbox->pack_start($label, false, false, 0);
+		
+		$expander = new GtkExpander('Details');
+		$vbox->pack_start($expander, false, false, 0);
+		
+		$label2 = new GtkLabel('Details can be shown or hidden');
+		$expander->add($label2);
+		
+		return $vbox;
+	}
+}
+
+$GLOBALS['class']		= 'Expander';
+$GLOBALS['description']	= 'GtkExpander allows to provide additional content that is initially hidden.
+This is also known as "disclosure triangle".';
+
+if (!@$GLOBALS['framework']) {
+	new Expander();
+	Gtk::main();
+}
+
+?>
\ No newline at end of file
diff --git a/demos/components/scribble.php b/demos/components/scribble.php
new file mode 100644
index 0000000..c0f880b
--- /dev/null
+++ b/demos/components/scribble.php
@@ -0,0 +1,133 @@
+<?php
+/**
+*   Scribble demo - simple painting with your mouse
+*/
+
+class Scribble extends GtkWindow
+{
+    protected $size_group = null;
+    protected $pixmap = null;
+
+
+    function __construct($parent = null)
+    {
+        parent::__construct();
+
+        if (@$GLOBALS['framework']) {
+            return;
+        }
+
+        if ($parent)
+            $this->set_screen($parent->get_screen());
+        else
+            $this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+        $this->set_title(__CLASS__);
+        $this->set_position(Gtk::WIN_POS_CENTER);
+        $this->set_default_size(-1, -1);
+        $this->set_border_width(8);
+
+        $this->add($this->__create_box());
+        $this->show_all();
+    }//function __construct($parent = null)
+
+
+
+    function __create_box()
+    {
+        $vbox = new GtkVBox();
+        $vbox->show();
+
+        $drawing_area = new GtkDrawingArea();
+        $drawing_area->set_size_request(300, 300);
+        $vbox->pack_start($drawing_area);
+//        $drawing_area->realize();
+
+        $drawing_area->connect('expose_event'       , array($this, 'expose_event'));
+        $drawing_area->connect('configure_event'    , array($this, 'configure_event'));
+
+        $drawing_area->connect('motion_notify_event', array($this, 'motion_notify_event'));
+        $drawing_area->connect('button_press_event' , array($this, 'button_press_event'));
+
+        $drawing_area->set_events(Gdk::EXPOSURE_MASK
+                                | Gdk::LEAVE_NOTIFY_MASK
+                                | Gdk::BUTTON_PRESS_MASK
+                                | Gdk::POINTER_MOTION_MASK
+                                | Gdk::POINTER_MOTION_HINT_MASK);
+
+        return $vbox;
+    }//function __create_box()
+
+
+
+    function configure_event($widget, $event)
+    {
+        $this->pixmap = new GdkPixmap($widget->window,
+                                $widget->allocation->width,
+                                $widget->allocation->height,
+                                -1);
+        $this->pixmap->draw_rectangle($widget->style->white_gc,
+                            true, 0, 0,
+                            $widget->allocation->width,
+                            $widget->allocation->height);
+        return true;
+    }
+
+
+    function expose_event($widget, $event)
+    {
+        $widget->window->draw_drawable($widget->style->fg_gc[$widget->state],
+                        $this->pixmap,
+                        $event->area->x, $event->area->y,
+                        $event->area->x, $event->area->y,
+                        $event->area->width, $event->area->height);
+
+        return false;
+    }
+
+
+
+    function button_press_event($widget, $event)
+    {
+        if ($event->button == 1 && $this->pixmap) {
+            $this->draw_brush($widget, (int)$event->x, (int)$event->y);
+        }
+
+        return true;
+    }
+
+
+
+    function motion_notify_event($widget, $event)
+    {
+        $window  = $event->window;
+        $pointer = $window->get_pointer();
+        $x = $pointer[0];
+        $y = $pointer[1];
+        $state = $pointer[2];
+
+        if (($state & Gdk::BUTTON1_MASK) && $this->pixmap) {
+            $this->draw_brush($widget, $x, $y);
+        }
+
+        return true;
+    }
+
+
+
+    function draw_brush($widget, $x, $y)
+    {
+        $this->pixmap->draw_arc($widget->style->black_gc, true, $x - 4, $y - 4, 8, 8, 0, 64 * 360);
+        $widget->queue_draw_area($x - 4, $y - 4, 8, 8);
+    }
+}//class Scribble extends GtkWindow
+
+
+$GLOBALS['class']       = 'Scribble';
+$GLOBALS['description'] = "Scribble lets you draw paintings with your mouse";
+
+if (!@$GLOBALS['framework']) {
+    new Scribble();
+    Gtk::main();
+}
+?>
diff --git a/demos/components/sizegroup.php b/demos/components/sizegroup.php
new file mode 100644
index 0000000..8e06232
--- /dev/null
+++ b/demos/components/sizegroup.php
@@ -0,0 +1,147 @@
+<?php
+if( !class_exists('gtk')) {
+    die('Please load the php-gtk2 module in your php.ini' . "\r\n");
+}
+
+
+class SizeGroup extends GtkWindow
+{
+    protected $size_group = null;
+    
+    
+    function __construct($parent = null)
+    {
+        parent::__construct();
+
+        if (@$GLOBALS['framework']) {
+            return;
+        }
+
+        if ($parent)
+            $this->set_screen($parent->get_screen());
+        else
+            $this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+        $this->set_title(__CLASS__);
+        $this->set_position(Gtk::WIN_POS_CENTER);
+        $this->set_default_size(-1, -1);
+        $this->set_border_width(8);
+        
+        $this->add($this->__create_box());
+        $this->show_all();
+    }
+
+    
+    
+    function __create_box()
+    {
+        $vbox = new GtkVBox(false, 5);
+        $vbox->set_border_width(5);
+        
+        $this->size_group = new GtkSizeGroup(gtk::SIZE_GROUP_HORIZONTAL);
+        
+        $frame = new GtkFrame('Color options');
+        $vbox->pack_start($frame, true, true, 0);
+        
+        $table = new GtkTable(2, 2, false);
+        $table->set_border_width(5);
+        $table->set_row_spacings(5);
+        $table->set_col_spacings(10);
+        $frame->add($table);
+        
+        $color_options = array('Red', 'Green', 'Blue');
+        
+        $this->add_row($table, 0, '_Foreground', $color_options);
+        $this->add_row($table, 1, '_Background', $color_options);
+        
+        $frame = new GtkFrame('Line options');
+        $vbox->pack_start($frame, true, true, 0);
+        
+        $table = new GtkTable(2, 2, false);
+        $table->set_border_width(5);
+        $table->set_row_spacings(5);
+        $table->set_col_spacings(10);
+        $frame->add($table);
+        
+        $dash_options  = array('Solid', 'Dashed', 'Dotted');
+        $end_options   = array('Square', 'Round', 'Arrow');
+        
+        $this->add_row($table, 0, '_Dashing', $dash_options);
+        $this->add_row($table, 1, '_Line ends', $end_options);
+        
+        
+        $check_button = new GtkCheckButton('_Enable grouping');
+        $check_button->set_use_underline(true);
+        $vbox->pack_start($check_button, false, false, 0);
+        
+        $check_button->set_active(true);
+        $check_button->connect('toggled', array($this, 'on_toggle_grouping'));
+        
+        return $vbox;
+    }
+    
+    
+    
+    function add_row($table, $row, $label_text, $options)
+    {
+        $label = new GtkLabel($label_text);
+        $label->set_use_underline(true);
+        $label->set_alignment(0, 1);
+        $table->attach($label, 0, 1, $row, $row + 1, Gtk::EXPAND + Gtk::FILL, 0, 0, 0);
+        
+        $option_menu = $this->create_option_menu($options);
+        $label->set_mnemonic_widget($option_menu);
+        $this->size_group->add_widget($option_menu);
+        $table->attach($option_menu, 1, 2, $row, $row + 1, 0, 0, 0, 0);
+    }
+    
+    
+    
+    function create_option_menu($options)
+    {
+//		$option_menu = new GtkComboBox();
+//		$model = new GtkListStore(Gtk::TYPE_STRING);
+//		$option_menu->set_model($model);
+        
+        $option_menu = GtkComboBox::new_text();
+        
+        foreach ($options as $option) {
+//			$iter = $model->append();
+//			$model->set($iter, 0, $option);
+
+            $option_menu->append_text($option);
+        }
+        
+        $option_menu->set_active(0);
+        return $option_menu;
+    }
+    
+    
+    
+    function on_toggle_grouping($check_button) {
+        if ($check_button->get_active()) {
+            $this->size_group->set_mode(gtk::SIZE_GROUP_HORIZONTAL);
+        } else {
+            $this->size_group->set_mode(gtk::SIZE_GROUP_NONE);
+        }
+    }
+}
+
+$GLOBALS['class']       = 'SizeGroup';
+$GLOBALS['description'] = "GtkSizeGroup provides a mechanism for grouping a number of widgets together so
+they all request the same amount of space. This is typically useful when you
+want a column of widgets to have the same size, but you can't use a GtkTable
+widget.
+
+Note that size groups only affect the amount of space requested, not the size
+that the widgets finally receive. If you want the widgets in a GtkSizeGroup to
+actually be the same size, you need to pack them in such a way that they get
+the size they request and not more. For example, if you are packing your
+widgets into a table, you would not include the GTK_FILL flag.";
+
+if (!@$GLOBALS['framework']) {
+    new SizeGroup();
+    Gtk::main();
+}
+
+?>
\ No newline at end of file
diff --git a/demos/components/stock-browser2.php b/demos/components/stock-browser2.php
new file mode 100644
index 0000000..58e2b5c
--- /dev/null
+++ b/demos/components/stock-browser2.php
@@ -0,0 +1,276 @@
+<?php
+
+/*
+ * This really is not a recommended way to load the PHP-GTK, but it will suffice
+ * for the demo purposes.
+ */
+if( !class_exists('gtk')) {
+	die('Please load the php-gtk2 module in your php.ini' . "\r\n");
+}
+
+class StockItemInfo {
+	public $stock_id = '';
+	public $stock_item = null;
+	public $small_icon = null;
+	public $constant = '';
+	public $accel_str = '';
+
+	function __construct($stock_id = null) {
+		$this->stock_id = $stock_id;
+		if ($stock_id) {
+			$this->constant = id_to_constant($stock_id);
+		}
+	}
+}
+
+class StockItemDisplay {
+	public $type_label;
+	public $constant_label;
+	public $id_label;
+	public $accel_label;
+	public $icon_image;
+}
+
+class StockItemBrowserDemo extends GtkWindow {
+	function __construct($parent = null)
+	{
+		parent::__construct();
+
+		if (@$GLOBALS['framework']) {
+			return;
+		}
+
+		if ($parent)
+			$this->set_screen($parent->get_screen());
+		else
+			$this->connect_simple('destroy', array('gtk', 'main_quit'));
+
+		$this->set_title(__CLASS__);
+		$this->set_position(Gtk::WIN_POS_CENTER);
+		$this->set_default_size(-1, 500);
+		$this->set_border_width(8);
+		
+		$this->add($this->__create_box());
+		$this->show_all();
+	}
+
+	function __create_box()
+	{
+		$hbox = new GtkHBox(false, 8);
+
+		$scrolled = new GtkScrolledWindow();
+		$scrolled->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
+		$scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+		$hbox->pack_start($scrolled, false, false, 0);
+
+		$model = $this->create_model();
+		$treeview = new GtkTreeView($model);
+		$scrolled->add($treeview);
+
+		$column = new GtkTreeViewColumn();
+		$column->set_title('Icon and Constant');
+
+		$cell_renderer = new GtkCellRendererPixbuf();
+		$column->pack_start($cell_renderer, false);
+		$column->set_attributes($cell_renderer, 'stock-id', 1);
+
+		$cell_renderer = new GtkCellRendererText();
+		$column->pack_start($cell_renderer, true);
+		$column->set_cell_data_func($cell_renderer, 'constant_setter');
+
+		$treeview->append_column($column);
+
+		$cell_renderer = new GtkCellRendererText();
+		$treeview->insert_column_with_data_func(-1, 'Label', $cell_renderer, 'label_setter');
+
+		$cell_renderer = new GtkCellRendererText();
+		$treeview->insert_column_with_data_func(-1, 'Accelerator', $cell_renderer, 'accel_setter');
+
+		$cell_renderer = new GtkCellRendererText();
+		$treeview->insert_column_with_data_func(-1, 'ID', $cell_renderer, 'id_setter');
+
+		$align = new GtkAlignment(0.5, 0, 0, 0);
+		$hbox->pack_end($align, true, true, 0);
+
+		$frame = new GtkFrame('Selection Info');
+		$align->add($frame);
+
+		$vbox = new GtkVBox(false, 8);
+		$vbox->set_border_width(4);
+		$frame->add($vbox);
+
+		$display = new StockItemDisplay();
+		$treeview->set_data('stock-display', $display);
+
+		$display->type_label = new GtkLabel();
+		$display->constant_label = new GtkLabel();
+		$display->id_label = new GtkLabel();
+		$display->accel_label = new GtkLabel();
+		$display->icon_image = new GtkImage();
+
+		$vbox->pack_start($display->type_label, false, false, 0);
+		$vbox->pack_start($display->icon_image, false, false, 0);
+		$vbox->pack_start($display->accel_label, false, false, 0);
+		$vbox->pack_start($display->constant_label, false, false, 0);
+		$vbox->pack_start($display->id_label, false, false, 0);
+
+		$selection = $treeview->get_selection();
+		$selection->set_mode(Gtk::SELECTION_SINGLE);
+
+		$selection->connect('changed', array($this, 'on_selection_changed'));
+
+		
+		return $hbox;
+	}
+
+	private function create_model()
+	{
+		$store = new GtkListStore(Gtk::TYPE_PHP_VALUE, Gtk::TYPE_STRING);
+
+		$ids = Gtk::stock_list_ids();
+		sort($ids);
+
+		foreach ($ids as $id) {
+			$info = new StockItemInfo($id);
+			$stock_item = Gtk::stock_lookup($id);
+			if ($stock_item)
+				$info->stock_item = $stock_item;
+			else
+				$info->stock_item = array('', '', 0, 0, '');
+
+			$icon_set = GtkIconFactory::lookup_default($id);
+			if ($icon_set) {
+				$sizes = $icon_set->get_sizes();
+				$size = $sizes[0];
+				for ($i = 0; $i < count($sizes); $i++) {
+					if ($sizes[$i] == Gtk::ICON_SIZE_MENU) {
+						$size = Gtk::ICON_SIZE_MENU;
+						break;
+					}
+				}
+				$info->small_icon = $this->render_icon($info->stock_id, $size);
+				if ($size != Gtk::ICON_SIZE_MENU) {
+					list($width, $height) = Gtk::icon_size_lookup(Gtk::ICON_SIZE_MENU);
+
+					$info->small_icon = $info->small_icon->scale_simple($width, $height, 'bilinear');
+				}
+
+			} else {
+				$info->small_icon = null;
+			}
+
+			if ($info->stock_item[3] == 0) {
+				$info->accel_str = '';
+			} else {
+				$info->accel_str = '<'.Gtk::accelerator_get_label($info->stock_item[3], $info->stock_item[2]).'>';
+			}
+
+			$iter = $store->append();
+			$store->set($iter, 0, $info, 1, $id);
+		}
+
+		return $store;
+	}
+
+	function on_selection_changed($selection)
+	{
+		$treeview = $selection->get_tree_view();
+		$display = $treeview->get_data('stock-display');
+
+		list($model, $iter) = $selection->get_selected();
+		if ($iter) {
+			$info = $model->get_value($iter, 0);
+
+			if ($info->small_icon && $info->stock_item[1])
+				$display->type_label->set_text('Item and Icon');
+			else if ($info->small_icon)
+				$display->type_label->set_text('Icon Only');
+			else if ($info->stock_item[1])
+				$display->type_label->set_text('Item Only');
+			else
+				$display->type_label->set_text('<unknown>');
+
+			$display->constant_label->set_text($info->constant);
+			$display->id_label->set_text($info->stock_id);
+
+			if ($info->stock_item[1])
+				$display->accel_label->set_text_with_mnemonic($info->stock_item[1].' '.$info->accel_str);
+			else
+				$display->accel_label->set_text('');
+
+			if ($info->small_icon)
+				$display->icon_image->set_from_stock($info->stock_id, get_largest_size($info->stock_id));
+			else
+				$display->icon_image->set_from_pixbuf(null);
+		} else {
+			$display->type_label->set_text('No Selected Item');
+			$display->icon_image->set_from_pixbuf(null);
+			$display->constant_label->set_text('');
+			$display->id_label->set_text('');
+			$display->accel_label->set_text('');
+		}
+	}
+}
+
+function id_to_constant($id)
+{
+	if (substr($id, 0, 3) == 'gtk') {
+		$constant = 'Gtk::STOCK' . preg_replace('!-([^-]+)!e', '"_".strtoupper("$1")', substr($id, 3));
+	} else {
+		$constant = substr(preg_replace('!([^-]+)-?!e', 'strtoupper($1)', $id), 1);
+	}
+
+	return $constant;
+}
+
+function get_largest_size($id)
+{
+	$icon_set = GtkIconFactory::lookup_default($id);
+	$best_size = Gtk::ICON_SIZE_INVALID;
+	$best_pixels = 0;
+
+	$sizes = $icon_set->get_sizes();
+	foreach ($sizes as $size) {
+		list($w, $h) = Gtk::icon_size_lookup($size);
+		if ($w * $h > $best_pixels) {
+			$best_size = $size;
+			$best_pixels = $w * $h;
+		}
+	}
+
+	return $best_size;
+}
+
+function constant_setter($column, $cell, $model, $iter)
+{
+	$info = $model->get_value($iter, 0);
+	$cell->set_property('text', $info->constant);
+}
+
+function label_setter($column, $cell, $model, $iter)
+{
+	$info = $model->get_value($iter, 0);
+	$cell->set_property('text', $info->stock_item[1]);
+}
+
+function accel_setter($column, $cell, $model, $iter)
+{
+	$info = $model->get_value($iter, 0);
+	$cell->set_property('text', $info->accel_str);
+}
+
+function id_setter($column, $cell, $model, $iter)
+{
+	$info = $model->get_value($iter, 0);
+	$cell->set_property('text', $info->stock_id);
+}
+
+
+$GLOBALS['class']		= 'StockItemBrowserDemo';
+$GLOBALS['description']	= 'This source code for this demo doesn\'t demonstrate anything particularly useful in applications. The purpose of the "demo" is just to provide a handy place to browse the available stock icons and stock items.';
+
+if (!@$GLOBALS['framework']) {
+	new StockItemBrowserDemo();
+	Gtk::main();
+}
+?>
diff --git a/demos/dialogmessage.php b/demos/dialogmessage.php
deleted file mode 100644
index 5cac5a2..0000000
--- a/demos/dialogmessage.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-if( !class_exists('gtk')) {
-    die('Please load the php-gtk2 module in your php.ini' . "\r\n");
-}
-
-
-class DialogMessagebox extends GtkWindow
-{
-    protected $entry1;
-    protected $entry2;
-    
-    protected $counter = 1;
-    
-    function __construct($parent = null)
-    {
-        parent::__construct();
-
-        if (@$GLOBALS['framework']) {
-            return;
-        }
-
-        if ($parent)
-            $this->set_screen($parent->get_screen());
-        else
-            $this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-        $this->set_title(__CLASS__);
-        $this->set_position(Gtk::WIN_POS_CENTER);
-        $this->set_border_width(8);
-        
-        $this->add($this->__create_box());
-        $this->show_all();
-    }
-
-    
-    
-    function __create_box()
-    {
-        $mvbox = new GtkVBox(false);
-        
-        $frame = new GtkFrame('Dialogs');
-        
-        $vbox = new GtkVBox(false, 8);
-        $vbox->set_border_width(8);
-        $frame->add($vbox);
-        
-        # Standard message dialog
-        $hbox = new GtkHBox(false, 8);
-        $vbox->pack_start($hbox);
-        $button = new GtkButton('_Message Dialog');
-        $button->connect('clicked', array($this, 'on_message_dialog_clicked'));
-        $hbox->pack_start($button, false, false, 0);
-        $vbox->pack_start(new GtkHSeparator(), false, false, 0);
-        
-        # Interactive dialog
-        $hbox = new GtkHBox(false, 8);
-        $vbox->pack_start($hbox, false, false, 0);
-        $vbox2 = new GtkVBox();
-        
-        $button = new GtkButton('_Interactive Dialog');
-        $button->connect('clicked', array($this, 'on_interactive_dialog_clicked'));
-        $hbox->pack_start($vbox2, false, false, 0);
-        $vbox2->pack_start($button, false, false, 0);
-        
-        $table = new GtkTable(2, 2);
-        $table->set_row_spacings(4);
-        $table->set_col_spacings(4);
-        $hbox->pack_start($table, false, false, 0);
-        
-        $label = new GtkLabel('Entry _1');
-        $label->set_use_underline(true);
-        $table->attach($label, 0, 1, 0, 1);
-        
-        $this->entry1 = new GtkEntry();
-        $table->attach($this->entry1, 1, 2, 0, 1);
-        $label->set_mnemonic_widget($this->entry1);
-        
-        $label = new GtkLabel('Entry _2');
-        $label->set_use_underline(true);
-        $table->attach($label, 0, 1, 1, 2);
-        
-        $this->entry2 = new GtkEntry();
-        $table->attach($this->entry2, 1, 2, 1, 2);
-        $label->set_mnemonic_widget($this->entry2);
-        
-        return $frame;
-    }
-    
-    
-    function on_message_dialog_clicked($button)
-    {
-        $dialog = new GtkMessageDialog($this, Gtk::DIALOG_MODAL | Gtk::DIALOG_DESTROY_WITH_PARENT,
-                        Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK,
-                        sprintf('This message box has been popped up %d time%s.', $this->counter, $this->counter == 1 ? '' : 's'));
-        $dialog->run();
-        $dialog->destroy();
-        $this->counter++;
-    }
-    
-    
-    function on_interactive_dialog_clicked($button)
-    {
-        $dialog = new GtkDialog('Interactive Dialog', $this, 0, array( Gtk::STOCK_OK, Gtk::RESPONSE_OK, '_Non-stock button', Gtk::RESPONSE_CANCEL));
-    
-        $hbox = new GtkHBox(false, 8);
-        $hbox->set_border_width(8);
-        $dialog->vbox->pack_start($hbox, false, false, 0);
-    
-        $stock = GtkImage::new_from_stock(
-                Gtk::STOCK_DIALOG_QUESTION,
-                Gtk::ICON_SIZE_DIALOG);
-        $hbox->pack_start($stock, false, false, 0);
-    
-        $table = new GtkTable(2, 2);
-        $table->set_row_spacings(4);
-        $table->set_col_spacings(4);
-        $hbox->pack_start($table, true, true, 0);
-    
-        $label = new GtkLabel('Entry _1');
-        $label->set_use_underline(true);
-        $table->attach($label, 0, 1, 0, 1);
-        $local_entry1 = new GtkEntry();
-        $local_entry1->set_text($this->entry1->get_text());
-        $table->attach($local_entry1, 1, 2, 0, 1);
-        $label->set_mnemonic_widget($local_entry1);
-    
-        $label = new GtkLabel('Entry _2');
-        $label->set_use_underline(true);
-        $table->attach($label, 0, 1, 1, 2);
-        $local_entry2 = new GtkEntry();
-        $local_entry2->set_text($this->entry2->get_text());
-        $table->attach($local_entry2, 1, 2, 1, 2);
-        $label->set_mnemonic_widget($local_entry2);
-    
-        $dialog->show_all();
-    
-        $response = $dialog->run();
-    
-        if ($response == Gtk::RESPONSE_OK) {
-            $this->entry1->set_text($local_entry1->get_text());
-            $this->entry2->set_text($local_entry2->get_text());
-        }
-        $dialog->destroy();
-    }
-}
-
-$GLOBALS['class']       = 'DialogMessagebox';
-$GLOBALS['description'] = 'Dialog widgets are used to pop up a transient window for user feedback.';
-
-if (!@$GLOBALS['framework']) {
-    new DialogMessagebox();
-    Gtk::main();
-}
-
-?>
\ No newline at end of file
diff --git a/demos/entrycompletion.php b/demos/entrycompletion.php
deleted file mode 100644
index 38d3435..0000000
--- a/demos/entrycompletion.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-if( !class_exists('gtk')) {
-    die('Please load the php-gtk2 module in your php.ini' . "\r\n");
-}
-
-
-class EntryCompletion extends GtkWindow
-{
-    function __construct($parent = null)
-    {
-        parent::__construct();
-
-        if (@$GLOBALS['framework']) {
-            return;
-        }
-
-        if ($parent)
-            $this->set_screen($parent->get_screen());
-        else
-            $this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-        $this->set_title(__CLASS__);
-        $this->set_position(Gtk::WIN_POS_CENTER);
-        $this->set_default_size(-1, -1);
-        $this->set_border_width(8);
-        
-        $this->add($this->__create_box());
-        $this->show_all();
-    }
-
-    
-    
-    function __create_box()
-    {
-        $vbox = new GtkVBox(false, 5);
-        $vbox->set_border_width(5);
-        
-        $label = new GtkLabel();
-        $label->set_markup('Completion demo, try writing <b>total</b> or <b>gnome</b> for example.');
-        
-        $vbox->pack_start($label, false, false, 0);
-        
-        $entry = new GtkEntry();
-        $vbox->pack_start($entry, false, false, 0);
-        
-        $completion = new GtkEntryCompletion();
-        $completion_model = $this->__create_completion_model();
-        $completion->set_model($completion_model);
-        $completion->set_text_column(0);
-        
-        $entry->set_completion($completion);
-        
-        
-        return $vbox;
-    }
-    
-    
-    
-    function __create_completion_model()
-    {
-        $store = new GtkListStore(Gtk::TYPE_STRING);
-        
-        $iter = $store->append();
-        $store->set($iter, 0, 'GNOME');
-        
-        $iter = $store->append();
-        $store->set($iter, 0, 'total');
-        
-        $iter = $store->append();
-        $store->set($iter, 0, 'totally');
-        
-        $iter = $store->append();
-        $store->set($iter, 0, 'PHP');
-        
-        $iter = $store->append();
-        $store->set($iter, 0, 'PHP-Gtk2');
-        
-        return $store;
-    }
-}
-
-$GLOBALS['class']       = 'EntryCompletion';
-$GLOBALS['description'] = 'GtkEntryCompletion provides a mechanism for adding support for
-completion in GtkEntry.';
-
-if (!@$GLOBALS['framework']) {
-    new EntryCompletion();
-    Gtk::main();
-}
-
-?>
\ No newline at end of file
diff --git a/demos/expander.php b/demos/expander.php
deleted file mode 100644
index 298e10c..0000000
--- a/demos/expander.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-if( !class_exists('gtk')) {
-	die('Please load the php-gtk2 module in your php.ini' . "\r\n");
-}
-
-
-class Expander extends GtkWindow
-{
-	function __construct($parent = null)
-	{
-		parent::__construct();
-
-		if (@$GLOBALS['framework']) {
-			return;
-		}
-
-		if ($parent)
-			$this->set_screen($parent->get_screen());
-		else
-			$this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-		$this->set_title(__CLASS__);
-		$this->set_position(Gtk::WIN_POS_CENTER);
-		$this->set_default_size(-1, 500);
-		$this->set_border_width(8);
-		
-		$this->add($this->__create_box());
-		$this->show_all();
-	}
-
-	
-	
-	function __create_box()
-	{
-		$vbox = new GtkVBox(false, 5);
-		$vbox->set_border_width(5);
-		
-		$label = new GtkLabel();
-		$label->set_markup('Expander demo. Click on the triangle for details.');
-		$vbox->pack_start($label, false, false, 0);
-		
-		$expander = new GtkExpander('Details');
-		$vbox->pack_start($expander, false, false, 0);
-		
-		$label2 = new GtkLabel('Details can be shown or hidden');
-		$expander->add($label2);
-		
-		return $vbox;
-	}
-}
-
-$GLOBALS['class']		= 'Expander';
-$GLOBALS['description']	= 'GtkExpander allows to provide additional content that is initially hidden.
-This is also known as "disclosure triangle".';
-
-if (!@$GLOBALS['framework']) {
-	new Expander();
-	Gtk::main();
-}
-
-?>
\ No newline at end of file
diff --git a/demos/phpgtk2-demo.php b/demos/phpgtk2-demo.php
index 510e7c7..f106511 100644
--- a/demos/phpgtk2-demo.php
+++ b/demos/phpgtk2-demo.php
@@ -180,12 +180,10 @@ class PHPGtk2Demo extends GtkWindow
 
     protected function load_demos()
     {
-        $files = glob(dirname(__FILE__).'/*.php');
+        $files = glob(dirname(__FILE__).'/components/*.php');
         foreach ($files as $id => $file) {
             $GLOBALS['class'] = null;
-            if (basename($file) != basename(__FILE__) 
-            && basename($file) != 'stock-browser.php'
-            && basename($file) != 'WidgetEditor.php') {
+            if (basename($file) != basename(__FILE__)) {
                 if (!@include_once($file)) {
                     continue;
                 }
diff --git a/demos/scribble.php b/demos/scribble.php
deleted file mode 100644
index c0f880b..0000000
--- a/demos/scribble.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/**
-*   Scribble demo - simple painting with your mouse
-*/
-
-class Scribble extends GtkWindow
-{
-    protected $size_group = null;
-    protected $pixmap = null;
-
-
-    function __construct($parent = null)
-    {
-        parent::__construct();
-
-        if (@$GLOBALS['framework']) {
-            return;
-        }
-
-        if ($parent)
-            $this->set_screen($parent->get_screen());
-        else
-            $this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-        $this->set_title(__CLASS__);
-        $this->set_position(Gtk::WIN_POS_CENTER);
-        $this->set_default_size(-1, -1);
-        $this->set_border_width(8);
-
-        $this->add($this->__create_box());
-        $this->show_all();
-    }//function __construct($parent = null)
-
-
-
-    function __create_box()
-    {
-        $vbox = new GtkVBox();
-        $vbox->show();
-
-        $drawing_area = new GtkDrawingArea();
-        $drawing_area->set_size_request(300, 300);
-        $vbox->pack_start($drawing_area);
-//        $drawing_area->realize();
-
-        $drawing_area->connect('expose_event'       , array($this, 'expose_event'));
-        $drawing_area->connect('configure_event'    , array($this, 'configure_event'));
-
-        $drawing_area->connect('motion_notify_event', array($this, 'motion_notify_event'));
-        $drawing_area->connect('button_press_event' , array($this, 'button_press_event'));
-
-        $drawing_area->set_events(Gdk::EXPOSURE_MASK
-                                | Gdk::LEAVE_NOTIFY_MASK
-                                | Gdk::BUTTON_PRESS_MASK
-                                | Gdk::POINTER_MOTION_MASK
-                                | Gdk::POINTER_MOTION_HINT_MASK);
-
-        return $vbox;
-    }//function __create_box()
-
-
-
-    function configure_event($widget, $event)
-    {
-        $this->pixmap = new GdkPixmap($widget->window,
-                                $widget->allocation->width,
-                                $widget->allocation->height,
-                                -1);
-        $this->pixmap->draw_rectangle($widget->style->white_gc,
-                            true, 0, 0,
-                            $widget->allocation->width,
-                            $widget->allocation->height);
-        return true;
-    }
-
-
-    function expose_event($widget, $event)
-    {
-        $widget->window->draw_drawable($widget->style->fg_gc[$widget->state],
-                        $this->pixmap,
-                        $event->area->x, $event->area->y,
-                        $event->area->x, $event->area->y,
-                        $event->area->width, $event->area->height);
-
-        return false;
-    }
-
-
-
-    function button_press_event($widget, $event)
-    {
-        if ($event->button == 1 && $this->pixmap) {
-            $this->draw_brush($widget, (int)$event->x, (int)$event->y);
-        }
-
-        return true;
-    }
-
-
-
-    function motion_notify_event($widget, $event)
-    {
-        $window  = $event->window;
-        $pointer = $window->get_pointer();
-        $x = $pointer[0];
-        $y = $pointer[1];
-        $state = $pointer[2];
-
-        if (($state & Gdk::BUTTON1_MASK) && $this->pixmap) {
-            $this->draw_brush($widget, $x, $y);
-        }
-
-        return true;
-    }
-
-
-
-    function draw_brush($widget, $x, $y)
-    {
-        $this->pixmap->draw_arc($widget->style->black_gc, true, $x - 4, $y - 4, 8, 8, 0, 64 * 360);
-        $widget->queue_draw_area($x - 4, $y - 4, 8, 8);
-    }
-}//class Scribble extends GtkWindow
-
-
-$GLOBALS['class']       = 'Scribble';
-$GLOBALS['description'] = "Scribble lets you draw paintings with your mouse";
-
-if (!@$GLOBALS['framework']) {
-    new Scribble();
-    Gtk::main();
-}
-?>
diff --git a/demos/sizegroup.php b/demos/sizegroup.php
deleted file mode 100644
index 8e06232..0000000
--- a/demos/sizegroup.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-if( !class_exists('gtk')) {
-    die('Please load the php-gtk2 module in your php.ini' . "\r\n");
-}
-
-
-class SizeGroup extends GtkWindow
-{
-    protected $size_group = null;
-    
-    
-    function __construct($parent = null)
-    {
-        parent::__construct();
-
-        if (@$GLOBALS['framework']) {
-            return;
-        }
-
-        if ($parent)
-            $this->set_screen($parent->get_screen());
-        else
-            $this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-        $this->set_title(__CLASS__);
-        $this->set_position(Gtk::WIN_POS_CENTER);
-        $this->set_default_size(-1, -1);
-        $this->set_border_width(8);
-        
-        $this->add($this->__create_box());
-        $this->show_all();
-    }
-
-    
-    
-    function __create_box()
-    {
-        $vbox = new GtkVBox(false, 5);
-        $vbox->set_border_width(5);
-        
-        $this->size_group = new GtkSizeGroup(gtk::SIZE_GROUP_HORIZONTAL);
-        
-        $frame = new GtkFrame('Color options');
-        $vbox->pack_start($frame, true, true, 0);
-        
-        $table = new GtkTable(2, 2, false);
-        $table->set_border_width(5);
-        $table->set_row_spacings(5);
-        $table->set_col_spacings(10);
-        $frame->add($table);
-        
-        $color_options = array('Red', 'Green', 'Blue');
-        
-        $this->add_row($table, 0, '_Foreground', $color_options);
-        $this->add_row($table, 1, '_Background', $color_options);
-        
-        $frame = new GtkFrame('Line options');
-        $vbox->pack_start($frame, true, true, 0);
-        
-        $table = new GtkTable(2, 2, false);
-        $table->set_border_width(5);
-        $table->set_row_spacings(5);
-        $table->set_col_spacings(10);
-        $frame->add($table);
-        
-        $dash_options  = array('Solid', 'Dashed', 'Dotted');
-        $end_options   = array('Square', 'Round', 'Arrow');
-        
-        $this->add_row($table, 0, '_Dashing', $dash_options);
-        $this->add_row($table, 1, '_Line ends', $end_options);
-        
-        
-        $check_button = new GtkCheckButton('_Enable grouping');
-        $check_button->set_use_underline(true);
-        $vbox->pack_start($check_button, false, false, 0);
-        
-        $check_button->set_active(true);
-        $check_button->connect('toggled', array($this, 'on_toggle_grouping'));
-        
-        return $vbox;
-    }
-    
-    
-    
-    function add_row($table, $row, $label_text, $options)
-    {
-        $label = new GtkLabel($label_text);
-        $label->set_use_underline(true);
-        $label->set_alignment(0, 1);
-        $table->attach($label, 0, 1, $row, $row + 1, Gtk::EXPAND + Gtk::FILL, 0, 0, 0);
-        
-        $option_menu = $this->create_option_menu($options);
-        $label->set_mnemonic_widget($option_menu);
-        $this->size_group->add_widget($option_menu);
-        $table->attach($option_menu, 1, 2, $row, $row + 1, 0, 0, 0, 0);
-    }
-    
-    
-    
-    function create_option_menu($options)
-    {
-//		$option_menu = new GtkComboBox();
-//		$model = new GtkListStore(Gtk::TYPE_STRING);
-//		$option_menu->set_model($model);
-        
-        $option_menu = GtkComboBox::new_text();
-        
-        foreach ($options as $option) {
-//			$iter = $model->append();
-//			$model->set($iter, 0, $option);
-
-            $option_menu->append_text($option);
-        }
-        
-        $option_menu->set_active(0);
-        return $option_menu;
-    }
-    
-    
-    
-    function on_toggle_grouping($check_button) {
-        if ($check_button->get_active()) {
-            $this->size_group->set_mode(gtk::SIZE_GROUP_HORIZONTAL);
-        } else {
-            $this->size_group->set_mode(gtk::SIZE_GROUP_NONE);
-        }
-    }
-}
-
-$GLOBALS['class']       = 'SizeGroup';
-$GLOBALS['description'] = "GtkSizeGroup provides a mechanism for grouping a number of widgets together so
-they all request the same amount of space. This is typically useful when you
-want a column of widgets to have the same size, but you can't use a GtkTable
-widget.
-
-Note that size groups only affect the amount of space requested, not the size
-that the widgets finally receive. If you want the widgets in a GtkSizeGroup to
-actually be the same size, you need to pack them in such a way that they get
-the size they request and not more. For example, if you are packing your
-widgets into a table, you would not include the GTK_FILL flag.";
-
-if (!@$GLOBALS['framework']) {
-    new SizeGroup();
-    Gtk::main();
-}
-
-?>
\ No newline at end of file
diff --git a/demos/stock-browser2.php b/demos/stock-browser2.php
deleted file mode 100644
index 58e2b5c..0000000
--- a/demos/stock-browser2.php
+++ /dev/null
@@ -1,276 +0,0 @@
-<?php
-
-/*
- * This really is not a recommended way to load the PHP-GTK, but it will suffice
- * for the demo purposes.
- */
-if( !class_exists('gtk')) {
-	die('Please load the php-gtk2 module in your php.ini' . "\r\n");
-}
-
-class StockItemInfo {
-	public $stock_id = '';
-	public $stock_item = null;
-	public $small_icon = null;
-	public $constant = '';
-	public $accel_str = '';
-
-	function __construct($stock_id = null) {
-		$this->stock_id = $stock_id;
-		if ($stock_id) {
-			$this->constant = id_to_constant($stock_id);
-		}
-	}
-}
-
-class StockItemDisplay {
-	public $type_label;
-	public $constant_label;
-	public $id_label;
-	public $accel_label;
-	public $icon_image;
-}
-
-class StockItemBrowserDemo extends GtkWindow {
-	function __construct($parent = null)
-	{
-		parent::__construct();
-
-		if (@$GLOBALS['framework']) {
-			return;
-		}
-
-		if ($parent)
-			$this->set_screen($parent->get_screen());
-		else
-			$this->connect_simple('destroy', array('gtk', 'main_quit'));
-
-		$this->set_title(__CLASS__);
-		$this->set_position(Gtk::WIN_POS_CENTER);
-		$this->set_default_size(-1, 500);
-		$this->set_border_width(8);
-		
-		$this->add($this->__create_box());
-		$this->show_all();
-	}
-
-	function __create_box()
-	{
-		$hbox = new GtkHBox(false, 8);
-
-		$scrolled = new GtkScrolledWindow();
-		$scrolled->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
-		$scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
-		$hbox->pack_start($scrolled, false, false, 0);
-
-		$model = $this->create_model();
-		$treeview = new GtkTreeView($model);
-		$scrolled->add($treeview);
-
-		$column = new GtkTreeViewColumn();
-		$column->set_title('Icon and Constant');
-
-		$cell_renderer = new GtkCellRendererPixbuf();
-		$column->pack_start($cell_renderer, false);
-		$column->set_attributes($cell_renderer, 'stock-id', 1);
-
-		$cell_renderer = new GtkCellRendererText();
-		$column->pack_start($cell_renderer, true);
-		$column->set_cell_data_func($cell_renderer, 'constant_setter');
-
-		$treeview->append_column($column);
-
-		$cell_renderer = new GtkCellRendererText();
-		$treeview->insert_column_with_data_func(-1, 'Label', $cell_renderer, 'label_setter');
-
-		$cell_renderer = new GtkCellRendererText();
-		$treeview->insert_column_with_data_func(-1, 'Accelerator', $cell_renderer, 'accel_setter');
-
-		$cell_renderer = new GtkCellRendererText();
-		$treeview->insert_column_with_data_func(-1, 'ID', $cell_renderer, 'id_setter');
-
-		$align = new GtkAlignment(0.5, 0, 0, 0);
-		$hbox->pack_end($align, true, true, 0);
-
-		$frame = new GtkFrame('Selection Info');
-		$align->add($frame);
-
-		$vbox = new GtkVBox(false, 8);
-		$vbox->set_border_width(4);
-		$frame->add($vbox);
-
-		$display = new StockItemDisplay();
-		$treeview->set_data('stock-display', $display);
-
-		$display->type_label = new GtkLabel();
-		$display->constant_label = new GtkLabel();
-		$display->id_label = new GtkLabel();
-		$display->accel_label = new GtkLabel();
-		$display->icon_image = new GtkImage();
-
-		$vbox->pack_start($display->type_label, false, false, 0);
-		$vbox->pack_start($display->icon_image, false, false, 0);
-		$vbox->pack_start($display->accel_label, false, false, 0);
-		$vbox->pack_start($display->constant_label, false, false, 0);
-		$vbox->pack_start($display->id_label, false, false, 0);
-
-		$selection = $treeview->get_selection();
-		$selection->set_mode(Gtk::SELECTION_SINGLE);
-
-		$selection->connect('changed', array($this, 'on_selection_changed'));
-
-		
-		return $hbox;
-	}
-
-	private function create_model()
-	{
-		$store = new GtkListStore(Gtk::TYPE_PHP_VALUE, Gtk::TYPE_STRING);
-
-		$ids = Gtk::stock_list_ids();
-		sort($ids);
-
-		foreach ($ids as $id) {
-			$info = new StockItemInfo($id);
-			$stock_item = Gtk::stock_lookup($id);
-			if ($stock_item)
-				$info->stock_item = $stock_item;
-			else
-				$info->stock_item = array('', '', 0, 0, '');
-
-			$icon_set = GtkIconFactory::lookup_default($id);
-			if ($icon_set) {
-				$sizes = $icon_set->get_sizes();
-				$size = $sizes[0];
-				for ($i = 0; $i < count($sizes); $i++) {
-					if ($sizes[$i] == Gtk::ICON_SIZE_MENU) {
-						$size = Gtk::ICON_SIZE_MENU;
-						break;
-					}
-				}
-				$info->small_icon = $this->render_icon($info->stock_id, $size);
-				if ($size != Gtk::ICON_SIZE_MENU) {
-					list($width, $height) = Gtk::icon_size_lookup(Gtk::ICON_SIZE_MENU);
-
-					$info->small_icon = $info->small_icon->scale_simple($width, $height, 'bilinear');
-				}
-
-			} else {
-				$info->small_icon = null;
-			}
-
-			if ($info->stock_item[3] == 0) {
-				$info->accel_str = '';
-			} else {
-				$info->accel_str = '<'.Gtk::accelerator_get_label($info->stock_item[3], $info->stock_item[2]).'>';
-			}
-
-			$iter = $store->append();
-			$store->set($iter, 0, $info, 1, $id);
-		}
-
-		return $store;
-	}
-
-	function on_selection_changed($selection)
-	{
-		$treeview = $selection->get_tree_view();
-		$display = $treeview->get_data('stock-display');
-
-		list($model, $iter) = $selection->get_selected();
-		if ($iter) {
-			$info = $model->get_value($iter, 0);
-
-			if ($info->small_icon && $info->stock_item[1])
-				$display->type_label->set_text('Item and Icon');
-			else if ($info->small_icon)
-				$display->type_label->set_text('Icon Only');
-			else if ($info->stock_item[1])
-				$display->type_label->set_text('Item Only');
-			else
-				$display->type_label->set_text('<unknown>');
-
-			$display->constant_label->set_text($info->constant);
-			$display->id_label->set_text($info->stock_id);
-
-			if ($info->stock_item[1])
-				$display->accel_label->set_text_with_mnemonic($info->stock_item[1].' '.$info->accel_str);
-			else
-				$display->accel_label->set_text('');
-
-			if ($info->small_icon)
-				$display->icon_image->set_from_stock($info->stock_id, get_largest_size($info->stock_id));
-			else
-				$display->icon_image->set_from_pixbuf(null);
-		} else {
-			$display->type_label->set_text('No Selected Item');
-			$display->icon_image->set_from_pixbuf(null);
-			$display->constant_label->set_text('');
-			$display->id_label->set_text('');
-			$display->accel_label->set_text('');
-		}
-	}
-}
-
-function id_to_constant($id)
-{
-	if (substr($id, 0, 3) == 'gtk') {
-		$constant = 'Gtk::STOCK' . preg_replace('!-([^-]+)!e', '"_".strtoupper("$1")', substr($id, 3));
-	} else {
-		$constant = substr(preg_replace('!([^-]+)-?!e', 'strtoupper($1)', $id), 1);
-	}
-
-	return $constant;
-}
-
-function get_largest_size($id)
-{
-	$icon_set = GtkIconFactory::lookup_default($id);
-	$best_size = Gtk::ICON_SIZE_INVALID;
-	$best_pixels = 0;
-
-	$sizes = $icon_set->get_sizes();
-	foreach ($sizes as $size) {
-		list($w, $h) = Gtk::icon_size_lookup($size);
-		if ($w * $h > $best_pixels) {
-			$best_size = $size;
-			$best_pixels = $w * $h;
-		}
-	}
-
-	return $best_size;
-}
-
-function constant_setter($column, $cell, $model, $iter)
-{
-	$info = $model->get_value($iter, 0);
-	$cell->set_property('text', $info->constant);
-}
-
-function label_setter($column, $cell, $model, $iter)
-{
-	$info = $model->get_value($iter, 0);
-	$cell->set_property('text', $info->stock_item[1]);
-}
-
-function accel_setter($column, $cell, $model, $iter)
-{
-	$info = $model->get_value($iter, 0);
-	$cell->set_property('text', $info->accel_str);
-}
-
-function id_setter($column, $cell, $model, $iter)
-{
-	$info = $model->get_value($iter, 0);
-	$cell->set_property('text', $info->stock_id);
-}
-
-
-$GLOBALS['class']		= 'StockItemBrowserDemo';
-$GLOBALS['description']	= 'This source code for this demo doesn\'t demonstrate anything particularly useful in applications. The purpose of the "demo" is just to provide a handy place to browse the available stock icons and stock items.';
-
-if (!@$GLOBALS['framework']) {
-	new StockItemBrowserDemo();
-	Gtk::main();
-}
-?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.