Gtk2-Perl

Description A set of Perl bindings for Gtk+ 2.0 and various related libraries
Gtk2-Perl > Perl Manuals > Gnome2-PanelApplet-main
Source

Index


NAME ^

Gnome2::PanelApplet

HIERARCHY ^

  Glib::Object
  +----Glib::InitiallyUnowned
       +----Gtk2::Object
            +----Gtk2::Widget
                 +----Gtk2::Container
                      +----Gtk2::Bin
                           +----Gtk2::EventBox
                                +----Gnome2::PanelApplet







INTERFACES ^

  Glib::Object::_Unregistered::AtkImplementorIface
  Gtk2::Buildable
















METHODS ^

$applet->add_preferences ($schema_dir)

* $schema_dir (string)

May croak with a Glib::Error in $@ on failure.

(type, color, pixmap) = $applet->get_background

Depending on type, color or pixmap, or both, may be undef.

flags = $applet->get_flags

$applet->set_flags ($flags)

* $flags (Gnome2::PanelApplet::Flags)

orient = $applet->get_orient

string or undef = $applet->get_preferences_key

$applet->setup_menu ($xml, $verb_list, $default_data=undef)

* $xml (string)
* $verb_list (scalar)
* $default_data (scalar)

This method sets up menu entries for your applet and binds them to callbacks. The XML for $xml needs to have the following format:

  <popup name="button3">
    <menuitem name="Properties Item"
              verb="Properties"
              _label="Properties ..."
              pixtype="stock"
              pixname="gtk-properties"/>
    <menuitem name="Help Item"
              verb="Help"
              _label="Help"
              pixtype="stock"
              pixname="gtk-help"/>
    <menuitem name="About Item"
              verb="About"
              _label="About ..."
              pixtype="stock"
              pixname="gnome-stock-about"/>
  </popup>

The verbs specified in this description can be mapped to callbacks in the $verb_list:

  $verb_list = {
    Properties => [\&properties_callback, 'data'],
    Help => \&help_callback,
    About => sub { about_callback(@_) },
  };

As you can see, the usual ways of specifying callbacks can be used:

o Bare code references as in \&help_callback
o Code references with data as in [\&properties_callback, 'data']
o Closures as in sub { about_callback(@_) }

If you use the first or last form, i.e. if you don't specify user data, the callback will be passed $default_data.

The callbacks will be passed three arguments: the bonobo component they belong to, the user data, and the verb they were installed for. Currently, the bonobo component will always be undef, since we have no bonobo Perl bindings yet.

$applet->setup_menu_from_file ($opt_datadir, $file, $opt_app_name, $verb_list, $default_data=undef)

* $opt_datadir (string or undef)
* $file (string)
* $opt_app_name (string or undef)
* $verb_list (scalar)
* $default_data (scalar)

integer = $applet->get_size

$applet->set_size_hints ($size_hints, $base_size)

* $size_hints (scalar)
* $base_size (integer)

SIGNALS ^

change-orient (Gnome2::PanelApplet, Glib::UInt)
change-size (Gnome2::PanelApplet, integer)
change-background (Gnome2::PanelApplet, Gnome2::PanelApplet::BackgroundType, Gtk2::Gdk::Color, Gtk2::Gdk::Pixmap)
move-focus-out-of-applet (Gnome2::PanelApplet, Gtk2::DirectionType)

ENUMS AND FLAGS ^

enum Gnome2::PanelApplet::BackgroundType

* 'no-background' / 'PANEL_NO_BACKGROUND'
* 'color-background' / 'PANEL_COLOR_BACKGROUND'
* 'pixmap-background' / 'PANEL_PIXMAP_BACKGROUND'

flags Gnome2::PanelApplet::Flags

* 'flags-none' / 'PANEL_APPLET_FLAGS_NONE'
* 'expand-major' / 'PANEL_APPLET_EXPAND_MAJOR'
* 'expand-minor' / 'PANEL_APPLET_EXPAND_MINOR'
* 'has-handle' / 'PANEL_APPLET_HAS_HANDLE'

enum Gnome2::PanelApplet::Orient

* 'up' / 'PANEL_APPLET_ORIENT_UP'
* 'down' / 'PANEL_APPLET_ORIENT_DOWN'
* 'left' / 'PANEL_APPLET_ORIENT_LEFT'
* 'right' / 'PANEL_APPLET_ORIENT_RIGHT'

enum Gtk2::DirectionType

* 'tab-forward' / 'GTK_DIR_TAB_FORWARD'
* 'tab-backward' / 'GTK_DIR_TAB_BACKWARD'
* 'up' / 'GTK_DIR_UP'
* 'down' / 'GTK_DIR_DOWN'
* 'left' / 'GTK_DIR_LEFT'
* 'right' / 'GTK_DIR_RIGHT'

SEE ALSO ^

Gnome2::PanelApplet, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::EventBox

COPYRIGHT ^

Copyright (C) 2003, 2007 by the gtk2-perl team.

This software is licensed under the LGPL. See Gnome2::PanelApplet for a full notice.