]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/app.h
fixed wxFontDialog API: accept const ref instead of (well, in addition to) a possibly...
[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/event.h"
20 #include "wx/icon.h"
21
22 class WXDLLEXPORT wxFrame;
23 class WXDLLEXPORT wxWindow;
24 class WXDLLEXPORT wxApp ;
25 class WXDLLEXPORT wxKeyEvent;
26 class WXDLLEXPORT wxLog;
27
28 // Represents the application. Derive OnInit and declare
29 // a new App object to start application
30 class WXDLLEXPORT wxApp : public wxAppBase
31 {
32 DECLARE_DYNAMIC_CLASS(wxApp)
33
34 public:
35 wxApp();
36 virtual ~wxApp();
37
38 // override base class (pure) virtuals
39 virtual int MainLoop();
40 virtual void ExitMainLoop();
41 virtual bool Initialized();
42 virtual bool Pending();
43 virtual void Dispatch();
44 virtual bool Yield(bool onlyIfNeeded = FALSE);
45
46 virtual void SetPrintMode(int mode) { m_printMode = mode; }
47 virtual int GetPrintMode() const { return m_printMode; }
48
49 // implementation only
50 void OnIdle(wxIdleEvent& event);
51 void OnEndSession(wxCloseEvent& event);
52 void OnQueryEndSession(wxCloseEvent& event);
53
54 // Send idle event to all top-level windows.
55 // Returns TRUE if more idle time is requested.
56 bool SendIdleEvents();
57
58 // Send idle event to window and all subwindows
59 // Returns TRUE if more idle time is requested.
60 bool SendIdleEvents(wxWindow* win);
61
62 void SetAuto3D(bool flag) { m_auto3D = flag; }
63 bool GetAuto3D() const { return m_auto3D; }
64
65 protected:
66 bool m_showOnInit;
67 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
68 bool m_auto3D ; // Always use 3D controls, except where overriden
69
70 /* Windows-specific wxApp definitions */
71
72 public:
73
74 // Implementation
75 static bool Initialize();
76 static void CleanUp();
77
78 static bool RegisterWindowClasses();
79 static bool UnregisterWindowClasses();
80
81 // Convert Windows to argc, argv style
82 void ConvertToStandardCommandArgs(const char* p);
83
84 // message processing
85 // ------------------
86
87 // process the given message
88 virtual void DoMessage(WXMSG *pMsg);
89
90 // retrieve the next message from the queue and process it
91 virtual bool DoMessage();
92
93 // preprocess the message
94 virtual bool ProcessMessage(WXMSG* pMsg);
95
96 // idle processing
97 // ---------------
98
99 void DeletePendingObjects();
100 bool ProcessIdle();
101
102 #if wxUSE_RICHEDIT
103 // initialize the richedit DLL of (at least) given version, return TRUE if
104 // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3)
105 static bool InitRichEdit(int version = 2);
106 #endif // wxUSE_RICHEDIT
107
108 // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
109 // wasn't found at all
110 static int GetComCtl32Version();
111
112 public:
113 int m_nCmdShow;
114
115 protected:
116 bool m_keepGoing;
117
118 DECLARE_EVENT_TABLE()
119 };
120
121 #if !defined(_WINDLL) || (defined(_WINDLL) && defined(WXMAKINGDLL))
122 int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance, WXHINSTANCE hPrevInstance,
123 char *lpszCmdLine, int nCmdShow, bool enterLoop = TRUE);
124 #else
125 int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance);
126 #endif
127
128 #endif
129 // _WX_APP_H_
130