]>
Commit | Line | Data |
---|---|---|
ef1717a9 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/display_impl.h | |
3 | // Purpose: wxDisplayImpl class declaration | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2006-03-15 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2002-2006 Vadim Zeitlin <vadim@wxwindows.org> | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_DISPLAY_IMPL_H_BASE_ | |
12 | #define _WX_DISPLAY_IMPL_H_BASE_ | |
13 | ||
47f43b6b VZ |
14 | #include "wx/gdicmn.h" // for wxRect |
15 | ||
ef1717a9 VZ |
16 | // ---------------------------------------------------------------------------- |
17 | // wxDisplayFactory: allows to create wxDisplay objects | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | class WXDLLEXPORT wxDisplayFactory | |
21 | { | |
22 | public: | |
23 | wxDisplayFactory() { } | |
24 | virtual ~wxDisplayFactory() { } | |
25 | ||
26 | // create a new display object | |
27 | // | |
28 | // it can return a NULL pointer if the display creation failed | |
4e675101 | 29 | virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; |
ef1717a9 VZ |
30 | |
31 | // get the total number of displays | |
4e675101 | 32 | virtual unsigned GetCount() = 0; |
ef1717a9 VZ |
33 | |
34 | // return the display for the given point or wxNOT_FOUND | |
35 | virtual int GetFromPoint(const wxPoint& pt) = 0; | |
36 | ||
37 | // return the display for the given window or wxNOT_FOUND | |
38 | // | |
39 | // the window pointer must not be NULL (i.e. caller should check it) | |
40 | virtual int GetFromWindow(wxWindow *window); | |
41 | }; | |
42 | ||
43 | // ---------------------------------------------------------------------------- | |
44 | // wxDisplayImpl: base class for all wxDisplay implementations | |
45 | // ---------------------------------------------------------------------------- | |
46 | ||
47 | class WXDLLEXPORT wxDisplayImpl | |
48 | { | |
49 | public: | |
50 | // virtual dtor for this base class | |
51 | virtual ~wxDisplayImpl() { } | |
52 | ||
53 | ||
54 | // return the full area of this display | |
55 | virtual wxRect GetGeometry() const = 0; | |
56 | ||
6c5d6291 VZ |
57 | // return the area of the display available for normal windows |
58 | virtual wxRect GetClientArea() const { return GetGeometry(); } | |
59 | ||
ef1717a9 VZ |
60 | // return the name (may be empty) |
61 | virtual wxString GetName() const = 0; | |
62 | ||
63 | // return the index of this display | |
4e675101 | 64 | unsigned GetIndex() const { return m_index; } |
ef1717a9 VZ |
65 | |
66 | // return true if this is the primary monitor (usually one with index 0) | |
67 | virtual bool IsPrimary() const { return GetIndex() == 0; } | |
68 | ||
69 | ||
70 | #if wxUSE_DISPLAY | |
71 | // implements wxDisplay::GetModes() | |
72 | virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const = 0; | |
73 | ||
74 | // get current video mode | |
75 | virtual wxVideoMode GetCurrentMode() const = 0; | |
76 | ||
77 | // change current mode, return true if succeeded, false otherwise | |
78 | virtual bool ChangeMode(const wxVideoMode& mode) = 0; | |
79 | #endif // wxUSE_DISPLAY | |
80 | ||
81 | protected: | |
82 | // create the object providing access to the display with the given index | |
4e675101 | 83 | wxDisplayImpl(unsigned n) : m_index(n) { } |
ef1717a9 VZ |
84 | |
85 | ||
86 | // the index of this display (0 is always the primary one) | |
4e675101 | 87 | const unsigned m_index; |
ef1717a9 VZ |
88 | |
89 | ||
90 | friend class wxDisplayFactory; | |
91 | ||
92 | DECLARE_NO_COPY_CLASS(wxDisplayImpl) | |
93 | }; | |
94 | ||
95 | // ---------------------------------------------------------------------------- | |
96 | // wxDisplayFactorySingle | |
97 | // ---------------------------------------------------------------------------- | |
98 | ||
99 | // this is a stub implementation using single/main display only, it is | |
100 | // available even if wxUSE_DISPLAY == 0 | |
101 | class WXDLLEXPORT wxDisplayFactorySingle : public wxDisplayFactory | |
102 | { | |
103 | public: | |
4e675101 PC |
104 | virtual wxDisplayImpl *CreateDisplay(unsigned n); |
105 | virtual unsigned GetCount() { return 1; } | |
ef1717a9 VZ |
106 | virtual int GetFromPoint(const wxPoint& pt); |
107 | }; | |
108 | ||
109 | #endif // _WX_DISPLAY_IMPL_H_BASE_ | |
110 |