File Duplex/UIComponent.lua

Functions

UIComponent:__eq (other) Compare with another instance (only check for object identity)
UIComponent:__init (display) Initialize the UIComponent class
UIComponent:__tostring () Prints the type of UIComponent
UIComponent:add_listeners () Attach listeners to the events (applications override this with their own implementation)
UIComponent:draw () Update the control's visual appearance
UIComponent:invalidate () Request update on next refresh
UIComponent:remove_listeners () Remove previously attached event listeners (applications override this with their own implementation)
UIComponent:set_palette (palette) Set palette, invalidate if changed
UIComponent:set_pos (x, y) Set the position using x/y or index within group
UIComponent:set_size (width, height) Method to set the control's size in units - it is important to use this instead of setting width/height directly, as this method will resize Canvas
UIComponent:test (x_pos, y_pos) Perform simple "inside square" hit test


Functions

UIComponent:__eq (other)
Compare with another instance (only check for object identity)

Parameters:

  • other: (UIComponent) another UIComponent instance

Return value:

    Boolean
UIComponent:__init (display)
Initialize the UIComponent class

Parameters:

  • display: (Duplex.Display)
UIComponent:__tostring ()
Prints the type of UIComponent
UIComponent:add_listeners ()
Attach listeners to the events (applications override this with their own implementation)
UIComponent:draw ()
Update the control's visual appearance
UIComponent:invalidate ()
Request update on next refresh
UIComponent:remove_listeners ()
Remove previously attached event listeners (applications override this with their own implementation)
UIComponent:set_palette (palette)
Set palette, invalidate if changed

Parameters:

  • palette: (Table), e.g {foreground={color={0x00,0x00,0x00}}}
UIComponent:set_pos (x, y)
Set the position using x/y or index within group

Parameters:

  • x: (Number)
  • y: (Number)
UIComponent:set_size (width, height)
Method to set the control's size in units - it is important to use this instead of setting width/height directly, as this method will resize Canvas

Parameters:

  • width: (Number)
  • height: (Number)
UIComponent:test (x_pos, y_pos)
Perform simple "inside square" hit test

Parameters:

  • x_pos: (Number)
  • y_pos: (Number)

Return value:

    (Boolean) true if inside area

Valid XHTML 1.0!