]>
Commit | Line | Data |
---|---|---|
fedec981 VZ |
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$ | |
77ffb593 | 8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> |
65571936 | 9 | // Licence: wxWindows licence |
fedec981 VZ |
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 | ||
53a2db12 | 19 | struct WXDLLIMPEXP_CORE wxVideoMode |
fedec981 VZ |
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 | ||
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 |