1 // This file is part of the utui library, a terminal UI framework.
3 // Copyright (C) 2006 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
9 #ifndef APP_H_226555EB37A021D97E5DB2EB1D8A12CD
10 #define APP_H_226555EB37A021D97E5DB2EB1D8A12CD
12 /// \class CApplication app.h utui.h
14 /// This is the main application class base. To create a utui application,
15 /// derive a singleton class from CApplication and use the WinMain macro
16 /// to instantiate it.
21 typedef const char* const* argv_t
;
23 inline virtual ~CApplication (void) { }
24 int Run (argc_t argc
, argv_t argv
);
27 virtual void OnCreate (argc_t argc
, argv_t argv
);
28 virtual void OnDestroy (void);
31 //----------------------------------------------------------------------
33 extern "C" void InstallCleanupHandlers (void);
35 //----------------------------------------------------------------------
38 inline int TWinMain (int argc
, const char* const* argv
)
40 InstallCleanupHandlers();
41 return (T::Instance().Run (argc
, argv
));
44 #define WinMain(AppClass) \
45 int main (int argc, const char* const* argv) \
47 return (TWinMain<AppClass> (argc, argv)); \
50 //----------------------------------------------------------------------