1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDisplay class
4 // Author: Royce Mitchell III
5 // Modified by: Vadim Zeitlin (resolution changes, display modes, ...)
8 // Copyright: (c) 2002-2003 wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DISPLAY_H_BASE_
13 #define _WX_DISPLAY_H_BASE_
17 #if defined(__GNUG__) && !defined(__APPLE__)
18 #pragma interface "displaybase.h"
21 #include "wx/dynarray.h"
23 // ----------------------------------------------------------------------------
24 // wxVideoMode: contains video mode parameters for a display
25 // ----------------------------------------------------------------------------
27 struct WXDLLEXPORT wxVideoMode
29 wxVideoMode(int width
= 0, int height
= 0, int depth
= 0, int freq
= 0)
39 // default copy ctor and assignment operator are ok
41 bool operator==(const wxVideoMode
& m
) const
43 return w
== m
.w
&& h
== m
.h
&& bpp
== m
.bpp
&& refresh
== m
.refresh
;
45 bool operator!=(const wxVideoMode
& mode
) const
47 return !operator==(mode
);
50 // returns true if this mode matches the other one in the sense that all
51 // non zero fields of the other mode have the same value in this one
52 // (except for refresh which is allowed to have a greater value)
53 bool Matches(const wxVideoMode
& other
) const
55 return (!other
.w
|| w
== other
.w
) &&
56 (!other
.h
|| h
== other
.h
) &&
57 (!other
.bpp
|| bpp
== other
.bpp
) &&
58 (!other
.refresh
|| refresh
>= other
.refresh
);
61 // the screen size in pixels (e.g. 640*480), 0 means unspecified
64 // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
67 // refresh frequency in Hz, 0 means unspecified/unknown
71 WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode
, wxArrayVideoModes
);
73 // default, uninitialized, video mode object
74 WXDLLEXPORT_DATA(extern const wxVideoMode
) wxDefaultVideoMode
;
76 // ----------------------------------------------------------------------------
77 // wxDisplayBase: represents a display/monitor attached to the system
78 // ----------------------------------------------------------------------------
80 class WXDLLEXPORT wxDisplayBase
83 // initialize the object containing all information about the given
86 // the displays are numbered from 0 to GetCount() - 1, 0 is always the
87 // primary display and the only one which is always supported
88 wxDisplayBase(size_t index
= 0);
90 // return the number of available displays, valid parameters to
91 // wxDisplay ctor are from 0 up to this number
92 static size_t GetCount();
94 // find the display where the given point lies, return wxNOT_FOUND if
95 // it doesn't belong to any display
96 static int GetFromPoint(const wxPoint
& pt
);
98 // find the display where the given window lies, return wxNOT_FOUND if it
99 // is not shown at all
100 static int GetFromWindow(wxWindow
*window
);
103 // get the display size
104 virtual wxRect
GetGeometry() const = 0;
107 virtual wxString
GetName() const = 0;
109 // display 0 is always the primary display
110 bool IsPrimary() const { return m_index
== 0; }
113 // enumerate all video modes supported by this display matching the given
114 // one (in the sense of wxVideoMode::Match())
116 // as any mode matches the default value of the argument and there is
117 // always at least one video mode supported by display, the returned array
118 // is only empty for the default value of the argument if this function is
119 // not supported at all on this platform
120 virtual wxArrayVideoModes
121 GetModes(const wxVideoMode
& mode
= wxDefaultVideoMode
) const = 0;
123 // get current video mode
124 virtual wxVideoMode
GetCurrentMode() const = 0;
126 // change current mode, return true if succeeded, false otherwise
128 // for the default value of the argument restores the video mode to default
129 virtual bool ChangeMode(const wxVideoMode
& mode
= wxDefaultVideoMode
) = 0;
131 // restore the default video mode (just a more readable synonym)
132 void ResetMode() { (void)ChangeMode(); }
134 // virtual dtor as for any base class
135 virtual ~wxDisplayBase() { }
138 // the index of this display (0 is always the primary one)
141 DECLARE_NO_COPY_CLASS(wxDisplayBase
);
145 #if defined(__WXMSW__)
146 #include "wx/msw/display.h"
147 #elif defined(__WXMOTIF__)
148 #include "wx/motif/display.h"
149 #elif defined(__WXGTK__)
150 #include "wx/gtk/display.h"
151 #elif defined(__WXMAC__)
152 #include "wx/mac/display.h"
153 #elif defined(__WXPM__)
154 #include "wx/os2/display.h"
157 #endif // wxUSE_DISPLAY
159 #endif // _WX_DISPLAY_H_BASE_