]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/app.h
Some work for wxX11 on 8-bit visuals.
[wxWidgets.git] / include / wx / x11 / app.h
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 // ----------------------------------------------------------------------------
20 // headers
21 // ----------------------------------------------------------------------------
22
23 #include "wx/gdicmn.h"
24 #include "wx/event.h"
25
26 // ----------------------------------------------------------------------------
27 // forward declarations
28 // ----------------------------------------------------------------------------
29
30 class WXDLLEXPORT wxFrame;
31 class WXDLLEXPORT wxWindow;
32 class WXDLLEXPORT wxApp;
33 class WXDLLEXPORT wxKeyEvent;
34 class WXDLLEXPORT wxLog;
35 class WXDLLEXPORT wxEventLoop;
36
37 // ----------------------------------------------------------------------------
38 // the wxApp class for wxX11 - see wxAppBase for more details
39 // ----------------------------------------------------------------------------
40
41 class WXDLLEXPORT wxApp : public wxAppBase
42 {
43 DECLARE_DYNAMIC_CLASS(wxApp)
44
45 public:
46 wxApp();
47 ~wxApp();
48
49 // override base class (pure) virtuals
50 // -----------------------------------
51
52 virtual int MainLoop();
53 virtual void ExitMainLoop();
54 virtual bool Initialized();
55 virtual bool Pending();
56 virtual void Dispatch();
57 virtual bool Yield(bool onlyIfNeeded = FALSE);
58
59 virtual bool OnInitGui();
60
61 // implementation from now on
62 // --------------------------
63
64 void OnIdle(wxIdleEvent& event);
65
66 // Send idle event to all top-level windows.
67 // Returns TRUE if more idle time is requested.
68 bool SendIdleEvents();
69
70 // Send idle event to window and all subwindows
71 // Returns TRUE if more idle time is requested.
72 bool SendIdleEvents(wxWindow* win);
73
74 // Processes an X event.
75 virtual bool ProcessXEvent(WXEvent* event);
76
77 virtual void OnAssert(const wxChar *file, int line, const wxChar *msg);
78
79 protected:
80 bool m_showOnInit;
81
82 public:
83 // Implementation
84 static bool Initialize();
85 static void CleanUp();
86
87 void DeletePendingObjects();
88 bool ProcessIdle();
89
90 WXWindow GetTopLevelWidget() const { return m_topLevelWidget; }
91 WXColormap GetMainColormap(WXDisplay* display);
92 long GetMaxRequestSize() const { return m_maxRequestSize; }
93
94 // This handler is called when a property change event occurs
95 virtual bool HandlePropertyChange(WXEvent *event);
96
97 // Values that can be passed on the command line.
98 // Returns -1, -1 if none specified.
99 const wxSize& GetInitialSize() const { return m_initialSize; }
100 bool GetShowIconic() const { return m_showIconic; }
101
102 // We need this before creating the app
103 static WXDisplay* GetDisplay() { return ms_display; }
104 static WXDisplay* ms_display;
105
106 public:
107 static long sm_lastMessageTime;
108 bool m_showIconic;
109 wxSize m_initialSize;
110
111 // Someone find a better place for these
112 int m_visualType; // TrueColor, DirectColor etc.
113 int m_visualDepth;
114 int m_visualColormapSize;
115 void *m_visualColormap;
116 int m_visualScreen;
117 unsigned long m_visualRedMask;
118 unsigned long m_visualGreenMask;
119 unsigned long m_visualBlueMask;
120 int m_visualRedShift;
121 int m_visualGreenShift;
122 int m_visualBlueShift;
123 int m_visualRedPrec;
124 int m_visualGreenPrec;
125 int m_visualBluePrec;
126
127 unsigned char *m_colorCube;
128
129 protected:
130 bool m_keepGoing;
131
132 WXWindow m_topLevelWidget;
133 WXColormap m_mainColormap;
134 long m_maxRequestSize;
135 wxEventLoop* m_mainLoop;
136
137 DECLARE_EVENT_TABLE()
138 };
139
140 int WXDLLEXPORT wxEntry( int argc, char *argv[] );
141
142 #endif
143 // _WX_APP_H_
144