Re: ToggleButton Change Icon
- From: Daniel Flemming <danflemming mac com>
- To: William B Carlson <carls107 msu edu>
- Cc: gtk-perl-list gnome org
- Subject: Re: ToggleButton Change Icon
- Date: Tue, 24 Aug 2004 09:57:27 -0400 (EDT)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, 24 Aug 2004, William B Carlson wrote:
I have ToggleButton, which is used to start and stop a process. I was
wondering if there was a way to use the stock icons (gtk-start, gtk-stop) in
place of the Start and Stop text.
Yup. Here's some code from a PlayPause button that I have.
my ( $widget, $programSettings ) = @_;
if ( $widget->get_active ) {
...
$widget->set_label('pause');
$widget->set_use_stock(TRUE);
$programSettings->{'MainTooltips'}->set_tip( $widget, 'Pause' );
...
}
else {
$widget->set_label('play');
$widget->set_use_stock(TRUE);
$programSettings->{'MainTooltips'}->set_tip( $widget, 'Play' );
...
}
# update the button
$widget->show;
$programSettings is a hashref that gets passed around everywhere. It's
used in the example to set tooltips. Both play and pause have been set up
as custom icons with an IconFactory; you can just as easily use
standard gtk stock icons there.
Basically, when the button is active, the program is playing, and the
button then represents pause mode. (And a lot of code's been omitted from
that section, obviously :) And then vice versa.
- --
GnuPG public key available from
http://homepage.mac.com/danflemming/gnupg_key.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFBK0lZER493M5r4PIRAspQAJ9aYKDEI67FeOpg4SmVHzB0vA8eVwCgmvgl
WcCXKT1goUViyvSXyKNdAlw=
=dEAv
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]