Module dispatcher
This module is responsible for dispatching events.
To add a new action an entry must be added to settingsList
& dispatcher_menu_order
This can also be done at runtime via registerAction().
settingsList
contains the list of dispatchable settings.
Each setting contains:
- category: one of:
* none: a direct event call * arg: a event that expects a gesture object or an argument * absolutenumber: event that sets a number * incrementalnumber: event that increments a number & accepts a gesture object * string: event with a list of arguments to chose from
- event: what to call.
- title: for use in ui.
- section: under which menu to display (currently: device, filemanager, rolling, paging)
and optionally
- min/max: for number
- default
- args: allowed values for string.
- toggle: display name for args
- separator: put a separator after in the menu list
- configurable: can be parsed from cre/kopt and used to set document.configurable. Should not be set manualy
Functions
Dispatcher:init () | add settings from CreOptions / KoptOptions |
Dispatcher:registerAction (name, value) | Adds settings at runtime. |
Dispatcher:addSubMenu (caller, menu, location, settings) |
Add a submenu to edit which items are dispatched arguments are:
example usage:
|
Dispatcher:execute (ui, settings, gesture) |
Calls the events in a settings list arguments are:
|
Functions
- Dispatcher:init ()
- add settings from CreOptions / KoptOptions
- Dispatcher:registerAction (name, value)
-
Adds settings at runtime.
Parameters:
- name the key to use in the table
- value a table per settingsList above
Usage:
function Hello:onDispatcherRegisterActions() Dispatcher:registerAction("helloworld_action", {category="none", event="HelloWorld", title=_("Hello World"), filemanager=true,}) end function Hello:init() self:onDispatcherRegisterActions() end
- Dispatcher:addSubMenu (caller, menu, location, settings)
-
Add a submenu to edit which items are dispatched arguments are:
1) the caller so dispatcher can set the updated flag 2) the table representing the submenu (can be empty) 3) the object (table) in which the settings table is found 4) the name of the settings table
example usage:
Dispatcher.addSubMenu(self, sub_items, self.data, "profile1")
Parameters:
- caller
- menu
- location
- settings
- Dispatcher:execute (ui, settings, gesture)
-
Calls the events in a settings list arguments are:
1) a reference to the uimanager 2) the settings table 3) optionally a <code>gestures</code>object
Parameters:
- ui
- settings
- gesture