Re: gtktoolbar: append_item

From: Date: Sun, 01 Aug 2004 17:15:44 +0000
Subject: Re: gtktoolbar: append_item
References: 1 2 3 4 5 6  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-657@lists.php.net to get a copy of this message
On Sun, 01 Aug 2004, Christian Weiske wrote: > The gtk function gtk_toolbar_set_style has nothing to do with GtkStyles, I know. > it determines if the toolbar is set to both/text only/icon only mode. I know. > When I add some buttons with both text and icons I should have the > ability to determine if only text is shown or that only icons are wanted. Right. > Now call me dumb if I didn't understand it right: > The set_style of GtkToolbar should set this *toolbar style*, or is there > another method? That's the method. > I originally meant that, if the method/function names are converted as > usual, that the "gtk_toolbar_set_style" is renamed to "set_style" and so > overrides the original set_style function which deals with GtkStyles. > That's what I called "crash", sorry for my bad english. I think you meant "clash". > So I thought the following should work: > $toolbar->set_style( GTK_TOOLBAR_ICONS); > which doesn't, or I am missing something. It works for me. Try the attached script. Does it work for you? -Andrei "Then again, E=mc^2 may only be a local phenomenon." -- Einstein

<?php if( !extension_loaded('gtk')) { dl( 'php_gtk.' . PHP_SHLIB_SUFFIX); } $window = &new GtkWindow(); $window->set_title( 'toolbar test'); $window->set_default_size( 400, 70); $window->connect_object('destroy', array('gtk', 'main_quit')); $systemimage = array( '13 13 5 2', ' c None s None', '. c topShadowColor m white c lightblue', 'X s iconColor1 m black c black', 'o s bottomShadowColor m black c #646464646464', 'O s selectColor m white c red', " ", " . . . ", " . . X X X o o ", " . X X X X X X X o ", " . X X X X X X X o ", " . X X X X O X X X X o ", " . X X X O O O X X X o ", " . X X X X O X X X X o ", " . X X X X X X X o ", " . X X X X X X X o ", " o o X X X o o ", " o o o ", " " ); $window->realize(); list($pixmap, $mask) = Gdk::pixmap_create_from_xpm_d($window->window, null, $systemimage); $pixmapwid = &new GtkPixmap($pixmap, $mask); $toolbar = &new GtkToolbar( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); //$toolbar = &new GtkToolbar( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_TEXT); //$toolbar = &new GtkToolbar( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); function toolbarclicked($button, $toolbar) { $toolbar->set_orientation(GTK_ORIENTATION_VERTICAL); $toolbar->set_style(GTK_TOOLBAR_ICONS); } $toolbar->append_item( 'new', 'Creates a new document', null, $pixmapwid, 'toolbarClicked', $toolbar ); $toolbar->append_item( 'old', 'Creates a new document', null, null, 'toolbarClicked', $toolbar ); $window->add( $toolbar); $window->show_all(); gtk::main(); ?>
« previous php.gtk.dev (#657) next »