12 lines
2.2 KiB
Text
12 lines
2.2 KiB
Text
version=pmwiki-1.0.5
|
|
newline=²
|
|
text=!!! show Gtk widget tree²²* just add this function and you will see complete widget tree.²* you need to call this function width any main window (GtkWindow)²²[[include:Main/CodeTable]]²<?php²²function show_widget_tree($widget, $level=0){² $childs = $widget->get_children();²² $spacing = str_repeat(' ', $level);² foreach($childs as $child){²² if(is_a($child, 'GtkWidget'))² $name = $child->get_name();² else² $name = '';²² if(is_a($child, 'GtkLabel'))² $label = " : " . $child->get_label();² else² $label = '';²² echo "$spacing - " . get_class($child) . " - $name $label\n";²² # recurse GtkWidget tree (containers)² if(is_a($child, 'GtkContainer'))² show_widget_tree($child, $level+1);² }²²}²²function on_test_activate($window){²² show_widget_tree($window);²}²²...²²$btn = new GtkButton('tree');²$btn->connect_simple('clicked', 'on_test_activate', $wnd);²²...²²?>²²[[include:Main/CodeTableEnd]]²
|
|
time=1158830877
|
|
diff:1158830877:1158830877:=1,48c1²< !!! show Gtk widget tree²< ²< * just add this function and you will see complete widget tree.²< * you need to call this function width any main window (GtkWindow)²< ²< [[include:Main/CodeTable]]²< <?php²< ²< function show_widget_tree($widget, $level=0){²< $childs = $widget->get_children();²< ²< $spacing = str_repeat(' ', $level);²< foreach($childs as $child){²< ²< if(is_a($child, 'GtkWidget'))²< $name = $child->get_name();²< else²< $name = '';²< ²< if(is_a($child, 'GtkLabel'))²< $label = " : " . $child->get_label();²< else²< $label = '';²< ²< echo "$spacing - " . get_class($child) . " - $name $label\n";²< ²< # recurse GtkWidget tree (containers)²< if(is_a($child, 'GtkContainer'))²< show_widget_tree($child, $level+1);²< }²< ²< }²< ²< function on_test_activate($window){²< ²< show_widget_tree($window);²< }²< ²< ...²< ²< $btn = new GtkButton('tree');²< $btn->connect_simple('clicked', 'on_test_activate', $wnd);²< ²< ...²< ²< ?>²< ²< [[include:Main/CodeTableEnd]]²---²> Describe WidgetTree here.²\ No newline at end of file²
|
|
author=Marc Quinton
|
|
author:1158830877=Marc Quinton
|
|
host:1158830877=143.196.162.107
|
|
name=CodeSnippets.WidgetTree
|
|
host=143.196.162.107
|
|
agent=Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217
|
|
rev=1
|