1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/display_impl.h
3 // Purpose: wxDisplayImpl class declaration
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2002-2006 Vadim Zeitlin <vadim@wxwindows.org>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_DISPLAY_IMPL_H_BASE_
11 #define _WX_DISPLAY_IMPL_H_BASE_
13 #include "wx/gdicmn.h" // for wxRect
15 // ----------------------------------------------------------------------------
16 // wxDisplayFactory: allows to create wxDisplay objects
17 // ----------------------------------------------------------------------------
19 class WXDLLIMPEXP_CORE wxDisplayFactory
22 wxDisplayFactory() { }
23 virtual ~wxDisplayFactory() { }
25 // create a new display object
27 // it can return a NULL pointer if the display creation failed
28 virtual wxDisplayImpl
*CreateDisplay(unsigned n
) = 0;
30 // get the total number of displays
31 virtual unsigned GetCount() = 0;
33 // return the display for the given point or wxNOT_FOUND
34 virtual int GetFromPoint(const wxPoint
& pt
) = 0;
36 // return the display for the given window or wxNOT_FOUND
38 // the window pointer must not be NULL (i.e. caller should check it)
39 virtual int GetFromWindow(const wxWindow
*window
);
42 // ----------------------------------------------------------------------------
43 // wxDisplayImpl: base class for all wxDisplay implementations
44 // ----------------------------------------------------------------------------
46 class WXDLLIMPEXP_CORE wxDisplayImpl
49 // virtual dtor for this base class
50 virtual ~wxDisplayImpl() { }
53 // return the full area of this display
54 virtual wxRect
GetGeometry() const = 0;
56 // return the area of the display available for normal windows
57 virtual wxRect
GetClientArea() const { return GetGeometry(); }
59 // return the name (may be empty)
60 virtual wxString
GetName() const = 0;
62 // return the index of this display
63 unsigned GetIndex() const { return m_index
; }
65 // return true if this is the primary monitor (usually one with index 0)
66 virtual bool IsPrimary() const { return GetIndex() == 0; }
70 // implements wxDisplay::GetModes()
71 virtual wxArrayVideoModes
GetModes(const wxVideoMode
& mode
) const = 0;
73 // get current video mode
74 virtual wxVideoMode
GetCurrentMode() const = 0;
76 // change current mode, return true if succeeded, false otherwise
77 virtual bool ChangeMode(const wxVideoMode
& mode
) = 0;
78 #endif // wxUSE_DISPLAY
81 // create the object providing access to the display with the given index
82 wxDisplayImpl(unsigned n
) : m_index(n
) { }
85 // the index of this display (0 is always the primary one)
86 const unsigned m_index
;
89 friend class wxDisplayFactory
;
91 wxDECLARE_NO_COPY_CLASS(wxDisplayImpl
);
94 // ----------------------------------------------------------------------------
95 // wxDisplayFactorySingle
96 // ----------------------------------------------------------------------------
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
103 virtual wxDisplayImpl
*CreateDisplay(unsigned n
);
104 virtual unsigned GetCount() { return 1; }
105 virtual int GetFromPoint(const wxPoint
& pt
);
108 #endif // _WX_DISPLAY_IMPL_H_BASE_