]>
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 | // ---------------------------------------------------------------------------- | |
e46fcdb4 | 16 | // wxVideoMode: a simple class containing video mode parameters for a display |
fedec981 VZ |
17 | // ---------------------------------------------------------------------------- |
18 | ||
e46fcdb4 | 19 | class WXDLLIMPEXP_CORE wxVideoMode |
fedec981 | 20 | { |
e46fcdb4 | 21 | public: |
fedec981 VZ |
22 | wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0) |
23 | { | |
24 | w = width; | |
25 | h = height; | |
26 | ||
27 | bpp = depth; | |
28 | ||
29 | refresh = freq; | |
30 | } | |
31 | ||
32 | // default copy ctor and assignment operator are ok | |
33 | ||
34 | bool operator==(const wxVideoMode& m) const | |
35 | { | |
36 | return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh; | |
37 | } | |
38 | bool operator!=(const wxVideoMode& mode) const | |
39 | { | |
40 | return !operator==(mode); | |
41 | } | |
42 | ||
43 | // returns true if this mode matches the other one in the sense that all | |
44 | // non zero fields of the other mode have the same value in this one | |
45 | // (except for refresh which is allowed to have a greater value) | |
46 | bool Matches(const wxVideoMode& other) const | |
47 | { | |
48 | return (!other.w || w == other.w) && | |
49 | (!other.h || h == other.h) && | |
50 | (!other.bpp || bpp == other.bpp) && | |
51 | (!other.refresh || refresh >= other.refresh); | |
52 | } | |
53 | ||
54 | // trivial accessors | |
55 | int GetWidth() const { return w; } | |
56 | int GetHeight() const { return h; } | |
57 | int GetDepth() const { return bpp; } | |
69fb24ce | 58 | int GetRefresh() const { return refresh; } |
fedec981 VZ |
59 | |
60 | // returns true if the object has been initialized | |
61 | bool IsOk() const { return w && h; } | |
62 | ||
63 | ||
e46fcdb4 FM |
64 | protected: |
65 | ||
fedec981 VZ |
66 | // the screen size in pixels (e.g. 640*480), 0 means unspecified |
67 | int w, h; | |
68 | ||
69 | // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known | |
70 | int bpp; | |
71 | ||
72 | // refresh frequency in Hz, 0 means unspecified/unknown | |
73 | int refresh; | |
74 | }; | |
75 | ||
76 | #endif // _WX_VMODE_H_ | |
77 |