Widget to control volume and similar values
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.
Glib::Object +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container +-----Gtk2::Bin +----Gtk2::Button +----Gtk2::ToggleButton +----Gtk2::Ex::VolumeButton
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();
Current volume
Image to lay over the current image when the volume is muted
Image to display when the volume is zero
Image to display when the volume is minimal
Image to display when the volume is medium
Image to display when the volume is maximal
Position of the popup window relativ to the button 'top' and 'buttom' are supported
Is the volume muted?
Emitted when the volume property is changed
Emitted when the mute status is changed
Gtk2, Glib::Object, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Button, Gtk2::ToggleButton
Florian Ragwitz <[email protected]>
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.