#if wxUSE_GUI
#include "wx/window.h" // for wxTopLevelWindows
+
+ #include "wx/vidmode.h"
#endif // wxUSE_GUI
#include "wx/build.h"
wxPRINT_POSTSCRIPT = 2
};
-// ----------------------------------------------------------------------------
-// support for framebuffer ports
-// ----------------------------------------------------------------------------
-
-#if wxUSE_GUI
-// VS: Fullscreen/framebuffer application needs to choose display mode prior
-// to wxWindows initialization. This class holds information about display
-// mode. It is used by wxApp::Set/GetDisplayMode.
-class WXDLLIMPEXP_CORE wxDisplayModeInfo
-{
-public:
- wxDisplayModeInfo() : m_ok(FALSE) {}
- wxDisplayModeInfo(unsigned width, unsigned height, unsigned depth)
- : m_width(width), m_height(height), m_depth(depth), m_ok(TRUE) {}
-
- unsigned GetWidth() const { return m_width; }
- unsigned GetHeight() const { return m_height; }
- unsigned GetDepth() const { return m_depth; }
- bool IsOk() const { return m_ok; }
-
-private:
- unsigned m_width, m_height, m_depth;
- bool m_ok;
-};
-#endif // wxUSE_GUI
-
-
// ----------------------------------------------------------------------------
// wxAppConsole: wxApp for non-GUI applications
// ----------------------------------------------------------------------------
// Get display mode that is used use. This is only used in framebuffer
// wxWin ports (such as wxMGL).
- virtual wxDisplayModeInfo GetDisplayMode() const { return wxDisplayModeInfo(); }
+ virtual wxVideoMode GetDisplayMode() const { return wxVideoMode(); }
// Set display mode to use. This is only used in framebuffer wxWin
// ports (such as wxMGL). This method should be called from
// wxApp::OnInitGui
- virtual bool SetDisplayMode(const wxDisplayModeInfo& WXUNUSED(info)) { return TRUE; }
+ virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return TRUE; }
// set use of best visual flag (see below)
void SetUseBestVisual( bool flag ) { m_useBestVisual = flag; }
#endif
#include "wx/dynarray.h"
+#include "wx/vidmode.h"
class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxPoint;
class WXDLLEXPORT wxRect;
class WXDLLEXPORT wxString;
-// ----------------------------------------------------------------------------
-// wxVideoMode: contains video mode parameters for a display
-// ----------------------------------------------------------------------------
-
-struct WXDLLEXPORT wxVideoMode
-{
- wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0)
- {
- w = width;
- h = height;
-
- bpp = depth;
-
- refresh = freq;
- }
-
- // default copy ctor and assignment operator are ok
-
- bool operator==(const wxVideoMode& m) const
- {
- return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh;
- }
- bool operator!=(const wxVideoMode& mode) const
- {
- return !operator==(mode);
- }
-
- // returns true if this mode matches the other one in the sense that all
- // non zero fields of the other mode have the same value in this one
- // (except for refresh which is allowed to have a greater value)
- bool Matches(const wxVideoMode& other) const
- {
- return (!other.w || w == other.w) &&
- (!other.h || h == other.h) &&
- (!other.bpp || bpp == other.bpp) &&
- (!other.refresh || refresh >= other.refresh);
- }
-
- // the screen size in pixels (e.g. 640*480), 0 means unspecified
- int w, h;
-
- // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
- int bpp;
-
- // refresh frequency in Hz, 0 means unspecified/unknown
- int refresh;
-};
-
WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
// default, uninitialized, video mode object
virtual void WakeUpIdle();
virtual bool Yield(bool onlyIfNeeded = FALSE);
- virtual wxDisplayModeInfo GetDisplayMode() const { return m_displayMode; }
- virtual bool SetDisplayMode(const wxDisplayModeInfo& mode);
+ virtual wxVideoMode GetDisplayMode() const { return m_displayMode; }
+ virtual bool SetDisplayMode(const wxVideoMode& mode);
private:
DECLARE_DYNAMIC_CLASS(wxApp)
DECLARE_EVENT_TABLE()
- wxDisplayModeInfo m_displayMode;
+ wxVideoMode m_displayMode;
};
#endif // __WX_APP_H__
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/vidmode.h
+// Purpose: declares wxVideoMode class used by both wxDisplay and wxApp
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 27.09.2003 (extracted from wx/display.h)
+// RCS-ID: $Id$
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_VMODE_H_
+#define _WX_VMODE_H_
+
+// ----------------------------------------------------------------------------
+// wxVideoMode: a simple struct containing video mode parameters for a display
+// ----------------------------------------------------------------------------
+
+struct WXDLLEXPORT wxVideoMode
+{
+ wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0)
+ {
+ w = width;
+ h = height;
+
+ bpp = depth;
+
+ refresh = freq;
+ }
+
+ // default copy ctor and assignment operator are ok
+
+ bool operator==(const wxVideoMode& m) const
+ {
+ return w == m.w && h == m.h && bpp == m.bpp && refresh == m.refresh;
+ }
+ bool operator!=(const wxVideoMode& mode) const
+ {
+ return !operator==(mode);
+ }
+
+ // returns true if this mode matches the other one in the sense that all
+ // non zero fields of the other mode have the same value in this one
+ // (except for refresh which is allowed to have a greater value)
+ bool Matches(const wxVideoMode& other) const
+ {
+ return (!other.w || w == other.w) &&
+ (!other.h || h == other.h) &&
+ (!other.bpp || bpp == other.bpp) &&
+ (!other.refresh || refresh >= other.refresh);
+ }
+
+ // trivial accessors
+ int GetWidth() const { return w; }
+ int GetHeight() const { return h; }
+ int GetDepth() const { return bpp; }
+
+ // returns true if the object has been initialized
+ bool IsOk() const { return w && h; }
+
+
+ // the screen size in pixels (e.g. 640*480), 0 means unspecified
+ int w, h;
+
+ // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
+ int bpp;
+
+ // refresh frequency in Hz, 0 means unspecified/unknown
+ int refresh;
+};
+
+#endif // _WX_VMODE_H_
+
// MGL initialization
//-----------------------------------------------------------------------------
-static bool wxCreateMGL_WM(const wxDisplayModeInfo& displayMode)
+static bool wxCreateMGL_WM(const wxVideoMode& displayMode)
{
int mode;
int refresh = MGL_DEFAULT_REFRESH;
{
}
-wxDisplayModeInfo wxGetDefaultDisplayMode()
+wxVideoMode wxGetDefaultDisplayMode()
{
wxString mode;
unsigned w, h, bpp;
w = 640, h = 480, bpp = 16;
}
- return wxDisplayModeInfo(w, h, bpp);
+ return wxVideoMode(w, h, bpp);
}
-bool wxApp::SetDisplayMode(const wxDisplayModeInfo& mode)
+bool wxApp::SetDisplayMode(const wxVideoMode& mode)
{
if ( !mode.IsOk() )
{