]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/display.cpp
don't crash when XIM is used under IRIX
[wxWidgets.git] / src / palmos / display.cpp
CommitLineData
ffecfa5a 1/////////////////////////////////////////////////////////////////////////////
e2731512 2// Name: src/palmos/display.cpp
ffecfa5a 3// Purpose: Palm OS Implementation of wxDisplay class
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10.13.04
e2731512 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ===========================================================================
13// declarations
14// ===========================================================================
15
16// ---------------------------------------------------------------------------
17// headers
18// ---------------------------------------------------------------------------
19
ffecfa5a
JS
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
27#if wxUSE_DISPLAY
28
29#ifndef WX_PRECOMP
30 #include "wx/app.h"
31 #include "wx/dynarray.h"
32 #include "wx/frame.h"
33#endif
34
35#include "wx/dynload.h"
36
37#include "wx/display.h"
38
39// ----------------------------------------------------------------------------
40// macros
41// ----------------------------------------------------------------------------
42
43#ifdef _UNICODE
44 #define WINFUNC(x) _T(#x) L"W"
45#else
46 #define WINFUNC(x) #x "A"
47#endif
48
49// ----------------------------------------------------------------------------
50// private classes
51// ----------------------------------------------------------------------------
52
53class wxDisplayInfo
54{
55public:
56 // handle of this monitor used by MonitorXXX() functions, never NULL
57 HMONITOR m_hmon;
58
59 // IDirectDraw object used to control this display, may be NULL
60 IDirectDraw2 *m_pDD2;
61
62 // DirectDraw GUID for this display, only valid when using DirectDraw
63 GUID m_guid;
64
65 // the entire area of this monitor in virtual screen coordinates
66 wxRect m_rect;
67
68 // the display device name for this monitor, empty initially and retrieved
69 // on demand by DoGetName()
70 wxString m_devName;
71
72 wxDisplayInfo() { m_hmon = NULL; m_pDD2 = NULL; }
73 ~wxDisplayInfo() { if ( m_pDD2 ) m_pDD2->Release(); }
74};
75
76WX_DECLARE_OBJARRAY(wxDisplayInfo, wxDisplayInfoArray);
77#include "wx/arrimpl.cpp"
78WX_DEFINE_OBJARRAY(wxDisplayInfoArray);
79
80// this module is used to cleanup gs_displays array
81class wxDisplayModule : public wxModule
82{
83public:
84 virtual bool OnInit() { return true; }
85 virtual void OnExit();
86
87 DECLARE_DYNAMIC_CLASS(wxDisplayModule)
88};
89
90IMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule)
91
92// ----------------------------------------------------------------------------
93// globals
94// ----------------------------------------------------------------------------
95
96// this is not really MT-unsafe as wxDisplay is only going to be used from the
97// main thread, i.e. we consider that it's a GUI class and so don't protect it
98static wxDisplayInfoArray *gs_displays = NULL;
99
100// ===========================================================================
101// implementation
102// ===========================================================================
103
104// ----------------------------------------------------------------------------
105// local functions
106// ----------------------------------------------------------------------------
107
108// initialize gs_displays using DirectX functions
109static bool DoInitDirectX()
110{
111 return false;
112}
113
114// initialize gs_displays using the standard Windows functions
115static void DoInitStdWindows()
116{
117}
118
119// this function must be called before accessing gs_displays array as it
120// creates and initializes it
121static void InitDisplays()
122{
123}
124
125// convert a DEVMODE to our wxVideoMode
126wxVideoMode ConvertToVideoMode(const DEVMODE& dm)
127{
128 return wxVideoMode(160,
129 160,
130 16,
131 0);
132}
133
134// ----------------------------------------------------------------------------
135// wxDisplayModule
136// ----------------------------------------------------------------------------
137
138void wxDisplayModule::OnExit()
139{
140}
141
142// ---------------------------------------------------------------------------
143// wxDisplay
144// ---------------------------------------------------------------------------
145
146/* static */
147void wxDisplay::UseDirectX(bool useDX)
148{
149}
150
151// helper of GetFromPoint() and GetFromWindow()
152static int DisplayFromHMONITOR(HMONITOR hmon)
153{
154 return wxNOT_FOUND;
155}
156
157/* static */
158size_t wxDisplayBase::GetCount()
159{
160 return 0;
161}
162
163/* static */
164int wxDisplayBase::GetFromPoint ( const wxPoint& pt )
165{
166 return 0;
167}
168
169/* static */
170int wxDisplayBase::GetFromWindow(wxWindow *window)
171{
172 return 0;
173}
174
175// ----------------------------------------------------------------------------
176// wxDisplay ctor/dtor
177// ----------------------------------------------------------------------------
178
179wxDisplay::wxDisplay ( size_t n )
180 : wxDisplayBase ( n )
181{
182}
183
184wxDisplay::~wxDisplay()
185{
186}
187
188// ----------------------------------------------------------------------------
189// wxDisplay simple accessors
190// ----------------------------------------------------------------------------
191
192bool wxDisplay::IsOk() const
193{
194 return false;
195}
196
197wxRect wxDisplay::GetGeometry() const
198{
199 wxRect rect;
200
201 return rect;
202}
203
204wxString wxDisplay::GetName() const
205{
206 wxString ret;
e2731512 207
ffecfa5a
JS
208 return ret;
209}
210
211wxString wxDisplay::GetNameForEnumSettings() const
212{
213 wxString ret;
e2731512 214
ffecfa5a
JS
215 return ret;
216}
217
218// ----------------------------------------------------------------------------
219// video modes enumeration
220// ----------------------------------------------------------------------------
221
222wxArrayVideoModes
223wxDisplay::DoGetModesDirectX(const wxVideoMode& WXUNUSED(modeMatch)) const
224{
225 wxArrayVideoModes modes;
226
227 return modes;
228}
229
230wxArrayVideoModes
231wxDisplay::DoGetModesWindows(const wxVideoMode& modeMatch) const
232{
233 wxArrayVideoModes modes;
234
235 return modes;
236}
237
238wxArrayVideoModes wxDisplay::GetModes(const wxVideoMode& modeMatch) const
239{
240 return gs_useDirectX ? DoGetModesDirectX(modeMatch)
241 : DoGetModesWindows(modeMatch);
242}
243
244wxVideoMode wxDisplay::GetCurrentMode() const
245{
246 wxVideoMode mode;
247
248 return mode;
249}
250
251// ----------------------------------------------------------------------------
252// video mode switching
253// ----------------------------------------------------------------------------
254
255bool wxDisplay::DoChangeModeDirectX(const wxVideoMode& mode)
256{
257 return false;
258}
259
260bool wxDisplay::DoChangeModeWindows(const wxVideoMode& mode)
261{
262 return false;
263}
264
265bool wxDisplay::ChangeMode(const wxVideoMode& mode)
266{
267 return gs_useDirectX ? DoChangeModeDirectX(mode)
268 : DoChangeModeWindows(mode);
269}
270
271#endif // wxUSE_DISPLAY
272