Re: How to create a button with a icon inside ?
| From: | Rich Payne | Date: | Sun, 08 Jul 2001 18:38:28 +0000 |
| Subject: | Re: How to create a button with a icon inside ? | ||
| References: | 1 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-2094@lists.php.net to get a copy of this message | ||
I think this is something like what you're looking for:
Load the image from a pixmap:
list ($pixmap, $mask) =
Gdk::pixmap_create_from_xpm($this->window,null,"images/forward.xpm");
$forward_image = &new GtkPixmap($pixmap, $mask);
create the button
$forward_button = &new GtkButton();
create a vbox
$forward_box = &new GtkVBox();
make a label with text
$forward_label = &new GtkLabel('Forward');
pack the label and image into the vbox,
$forward_box->pack_start($forward_image);
$forward_box->pack_start($forward_label);
then add that vbox to the button.
$forward_button->add($forward_box);
Remember that a button itself is a container so you can add other widgets
to it.
If you were just adding the image then there should be no need for the
vbox.
hope that helps,
--rdp
On Sun, 8 Jul 2001, Mauro Ferreira wrote:
> Can someone show me a example ?
>
> I'm doing some refinements in an database-oriented app, and show database navigation and
> action buttons with small icons instead of text will do a lot for the visual - and cuts a lot in
> internationalization too !
>
> If isn't ask for too much, a example of a combined icon+text button too will be great too
> - some not-so-obvious actions, like data integrity check need a text anyway.
>
> Know how to make this will simplify my work a lot, not to mention the visual aspect.
>
> Thanks !
>
--
Rich Payne
rpayne@alphalinux.org www.alphalinux.org