Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
Classes

Description

Screen and widget management.

A screen in this toolkit is similar to what is a window on a desktop system or an "activity" in Android. It represents the present screen contents and covers the whole display. At a time, only one screen can be active.

A screen contains a stack of widgets, each covering a rectangular part of the screen. New widgets are added on top and may hide (parts of) other widgets added earlier.

Collaboration diagram for Screen:

Classes

class  CWidget
 Base class for all widgets. More...
 
class  CCanvas
 Canvas widget. More...
 
class  CScreen
 Screen object. More...
 

Layout helpers ...

SDL_Rect * LayoutRow (SDL_Rect container, const int *format, int items=-1, int space=UI_BUTTONS_SPACE)
 Layout a row of rectangles. More...
 
SDL_Rect * LayoutRow (SDL_Rect container, int space=UI_BUTTONS_SPACE,...)
 Layout a row of rectangles based on a 0-termintated list of format valus passed as variable arguments.
 
static SDL_Rect * LayoutRowEqually (SDL_Rect container, int items, int space=UI_BUTTONS_SPACE)
 Layout a row of 'items' rectangles with equal width.
 
SDL_Rect * LayoutCol (SDL_Rect container, const int *format, int items=-1, int space=UI_BUTTONS_SPACE)
 Layout a column of rectangles. More...
 
SDL_Rect * LayoutCol (SDL_Rect container, int space=UI_BUTTONS_SPACE,...)
 Layout a column of rectangles based on a 0-termintated list of format valus passed as variable arguments.
 
static SDL_Rect * LayoutColEqually (SDL_Rect container, int items, int space=UI_BUTTONS_SPACE)
 Layout a column of 'items' rectangles with equal width.
 
SDL_Rect * LayoutMatrix (SDL_Rect container, const int *hFormat, const int *vFormat, int hItems=-1, int vItems=-1, int hSpace=UI_BUTTONS_SPACE, int vSpace=UI_BUTTONS_SPACE)
 Layout a matrix of variable-size elements. More...
 

Init/Done ...

static void ScreenInit ()
 
static void ScreenDone ()
 

General definitions ...

#define UI_BUTTONS_HEIGHT   64
 Height of the button bar.
 
#define UI_BUTTONS_SPACE   8
 Standard spacing between buttons.
 
#define UI_BUTTONS_RECT   Rect (0, UI_RES_Y - UI_BUTTONS_HEIGHT, UI_RES_X, UI_BUTTONS_HEIGHT)
 Button area on the bottom of the display.
 
#define UI_BUTTONS_BACKWIDTH   (UI_BUTTONS_HEIGHT + UI_BUTTONS_HEIGHT/2)
 Standard width of the "back" button,.
 
#define UI_USER_RECT   Rect (0, 0, UI_RES_X, UI_RES_Y - UI_BUTTONS_HEIGHT - UI_BUTTONS_SPACE)
 Rectangle describing the screen space usable for applets.
 

Function Documentation

◆ LayoutRow()

SDL_Rect * LayoutRow ( SDL_Rect  container,
const int *  format,
int  items = -1,
int  space = UI_BUTTONS_SPACE 
)

Layout a row of rectangles.

Parameters
containeris the surrounding rectangle into which the row is fit.
formatis an array describing the layout:
  • values > 0 describe fixed-width elements of width |value|.
  • values < 0 describe variable-width elements of weight |value|.
  • 0 terminates the list (then, 'items' does not need to be set).
itemsis the number of items if set >= 0 (useful if the format array is not 0-terminated).
spaceis the space between the items.

If 'format' is ommited (== NULL), 'items' is obligatory, and all items are layed out with variable width and equal size.

The returned array has a size equal to the 'format' list (without the 0) and must be free'd by the caller afterwards.

◆ LayoutCol()

SDL_Rect * LayoutCol ( SDL_Rect  container,
const int *  format,
int  items = -1,
int  space = UI_BUTTONS_SPACE 
)

Layout a column of rectangles.

Parameters
containeris the surrounding rectangle into which the column is fit.
formatis an array describing the layout:
  • values > 0 describe fixed-height elements of height |value|.
  • values < 0 describe variable-height elements of weight |value|.
  • 0 terminates the list (then, 'items' does not need to be set).
itemsis the number of items if set >= 0 (useful if the format array is not 0-terminated).
spaceis the space between the items.

If 'format' is ommited (== NULL), 'items' is obligatory, and all items are layed out with variable width and equal size.

The returned array has a size equal to the 'format' list (without the 0) and must be free'd by the caller afterwards.

◆ LayoutMatrix()

SDL_Rect * LayoutMatrix ( SDL_Rect  container,
const int *  hFormat,
const int *  vFormat,
int  hItems = -1,
int  vItems = -1,
int  hSpace = UI_BUTTONS_SPACE,
int  vSpace = UI_BUTTONS_SPACE 
)

Layout a matrix of variable-size elements.

'hFormat' and 'vFormat' are the formats in horizontal and vertical direction, respectively The returned array has a size equal to |hFormat| * |vFormat| and is organized in lines.