lupemod__define.pro
lupemod
Description:
This is the template object for a lupe module. Real modules should
subclass to this object and overload all methods - the methods
implemented here will create an error message upon execution.
The menu dispatcher will approximately work the following way:
- user selects menu entry, corresponding to a module
- call readyToExecute of this module
if result is zero, do nothing (it is the module's responsibility
to inform the user that it is not ready to run - if it should
care to do so)
- readyToExecute is ok.
If the new module is 'exclusive', unmap all currently mapped
modules. If it is of type 'embedded' and there's currently another
module in the main window, call the unmap function of the currently
embedded module first.
The menu dispatcher will also take care to display the logo in
main window whenever no embedded window is displayed.
Then map the new module and we're done for now
- Otherwise 'execute' (non-UI) or 'map' (top-level) the new module.
Note that top-level modules may be closed by the user anytime
without further notification!
- 'mod_exit' would be an example for an exclusive module (to make
sure all other modules are closed properly) without UI.
lupemod::init
Syntax:
obj = obj_new('lupemod', type, exclusive, revision )
Arguments:
type
One of 'noUI', 'top', 'embedded' (case-insensitive)
exclusive
Either '0' for non-exclusive or '1' for exclusive modules
(an exclusive module will cause other modules to unmap before mapping
itself)
Description:
lupemod::revision
Syntax:
rev = obj->revision()
Description:
Returns the current revision of the module as a string
In this method we check whether we're (falsely) called from the
subclass or directly. All other methods have to be overloaded.
lupemod::readyToExecute
Description:
The module checks whether it is ready to be mapped to screen. This
might involve things like checking whether all necessary data is
available to be able to run.
lupemod::map
Description:
Map the module to screen
lupemod::unmap
Description:
Remove the module from screen. If there's no cleanup to do, the
method doesn't need to be implemented by the module. However if so,
unmapping shall not be done in the overloaded method as some bookkeeping
is done here as well. Hold on to the template.
The nologo option is used from lupe_evthandler to avoid mapping of
the logo when another module is to be mapped anyway
lupemod::execute
Description:
Modules of type '0' (no UI) cannot be mapped to screen. Instead their
execute function is called to fulfill Map the module on screen
lupemod::reset
Description:
Reset the internal status of this module - i.e. ess. bring it into
the same state as right after instanciation
lupemod::update
Description:
The module makes use of data that might have been changed. Check
for data changes and update the internal status and display
accordingly.
lupemod::evthandler
Description:
lupemod::createBaseWidget
Syntax:
Arguments:
Description:
This function creates a base widget for both embedded and top-level
modules, although the arguments differ as embedded modules have a
fixed size which cannot be changed.
Example for a top-level module:
res = self->createBaseWidget( /column, scr_xsize=345, scr_ysize=283, title='Prefs' )
Example for an embedded module:
res = self->createBaseWidget( /column )
lupemod::placeAndRegister
Description:
If the module is a 'top' module, it is placed on screen, either at
the center or at the previously stored position, and then registers
the module with xmanager. Since object orientation has not arrived
yet in IDL's widget-world, this needs to be a 'static' procedure:
lupemod_evthandler
Description:
A 'static' method, so to speak. All module events arrive here -
the widgets have their object and the method to call stored as
anonymous structure in their uvalue. This event handler does
nothing more than calling this method.
lupemod_killevt
Description:
This function is called, whenever a window is removed from screen,
whether via Alt-F4, the window's close button or the close window handle.
We have it here to catch unexpected kills - by the time we get here,
the window itself has already been removed from screen by the WM,
but we may still do the book-keeping.
lupemod::killevt
Description:
This method is called when the window has been killed via Alt-F4.
We call the unmap method which gives the module the chance to do some
cleanup. The window itself is already gone!
There's no need to overload this method - check for the /killed keyword
in unmap if anything UI specific needs to be done.
lupemod::type
Syntax:
type = obj->getType()
Description:
Returns the type of this module. Possible values are
0: if the module implements no UI functionality
1: if the module creates its own separate top level window
2: if the module is embedded in the main window
lupemod::setScrXpos
Description:
store the current window x-position for later use
lupemod::setScrYpos
Description:
store the current window y-position for later use
lupemod__define
Description:
Private Procedure (constructor)