]> git.saurik.com Git - wxWidgets.git/blame - include/wx/display.h
Mobile 5 Smartphone fixes
[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
VZ
24 // default, uninitialized, video mode object
25 extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode;
26#endif // wxUSE_DISPLAY
bfc90810 27
e97251c5 28class WXDLLEXPORT wxWindow;
3dd514f1
VZ
29class WXDLLEXPORT wxPoint;
30class WXDLLEXPORT wxRect;
68379eaf 31class WXDLLEXPORT wxString;
e97251c5 32
ef1717a9
VZ
33class WXDLLEXPORT wxDisplayFactory;
34class WXDLLEXPORT wxDisplayImpl;
bfc90810
VZ
35
36// ----------------------------------------------------------------------------
ef1717a9 37// wxDisplay: represents a display/monitor attached to the system
bfc90810 38// ----------------------------------------------------------------------------
a536e411 39
ef1717a9 40class WXDLLEXPORT 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
ef1717a9
VZ
48 wxDisplay(size_t n = 0);
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
57 static size_t GetCount();
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
65 static int GetFromWindow(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
bfc90810 71 // get the display size
ef1717a9 72 wxRect GetGeometry() const;
a536e411
JS
73
74 // name may be empty
ef1717a9 75 wxString GetName() const;
a536e411 76
24d2b4f5 77 // display 0 is usually the primary display
ef1717a9 78 bool IsPrimary() const;
bfc90810 79
a536e411 80
ef1717a9 81#if wxUSE_DISPLAY
bfc90810
VZ
82 // enumerate all video modes supported by this display matching the given
83 // one (in the sense of wxVideoMode::Match())
84 //
85 // as any mode matches the default value of the argument and there is
86 // always at least one video mode supported by display, the returned array
87 // is only empty for the default value of the argument if this function is
88 // not supported at all on this platform
ef1717a9
VZ
89 wxArrayVideoModes
90 GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const;
a536e411 91
bfc90810 92 // get current video mode
ef1717a9 93 wxVideoMode GetCurrentMode() const;
bfc90810
VZ
94
95 // change current mode, return true if succeeded, false otherwise
96 //
97 // for the default value of the argument restores the video mode to default
ef1717a9 98 bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
bfc90810
VZ
99
100 // restore the default video mode (just a more readable synonym)
101 void ResetMode() { (void)ChangeMode(); }
ef1717a9 102#endif // wxUSE_DISPLAY
bfc90810 103
ef1717a9
VZ
104private:
105 // returns the factory used to implement our static methods and create new
106 // displays
107 static wxDisplayFactory& Factory();
a536e411 108
ef1717a9
VZ
109 // creates the factory object, called by Factory() when it is called for
110 // the first time and should return a pointer allocated with new (the
111 // caller will delete it)
112 //
113 // this method must be implemented in platform-specific code if
114 // wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code)
115 static wxDisplayFactory *CreateFactory();
a536e411 116
a536e411 117
ef1717a9
VZ
118 // the real implementation
119 wxDisplayImpl *m_impl;
bfc90810 120
a536e411 121
ef1717a9
VZ
122 DECLARE_NO_COPY_CLASS(wxDisplay)
123};
a536e411
JS
124
125#endif // _WX_DISPLAY_H_BASE_