Module ui.uimanager

This module manages widgets.

Functions

UIManager:show (widget, refreshtype, refreshregion, x, y) Registers and shows a widget.
UIManager:close (widget, refreshtype, refreshregion) Unregisters a widget.
UIManager:scheduleIn (seconds, action) Schedules task in a certain amount of seconds (fractions allowed) from now.
UIManager:unschedule (action) Unschedules an execution task.
UIManager:setDirty (widget, refreshtype, refreshregion) Registers a widget to be repainted and enqueues a refresh.
UIManager:setRefreshRate (rate) Sets full refresh rate for e-ink screen.
UIManager:getRefreshRate (rate) Gets full refresh rate for e-ink screen.
UIManager:quit () Signals to quit.
UIManager:sendEvent (event) Transmits an event to an active widget.
UIManager:broadcastEvent (event) Transmits an event to all registered widgets.
UIManager:_refresh (mode, region) Enqueues a refresh.
UIManager:_repaint () Repaints dirty widgets.


Functions

UIManager:show (widget, refreshtype, refreshregion, x, y)
Registers and shows a widget.

Modal widget should be always on top. For refreshtype & refreshregion see description of setDirty().

Parameters:

  • widget a widget object
  • refreshtype "full", "partial", "ui", "fast"
  • refreshregion a Geom object
  • x int
  • y int

See also:

UIManager:close (widget, refreshtype, refreshregion)
Unregisters a widget.

For refreshtype & refreshregion see description of setDirty().

Parameters:

  • widget a widget object
  • refreshtype "full", "partial", "ui", "fast"
  • refreshregion a Geom object

See also:

UIManager:scheduleIn (seconds, action)
Schedules task in a certain amount of seconds (fractions allowed) from now.

Parameters:

  • seconds
  • action
UIManager:unschedule (action)
Unschedules an execution task.

In order to unschedule anonymous functions, store a reference.

Parameters:

  • action

Usage:

    self.anonymousFunction = function() self:regularFunction() end
    UIManager:scheduleIn(10, self.anonymousFunction)
    UIManager:unschedule(self.anonymousFunction)
UIManager:setDirty (widget, refreshtype, refreshregion)
Registers a widget to be repainted and enqueues a refresh.

the second parameter (refreshtype) can either specify a refreshtype (optionally in combination with a refreshregion - which is suggested) or a function that returns refreshtype AND refreshregion and is called after painting the widget.

Parameters:

  • widget a widget object
  • refreshtype "full", "partial", "ui", "fast"
  • refreshregion a Geom object

Usage:

    UIManager:setDirty(self.widget, "partial")
    UIManager:setDirty(self.widget, "partial", Geom:new{x=10,y=10,w=100,h=50})
    UIManager:setDirty(self.widget, function() return "ui", self.someelement.dimen end)
UIManager:setRefreshRate (rate)
Sets full refresh rate for e-ink screen.

Also makes the refresh rate persistent in global reader settings.

Parameters:

  • rate
UIManager:getRefreshRate (rate)
Gets full refresh rate for e-ink screen.

Parameters:

  • rate
UIManager:quit ()
Signals to quit.
UIManager:sendEvent (event)
Transmits an event to an active widget.

Parameters:

  • event
UIManager:broadcastEvent (event)
Transmits an event to all registered widgets.

Parameters:

  • event the widget's event handler might close widgets in which case a simple iterator like ipairs would skip over some entries
UIManager:_refresh (mode, region)
Enqueues a refresh.

Widgets call this in their paintTo() method in order to notify UIManager that a certain part of the screen is to be refreshed.

Parameters:

  • mode
    refresh mode ("full", "partial", "ui", "fast")
    
  • region
    Rect() that specifies the region to be updated
    optional, update will affect whole screen if not specified.
    Note that this should be the exception.
    
UIManager:_repaint ()
Repaints dirty widgets.
generated by LDoc 1.4.6 Last updated 2017-08-17 09:26:49