]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/app.h
fixed 64but bug with g_strEmpty initialization
[wxWidgets.git] / include / wx / msw / app.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: app.h
3 // Purpose: wxApp class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_APP_H_
13 #define _WX_APP_H_
14
15 #ifdef __GNUG__
16 #pragma interface "app.h"
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/object.h"
21
22 class WXDLLEXPORT wxFrame;
23 class WXDLLEXPORT wxWindow;
24 class WXDLLEXPORT wxApp ;
25 class WXDLLEXPORT wxKeyEvent;
26 class WXDLLEXPORT wxLog;
27
28 #define wxPRINT_WINDOWS 1
29 #define wxPRINT_POSTSCRIPT 2
30
31 WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
32
33 // Force an exit from main loop
34 void WXDLLEXPORT wxExit();
35
36 // Yield to other apps/messages
37 bool WXDLLEXPORT wxYield();
38
39 // Represents the application. Derive OnInit and declare
40 // a new App object to start application
41 class WXDLLEXPORT wxApp: public wxEvtHandler
42 {
43 DECLARE_DYNAMIC_CLASS(wxApp)
44 wxApp();
45 ~wxApp();
46
47 static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
48 static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; }
49
50 virtual int MainLoop();
51 void ExitMainLoop();
52 bool Initialized();
53 virtual bool Pending() ;
54 virtual void Dispatch() ;
55
56 void OnIdle(wxIdleEvent& event);
57
58 // Generic
59 virtual bool OnInit() { return FALSE; };
60
61 // No specific tasks to do here.
62 virtual bool OnInitGui() { return TRUE; }
63
64 // Called to set off the main loop
65 virtual int OnRun() { return MainLoop(); };
66 virtual int OnExit() { return 0; }
67
68 inline void SetPrintMode(int mode) { m_printMode = mode; }
69 inline int GetPrintMode() const { return m_printMode; }
70
71 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
72 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
73
74 inline wxString GetAppName() const {
75 if (m_appName != "")
76 return m_appName;
77 else return m_className;
78 }
79
80 inline void SetAppName(const wxString& name) { m_appName = name; };
81 inline wxString GetClassName() const { return m_className; }
82 inline void SetClassName(const wxString& name) { m_className = name; }
83
84 void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
85 const wxString& GetVendorName() const { return m_vendorName; }
86
87 wxWindow *GetTopWindow() const ;
88 inline void SetTopWindow(wxWindow *win) { m_topWindow = win; }
89
90 inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
91 inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
92
93 // Send idle event to all top-level windows.
94 // Returns TRUE if more idle time is requested.
95 bool SendIdleEvents();
96
97 // Send idle event to window and all subwindows
98 // Returns TRUE if more idle time is requested.
99 bool SendIdleEvents(wxWindow* win);
100
101 inline void SetAuto3D(bool flag) { m_auto3D = flag; }
102 inline bool GetAuto3D() const { return m_auto3D; }
103
104 // Creates a log object
105 virtual wxLog* CreateLogTarget();
106
107 public:
108 // void (*work_proc)(wxApp*app); // work procedure;
109 int argc;
110 char ** argv;
111
112 protected:
113 bool m_wantDebugOutput ;
114 wxString m_className;
115 wxString m_appName,
116 m_vendorName;
117 wxWindow * m_topWindow;
118 bool m_exitOnFrameDelete;
119 bool m_showOnInit;
120 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
121 bool m_auto3D ; // Always use 3D controls, except
122 // where overriden
123 static wxAppInitializerFunction m_appInitFn;
124
125 /* Windows-specific wxApp definitions */
126
127 public:
128
129 // Implementation
130 static bool Initialize();
131 static void CleanUp();
132
133 static bool RegisterWindowClasses();
134 // Convert Windows to argc, argv style
135 void ConvertToStandardCommandArgs(char* p);
136 virtual bool DoMessage();
137 virtual bool ProcessMessage(WXMSG* pMsg);
138 void DeletePendingObjects();
139 bool ProcessIdle();
140 int GetComCtl32Version() const;
141
142 public:
143 static long sm_lastMessageTime;
144 int m_nCmdShow;
145
146 protected:
147 bool m_keepGoing ;
148
149 DECLARE_EVENT_TABLE()
150 };
151
152 #if !defined(_WINDLL) || (defined(_WINDLL) && defined(WXMAKINGDLL))
153 int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance, WXHINSTANCE hPrevInstance, char *lpszCmdLine,
154 int nCmdShow, bool enterLoop = TRUE);
155 #else
156 int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance);
157 #endif
158
159 #endif
160 // _WX_APP_H_
161