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