Re: gtktoolbar: append_item

From: Date: Sun, 01 Aug 2004 04:00:30 +0000
Subject: Re: gtktoolbar: append_item
References: 1 2 3 4 5  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-654@lists.php.net to get a copy of this message
Hi
Before I couldn't really test the set_style cause it applies to elements created with insert_element, but now I could test it and it doesn't seem to work. I think it crashes with the set_style of GtkWidget, and is not overridden. The best thing would be to rename the toolbar's set_style to set_toolbar_style to distinguish between the two functions.
I didn't see any crashes. GtkToolbar::set_style() should properly override GtkWidget's set_style() method. Can you send me a sample code that crashes?
No, you didn't understand me. The gtk function gtk_toolbar_set_style has nothing to do with GtkStyles, it determines if the toolbar is set to both/text only/icon only mode. 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. Try this: <?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); $toolbar->append_item( 'new', 'Creates a new document', null, $pixmapwid, 'toolbarClicked', 'new' ); $window->add( $toolbar); $window->show_all(); gtk::main(); ?> There are some commented lines which create a toolbar with different *toolbar styles*. Even that there is only one button which is created by the toolbar itself and has an icon - always both text and icon is shown. 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? 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. So I thought the following should work: $toolbar->set_style( GTK_TOOLBAR_ICONS); which doesn't, or I am missing something. It may be that both things (constructor and set_style) don't have anything in common on this problem, but it could be I think. Regards/MfG, Christian Weiske -- XMMS is playing now: Tocotronic - Alles was ich will, ist...

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.gtk.dev (#654) next »