]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/display.h | |
3 | // Purpose: wxDisplay class | |
4 | // Author: Royce Mitchell III | |
5 | // Modified by: Vadim Zeitlin (resolution changes, display modes, ...) | |
6 | // Created: 06/21/02 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2002-2003 wxWindows team | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DISPLAY_H_BASE_ | |
13 | #define _WX_DISPLAY_H_BASE_ | |
14 | ||
15 | #if wxUSE_DISPLAY | |
16 | ||
17 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
18 | #pragma interface "displaybase.h" | |
19 | #endif | |
20 | ||
21 | #include "wx/dynarray.h" | |
22 | #include "wx/vidmode.h" | |
23 | ||
24 | class WXDLLEXPORT wxWindow; | |
25 | class WXDLLEXPORT wxPoint; | |
26 | class WXDLLEXPORT wxRect; | |
27 | class WXDLLEXPORT wxString; | |
28 | ||
29 | WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes); | |
30 | ||
31 | // default, uninitialized, video mode object | |
32 | WXDLLEXPORT_DATA(extern const wxVideoMode) wxDefaultVideoMode; | |
33 | ||
34 | // ---------------------------------------------------------------------------- | |
35 | // wxDisplayBase: represents a display/monitor attached to the system | |
36 | // ---------------------------------------------------------------------------- | |
37 | ||
38 | class WXDLLEXPORT wxDisplayBase | |
39 | { | |
40 | public: | |
41 | // initialize the object containing all information about the given | |
42 | // display | |
43 | // | |
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); | |
47 | ||
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(); | |
51 | ||
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); | |
55 | ||
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); | |
59 | ||
60 | ||
61 | // return true if the object was initialized successfully | |
62 | virtual bool IsOk() const { return true; } | |
63 | ||
64 | // get the display size | |
65 | virtual wxRect GetGeometry() const = 0; | |
66 | ||
67 | // name may be empty | |
68 | virtual wxString GetName() const = 0; | |
69 | ||
70 | // display 0 is always the primary display | |
71 | bool IsPrimary() const { return m_index == 0; } | |
72 | ||
73 | ||
74 | // enumerate all video modes supported by this display matching the given | |
75 | // one (in the sense of wxVideoMode::Match()) | |
76 | // | |
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; | |
83 | ||
84 | // get current video mode | |
85 | virtual wxVideoMode GetCurrentMode() const = 0; | |
86 | ||
87 | // change current mode, return true if succeeded, false otherwise | |
88 | // | |
89 | // for the default value of the argument restores the video mode to default | |
90 | virtual bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode) = 0; | |
91 | ||
92 | // restore the default video mode (just a more readable synonym) | |
93 | void ResetMode() { (void)ChangeMode(); } | |
94 | ||
95 | // virtual dtor as for any base class | |
96 | virtual ~wxDisplayBase() { } | |
97 | ||
98 | protected: | |
99 | // the index of this display (0 is always the primary one) | |
100 | size_t m_index; | |
101 | ||
102 | DECLARE_NO_COPY_CLASS(wxDisplayBase) | |
103 | }; | |
104 | ||
105 | ||
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(__WXMAC__) | |
113 | #include "wx/mac/display.h" | |
114 | #elif defined(__WXPM__) | |
115 | #include "wx/os2/display.h" | |
116 | #endif | |
117 | ||
118 | #endif // wxUSE_DISPLAY | |
119 | ||
120 | #endif // _WX_DISPLAY_H_BASE_ |