]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/display.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Palm OS Implementation of wxDisplay class
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "display.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
35 #include "wx/dynarray.h"
39 #include "wx/dynload.h"
41 #include "wx/display.h"
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
48 #define WINFUNC(x) _T(#x) L"W"
50 #define WINFUNC(x) #x "A"
53 // ----------------------------------------------------------------------------
55 // ----------------------------------------------------------------------------
60 // handle of this monitor used by MonitorXXX() functions, never NULL
63 // IDirectDraw object used to control this display, may be NULL
66 // DirectDraw GUID for this display, only valid when using DirectDraw
69 // the entire area of this monitor in virtual screen coordinates
72 // the display device name for this monitor, empty initially and retrieved
73 // on demand by DoGetName()
76 wxDisplayInfo() { m_hmon
= NULL
; m_pDD2
= NULL
; }
77 ~wxDisplayInfo() { if ( m_pDD2
) m_pDD2
->Release(); }
80 WX_DECLARE_OBJARRAY(wxDisplayInfo
, wxDisplayInfoArray
);
81 #include "wx/arrimpl.cpp"
82 WX_DEFINE_OBJARRAY(wxDisplayInfoArray
);
84 // this module is used to cleanup gs_displays array
85 class wxDisplayModule
: public wxModule
88 virtual bool OnInit() { return true; }
89 virtual void OnExit();
91 DECLARE_DYNAMIC_CLASS(wxDisplayModule
)
94 IMPLEMENT_DYNAMIC_CLASS(wxDisplayModule
, wxModule
)
96 // ----------------------------------------------------------------------------
98 // ----------------------------------------------------------------------------
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
;
104 // ===========================================================================
106 // ===========================================================================
108 // ----------------------------------------------------------------------------
110 // ----------------------------------------------------------------------------
112 // initialize gs_displays using DirectX functions
113 static bool DoInitDirectX()
118 // initialize gs_displays using the standard Windows functions
119 static void DoInitStdWindows()
123 // this function must be called before accessing gs_displays array as it
124 // creates and initializes it
125 static void InitDisplays()
129 // convert a DEVMODE to our wxVideoMode
130 wxVideoMode
ConvertToVideoMode(const DEVMODE
& dm
)
132 return wxVideoMode(160,
138 // ----------------------------------------------------------------------------
140 // ----------------------------------------------------------------------------
142 void wxDisplayModule::OnExit()
146 // ---------------------------------------------------------------------------
148 // ---------------------------------------------------------------------------
151 void wxDisplay::UseDirectX(bool useDX
)
155 // helper of GetFromPoint() and GetFromWindow()
156 static int DisplayFromHMONITOR(HMONITOR hmon
)
162 size_t wxDisplayBase::GetCount()
168 int wxDisplayBase::GetFromPoint ( const wxPoint
& pt
)
174 int wxDisplayBase::GetFromWindow(wxWindow
*window
)
179 // ----------------------------------------------------------------------------
180 // wxDisplay ctor/dtor
181 // ----------------------------------------------------------------------------
183 wxDisplay::wxDisplay ( size_t n
)
184 : wxDisplayBase ( n
)
188 wxDisplay::~wxDisplay()
192 // ----------------------------------------------------------------------------
193 // wxDisplay simple accessors
194 // ----------------------------------------------------------------------------
196 bool wxDisplay::IsOk() const
201 wxRect
wxDisplay::GetGeometry() const
208 wxString
wxDisplay::GetName() const
215 wxString
wxDisplay::GetNameForEnumSettings() const
222 // ----------------------------------------------------------------------------
223 // video modes enumeration
224 // ----------------------------------------------------------------------------
227 wxDisplay::DoGetModesDirectX(const wxVideoMode
& WXUNUSED(modeMatch
)) const
229 wxArrayVideoModes modes
;
235 wxDisplay::DoGetModesWindows(const wxVideoMode
& modeMatch
) const
237 wxArrayVideoModes modes
;
242 wxArrayVideoModes
wxDisplay::GetModes(const wxVideoMode
& modeMatch
) const
244 return gs_useDirectX
? DoGetModesDirectX(modeMatch
)
245 : DoGetModesWindows(modeMatch
);
248 wxVideoMode
wxDisplay::GetCurrentMode() const
255 // ----------------------------------------------------------------------------
256 // video mode switching
257 // ----------------------------------------------------------------------------
259 bool wxDisplay::DoChangeModeDirectX(const wxVideoMode
& mode
)
264 bool wxDisplay::DoChangeModeWindows(const wxVideoMode
& mode
)
269 bool wxDisplay::ChangeMode(const wxVideoMode
& mode
)
271 return gs_useDirectX
? DoChangeModeDirectX(mode
)
272 : DoChangeModeWindows(mode
);
275 #endif // wxUSE_DISPLAY