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