1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDisplay class
4 // Author: Royce Mitchell III, Vadim Zeitlin
6 // Copyright: (c) 2002-2006 wxWidgets team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_DISPLAY_H_BASE_
11 #define _WX_DISPLAY_H_BASE_
13 // NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but
14 // not the video mode stuff) is always available but if wxUSE_DISPLAY == 0
15 // it becomes just a trivial wrapper around the old wxDisplayXXX() functions
18 #include "wx/dynarray.h"
19 #include "wx/vidmode.h"
21 WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode
, wxArrayVideoModes
);
23 // default, uninitialized, video mode object
24 extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode
) wxDefaultVideoMode
;
25 #endif // wxUSE_DISPLAY
27 class WXDLLIMPEXP_FWD_CORE wxWindow
;
28 class WXDLLIMPEXP_FWD_CORE wxPoint
;
29 class WXDLLIMPEXP_FWD_CORE wxRect
;
30 class WXDLLIMPEXP_FWD_BASE wxString
;
32 class WXDLLIMPEXP_FWD_CORE wxDisplayFactory
;
33 class WXDLLIMPEXP_FWD_CORE wxDisplayImpl
;
35 // ----------------------------------------------------------------------------
36 // wxDisplay: represents a display/monitor attached to the system
37 // ----------------------------------------------------------------------------
39 class WXDLLIMPEXP_CORE wxDisplay
42 // initialize the object containing all information about the given
45 // the displays are numbered from 0 to GetCount() - 1, 0 is always the
46 // primary display and the only one which is always supported
47 wxDisplay(unsigned n
= 0);
49 // dtor is not virtual as this is a concrete class not meant to be derived
54 // return the number of available displays, valid parameters to
55 // wxDisplay ctor are from 0 up to this number
56 static unsigned GetCount();
58 // find the display where the given point lies, return wxNOT_FOUND if
59 // it doesn't belong to any display
60 static int GetFromPoint(const wxPoint
& pt
);
62 // find the display where the given window lies, return wxNOT_FOUND if it
63 // is not shown at all
64 static int GetFromWindow(const wxWindow
*window
);
67 // return true if the object was initialized successfully
68 bool IsOk() const { return m_impl
!= NULL
; }
70 // get the full display size
71 wxRect
GetGeometry() const;
73 // get the client area of the display, i.e. without taskbars and such
74 wxRect
GetClientArea() const;
77 wxString
GetName() const;
79 // display 0 is usually the primary display
80 bool IsPrimary() const;
84 // enumerate all video modes supported by this display matching the given
85 // one (in the sense of wxVideoMode::Match())
87 // as any mode matches the default value of the argument and there is
88 // always at least one video mode supported by display, the returned array
89 // is only empty for the default value of the argument if this function is
90 // not supported at all on this platform
92 GetModes(const wxVideoMode
& mode
= wxDefaultVideoMode
) const;
94 // get current video mode
95 wxVideoMode
GetCurrentMode() const;
97 // change current mode, return true if succeeded, false otherwise
99 // for the default value of the argument restores the video mode to default
100 bool ChangeMode(const wxVideoMode
& mode
= wxDefaultVideoMode
);
102 // restore the default video mode (just a more readable synonym)
103 void ResetMode() { (void)ChangeMode(); }
104 #endif // wxUSE_DISPLAY
107 // returns the factory used to implement our static methods and create new
109 static wxDisplayFactory
& Factory();
111 // creates the factory object, called by Factory() when it is called for
112 // the first time and should return a pointer allocated with new (the
113 // caller will delete it)
115 // this method must be implemented in platform-specific code if
116 // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code)
117 static wxDisplayFactory
*CreateFactory();
120 // the real implementation
121 wxDisplayImpl
*m_impl
;
124 wxDECLARE_NO_COPY_CLASS(wxDisplay
);
127 #endif // _WX_DISPLAY_H_BASE_