Gtk2::Ex::VolumeButton.3pm

Langue: en

Autres versions - même langue

Version: 2004-12-18 (ubuntu - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Gtk2::Ex::VolumeButton - widget to control volume and similar values

DESCRIPTION

Gtk2::Ex::VolumeButton is a simple Gtk2 widget based on Gtk2::ToggleButton to control the volume and similar values. It consists of a Gtk2::ToggleButton widget displaying an image representing the current volume. When the button is clicked a popup window containing a Gtk2::VScale widget shows up and allows you to change the widgets volume value. It's also possible to change the volume using the scroll wheel over the toggle button even if the popup window isn't shown.

This widget is modeled after the widgets use in gnome-panel, muine and rhythmbox. Much code is stolen from the muine volume-button widget.

OBJECT HIERARCHY

   Glib::Object
   +----Gtk2::Object
         +----Gtk2::Widget
               +----Gtk2::Container
                     +-----Gtk2::Bin
                            +----Gtk2::Button
                                  +----Gtk2::ToggleButton
                                        +----Gtk2::Ex::VolumeButton
 
 

SYNOPSIS

   use Gtk2::Ex::VolumeButton;
 
   ...
 
   my $vb = Gtk2::Ex::VolumeButton->new(
       volume       => 20,
       mute_image   => 'mute.png',
       zero_image   => 'zero.png',
       min_image    => 'min.png',
       medium_image => 'medium.png',
       max_image    => 'max.png',
       icon_size    => 20,
       position     => 'top',
       muted        => 1
   );
   $vb->show();
 
   $vb->signal_connect( volume_changed =>
       sub { print 'volume changed: ', $vb->{volume}, "\n" } );
 
   $vb->signal_connect( mute_changed =>
       sub { print $_[1] ? 'muted : 'unmuted', "\n" } );
 
   ...
 
   Gtk2->main();
 
 

PROPERTIES

'volume' (int : readable / writable)
Current volume
'mute_image' (string : readable / writable)
Image to lay over the current image when the volume is muted
'zero_image' (string : readable / writable)
Image to display when the volume is zero
'min_image' (string : readable / writable)
Image to display when the volume is minimal
'medium_image' (string : readable / writable)
Image to display when the volume is medium
'max_image' (string : readable / writable)
Image to display when the volume is maximal
'position' (string : readable / writable)
Position of the popup window relativ to the button

'top' and 'buttom' are supported

'muted' (boolean : readable / writable)
Is the volume muted?

SIGNALS

'volume_changed'
Emitted when the volume property is changed
'mute_changed'
Emitted when the mute status is changed

SEE ALSO

Gtk2, Glib::Object, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Button, Gtk2::ToggleButton

AUTHOR

Florian Ragwitz <flora@cpan.org> Copyright (C) 2004 by Florian Ragwitz

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.