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