Add wxDEPRECATED_MSG() and use it in a couple of places.
[wxWidgets.git] / include / wx / display.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/display.h
3 // Purpose: wxDisplay class
4 // Author: Royce Mitchell III, Vadim Zeitlin
5 // Created: 06/21/02
6 // Copyright: (c) 2002-2006 wxWidgets team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_DISPLAY_H_BASE_
11 #define _WX_DISPLAY_H_BASE_
12
13 // NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but
14 // not the video mode stuff) is always available but if wxUSE_DISPLAY == 0
15 // it becomes just a trivial wrapper around the old wxDisplayXXX() functions
16
17 #if wxUSE_DISPLAY
18 #include "wx/dynarray.h"
19 #include "wx/vidmode.h"
20
21 WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
22
23 // default, uninitialized, video mode object
24 extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode) wxDefaultVideoMode;
25 #endif // wxUSE_DISPLAY
26
27 class WXDLLIMPEXP_FWD_CORE wxWindow;
28 class WXDLLIMPEXP_FWD_CORE wxPoint;
29 class WXDLLIMPEXP_FWD_CORE wxRect;
30 class WXDLLIMPEXP_FWD_BASE wxString;
31
32 class WXDLLIMPEXP_FWD_CORE wxDisplayFactory;
33 class WXDLLIMPEXP_FWD_CORE wxDisplayImpl;
34
35 // ----------------------------------------------------------------------------
36 // wxDisplay: represents a display/monitor attached to the system
37 // ----------------------------------------------------------------------------
38
39 class WXDLLIMPEXP_CORE wxDisplay
40 {
41 public:
42 // initialize the object containing all information about the given
43 // display
44 //
45 // the displays are numbered from 0 to GetCount() - 1, 0 is always the
46 // primary display and the only one which is always supported
47 wxDisplay(unsigned n = 0);
48
49 // dtor is not virtual as this is a concrete class not meant to be derived
50 // from
51 ~wxDisplay();
52
53
54 // return the number of available displays, valid parameters to
55 // wxDisplay ctor are from 0 up to this number
56 static unsigned GetCount();
57
58 // find the display where the given point lies, return wxNOT_FOUND if
59 // it doesn't belong to any display
60 static int GetFromPoint(const wxPoint& pt);
61
62 // find the display where the given window lies, return wxNOT_FOUND if it
63 // is not shown at all
64 static int GetFromWindow(const wxWindow *window);
65
66
67 // return true if the object was initialized successfully
68 bool IsOk() const { return m_impl != NULL; }
69
70 // get the full display size
71 wxRect GetGeometry() const;
72
73 // get the client area of the display, i.e. without taskbars and such
74 wxRect GetClientArea() const;
75
76 // name may be empty
77 wxString GetName() const;
78
79 // display 0 is usually the primary display
80 bool IsPrimary() const;
81
82
83 #if wxUSE_DISPLAY
84 // enumerate all video modes supported by this display matching the given
85 // one (in the sense of wxVideoMode::Match())
86 //
87 // as any mode matches the default value of the argument and there is
88 // always at least one video mode supported by display, the returned array
89 // is only empty for the default value of the argument if this function is
90 // not supported at all on this platform
91 wxArrayVideoModes
92 GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const;
93
94 // get current video mode
95 wxVideoMode GetCurrentMode() const;
96
97 // change current mode, return true if succeeded, false otherwise
98 //
99 // for the default value of the argument restores the video mode to default
100 bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
101
102 // restore the default video mode (just a more readable synonym)
103 void ResetMode() { (void)ChangeMode(); }
104 #endif // wxUSE_DISPLAY
105
106 private:
107 // returns the factory used to implement our static methods and create new
108 // displays
109 static wxDisplayFactory& Factory();
110
111 // creates the factory object, called by Factory() when it is called for
112 // the first time and should return a pointer allocated with new (the
113 // caller will delete it)
114 //
115 // this method must be implemented in platform-specific code if
116 // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code)
117 static wxDisplayFactory *CreateFactory();
118
119
120 // the real implementation
121 wxDisplayImpl *m_impl;
122
123
124 wxDECLARE_NO_COPY_CLASS(wxDisplay);
125 };
126
127 #endif // _WX_DISPLAY_H_BASE_