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