Re: second patch and question to DOC team

From: Date: Tue, 10 May 2005 07:22:21 +0000
Subject: Re: second patch and question to DOC team
References: 1 2 3 4 5 6  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-1245@lists.php.net to get a copy of this message
Hello Markus On 5/10/05, Markus Fischer <markus@fischer.name> wrote: > Andrei Zmievski wrote: > > Thank you very much for the patch! I committed an optimized version of > > it just now. Do you have an app that illustrates GtkTreeStore? I'd like > > to be able to show something like that in Mexico. > > I called it PhpGtkReflector, basically what Christian was talking about > on the list, use Reflection on PHP itself. However I stopped in the > middle of starting it. You can even edit the second column (double > click), though it doesn't make much sense in this context I guess ;) > > > Any more patches coming up? :) > > Don't expect anything timely. I'm unable to predict when and how much > time I can spend on php-gtk currently. > > But basically, yes, I want to see it in production and if I had a wish I > would want it ready yesterday. And for win32. Any news from Frank ? :) > It would be very well that Frank compiled some version for Windows to see as it is left Php-gtk2 in Windows: -) > Another questions to the DOC team: > Can not yet documented classes/functions be autogenerated a dummy doc > entry so at least we have a page, even if it's empty? I don't remember > exactly but I found the on or other function not documented. Is the > documentation based on an older gtk version? > > And what would you all think about making a link between the php-gtk > classes/methods/functions to the official API documentation on > http://developer.gnome.org/doc/API/ ? Most of the time > there's useful > documentation included there too and it helps to understand how things work. > I think that you are all the right, I use much the book of development of GNOME for the development of applications in Php-gtk, many properties and widgets there are very well documented in that API > - Markus > > > <?php > class PhpGtkReflector extends GtkWindow { > function __construct() { > parent::__construct(); > > $this->connect_object('destroy', array('gtk', > 'main_quit')); > $this->set_title(__CLASS__); > $this->set_default_size(400, 300); > > $model = $this->create_model(); > $tree = new GtkTreeView($model); > > $tree->insert_column_with_data_func(-1, "Classes", new > GtkCellRendererText, array($this, 'col1_setter')); > $cellRenderer = new GtkCellRendererText; > $cellRenderer->set_property("editable", true); > $cellRenderer->connect('edited', array($this, > 'cellEditDone'), $model); > $cellRenderer->set_data("column", 1); > $tree->insert_column_with_data_func(-1, "Info", > $cellRenderer, array($this, 'col2_setter')); > > $scroll = new GtkScrolledWindow(); > $scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); > $scroll->add($tree); > > $this->add($scroll); > > $this->show_all(); > > } > public function cellEditDone($oText, $sPath, $sNewText, $oStore) { > $iColumn = $oText->get_data("column"); > $oStore->set($oStore->get_iter_from_string($sPath), $iColumn, > $sNewText); > } > public function col1_setter($column, $cell, $model, $iter) { > $data = $model->get_value($iter, 0); > $cell->set_property("text", $data); > } > public function col2_setter($column, $cell, $model, $iter) { > $data = $model->get_value($iter, 1); > $cell->set_property("text", $data); > } > private function create_model() { > $store = new GtkTreeStore(Gtk::TYPE_STRING, Gtk::TYPE_STRING); > > sort($aClasses = get_declared_classes()); > foreach($aClasses as $sClassName) { > $oClassIter = $store->append(); > list($iCountProperties, $iCountMethods) = > $this->model_add_methods($store, $oClassIter, $sClassName); > $store->set($oClassIter, 0, $sClassName, 1, > "Properties: $iCountProperties, Methods: $iCountMethods"); > } > return $store; > } > private function model_add_methods($store, $oParentIter, $sClassName) { > $oRefClass = new ReflectionClass($sClassName); > > # model properties > usort($aProperties = $oRefClass->getProperties(), array($this, > "sortByNameMethod")); > if (($iCountProperties = count($aProperties)) > 0) { > $oPropsIter = $store->append($oParentIter); > $store->set($oPropsIter, 0, "Properties"); > foreach ($aProperties as $oRefProp) { > $oPropIter = $store->append($oPropsIter); > $store->set($oPropIter, 0, $oRefProp->getName()); > } > } > > # model methods > usort($aMethods = $oRefClass->getMethods(), array($this, > "sortByNameMethod")); > if (($iCountMethods = count($aMethods)) > 0) { > $oMethodsIter = $store->append($oParentIter); > $store->set($oMethodsIter, 0, "Methods"); > foreach ($aMethods as $oRefMethod) { > $oMethodIter = $store->append($oMethodsIter); > $store->set($oMethodIter, 0, > $oRefMethod->getName()); > } > } > > return array($iCountProperties, $iCountMethods); > } > private function sortByNameMethod($a, $b) { > return strcmp($a->getName(), $b->getName()); > } > } > > new PhpGtkReflector; > Gtk::main(); > ?> > Very cool program :-) > > -- > PHP-GTK Development Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.gtk.dev (#1245) next »