Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otWYSIWYG Class Reference
[WYSIWYG - What You See Is What You Get, a very simple approach to manage menus, buttons and GUIs in general., WYSIWYG - What You See Is What You Get, a very simple approach to manage menus, buttons and GUIs in general.]

Class for create simple GUI.

#include <otWYSIWYG.h>


Public Types

enum  objectType {
  OBJ_VAR_S32, OBJ_VAR_S16, OBJ_VAR_S8, OBJ_VAR_REAL,
  OBJ_BUTTON, OBJ_LABEL, OBJ_LIST, OBJ_HELP,
  OBJ_VBAR, OBJ_HBAR
}
 < Object type More...
enum  objectState { OBJ_STAT_NORMAL, OBJ_STAT_SELECTED, OBJ_STAT_ACTIVATED, OBJ_STAT_DISABLED }
enum  objectColor {
  OBJ_COL_NORMAL_FORE, OBJ_COL_NORMAL_BACK, OBJ_COL_SELECTED_FORE, OBJ_COL_SELECTED_BACK,
  OBJ_COL_ACTIVATED_FORE, OBJ_COL_ACTIVATED_BACK, OBJ_COL_DISABLED_FORE, OBJ_COL_DISABLED_BACK,
  OBJ_COL_WINDOW_FRAME, OBJ_COL_BAR, OBJ_COL_HELP
}

Public Member Functions

 otWYSIWYG ()
void init (U16 nObjects, const char *view, U16 wide, U16 xLoc, U16 yLoc, otGraphics *lcdInt, U16 size=1)
void setColor (U8 colorId, U16 color)
void close ()
U16 addHelp (const char *textId, const char *help, U16 helpWidth)
U16 addList (const char *textId, const char **list, U16 listCount)
U16 addButton (const char *textId, buttonCallback cb)
U16 addLabel (const char *textId)
U16 addLabel (const char *textId, const char *label)
U16 addInteger (const char *textId, void *varPtr, U8 intType=OBJ_VAR_S32)
U16 addReal (const char *textId, F32 *varPtr)
U16 addVBar (const char *textId, U16 height, U16 maxValue)
U16 addHBar (const char *textId, U16 width, U16 maxValue)
void setList (U16 id, U16 index)
void setText (U16 id, const char *text)
void setBar (U16 id, U16 value, S32 tmpColor=-1)
const char * text (U16 id)
U16 checkArea (U16 x, U16 y)
void regen ()
void regen (U16 id)
void regen (U16 id, U16 fore, U16 back)
void setState (U16 id, U8 state)
U8 state (U16 id)
void clearActivated ()
bool exec (U16 id)


Member Enumeration Documentation

enum otWYSIWYG::objectColor
 

Enumeration values:
OBJ_COL_NORMAL_FORE  Foreground color.
OBJ_COL_NORMAL_BACK  Background color.
OBJ_COL_SELECTED_FORE  Selected foreground color.
OBJ_COL_SELECTED_BACK  Selected background color.
OBJ_COL_ACTIVATED_FORE  Activated foreground color.
OBJ_COL_ACTIVATED_BACK  Activated background color.
OBJ_COL_DISABLED_FORE  Disabled foreground color.
OBJ_COL_DISABLED_BACK  Disabled background color.
OBJ_COL_WINDOW_FRAME  Window frame color.
OBJ_COL_BAR  Bar color.
OBJ_COL_HELP  Help color.

enum otWYSIWYG::objectState
 

Enumeration values:
OBJ_STAT_NORMAL  Normal.
OBJ_STAT_SELECTED  Selected.
OBJ_STAT_ACTIVATED  Activated.
OBJ_STAT_DISABLED  Disabled.

enum otWYSIWYG::objectType
 

Enumeration values:
OBJ_VAR_S32  32 bit integer variable
OBJ_VAR_S16  16 bit integer variable
OBJ_VAR_S8  8 bit integer variable
OBJ_VAR_REAL  Floating point variable.
OBJ_BUTTON  Push button.
OBJ_LABEL  Label.
OBJ_LIST  Text list.
OBJ_HELP  Animated help.
OBJ_VBAR  Vertical bar.
OBJ_HBAR  Horizontal bar.


Constructor & Destructor Documentation

otWYSIWYG.otWYSIWYG (   ) 
 

Create the class


Member Function Documentation

U16 otWYSIWYG.addButton (  const char *  textId,
buttonCallback  cb
) 
 

Add a push button.

