]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/display.h | |
3 | // Purpose: wxDisplay class | |
4 | // Author: Royce Mitchell III, Vadim Zeitlin | |
5 | // Created: 06/21/02 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2002-2006 wxWidgets team | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_DISPLAY_H_BASE_ | |
12 | #define _WX_DISPLAY_H_BASE_ | |
13 | ||
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 | |
17 | ||
18 | #if wxUSE_DISPLAY | |
19 | #include "wx/dynarray.h" | |
20 | #include "wx/vidmode.h" | |
21 | ||
22 | WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes); | |
23 | ||
24 | // default, uninitialized, video mode object | |
25 | extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode; | |
26 | #endif // wxUSE_DISPLAY | |
27 | ||
28 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
29 | class WXDLLIMPEXP_FWD_CORE wxPoint; | |
30 | class WXDLLIMPEXP_FWD_CORE wxRect; | |
31 | class WXDLLIMPEXP_FWD_BASE wxString; | |
32 | ||
33 | class WXDLLIMPEXP_FWD_CORE wxDisplayFactory; | |
34 | class WXDLLIMPEXP_FWD_CORE wxDisplayImpl; | |
35 | ||
36 | // ---------------------------------------------------------------------------- | |
37 | // wxDisplay: represents a display/monitor attached to the system | |
38 | // ---------------------------------------------------------------------------- | |
39 | ||
40 | class WXDLLEXPORT wxDisplay | |
41 | { | |
42 | public: | |
43 | // initialize the object containing all information about the given | |
44 | // display | |
45 | // | |
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); | |
49 | ||
50 | // dtor is not virtual as this is a concrete class not meant to be derived | |
51 | // from | |
52 | ~wxDisplay(); | |
53 | ||
54 | ||
55 | // return the number of available displays, valid parameters to | |
56 | // wxDisplay ctor are from 0 up to this number | |
57 | static unsigned GetCount(); | |
58 | ||
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); | |
62 | ||
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); | |
66 | ||
67 | ||
68 | // return true if the object was initialized successfully | |
69 | bool IsOk() const { return m_impl != NULL; } | |
70 | ||
71 | // get the full display size | |
72 | wxRect GetGeometry() const; | |
73 | ||
74 | // get the client area of the display, i.e. without taskbars and such | |
75 | wxRect GetClientArea() const; | |
76 | ||
77 | // name may be empty | |
78 | wxString GetName() const; | |
79 | ||
80 | // display 0 is usually the primary display | |
81 | bool IsPrimary() const; | |
82 | ||
83 | ||
84 | #if wxUSE_DISPLAY | |
85 | // enumerate all video modes supported by this display matching the given | |
86 | // one (in the sense of wxVideoMode::Match()) | |
87 | // | |
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 | |
92 | wxArrayVideoModes | |
93 | GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const; | |
94 | ||
95 | // get current video mode | |
96 | wxVideoMode GetCurrentMode() const; | |
97 | ||
98 | // change current mode, return true if succeeded, false otherwise | |
99 | // | |
100 | // for the default value of the argument restores the video mode to default | |
101 | bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode); | |
102 | ||
103 | // restore the default video mode (just a more readable synonym) | |
104 | void ResetMode() { (void)ChangeMode(); } | |
105 | #endif // wxUSE_DISPLAY | |
106 | ||
107 | private: | |
108 | // returns the factory used to implement our static methods and create new | |
109 | // displays | |
110 | static wxDisplayFactory& Factory(); | |
111 | ||
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) | |
115 | // | |
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(); | |
119 | ||
120 | ||
121 | // the real implementation | |
122 | wxDisplayImpl *m_impl; | |
123 | ||
124 | ||
125 | DECLARE_NO_COPY_CLASS(wxDisplay) | |
126 | }; | |
127 | ||
128 | #endif // _WX_DISPLAY_H_BASE_ |