From c358c6601faad58edf218909bf1697ac148b1b1a Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 4 Nov 2001 00:00:15 +0000 Subject: [PATCH] implemented wxApp::Get/SetDisplayMode git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12298 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/appcmn.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 84f193af62..37b04e0e86 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -192,6 +192,7 @@ bool wxAppBase::OnInit() #define OPTION_VERBOSE _T("verbose") #define OPTION_THEME _T("theme") +#define OPTION_MODE _T("mode") void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) { @@ -226,6 +227,19 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) }, #endif // __WXUNIVERSAL__ +#if defined(__WXMGL__) + // VS: this is not specific to wxMGL, all fullscreen (framebuffer) ports + // should provide this option. That's why it is in common/appcmn.cpp + // and not mgl/app.cpp + { + wxCMD_LINE_OPTION, + _T(""), + OPTION_MODE, + gettext_noop("specify display mode to use (e.g. 640x480-16)"), + wxCMD_LINE_VAL_STRING + }, +#endif // __WXMGL__ + // terminator { wxCMD_LINE_NONE } }; @@ -258,6 +272,22 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) } #endif // __WXUNIVERSAL__ +#if defined(__WXMGL__) + wxString modeDesc; + if ( parser.Found(OPTION_MODE, &modeDesc) ) + { + unsigned w, h, bpp; + if ( wxSscanf(modeDesc.c_str(), _T("%ux%u-%u"), &w, &h, &bpp) != 3 ) + { + wxLogError(_("Unsupported display mode '%s'."), themeName.c_str()); + + return FALSE; + } + + SetDisplayMode(wxDisplayModeInfo(wxSize(w, h), bpp)); + } +#endif + return TRUE; } -- 2.45.2