]> git.saurik.com Git - wxWidgets.git/blame - include/wx/display_impl.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / display_impl.h
CommitLineData
ef1717a9
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/display_impl.h
3// Purpose: wxDisplayImpl class declaration
4// Author: Vadim Zeitlin
5// Created: 2006-03-15
ef1717a9
VZ
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
47f43b6b
VZ
13#include "wx/gdicmn.h" // for wxRect
14
ef1717a9
VZ
15// ----------------------------------------------------------------------------
16// wxDisplayFactory: allows to create wxDisplay objects
17// ----------------------------------------------------------------------------
18
53a2db12 19class WXDLLIMPEXP_CORE wxDisplayFactory
ef1717a9
VZ
20{
21public:
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
4e675101 28 virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0;
ef1717a9
VZ
29
30 // get the total number of displays
4e675101 31 virtual unsigned GetCount() = 0;
ef1717a9
VZ
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)
1e93d595 39 virtual int GetFromWindow(const wxWindow *window);
ef1717a9
VZ
40};
41
42// ----------------------------------------------------------------------------
43// wxDisplayImpl: base class for all wxDisplay implementations
44// ----------------------------------------------------------------------------
45
53a2db12 46class WXDLLIMPEXP_CORE wxDisplayImpl
ef1717a9
VZ
47{
48public:
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
6c5d6291
VZ
56 // return the area of the display available for normal windows
57 virtual wxRect GetClientArea() const { return GetGeometry(); }
58
ef1717a9
VZ
59 // return the name (may be empty)
60 virtual wxString GetName() const = 0;
61
62 // return the index of this display
4e675101 63 unsigned GetIndex() const { return m_index; }
ef1717a9
VZ
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
80protected:
81 // create the object providing access to the display with the given index
4e675101 82 wxDisplayImpl(unsigned n) : m_index(n) { }
ef1717a9
VZ
83
84
85 // the index of this display (0 is always the primary one)
4e675101 86 const unsigned m_index;
ef1717a9
VZ
87
88
89 friend class wxDisplayFactory;
90
c0c133e1 91 wxDECLARE_NO_COPY_CLASS(wxDisplayImpl);
ef1717a9
VZ
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
53a2db12 100class WXDLLIMPEXP_CORE wxDisplayFactorySingle : public wxDisplayFactory
ef1717a9
VZ
101{
102public:
4e675101
PC
103 virtual wxDisplayImpl *CreateDisplay(unsigned n);
104 virtual unsigned GetCount() { return 1; }
ef1717a9
VZ
105 virtual int GetFromPoint(const wxPoint& pt);
106};
107
108#endif // _WX_DISPLAY_IMPL_H_BASE_
109