]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/app.h
Moved the cleanup code to an EVT_WINDOW_DESTROY handler.
[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__
83df96d6 16#pragma interface "app.h"
9b6dbb09
JS
17#endif
18
ee31c392
VZ
19// ----------------------------------------------------------------------------
20// headers
21// ----------------------------------------------------------------------------
22
9b6dbb09
JS
23#include "wx/gdicmn.h"
24#include "wx/event.h"
25
ee31c392
VZ
26// ----------------------------------------------------------------------------
27// forward declarations
28// ----------------------------------------------------------------------------
29
9b6dbb09
JS
30class WXDLLEXPORT wxFrame;
31class WXDLLEXPORT wxWindow;
72cdf4c9 32class WXDLLEXPORT wxApp;
9b6dbb09
JS
33class WXDLLEXPORT wxKeyEvent;
34class WXDLLEXPORT wxLog;
35
ee31c392
VZ
36// ----------------------------------------------------------------------------
37// the wxApp class for Motif - see wxAppBase for more details
38// ----------------------------------------------------------------------------
9b6dbb09 39
ee31c392 40class WXDLLEXPORT wxApp : public wxAppBase
9b6dbb09 41{
83df96d6
JS
42 DECLARE_DYNAMIC_CLASS(wxApp)
43
ee31c392
VZ
44public:
45 wxApp();
46 ~wxApp() {}
83df96d6 47
ee31c392
VZ
48 // override base class (pure) virtuals
49 // -----------------------------------
83df96d6 50
ee31c392
VZ
51 virtual int MainLoop();
52 virtual void ExitMainLoop();
53 virtual bool Initialized();
72cdf4c9
VZ
54 virtual bool Pending();
55 virtual void Dispatch();
8461e4c2 56 virtual bool Yield(bool onlyIfNeeded = FALSE);
83df96d6 57
ee31c392 58 virtual bool OnInitGui();
83df96d6 59
ee31c392
VZ
60 // implementation from now on
61 // --------------------------
83df96d6 62
ee31c392 63 void OnIdle(wxIdleEvent& event);
83df96d6 64
ee31c392
VZ
65 // Send idle event to all top-level windows.
66 // Returns TRUE if more idle time is requested.
67 bool SendIdleEvents();
83df96d6 68
ee31c392
VZ
69 // Send idle event to window and all subwindows
70 // Returns TRUE if more idle time is requested.
71 bool SendIdleEvents(wxWindow* win);
83df96d6 72
ee31c392 73 // Motif implementation.
83df96d6 74
ee31c392
VZ
75 // Processes an X event.
76 virtual void ProcessXEvent(WXEvent* event);
83df96d6 77
ee31c392
VZ
78 // Returns TRUE if an accelerator has been processed
79 virtual bool CheckForAccelerator(WXEvent* event);
83df96d6 80
ee31c392
VZ
81 // Returns TRUE if a key down event has been processed
82 virtual bool CheckForKeyDown(WXEvent* event);
83df96d6 83
e2e04ea4
MB
84 // Returns TRUE if a key up event has been processed
85 virtual bool CheckForKeyUp(WXEvent* event);
83df96d6 86
9b6dbb09 87protected:
ee31c392 88 bool m_showOnInit;
83df96d6 89
9b6dbb09 90public:
ee31c392
VZ
91 // Implementation
92 static bool Initialize();
93 static void CleanUp();
83df96d6 94
ee31c392
VZ
95 void DeletePendingObjects();
96 bool ProcessIdle();
83df96d6 97
ee31c392
VZ
98 // Motif-specific
99 WXAppContext GetAppContext() const { return m_appContext; }
100 WXWidget GetTopLevelWidget() const { return m_topLevelWidget; }
72cdf4c9 101 WXColormap GetMainColormap(WXDisplay* display);
ee31c392
VZ
102 WXDisplay* GetInitialDisplay() const { return m_initialDisplay; }
103 long GetMaxRequestSize() const { return m_maxRequestSize; }
83df96d6 104
ee31c392
VZ
105 // This handler is called when a property change event occurs
106 virtual void HandlePropertyChange(WXEvent *event);
83df96d6 107
9b6dbb09 108public:
ee31c392
VZ
109 static long sm_lastMessageTime;
110 int m_nCmdShow;
83df96d6 111
9b6dbb09 112protected:
72cdf4c9 113 bool m_keepGoing;
83df96d6 114
ee31c392
VZ
115 // Motif-specific
116 WXAppContext m_appContext;
117 WXWidget m_topLevelWidget;
118 WXColormap m_mainColormap;
119 WXDisplay* m_initialDisplay;
120 long m_maxRequestSize;
83df96d6 121
ee31c392 122 DECLARE_EVENT_TABLE()
9b6dbb09
JS
123};
124
125int WXDLLEXPORT wxEntry( int argc, char *argv[] );
126
127#endif
83df96d6 128// _WX_APP_H_
9b6dbb09 129