Gtk2::Ex::VolumeButton(3pm)

Gtk2::Ex::VolumeButton3pm

Widget to control volume and similar values

Usage

  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();

Overview

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

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

Releases

7 releases since Debian 3.1 (Sarge); the text changed 2 times.

  1. 3.1–4.0
  2. 5.0
  3. 6.0–9

Author

Florian Ragwitz <[email protected]>

From libgtk2-ex-volumebutton-perl 0.07-2 in Debian 9 (Stretch). Parsed by carta from the page's man source.