1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDisplay class
4 // Author: Royce Mitchell III, Vadim Zeitlin
7 // Copyright: (c) 2002-2006 wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DISPLAY_H_BASE_
12 #define _WX_DISPLAY_H_BASE_
14 // NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but
15 // not the video mode stuff) is always available but if wxUSE_DISPLAY == 0
16 // it becomes just a trivial wrapper around the old wxDisplayXXX() functions
19 #include "wx/dynarray.h"
20 #include "wx/vidmode.h"
22 WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode
, wxArrayVideoModes
);
24 // default, uninitialized, video mode object
25 extern WXDLLEXPORT_DATA(const wxVideoMode
) wxDefaultVideoMode
;
26 #endif // wxUSE_DISPLAY
28 class WXDLLIMPEXP_FWD_CORE wxWindow
;
29 class WXDLLIMPEXP_FWD_CORE wxPoint
;
30 class WXDLLIMPEXP_FWD_CORE wxRect
;
31 class WXDLLIMPEXP_FWD_BASE wxString
;
33 class WXDLLIMPEXP_FWD_CORE wxDisplayFactory
;
34 class WXDLLIMPEXP_FWD_CORE wxDisplayImpl
;
36 // ----------------------------------------------------------------------------
37 // wxDisplay: represents a display/monitor attached to the system
38 // ----------------------------------------------------------------------------
40 class WXDLLEXPORT wxDisplay
43 // initialize the object containing all information about the given
46 // the displays are numbered from 0 to GetCount() - 1, 0 is always the
47 // primary display and the only one which is always supported
48 wxDisplay(unsigned n
= 0);
50 // dtor is not virtual as this is a concrete class not meant to be derived
55 // return the number of available displays, valid parameters to
56 // wxDisplay ctor are from 0 up to this number
57 static unsigned GetCount();
59 // find the display where the given point lies, return wxNOT_FOUND if
60 // it doesn't belong to any display
61 static int GetFromPoint(const wxPoint
& pt
);
63 // find the display where the given window lies, return wxNOT_FOUND if it
64 // is not shown at all
65 static int GetFromWindow(const wxWindow
*window
);
68 // return true if the object was initialized successfully
69 bool IsOk() const { return m_impl
!= NULL
; }
71 // get the full display size
72 wxRect
GetGeometry() const;
74 // get the client area of the display, i.e. without taskbars and such
75 wxRect
GetClientArea() const;
78 wxString
GetName() const;
80 // display 0 is usually the primary display
81 bool IsPrimary() const;
85 // enumerate all video modes supported by this display matching the given
86 // one (in the sense of wxVideoMode::Match())
88 // as any mode matches the default value of the argument and there is
89 // always at least one video mode supported by display, the returned array
90 // is only empty for the default value of the argument if this function is
91 // not supported at all on this platform
93 GetModes(const wxVideoMode
& mode
= wxDefaultVideoMode
) const;
95 // get current video mode
96 wxVideoMode
GetCurrentMode() const;
98 // change current mode, return true if succeeded, false otherwise
100 // for the default value of the argument restores the video mode to default
101 bool ChangeMode(const wxVideoMode
& mode
= wxDefaultVideoMode
);
103 // restore the default video mode (just a more readable synonym)
104 void ResetMode() { (void)ChangeMode(); }
105 #endif // wxUSE_DISPLAY
108 // returns the factory used to implement our static methods and create new
110 static wxDisplayFactory
& Factory();
112 // creates the factory object, called by Factory() when it is called for
113 // the first time and should return a pointer allocated with new (the
114 // caller will delete it)
116 // this method must be implemented in platform-specific code if
117 // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code)
118 static wxDisplayFactory
*CreateFactory();
121 // the real implementation
122 wxDisplayImpl
*m_impl
;
125 DECLARE_NO_COPY_CLASS(wxDisplay
)
128 #endif // _WX_DISPLAY_H_BASE_