Module ui.widget.widget
This is a generic Widget interface, which is the base class for all other widgets.
Widgets can be queried about their size and can be painted on screen. that's it for now. Probably we need something more elaborate later.
If the table that was given to us as parameter has an "init" method, it will be called. use this to set instance variables rather than class variables.
Functions
Widget:extend (subclass) | Use this method to define a widget subclass that's inherited from a base class widget. |
Widget:new (o) | Use this method to initiate an instance of a class. |
Widget:paintTo (bb, x, y) | Paint widget to a BlitBuffer. |
Tables
Widget | Widget base class |
Functions
- Widget:extend (subclass)
-
Use this method to define a widget subclass that's inherited from a base class widget.
It only setups the metatable (or prototype chain) and will not initiate a real instance, i.e. call self:init().
Parameters:
- subclass table
Returns:
- Widget:new (o)
-
Use this method to initiate an instance of a class.
Do NOT use it for class definitions because it also calls self:init().
Parameters:
- o table
Returns:
- Widget:paintTo (bb, x, y)
-
Paint widget to a BlitBuffer.
Parameters:
- bb BlitBuffer BlitBuffer to paint to. If it's the screen BlitBuffer, then widget will show up on screen refresh.
- x integer x offset within the BlitBuffer
- y integer y offset within the BlitBuffer