]> git.saurik.com Git - wxWidgets.git/blame - include/wx/display.h
proper default for iphone
[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 5// Created: 06/21/02
ef1717a9 6// Copyright: (c) 2002-2006 wxWidgets team
65571936 7// Licence: wxWindows licence
a536e411
JS
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_DISPLAY_H_BASE_
11#define _WX_DISPLAY_H_BASE_
12
ef1717a9
VZ
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
fdc37e95 17#if wxUSE_DISPLAY
ef1717a9
VZ
18 #include "wx/dynarray.h"
19 #include "wx/vidmode.h"
20
21 WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
a536e411 22
ef1717a9 23 // default, uninitialized, video mode object
53a2db12 24 extern WXDLLIMPEXP_DATA_CORE(const wxVideoMode) wxDefaultVideoMode;
ef1717a9 25#endif // wxUSE_DISPLAY
bfc90810 26
b5dbe15d
VS
27class WXDLLIMPEXP_FWD_CORE wxWindow;
28class WXDLLIMPEXP_FWD_CORE wxPoint;
29class WXDLLIMPEXP_FWD_CORE wxRect;
30class WXDLLIMPEXP_FWD_BASE wxString;
e97251c5 31
b5dbe15d
VS
32class WXDLLIMPEXP_FWD_CORE wxDisplayFactory;
33class WXDLLIMPEXP_FWD_CORE wxDisplayImpl;
bfc90810
VZ
34
35// ----------------------------------------------------------------------------
ef1717a9 36// wxDisplay: represents a display/monitor attached to the system
bfc90810 37// ----------------------------------------------------------------------------
a536e411 38
53a2db12 39class WXDLLIMPEXP_CORE wxDisplay
a536e411
JS
40{
41public:
42 // initialize the object containing all information about the given
43 // display
bfc90810
VZ
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
4e675101 47 wxDisplay(unsigned n = 0);
ef1717a9
VZ
48
49 // dtor is not virtual as this is a concrete class not meant to be derived
50 // from
51 ~wxDisplay();
52
a536e411
JS
53
54 // return the number of available displays, valid parameters to
55 // wxDisplay ctor are from 0 up to this number
4e675101 56 static unsigned GetCount();
a536e411 57
bfc90810 58 // find the display where the given point lies, return wxNOT_FOUND if
a536e411 59 // it doesn't belong to any display
bfc90810
VZ
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
1e93d595 64 static int GetFromWindow(const wxWindow *window);
a536e411 65
a536e411 66
06efac1f 67 // return true if the object was initialized successfully
ef1717a9 68 bool IsOk() const { return m_impl != NULL; }
06efac1f 69
6c5d6291 70 // get the full display size
ef1717a9 71 wxRect GetGeometry() const;
a536e411 72
6c5d6291
VZ
73 // get the client area of the display, i.e. without taskbars and such
74 wxRect GetClientArea() const;
75
a536e411 76 // name may be empty
ef1717a9 77 wxString GetName() const;
a536e411 78
24d2b4f5 79 // display 0 is usually the primary display
ef1717a9 80 bool IsPrimary() const;
bfc90810 81
a536e411 82
ef1717a9 83#if wxUSE_DISPLAY
bfc90810
VZ
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
ef1717a9
VZ
91 wxArrayVideoModes
92 GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const;
a536e411 93
bfc90810 94 // get current video mode
ef1717a9 95 wxVideoMode GetCurrentMode() const;
bfc90810
VZ
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
ef1717a9 100 bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
bfc90810
VZ
101
102 // restore the default video mode (just a more readable synonym)
103 void ResetMode() { (void)ChangeMode(); }
ef1717a9 104#endif // wxUSE_DISPLAY
bfc90810 105
ef1717a9
VZ
106private:
107 // returns the factory used to implement our static methods and create new
108 // displays
109 static wxDisplayFactory& Factory();
a536e411 110
ef1717a9
VZ
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();
a536e411 118
a536e411 119
ef1717a9
VZ
120 // the real implementation
121 wxDisplayImpl *m_impl;
bfc90810 122
a536e411 123
c0c133e1 124 wxDECLARE_NO_COPY_CLASS(wxDisplay);
ef1717a9 125};
a536e411
JS
126
127#endif // _WX_DISPLAY_H_BASE_