]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/app.h
* New wxStreams (to be documented), new classes: wxBufferedStreams,
[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 #include "wx/event.h"
22 #include "wx/icon.h"
23
24 class WXDLLEXPORT wxFrame;
25 class WXDLLEXPORT wxWindow;
26 class WXDLLEXPORT wxApp ;
27 class WXDLLEXPORT wxKeyEvent;
28 class WXDLLEXPORT wxLog;
29
30 WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
31
32 // Force an exit from main loop
33 void WXDLLEXPORT wxExit();
34
35 // Yield to other apps/messages
36 bool WXDLLEXPORT wxYield();
37
38 // Represents the application. Derive OnInit and declare
39 // a new App object to start application
40 class WXDLLEXPORT wxApp : public wxAppBase
41 {
42 DECLARE_DYNAMIC_CLASS(wxApp)
43
44 public:
45 wxApp();
46 virtual ~wxApp();
47
48 // override base class (pure) virtuals
49 virtual int MainLoop();
50 virtual void ExitMainLoop();
51 virtual bool Initialized();
52 virtual bool Pending() ;
53 virtual void Dispatch() ;
54
55 virtual wxIcon GetStdIcon(int which) const;
56
57 virtual void SetPrintMode(int mode) { m_printMode = mode; }
58 virtual int GetPrintMode() const { return m_printMode; }
59
60 // implementation only
61 void OnIdle(wxIdleEvent& event);
62 void OnEndSession(wxCloseEvent& event);
63 void OnQueryEndSession(wxCloseEvent& event);
64
65 // Send idle event to all top-level windows.
66 // Returns TRUE if more idle time is requested.
67 bool SendIdleEvents();
68
69 // Send idle event to window and all subwindows
70 // Returns TRUE if more idle time is requested.
71 bool SendIdleEvents(wxWindow* win);
72
73 void SetAuto3D(bool flag) { m_auto3D = flag; }
74 bool GetAuto3D() const { return m_auto3D; }
75
76 protected:
77 bool m_showOnInit;
78 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
79 bool m_auto3D ; // Always use 3D controls, except where overriden
80
81 /* Windows-specific wxApp definitions */
82
83 public:
84
85 // Implementation
86 static bool Initialize();
87 static void CleanUp();
88
89 static bool RegisterWindowClasses();
90 // Convert Windows to argc, argv style
91 void ConvertToStandardCommandArgs(char* p);
92 virtual bool DoMessage();
93 virtual bool ProcessMessage(WXMSG* pMsg);
94 void DeletePendingObjects();
95 bool ProcessIdle();
96 #if wxUSE_THREADS
97 void ProcessPendingEvents();
98 #endif
99 int GetComCtl32Version() const;
100
101 public:
102 int m_nCmdShow;
103
104 protected:
105 bool m_keepGoing ;
106
107 DECLARE_EVENT_TABLE()
108 };
109
110 #if !defined(_WINDLL) || (defined(_WINDLL) && defined(WXMAKINGDLL))
111 int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance, WXHINSTANCE hPrevInstance, char *lpszCmdLine,
112 int nCmdShow, bool enterLoop = TRUE);
113 #else
114 int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance);
115 #endif
116
117 #endif
118 // _WX_APP_H_
119