+#if wxUSE_CMDLINE_PARSER
+
+// ----------------------------------------------------------------------------
+// GUI-specific command line options handling
+// ----------------------------------------------------------------------------
+
+#define OPTION_THEME "theme"
+#define OPTION_MODE "mode"
+
+void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
+{
+ // first add the standard non GUI options
+ wxAppConsole::OnInitCmdLine(parser);
+
+ // the standard command line options
+ static const wxCmdLineEntryDesc cmdLineGUIDesc[] =
+ {
+#ifdef __WXUNIVERSAL__
+ {
+ wxCMD_LINE_OPTION,
+ NULL,
+ OPTION_THEME,
+ gettext_noop("specify the theme to use"),
+ wxCMD_LINE_VAL_STRING,
+ 0x0
+ },
+#endif // __WXUNIVERSAL__
+
+#if defined(__WXDFB__)
+ // VS: this is not specific to wxDFB, all fullscreen (framebuffer) ports
+ // should provide this option. That's why it is in common/appcmn.cpp
+ // and not dfb/app.cpp
+ {
+ wxCMD_LINE_OPTION,
+ NULL,
+ OPTION_MODE,
+ gettext_noop("specify display mode to use (e.g. 640x480-16)"),
+ wxCMD_LINE_VAL_STRING,
+ 0x0
+ },
+#endif // __WXDFB__
+
+ // terminator
+ wxCMD_LINE_DESC_END
+ };
+
+ parser.SetDesc(cmdLineGUIDesc);
+}
+
+bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser)
+{
+#ifdef __WXUNIVERSAL__
+ wxString themeName;
+ if ( parser.Found(OPTION_THEME, &themeName) )
+ {
+ wxTheme *theme = wxTheme::Create(themeName);
+ if ( !theme )
+ {
+ wxLogError(_("Unsupported theme '%s'."), themeName.c_str());
+ return false;
+ }
+
+ // Delete the defaultly created theme and set the new theme.
+ delete wxTheme::Get();
+ wxTheme::Set(theme);
+ }
+#endif // __WXUNIVERSAL__
+
+#if defined(__WXDFB__)
+ wxString modeDesc;
+ if ( parser.Found(OPTION_MODE, &modeDesc) )
+ {
+ unsigned w, h, bpp;
+ if ( wxSscanf(modeDesc.c_str(), wxT("%ux%u-%u"), &w, &h, &bpp) != 3 )
+ {
+ wxLogError(_("Invalid display mode specification '%s'."), modeDesc.c_str());
+ return false;
+ }
+
+ if ( !SetDisplayMode(wxVideoMode(w, h, bpp)) )
+ return false;
+ }
+#endif // __WXDFB__
+
+ return wxAppConsole::OnCmdLineParsed(parser);
+}
+
+#endif // wxUSE_CMDLINE_PARSER
+