SharkAPI::App.pm -- Application Object Container
use SharkAPI::App;
#
# Init SharkAPI
#
$DBF_Sample::app = new SharkAPI::App(app_module => 'MAIN',
run_mode => 'Gtk',
oix_object => $SnapRun::xml->{oix});
This module holds the application specific objects and the run mode.
It is used to ``boot' the application and is passed to other objects
that need to take specific actions based on the run mode.
- new ( [ OPT => OPT_VALUE [,...]] )
-
This method creates the App object. It either returns the object on
successful creation or undef upon failure. $! is the error code if any.
Options are passed as keyword value pairs. Recognized options are:
- run_mode
This options specifies the run mode. It defaults to ``Gtk'' if not
specified. Currently supported modes are Gtk, and Html. Gtk2 will be
completed soon.
- app_object
When provided will assign the specified value to the application object
associated with this application object. For example in a Gtk application
the application object is: Gtk::GladeXML. This option can also be set during
the boot method.
- oix_object
When provided the SharkAPI::App object will construct an internal structure
that holds the OIX data corresponding to the application module. The data
can then be accessed via the oix_key method.
- app_module
This option defines the module that defines this instance of the application
object. It defaults to ``MAIN'' when not specified. This value is used to
partion widget namespaces and contains only on glade xml file.
- app_path
This option is specific to the ``Html'' run mode. It defines the path to
the Mason/Snapper application modules.
- boot ( [ OPT => OPT_VALUE [, ...]] )
-
This method will ``boot' a Snapper application. It will define the application
object upon successful completion. Options are passed as keyword value pairs.
Recognized options are:
- app_name
This option specifies the application name passed to the Gnome init call. It
defaults to ``snapperapp''.
- main_win
This option specifies the window to activate upon startup. It defaults to
``MAIN''.
- snap_obj
This option specifies the Snapper object to use for application activation.
It defaults to ``$SnapRun::xml''. The object will be detroyed after
activation.
The ``boot'' method is used primarily to simplify and unify startup scripts.
The following code can be added to a 999_main.pl script to startup the
application.
use SharkAPI;
use SharkAPI::App;
#
# Init SharkAPI
#
$Grid_Sample::app = new SharkAPI::App(app_module => 'MAIN',
run_mode => 'Gtk');
#
# Boot Via SharkAPI
#
$Grid_Sample::app->boot(snap_obj=>$SnapRun::xml);
#
# Drop into main loop
#
$Grid_Sample->main();
- oix_key ( [ $name ], [$class], [$group], [$option], [$value] )
-
This method will query or set OIX data in the internal application OIX
data store. All variations return a hash reference except when all
arguments but ``value'' are passed. This version will return the ``value''
of the OIX option.
- get_run_mode ( )
-
Returns the run mode.
- get_app_object ( )
-
Returns the application object.
- true ( )
-
This function will return the application's object version of true.
- false ( )
-
This function will return the application's object version of false.
- main ( )
-
This function will drop into main appliction loop.
- quit ( )
-
This function will quit the current application.
- grab_focus ( $name )
-
This function will place the current focus on the named widget. For
example, if the widget is an entry box then the cursor will be placed in
the field.
- active ( ($name | \@names) [,$state] )
-
This function will enable or disable the named widget for normal use. This
is the same as the ``on'' and ``off'' methods but accepts an argument that
determines the state. 1 = on, 2 = off. An array reference can be passed for
multiple values, the state value will be applied to the whole group. If no
state value is passed then the current state of the widget is returned.
-
$app->active( ['widget1', 'widget2', 'widget3'], 1 );
- on ( ($name | \@names) )
-
This function will enable the named widget for normal use. An array reference
can be passed for multiple values.
-
$app->on( ['widget1', 'widget2', 'widget3'] );
- off ( ($name | \@names) )
-
This function will disable the named widget, i.e. not usable. An array
reference can be passed for multiple values.
-
$app->off( ['widget1', 'widget2', 'widget3'] );
- show ( $name )
-
This function will display the named widget. An array reference can be
passed for multiple values.
-
$app->show( ['widget1', 'widget2', 'widget3'] );
- hide ( $name )
-
This hides the named widget. An array reference can be passed for multiple
values.
-
$app->hide( ['widget1', 'widget2', 'widget3'] );
- thaw ( $name )
-
This method will thaw out the named widget, i.e. display updates.
- freeze ( $name )
-
This method will freeze the named widget, i.e. no updates will be displayed.
- baseobj ( $name )
-
This method returns the native class of the named widget.
- getvals ( \@names )
-
This function returns the values from the given widget name array based
on the widget class.
-
my ($id, $name) = $app->getvals(['id', 'name']);
- setvals ( NAME => NAME_VALUE [, ...]] )
-
This function sets the values of the given widget based on the widget
class.
-
$app->setvals(id => $id, name => $name);
- set_widths ( $name, \@widths )
-
This function sets the widths of the given widget based on the widget
class, i.e. column widths.
- set_strings ( $name, \@strings )
-
This function sets the strings of the given widget based on the widget
class, i.e. drop down items.
- getval ( $name )
-
This function returns the value from the given widget based on the widget
class.
- setval ( $name, $value )
-
This function sets the value of the given widget based on the widget
class.
- setvala ( $name, $value )
-
This function appends the passed value to the value displayed in the
widget.
- setclear ( $name )
-
This function clears the value of the given widget based on the widget
class.
perl
Snapper
SharkAPI
Bill Walz, bill@landsharklinux.com
The SharkAPI::App module is Copyright (c) 2002 Albacore Technology, LLC
The SharkAPI::App module is commercial licensed software
|