Snapper - XML Application SourceForge.net Logo  


NAME

SharkAPI::App::Gtk.pm -- SharkAPI Widget Gtk Functions


DESCRIPTION

This module contains the widget functions for Gtk. All of the methods expect to be passed a SharkAPI::App object. The ``$name'' argument corresponds to the widget named defined in Glade. This module is not a replacement for the Gtk API, but is rather a way to produce code that will work across Gtk versions and Html versions.


OBJECT INTERFACE

  • true ( $app_object )
  • This method will return true.
      return Gtk->true();

  • false ( $app_object )
  • This method will return false.
      return Gtk->false();

  • main ( $app_object )
  • This method will drop into the Gtk main loop.
      Gtk->main();

  • quit ( $app_object )
  • This method will call the Gtk exit method to end an application.
      Gtk->exit(0);

  • getval ( $app_object, $name )
  • This function returns the value from the given widget, specified by name and the SharkAPI::App object, based on the widget class. Since widgets have different ways of returning values, i.e. get_text vs. get_chars, this function simplifies coding. The following matrix explains the methods used to obtain the value:
      Class               Method             Description
      =====               ======             ===========
      GtkEntry            get_text           Text of entry box
      GtkText             get_chars(0,-1)    Text of entire box
      GtkCombo            get_text           Text of entry object
      GtkRadioButton      active             If the radio button is a
                                             member of a group then
                                             the widget NAME of the
                                             selected item is returned.
                                             If the radio button is not
                                             in a group then 0 or 1 is
                                             returned based on selection.
      GtkCheckButton      active             Same as RadioButton

  • setstrings ( $app_object, $name, \@strings )
  • This function assigns the specified ``strings'' array to the named widget. The following matrix explains the methods used to set the value:
      Class               Method              Description
      =====               ======              ===========
      GtkCombo            set_popdown_strings Sets the drop down menu of the combo
                                              box

  • set_widths ( $app_object, $name, \@widths )
  • This function sets the widths of the given widget based on the widget class. The following matrix explains the methods used to set the value:
      Class               Method              Description
      =====               ======              ===========
      GtkCList            set_column_width    Sets the column widths

  • set_strings ( $app_object, $name, \@strings )
  • This function sets the strings of the given widget based on the widget class. The following matrix explains the methods used to set the value:
      Class               Method              Description
      =====               ======              ===========
      GtkCombo            set_popdown_strings Sets the drop down items

  • setval ( $app_object, $name, $value )
  • This function sets the value of the given widget based on the widget class. Since widgets have different ways of setting values, i.e. set_text vs. insert, this function simplifies coding. The following matrix explains the methods used to set the value:
      Class               Method              Description
      =====               ======              ===========
      GtkFrame            set_label           Sets the label of the frame
      GtkWindow           set_title           Sets the title of the window
      GnomeApp            set_title           Sets the title of the window
      GtkEntry            set_text            Sets text of entry box
      GtkText             insert              Sets text of entire box
      GtkCombo            set_text            Sets the text of the combo
                                              entry widget, the value will also
                                              be selected in the list
      GtkRadioButton      set_active          If the radio button is a
                                              member of a group then the
                                              widget with the name equal
                                              to the name passed by value
                                              will be turned on.  If the
                                              value argument is blank then
                                              all radio buttons in the
                                              group are turned off.  If the
                                              radio button is not a member
                                              of a group then it is turned
                                              on or off based on the boolean
                                              value of the value argument.
      GtkCheckButton      set_active          Same as RadioButton
      GnomeAppBar         push                Sets the value of the Gnome
                                              status bar.
      GtkStatusbar        push                Sets the value of the Gtk
                                              status bar.
      GtkCList            append              Clears the list contents and
                                              adds the specified data. Data
                                              should be passed as an array. If
                                              a LOL (list of lists) reference
                                              is passed then more than one row
                                              will be added

  • setvala ( $app_object, $name, $value )
  • This function appends the passed value to the value displayed in the widget. Since widgets have different ways of setting values, i.e. set_text vs. insert, this function simplifies coding. The following matrix explains the methods used to append the value:
      Class               Method             Description
      =====               ======             ===========
      GtkEntry            set_text           Adds to the text of the entry
                                             box
      GtkText             insert             Adds to the text of the text
                                             box
      GtkCombo            set_text           Adds to the text of the entry
                                             object
      GtkCList            append             Appends the specified row. Data
                                             should be passed as an array
                                             reference. If a LOL (list of lists)
                                             reference is passed then more than
                                             one row will be added

  • getvals ( $app_object, \@names )
  • This function returns the values from the given widget name array based on the widget class. See the ``getval'' method for class actions.
      my ($id, $name) = SharkAPI::App::Gtk::getvals( $app, ['id', 'name']);

  • setvals ( $app_object, [ NAME => NAME_VALUE [, ...]] )
  • This function sets the values of the given widgets based on the widget class. Names/Values are passed as keyword value pairs. See the ``setval'' method for class actions.
      SharkAPI::App::Gtk::setvals( $app, id => $id, name => $name);

  • setclear ( $app_object, $name )
  • This function clears the value of the given widget based on the widget class. Since widgets have different ways of setting values, i.e. set_text vs. insert, this function simplifies coding. The following matrix explains the methods used to clear the value:
      Class               Method             Description
      =====               ======             ===========
      GtkFrame            set_label          Clears the label of the frame
      GtkWindow           set_title          Clears the title of the window
      GnomeApp            set_title          Clears the title of the window
      GtkEntry            set_text           Clears the entry box
      GtkText             insert             Clears the entire box
      GtkCombo            set_text           Clears the entry object
      GtkRadioButton      set_active         If the radio button is a
                                             member of a group then the
                                             group is turned off.  If the
                                             radio button is not a member
                                             of a group then it is turned
                                             off.
      GtkCheckButton      set_active         Same as RadioButton
      GnomeAppBar         push               Clears the Gnome status bar.
      GtkStatusbar        push               Clears the Gtk status bar.


SEE ALSO

perl(1).

Snapper(3).

SharkAPI(3).


AUTHOR

Bill Walz, bill@landsharklinux.com


COPYRIGHT

The SharkAPI::App::Gtk module is Copyright (c) 2002 Albacore Technology, LLC The SharkAPI::App::Gtk module is commercial licensed software


Valid HTML 4.01!
Content owned by Albacore Technology is copyright 1999-2000 Albacore Technology, LLC All rights reserved.