]>
Commit | Line | Data |
---|---|---|
a536e411 | 1 | ///////////////////////////////////////////////////////////////////////////// |
bfc90810 | 2 | // Name: wx/display.h |
a536e411 JS |
3 | // Purpose: wxDisplay class |
4 | // Author: Royce Mitchell III | |
bfc90810 | 5 | // Modified by: Vadim Zeitlin (resolution changes, display modes, ...) |
a536e411 JS |
6 | // Created: 06/21/02 |
7 | // RCS-ID: $Id$ | |
77ffb593 | 8 | // Copyright: (c) 2002-2003 wxWidgets team |
65571936 | 9 | // Licence: wxWindows licence |
a536e411 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_DISPLAY_H_BASE_ | |
13 | #define _WX_DISPLAY_H_BASE_ | |
14 | ||
fdc37e95 | 15 | #if wxUSE_DISPLAY |
a536e411 | 16 | |
12028905 | 17 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
bfc90810 | 18 | #pragma interface "displaybase.h" |
a536e411 JS |
19 | #endif |
20 | ||
bfc90810 | 21 | #include "wx/dynarray.h" |
fedec981 | 22 | #include "wx/vidmode.h" |
bfc90810 | 23 | |
e97251c5 | 24 | class WXDLLEXPORT wxWindow; |
3dd514f1 VZ |
25 | class WXDLLEXPORT wxPoint; |
26 | class WXDLLEXPORT wxRect; | |
68379eaf | 27 | class WXDLLEXPORT wxString; |
e97251c5 | 28 | |
bfc90810 VZ |
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 | // ---------------------------------------------------------------------------- | |
a536e411 JS |
37 | |
38 | class WXDLLEXPORT wxDisplayBase | |
39 | { | |
40 | public: | |
41 | // initialize the object containing all information about the given | |
42 | // display | |
bfc90810 VZ |
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); | |
a536e411 JS |
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 | ||
bfc90810 | 52 | // find the display where the given point lies, return wxNOT_FOUND if |
a536e411 | 53 | // it doesn't belong to any display |
bfc90810 VZ |
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); | |
a536e411 | 59 | |
a536e411 | 60 | |
06efac1f VZ |
61 | // return true if the object was initialized successfully |
62 | virtual bool IsOk() const { return true; } | |
63 | ||
bfc90810 VZ |
64 | // get the display size |
65 | virtual wxRect GetGeometry() const = 0; | |
a536e411 JS |
66 | |
67 | // name may be empty | |
68 | virtual wxString GetName() const = 0; | |
69 | ||
bfc90810 VZ |
70 | // display 0 is always the primary display |
71 | bool IsPrimary() const { return m_index == 0; } | |
72 | ||
a536e411 | 73 | |
bfc90810 VZ |
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; | |
a536e411 | 83 | |
bfc90810 VZ |
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() { } | |
a536e411 JS |
97 | |
98 | protected: | |
bfc90810 VZ |
99 | // the index of this display (0 is always the primary one) |
100 | size_t m_index; | |
a536e411 | 101 | |
b2644cc3 | 102 | DECLARE_NO_COPY_CLASS(wxDisplayBase) |
a536e411 JS |
103 | }; |
104 | ||
bfc90810 | 105 | |
a536e411 JS |
106 | #if defined(__WXMSW__) |
107 | #include "wx/msw/display.h" | |
108 | #elif defined(__WXMOTIF__) | |
b96f9d19 | 109 | #include "wx/unix/displayx11.h" |
a536e411 | 110 | #elif defined(__WXGTK__) |
b1b3ddd8 | 111 | #include "wx/unix/displayx11.h" |
11e72075 MB |
112 | #elif defined(__WXX11__) |
113 | #include "wx/unix/displayx11.h" | |
51259762 RN |
114 | #elif defined(__WXCOCOA__) |
115 | #include "wx/cocoa/display.h" | |
a536e411 JS |
116 | #elif defined(__WXMAC__) |
117 | #include "wx/mac/display.h" | |
118 | #elif defined(__WXPM__) | |
119 | #include "wx/os2/display.h" | |
120 | #endif | |
121 | ||
122 | #endif // wxUSE_DISPLAY | |
123 | ||
124 | #endif // _WX_DISPLAY_H_BASE_ |