vidmode.h 2.3 KB

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