1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/display_impl.h
3 // Purpose: wxDisplayImpl class declaration
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2002-2006 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DISPLAY_IMPL_H_BASE_
12 #define _WX_DISPLAY_IMPL_H_BASE_
14 // ----------------------------------------------------------------------------
15 // wxDisplayFactory: allows to create wxDisplay objects
16 // ----------------------------------------------------------------------------
18 class WXDLLEXPORT wxDisplayFactory
21 wxDisplayFactory() { }
22 virtual ~wxDisplayFactory() { }
24 // create a new display object
26 // it can return a NULL pointer if the display creation failed
27 virtual wxDisplayImpl
*CreateDisplay(size_t n
) = 0;
29 // get the total number of displays
30 virtual size_t GetCount() = 0;
32 // return the display for the given point or wxNOT_FOUND
33 virtual int GetFromPoint(const wxPoint
& pt
) = 0;
35 // return the display for the given window or wxNOT_FOUND
37 // the window pointer must not be NULL (i.e. caller should check it)
38 virtual int GetFromWindow(wxWindow
*window
);
41 // ----------------------------------------------------------------------------
42 // wxDisplayImpl: base class for all wxDisplay implementations
43 // ----------------------------------------------------------------------------
45 class WXDLLEXPORT wxDisplayImpl
48 // virtual dtor for this base class
49 virtual ~wxDisplayImpl() { }
52 // return the full area of this display
53 virtual wxRect
GetGeometry() const = 0;
55 // return the name (may be empty)
56 virtual wxString
GetName() const = 0;
58 // return the index of this display
59 size_t GetIndex() const { return m_index
; }
61 // return true if this is the primary monitor (usually one with index 0)
62 virtual bool IsPrimary() const { return GetIndex() == 0; }
66 // implements wxDisplay::GetModes()
67 virtual wxArrayVideoModes
GetModes(const wxVideoMode
& mode
) const = 0;
69 // get current video mode
70 virtual wxVideoMode
GetCurrentMode() const = 0;
72 // change current mode, return true if succeeded, false otherwise
73 virtual bool ChangeMode(const wxVideoMode
& mode
) = 0;
74 #endif // wxUSE_DISPLAY
77 // create the object providing access to the display with the given index
78 wxDisplayImpl(size_t n
) : m_index(n
) { }
81 // the index of this display (0 is always the primary one)
85 friend class wxDisplayFactory
;
87 DECLARE_NO_COPY_CLASS(wxDisplayImpl
)
90 // ----------------------------------------------------------------------------
91 // wxDisplayFactorySingle
92 // ----------------------------------------------------------------------------
94 // this is a stub implementation using single/main display only, it is
95 // available even if wxUSE_DISPLAY == 0
96 class WXDLLEXPORT wxDisplayFactorySingle
: public wxDisplayFactory
99 virtual wxDisplayImpl
*CreateDisplay(size_t n
);
100 virtual size_t GetCount() { return 1; }
101 virtual int GetFromPoint(const wxPoint
& pt
);
104 #endif // _WX_DISPLAY_IMPL_H_BASE_