]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/display.cpp
Added missing include
[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 // 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
53 class wxDisplayInfo
54 {
55 public:
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
76 WX_DECLARE_OBJARRAY(wxDisplayInfo, wxDisplayInfoArray);
77 #include "wx/arrimpl.cpp"
78 WX_DEFINE_OBJARRAY(wxDisplayInfoArray);
79
80 // this module is used to cleanup gs_displays array
81 class wxDisplayModule : public wxModule
82 {
83 public:
84 virtual bool OnInit() { return true; }
85 virtual void OnExit();
86
87 DECLARE_DYNAMIC_CLASS(wxDisplayModule)
88 };
89
90 IMPLEMENT_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
98 static wxDisplayInfoArray *gs_displays = NULL;
99
100 // ===========================================================================
101 // implementation
102 // ===========================================================================
103
104 // ----------------------------------------------------------------------------
105 // local functions
106 // ----------------------------------------------------------------------------
107
108 // initialize gs_displays using DirectX functions
109 static bool DoInitDirectX()
110 {
111 return false;
112 }
113
114 // initialize gs_displays using the standard Windows functions
115 static void DoInitStdWindows()
116 {
117 }
118
119 // this function must be called before accessing gs_displays array as it
120 // creates and initializes it
121 static void InitDisplays()
122 {
123 }
124
125 // convert a DEVMODE to our wxVideoMode
126 wxVideoMode ConvertToVideoMode(const DEVMODE& dm)
127 {
128 return wxVideoMode(160,
129 160,
130 16,
131 0);
132 }
133
134 // ----------------------------------------------------------------------------
135 // wxDisplayModule
136 // ----------------------------------------------------------------------------
137
138 void wxDisplayModule::OnExit()
139 {
140 }
141
142 // ---------------------------------------------------------------------------
143 // wxDisplay
144 // ---------------------------------------------------------------------------
145
146 /* static */
147 void wxDisplay::UseDirectX(bool useDX)
148 {
149 }
150
151 // helper of GetFromPoint() and GetFromWindow()
152 static int DisplayFromHMONITOR(HMONITOR hmon)
153 {
154 return wxNOT_FOUND;
155 }
156
157 /* static */
158 size_t wxDisplayBase::GetCount()
159 {
160 return 0;
161 }
162
163 /* static */
164 int wxDisplayBase::GetFromPoint ( const wxPoint& pt )
165 {
166 return 0;
167 }
168
169 /* static */
170 int wxDisplayBase::GetFromWindow(wxWindow *window)
171 {
172 return 0;
173 }
174
175 // ----------------------------------------------------------------------------
176 // wxDisplay ctor/dtor
177 // ----------------------------------------------------------------------------
178
179 wxDisplay::wxDisplay ( size_t n )
180 : wxDisplayBase ( n )
181 {
182 }
183
184 wxDisplay::~wxDisplay()
185 {
186 }
187
188 // ----------------------------------------------------------------------------
189 // wxDisplay simple accessors
190 // ----------------------------------------------------------------------------
191
192 bool wxDisplay::IsOk() const
193 {
194 return false;
195 }
196
197 wxRect wxDisplay::GetGeometry() const
198 {
199 wxRect rect;
200
201 return rect;
202 }
203
204 wxString wxDisplay::GetName() const
205 {
206 wxString ret;
207
208 return ret;
209 }
210
211 wxString wxDisplay::GetNameForEnumSettings() const
212 {
213 wxString ret;
214
215 return ret;
216 }
217
218 // ----------------------------------------------------------------------------
219 // video modes enumeration
220 // ----------------------------------------------------------------------------
221
222 wxArrayVideoModes
223 wxDisplay::DoGetModesDirectX(const wxVideoMode& WXUNUSED(modeMatch)) const
224 {
225 wxArrayVideoModes modes;
226
227 return modes;
228 }
229
230 wxArrayVideoModes
231 wxDisplay::DoGetModesWindows(const wxVideoMode& modeMatch) const
232 {
233 wxArrayVideoModes modes;
234
235 return modes;
236 }
237
238 wxArrayVideoModes wxDisplay::GetModes(const wxVideoMode& modeMatch) const
239 {
240 return gs_useDirectX ? DoGetModesDirectX(modeMatch)
241 : DoGetModesWindows(modeMatch);
242 }
243
244 wxVideoMode wxDisplay::GetCurrentMode() const
245 {
246 wxVideoMode mode;
247
248 return mode;
249 }
250
251 // ----------------------------------------------------------------------------
252 // video mode switching
253 // ----------------------------------------------------------------------------
254
255 bool wxDisplay::DoChangeModeDirectX(const wxVideoMode& mode)
256 {
257 return false;
258 }
259
260 bool wxDisplay::DoChangeModeWindows(const wxVideoMode& mode)
261 {
262 return false;
263 }
264
265 bool wxDisplay::ChangeMode(const wxVideoMode& mode)
266 {
267 return gs_useDirectX ? DoChangeModeDirectX(mode)
268 : DoChangeModeWindows(mode);
269 }
270
271 #endif // wxUSE_DISPLAY
272