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

RELATED TO Gtk2::Ex::VolumeButton…

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

AUTHOR

Florian Ragwitz <[email protected]>

COPYRIGHT AND LICENSE

Copyright (C) 2004 by Florian Ragwitz

This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 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 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0 Library General Public License for more details.

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