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