]> git.saurik.com Git - wxWidgets.git/blob - include/wx/vidmode.h
add watcom define HAVE_VSSCANF_DECL (http://article.gmane.org/gmane.comp.lib.wxwidget...
[wxWidgets.git] / include / wx / vidmode.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/vidmode.h
3 // Purpose: declares wxVideoMode class used by both wxDisplay and wxApp
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 27.09.2003 (extracted from wx/display.h)
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_VMODE_H_
13 #define _WX_VMODE_H_
14
15 // ----------------------------------------------------------------------------
16 // wxVideoMode: a simple struct containing video mode parameters for a display
17 // ----------------------------------------------------------------------------
18
19 struct WXDLLIMPEXP_CORE wxVideoMode
20 {
21 wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0)
22 {
23 w = width;
24 h = height;
25
26 bpp = depth;
27
28 refresh = freq;
29 }
30
31 // default copy ctor and assignment operator are ok
32
33 bool operator==(const wxVideoMode& m) const
34 {
35 return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh;
36 }
37 bool operator!=(const wxVideoMode& mode) const
38 {
39 return !operator==(mode);
40 }
41
42 // returns true if this mode matches the other one in the sense that all
43 // non zero fields of the other mode have the same value in this one
44 // (except for refresh which is allowed to have a greater value)
45 bool Matches(const wxVideoMode& other) const
46 {
47 return (!other.w || w == other.w) &&
48 (!other.h || h == other.h) &&
49 (!other.bpp || bpp == other.bpp) &&
50 (!other.refresh || refresh >= other.refresh);
51 }
52
53 // trivial accessors
54 int GetWidth() const { return w; }
55 int GetHeight() const { return h; }
56 int GetDepth() const { return bpp; }
57 int GetRefresh() const { return refresh; }
58
59 // returns true if the object has been initialized
60 bool IsOk() const { return w && h; }
61
62
63 // the screen size in pixels (e.g. 640*480), 0 means unspecified
64 int w, h;
65
66 // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
67 int bpp;
68
69 // refresh frequency in Hz, 0 means unspecified/unknown
70 int refresh;
71 };
72
73 #endif // _WX_VMODE_H_
74