]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/app.h
set background to white. EVT_CHAR still doesn't work in MSW though.
[wxWidgets.git] / include / wx / motif / app.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: app.h
3// Purpose: wxApp class
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
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/gdicmn.h"
22#include "wx/event.h"
23
24class WXDLLEXPORT wxFrame;
25class WXDLLEXPORT wxWindow;
26class WXDLLEXPORT wxApp ;
27class WXDLLEXPORT wxKeyEvent;
28class WXDLLEXPORT wxLog;
29
30#define wxPRINT_WINDOWS 1
31#define wxPRINT_POSTSCRIPT 2
32
33WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
34
35// Force an exit from main loop
36void WXDLLEXPORT wxExit();
37
38// Yield to other apps/messages
39bool WXDLLEXPORT wxYield();
40
41// Represents the application. Derive OnInit and declare
42// a new App object to start application
43class WXDLLEXPORT wxApp: public wxEvtHandler
44{
45 DECLARE_DYNAMIC_CLASS(wxApp)
46 wxApp();
47 inline ~wxApp() {}
48
49 static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
50 static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; }
51
52 virtual int MainLoop();
53 void ExitMainLoop();
54 bool Initialized();
55 virtual bool Pending() ;
56 virtual void Dispatch() ;
57
58 void OnIdle(wxIdleEvent& event);
59
60// Generic
61 virtual bool OnInit() { return FALSE; };
62
63 // Create an application context
64 virtual bool OnInitGui();
65
66 // Called to set off the main loop
67 virtual int OnRun() { return MainLoop(); };
68 virtual int OnExit() { return 0; }
69
70 inline void SetPrintMode(int mode) { m_printMode = mode; }
71 inline int GetPrintMode() const { return m_printMode; }
72
73 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
74 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
75
76 inline wxString GetAppName() const {
77 if (m_appName != "")
78 return m_appName;
79 else return m_className;
80 }
81
82 inline void SetAppName(const wxString& name) { m_appName = name; };
83 inline wxString GetClassName() const { return m_className; }
84 inline void SetClassName(const wxString& name) { m_className = name; }
85
86 void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
87 const wxString& GetVendorName() const { return m_vendorName; }
88
89 wxWindow *GetTopWindow() const ;
90 inline void SetTopWindow(wxWindow *win) { m_topWindow = win; }
91
92 inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
93 inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
94
95 // Send idle event to all top-level windows.
96 // Returns TRUE if more idle time is requested.
97 bool SendIdleEvents();
98
99 // Send idle event to window and all subwindows
100 // Returns TRUE if more idle time is requested.
101 bool SendIdleEvents(wxWindow* win);
102
103 // Windows only, but for compatibility...
104 inline void SetAuto3D(bool flag) { m_auto3D = flag; }
105 inline bool GetAuto3D() const { return m_auto3D; }
106
107 // Creates a log object
108 virtual wxLog* CreateLogTarget();
109
8aa04e8b
JS
110// Motif implementation.
111
112 // Processes an X event.
113 virtual void ProcessXEvent(WXEvent* event);
114
115 // Returns TRUE if an accelerator has been processed
116 virtual bool CheckForAccelerator(WXEvent* event);
117
9b6dbb09
JS
118public:
119 // Will always be set to the appropriate, main-style values.
120 int argc;
121 char ** argv;
122
123protected:
124 bool m_wantDebugOutput ;
125 wxString m_className;
126 wxString m_appName,
127 m_vendorName;
128 wxWindow * m_topWindow;
129 bool m_exitOnFrameDelete;
130 bool m_showOnInit;
131 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
132 bool m_auto3D ; // Always use 3D controls, except
133 // where overriden
134 static wxAppInitializerFunction m_appInitFn;
135
136public:
137
138 // Implementation
139 static bool Initialize();
140 static void CleanUp();
141
142 void DeletePendingObjects();
143 bool ProcessIdle();
144
145 // Motif-specific
146 inline WXAppContext GetAppContext() const { return m_appContext; }
147 inline WXWidget GetTopLevelWidget() const { return m_topLevelWidget; }
148 WXColormap GetMainColormap(WXDisplay* display) ;
47bc1060 149 WXDisplay* GetInitialDisplay() const { return m_initialDisplay; }
9b6dbb09
JS
150 inline long GetMaxRequestSize() const { return m_maxRequestSize; }
151
152 // This handler is called when a property change event occurs
153 virtual void HandlePropertyChange(WXEvent *event);
154
155public:
156 static long sm_lastMessageTime;
157 int m_nCmdShow;
158
159protected:
160 bool m_keepGoing ;
161
162// Motif-specific
163 WXAppContext m_appContext;
164 WXWidget m_topLevelWidget;
165 WXColormap m_mainColormap;
47bc1060 166 WXDisplay* m_initialDisplay;
9b6dbb09
JS
167 long m_maxRequestSize;
168
169DECLARE_EVENT_TABLE()
170};
171
172int WXDLLEXPORT wxEntry( int argc, char *argv[] );
173
174#endif
175 // _WX_APP_H_
176