Parameters:
textId Object identifier in text that define GUI screen
cb Button callback to a function
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.addHBar (  const char *  textId,
U16  width,
U16  maxValue
) 
 

Add a horizontal BAR

Parameters:
textId Object identifier in text that define GUI screen.
width Width as characters
maxValue Maximum value
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.addHelp (  const char *  textId,
const char *  help,
U16  helpWidth
) 
 

Add an animated help (Horizontal scrolling).

Parameters:
textId Object identifier in text that define GUI screen
help Text help to display
helpWidth Number of displayed characters.
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.addInteger (  const char *  textId,
void *  varPtr,
U8  intType = OBJ_VAR_S32
) 
 

Add an integer

Parameters:
textId Object identifier in text that define GUI screen
varPtr Variable pointer.
intType Variable type, see objectType for reference.
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.addLabel (  const char *  textId,
const char *  label
) 
 

Add a label

Parameters:
textId Object identifier in text that define GUI screen
label Text to be displayed
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.addLabel (  const char *  textId  ) 
 

Add a label

Parameters:
textId Object identifier in text that define GUI screen
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.addList (  const char *  textId,
const char **  list,
U16  listCount
) 
 

Add a string list.

Parameters:
textId Object identifier in text that define GUI screen
list String list. All defined string must have the same size.
listCount Size of the list
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.addReal (  const char *  textId,
F32 *  varPtr
) 
 

Add a real number

Parameters:
textId Object identifier in text that define GUI screen
varPtr Variable pointer.
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.addVBar (  const char *  textId,
U16  height,
U16  maxValue
) 
 

Add a vertical BAR

Parameters:
textId Object identifier in text that define GUI screen. Number of characters defined for ID also define the BAR width.
height Height as characters
maxValue Maximum value
Returns:
Object identifier, to be saved for available functions.

U16 otWYSIWYG.checkArea (  U16  x,
U16  y
) 
 

Checks whether or not a specified point belongs to a GUI object.

Parameters:
x Horizontal position
y Vertical position
Returns:
The object identifier or 0xFFFF if not found.

void otWYSIWYG.clearActivated (   ) 
 

Set NORMAL state to all ACTIVATED objects

void otWYSIWYG.close (   ) 
 

Free all allocated memory for the GUI

bool otWYSIWYG.exec (  U16  id  ) 
 

Exec the callback (if one is defined) for specified object.

Parameters:
id Object identifier

void otWYSIWYG.init (  U16  nObjects,
const char *  view,
U16  wide,
U16  xLoc,
U16  yLoc,
otGraphics *  lcdInt,
U16  size = 1
) 
 

Init the class

Parameters:
nObjects Maximum number of objects that will belong to this GUI.
view GUI content described as text.
wide GUI width expressed as the number of horizontal characters. With textSize 1 the screen can have 53x30 characters.
xLoc Horizontal start coordinate
yLoc Vertical start coordinate
lcdInt Display driver pointer.
size Text size.

void otWYSIWYG.regen (  U16  id,
U16  fore,
U16  back
) 
 

Update only specified GUI object by its identifier. Override default colors.

Parameters:
id Object identifier
fore Foreground 565 encoded RGB color
back Background 565 encoded RGB color

void otWYSIWYG.regen (  U16  id  ) 
 

Update only specified GUI object by its identifier

Parameters:
id Object identifier

void otWYSIWYG.regen (   ) 
 

Draw all GUI contents.

void otWYSIWYG.setBar (  U16  id,
U16  value,
S32  tmpColor = -1
) 
 

Set the value of a selected BAR

Parameters:
id Object identifier
value BAR value in the range 0 to maxValue
tmpColor BAR color id defined else default is used

void otWYSIWYG.setColor (  U8  colorId,
U16  color
) 
 

Change selected color. See objectColor for reference.

Parameters:
colorId Color identifier, see objectColor.
color 565 encoded RGB color

void otWYSIWYG.setList (  U16  id,
U16  index
) 
 

Change selected item of a list

Parameters:
id Object identifier
index Item index

void otWYSIWYG.setState (  U16  id,
U8  state
) 
 

Set the state for a specifed GUI object, see objectState for reference.

Parameters:
id Object identifier
state Object states

void otWYSIWYG.setText (  U16  id,
const char *  text
) 
 

Change the text of a GUI object

Parameters:
id Object identifier
text Text to write

U8 otWYSIWYG.state (  U16  id  ) 
 

Return object state

Returns:
State

const char* otWYSIWYG.text (  U16  id  ) 
 

Return the text of selected GUI object

Parameters:
id Object identifier
Returns:
Object text


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0