1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDisplay class
4 // Author: Royce Mitchell III
5 // Modified by: Vadim Zeitlin (resolution changes, display modes, ...)
8 // Copyright: (c) 2002-2003 wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DISPLAY_H_BASE_
13 #define _WX_DISPLAY_H_BASE_
17 #include "wx/dynarray.h"
18 #include "wx/vidmode.h"
20 class WXDLLEXPORT wxWindow
;
21 class WXDLLEXPORT wxPoint
;
22 class WXDLLEXPORT wxRect
;
23 class WXDLLEXPORT wxString
;
25 WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode
, wxArrayVideoModes
);
27 // default, uninitialized, video mode object
28 extern WXDLLEXPORT_DATA(const wxVideoMode
) wxDefaultVideoMode
;
30 // ----------------------------------------------------------------------------
31 // wxDisplayBase: represents a display/monitor attached to the system
32 // ----------------------------------------------------------------------------
34 class WXDLLEXPORT wxDisplayBase
37 // initialize the object containing all information about the given
40 // the displays are numbered from 0 to GetCount() - 1, 0 is always the
41 // primary display and the only one which is always supported
42 wxDisplayBase(size_t index
= 0);
44 // return the number of available displays, valid parameters to
45 // wxDisplay ctor are from 0 up to this number
46 static size_t GetCount();
48 // find the display where the given point lies, return wxNOT_FOUND if
49 // it doesn't belong to any display
50 static int GetFromPoint(const wxPoint
& pt
);
52 // find the display where the given window lies, return wxNOT_FOUND if it
53 // is not shown at all
54 static int GetFromWindow(wxWindow
*window
);
57 // return true if the object was initialized successfully
58 virtual bool IsOk() const { return true; }
60 // get the display size
61 virtual wxRect
GetGeometry() const = 0;
64 virtual wxString
GetName() const = 0;
66 // display 0 is usually the primary display
67 virtual bool IsPrimary() const { return m_index
== 0; }
70 // enumerate all video modes supported by this display matching the given
71 // one (in the sense of wxVideoMode::Match())
73 // as any mode matches the default value of the argument and there is
74 // always at least one video mode supported by display, the returned array
75 // is only empty for the default value of the argument if this function is
76 // not supported at all on this platform
77 virtual wxArrayVideoModes
78 GetModes(const wxVideoMode
& mode
= wxDefaultVideoMode
) const = 0;
80 // get current video mode
81 virtual wxVideoMode
GetCurrentMode() const = 0;
83 // change current mode, return true if succeeded, false otherwise
85 // for the default value of the argument restores the video mode to default
86 virtual bool ChangeMode(const wxVideoMode
& mode
= wxDefaultVideoMode
) = 0;
88 // restore the default video mode (just a more readable synonym)
89 void ResetMode() { (void)ChangeMode(); }
91 // virtual dtor as for any base class
92 virtual ~wxDisplayBase() { }
95 // the index of this display (0 is always the primary one)
98 DECLARE_NO_COPY_CLASS(wxDisplayBase
)
102 #if defined(__WXMSW__)
103 #include "wx/msw/display.h"
104 #elif defined(__WXMOTIF__)
105 #include "wx/unix/displayx11.h"
106 #elif defined(__WXGTK__)
107 #include "wx/unix/displayx11.h"
108 #elif defined(__WXX11__)
109 #include "wx/unix/displayx11.h"
110 #elif defined(__WXCOCOA__)
111 #include "wx/cocoa/display.h"
112 #elif defined(__WXMAC__)
113 #include "wx/mac/display.h"
114 #elif defined(__WXPM__)
115 #include "wx/os2/display.h"
116 #elif defined(__WXMGL__)
117 #include "wx/mgl/display.h"
120 #endif // wxUSE_DISPLAY
122 #endif // _WX_DISPLAY_H_BASE_