Home2L - C/C++ API  v1.2-2-ga4fe (2023-04-15)
Smart Tools for a Private Home
Macros | Typedefs | Enumerations
Applets

Description

Managing applets.

Developing new applets

A new applet - say "Foobar" is integrated as follows.

Collaboration diagram for Applets:

Macros

#define APP_INIT_OK   ((void *) 1)
 Return value for 'appOpInit': Initialization was successful.
 
#define APP_INIT_FAIL   NULL
 Return value for 'appOpInit': Initialization failed.
 

Typedefs

typedef void * FAppFunc(int appOp, void *data)
 Prototype for applet entry functions. Example: void *AppPhoneFunc (int appOp, void *data)
 

Enumerations

enum  EAppOperation {
  appOpInit = 0 , appOpDone , appOpLabel , appOpActivate ,
  appOpLongPush , appOpUser = 0x80
}
 Applet operations. More...
 

Helpers for launch buttons ...

TTF_Font * fntAppLabel
 Default font for launch buttons (read-only!).
 
#define COL_APP_LABEL   ToColor (0x60, 0x60, 0x60)
 Normal launcher labels.
 
#define COL_APP_LABEL_LIVE   WHITE
 App is active, and the user must be aware of that.
 
#define COL_APP_LABEL_BUSY   LIGHT_RED
 App is busy with something.
 
#define COL_APP_LABEL_ALARM   ToColor (0xff, 0x40, 0x40)
 Something very urgant/important is with the app.
 
#define APP_SET_LAUNCHER(BTN, ICON_NAME, TEXT, HOTKEY)
 Set launcher appearance (standard color) and hotkey; Typical use: initialization. More...
 
#define APP_SET_LABEL(BTN, ICON_NAME, TEXT, COLOR)    ((CButton *) (BTN))->SetLabel ((COLOR), ICON_NAME "-48", TEXT, fntAppLabel)
 Set launcher appearance; Typical use is to change color or label. More...
 
#define APP_SET_HOTKEY(BTN, HOTKEY)    ((CButton *) (BTN))->SetHotkey (HOTKEY);
 Set the hotkey.
 

General ...

void AppsInit ()
 
void AppsDone ()
 
static int Apps ()
 

Sending intents to applets ...

void * AppCall (EAppId appId, int appOp, void *data=NULL)
 
static void AppActivate (EAppId appId)
 
static void AppEscape ()
 
bool AppEnabled (EAppId appId)
 

Convenience callbacks for push buttons ...

void CbAppActivate (class CButton *, bool, void *appId)
 
void CbAppEscape (class CButton *, bool, void *)
 

Macro Definition Documentation

◆ APP_SET_LAUNCHER

#define APP_SET_LAUNCHER (   BTN,
  ICON_NAME,
  TEXT,
  HOTKEY 
)
Value:
((CButton *) (BTN))->SetLabel (COL_APP_LABEL, ICON_NAME "-48", TEXT, fntAppLabel); \
((CButton *) (BTN))->SetHotkey (HOTKEY);
Push-button widget.
Definition: ui_widgets.H:214
TTF_Font * fntAppLabel
Default font for launch buttons (read-only!).
#define COL_APP_LABEL
Normal launcher labels.
Definition: apps.H:146

Set launcher appearance (standard color) and hotkey; Typical use: initialization.

Example:

APP_SET_LAUNCHER(data, "ic_foobar", "FooBar", SDLK_f);
#define APP_SET_LAUNCHER(BTN, ICON_NAME, TEXT, HOTKEY)
Set launcher appearance (standard color) and hotkey; Typical use: initialization.
Definition: apps.H:153

Definition at line 164 of file apps.H.

◆ APP_SET_LABEL

#define APP_SET_LABEL (   BTN,
  ICON_NAME,
  TEXT,
  COLOR 
)     ((CButton *) (BTN))->SetLabel ((COLOR), ICON_NAME "-48", TEXT, fntAppLabel)

Set launcher appearance; Typical use is to change color or label.

Example:

APP_SET_LAUNCHER(data, "ic_foobar", "FooBar", COL_APP_LIVE);

Definition at line 174 of file apps.H.

Enumeration Type Documentation

◆ EAppOperation

Applet operations.

Enumerator
appOpInit 

Initialize applet.

  • Argument: (none)
  • Return: APP_INIT_OK | APP_INIT_FAIL

If APP_INIT_FAIL is returned, no other operations will be called again.

appOpDone 

Shutdown applet; Called on shutdown (not for disabled apps).

appOpLabel 

Set the launcher label.

  • Argument: CButton *launchButton = (CButton *) data;
  • Return: return NULL;

Set the 'launchButton' label using its 'CButton::SetLabel*' methods. The app may store the latest passed button object and later change the label arbitrarily. The label must be transparent be colored according to the COL_APP_LABEL_* color scheme. 'launchButton' may be NULL, indicating that not button changes can be performed.

appOpActivate 

Activate the main screen (no arguments, return value ignored).

appOpLongPush 

A long push on the launcher button has been exercised (optional). Note: The applet has not been activated yet and will not be activated automatically.

appOpUser 

First user-defined operation.

Definition at line 94 of file apps.H.