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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18 #pragma interface "displaybase.h"
21 #include "wx/dynarray.h"
22 #include "wx/vidmode.h"
24 class WXDLLEXPORT wxWindow
;
25 class WXDLLEXPORT wxPoint
;
26 class WXDLLEXPORT wxRect
;
27 class WXDLLEXPORT wxString
;
29 WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode
, wxArrayVideoModes
);
31 // default, uninitialized, video mode object
32 WXDLLEXPORT_DATA(extern const wxVideoMode
) wxDefaultVideoMode
;
34 // ----------------------------------------------------------------------------
35 // wxDisplayBase: represents a display/monitor attached to the system
36 // ----------------------------------------------------------------------------
38 class WXDLLEXPORT wxDisplayBase
41 // initialize the object containing all information about the given
44 // the displays are numbered from 0 to GetCount() - 1, 0 is always the
45 // primary display and the only one which is always supported
46 wxDisplayBase(size_t index
= 0);
48 // return the number of available displays, valid parameters to
49 // wxDisplay ctor are from 0 up to this number
50 static size_t GetCount();
52 // find the display where the given point lies, return wxNOT_FOUND if
53 // it doesn't belong to any display
54 static int GetFromPoint(const wxPoint
& pt
);
56 // find the display where the given window lies, return wxNOT_FOUND if it
57 // is not shown at all
58 static int GetFromWindow(wxWindow
*window
);
61 // return true if the object was initialized successfully
62 virtual bool IsOk() const { return true; }
64 // get the display size
65 virtual wxRect
GetGeometry() const = 0;
68 virtual wxString
GetName() const = 0;
70 // display 0 is always the primary display
71 bool IsPrimary() const { return m_index
== 0; }
74 // enumerate all video modes supported by this display matching the given
75 // one (in the sense of wxVideoMode::Match())
77 // as any mode matches the default value of the argument and there is
78 // always at least one video mode supported by display, the returned array
79 // is only empty for the default value of the argument if this function is
80 // not supported at all on this platform
81 virtual wxArrayVideoModes
82 GetModes(const wxVideoMode
& mode
= wxDefaultVideoMode
) const = 0;
84 // get current video mode
85 virtual wxVideoMode
GetCurrentMode() const = 0;
87 // change current mode, return true if succeeded, false otherwise
89 // for the default value of the argument restores the video mode to default
90 virtual bool ChangeMode(const wxVideoMode
& mode
= wxDefaultVideoMode
) = 0;
92 // restore the default video mode (just a more readable synonym)
93 void ResetMode() { (void)ChangeMode(); }
95 // virtual dtor as for any base class
96 virtual ~wxDisplayBase() { }
99 // the index of this display (0 is always the primary one)
102 DECLARE_NO_COPY_CLASS(wxDisplayBase
)
106 #if defined(__WXMSW__)
107 #include "wx/msw/display.h"
108 #elif defined(__WXMOTIF__)
109 #include "wx/unix/displayx11.h"
110 #elif defined(__WXGTK__)
111 #include "wx/unix/displayx11.h"
112 #elif defined(__WXX11__)
113 #include "wx/unix/displayx11.h"
114 #elif defined(__WXCOCOA__)
115 #include "wx/cocoa/display.h"
116 #elif defined(__WXMAC__)
117 #include "wx/mac/display.h"
118 #elif defined(__WXPM__)
119 #include "wx/os2/display.h"
122 #endif // wxUSE_DISPLAY
124 #endif // _WX_DISPLAY_H_BASE_