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