Home2L - C/C++ API  v1.2-2-ga4fe (2023-04-15)
Smart Tools for a Private Home
apps.H
Go to the documentation of this file.
1 /*
2  * This file is part of the Home2L project.
3  *
4  * (C) 2015-2021 Gundolf Kiefer
5  *
6  * Home2L is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Home2L is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Home2L. If not, see <https://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 #ifndef _APPS_
23 #define _APPS_
24 
25 
76 #include "config.H"
77 #include "ui_base.H"
78 
79 
80 enum EAppId {
81  appIdNONE = -1,
82 #define APP(NAME, ENV_PREFIX) appId##NAME,
83 #include "apps_config.H"
84 #undef APP
85  appIdEND
86 };
87 
88 
89 #define APP_INIT_OK ((void *) 1)
90 #define APP_INIT_FAIL NULL
91 
92 
95  appOpInit = 0,
100 
102 
103  appOpLabel,
111 
113 
114  appOpLongPush,
116 
117  appOpUser = 0x80
118 };
119 
120 
121 typedef void *FAppFunc (int appOp, void *data);
124 
125 
128 void AppsInit ();
129 void AppsDone ();
130 
131 static inline int Apps () { return (int) appIdEND; }
133 
134 
137 void *AppCall (EAppId appId, int appOp, void *data = NULL);
138 static inline void AppActivate (EAppId appId) { AppCall (appId, appOpActivate); }
139 static inline void AppEscape () { AppActivate (appIdHome); }
140 bool AppEnabled (EAppId appId);
142 
143 
146 #define COL_APP_LABEL ToColor (0x60, 0x60, 0x60)
147 #define COL_APP_LABEL_LIVE WHITE
148 #define COL_APP_LABEL_BUSY LIGHT_RED
149 #define COL_APP_LABEL_ALARM ToColor (0xff, 0x40, 0x40)
150 
151 extern TTF_Font *fntAppLabel;
152 
153 #define APP_SET_LAUNCHER(BTN, ICON_NAME, TEXT, HOTKEY) \
154  ((CButton *) (BTN))->SetLabel (COL_APP_LABEL, ICON_NAME "-48", TEXT, fntAppLabel); \
155  ((CButton *) (BTN))->SetHotkey (HOTKEY);
162 #define APP_SET_LABEL(BTN, ICON_NAME, TEXT, COLOR) \
163  ((CButton *) (BTN))->SetLabel ((COLOR), ICON_NAME "-48", TEXT, fntAppLabel)
170 #define APP_SET_HOTKEY(BTN, HOTKEY) \
171  ((CButton *) (BTN))->SetHotkey (HOTKEY);
174 
175 
178 void CbAppActivate (class CButton *, bool, void *appId); // activates app, 'appId' is of type 'EAppId'
179 void CbAppEscape (class CButton *, bool, void *); // for "back" button
181 
182 
183 
189 #endif
Push-button widget.
Definition: ui_widgets.H:214
EAppOperation
Applet operations.
Definition: apps.H:94
TTF_Font * fntAppLabel
Default font for launch buttons (read-only!).
void * FAppFunc(int appOp, void *data)
Prototype for applet entry functions. Example: void *AppPhoneFunc (int appOp, void *data)
Definition: apps.H:121
@ appOpLabel
Definition: apps.H:103
@ appOpInit
Definition: apps.H:95
@ appOpLongPush
Definition: apps.H:114
@ appOpActivate
Activate the main screen (no arguments, return value ignored).
Definition: apps.H:112
@ appOpUser
First user-defined operation.
Definition: apps.H:117
@ appOpDone
Shutdown applet; Called on shutdown (not for disabled apps).
Definition: apps.H:101