summaryrefslogtreecommitdiffstats
path: root/languages/cpp/app_templates/prc-tool/palmhello.c
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/cpp/app_templates/prc-tool/palmhello.c
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/cpp/app_templates/prc-tool/palmhello.c')
-rw-r--r--languages/cpp/app_templates/prc-tool/palmhello.c117
1 files changed, 117 insertions, 0 deletions
diff --git a/languages/cpp/app_templates/prc-tool/palmhello.c b/languages/cpp/app_templates/prc-tool/palmhello.c
new file mode 100644
index 00000000..0a34b6c4
--- /dev/null
+++ b/languages/cpp/app_templates/prc-tool/palmhello.c
@@ -0,0 +1,117 @@
+
+/* Main code for PalmHello */
+
+#include <PalmOS.h>
+#include <PalmCompatibility.h>
+#include "callback.h"
+
+#include "palmhelloRsc.h"
+
+static Boolean MainFormHandleEvent (EventPtr e)
+{
+ Boolean handled = false;
+ FormPtr frm;
+
+ CALLBACK_PROLOGUE
+
+ switch (e->eType) {
+ case frmOpenEvent:
+ frm = FrmGetActiveForm();
+ FrmDrawForm(frm);
+ handled = true;
+ break;
+
+ case menuEvent:
+ MenuEraseStatus(NULL);
+
+ switch(e->data.menu.itemID) {
+ }
+
+ handled = true;
+ break;
+
+ case ctlSelectEvent:
+ switch(e->data.ctlSelect.controlID) {
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ CALLBACK_EPILOGUE
+
+ return handled;
+}
+
+static Boolean ApplicationHandleEvent(EventPtr e)
+{
+ FormPtr frm;
+ Word formId;
+ Boolean handled = false;
+
+ if (e->eType == frmLoadEvent) {
+ formId = e->data.frmLoad.formID;
+ frm = FrmInitForm(formId);
+ FrmSetActiveForm(frm);
+
+ switch(formId) {
+ case MainForm:
+ FrmSetEventHandler(frm, MainFormHandleEvent);
+ break;
+ }
+ handled = true;
+ }
+
+ return handled;
+}
+
+/* Get preferences, open (or create) app database */
+static Word StartApplication(void)
+{
+ FrmGotoForm(MainForm);
+ return 0;
+}
+
+/* Save preferences, close forms, close app database */
+static void StopApplication(void)
+{
+ FrmSaveAllForms();
+ FrmCloseAllForms();
+}
+
+/* The main event loop */
+static void EventLoop(void)
+{
+ Word err;
+ EventType e;
+
+ do {
+ EvtGetEvent(&e, evtWaitForever);
+ if (! SysHandleEvent (&e))
+ if (! MenuHandleEvent (NULL, &e, &err))
+ if (! ApplicationHandleEvent (&e))
+ FrmDispatchEvent (&e);
+ } while (e.eType != appStopEvent);
+}
+
+/* Main entry point; it is unlikely you will need to change this except to
+ handle other launch command codes */
+DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags)
+{
+ Word err;
+
+ if (cmd == sysAppLaunchCmdNormalLaunch) {
+
+ err = StartApplication();
+ if (err) return err;
+
+ EventLoop();
+ StopApplication();
+
+ } else {
+ return sysErrParamErr;
+ }
+
+ return 0;
+}