git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12299
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
class WXDLLEXPORT wxApp;
class WXDLLEXPORT wxLog;
class WXDLLEXPORT wxEventLoop;
class WXDLLEXPORT wxApp;
class WXDLLEXPORT wxLog;
class WXDLLEXPORT wxEventLoop;
-class WXDLLEXPORT wxDesktopWindow;
//-----------------------------------------------------------------------------
// wxApp
//-----------------------------------------------------------------------------
// wxApp
virtual bool Yield(bool onlyIfNeeded = FALSE);
virtual bool Yield(bool onlyIfNeeded = FALSE);
+ virtual wxDisplayModeInfo GetDisplayMode() const { return m_displayMode; }
+ virtual bool SetDisplayMode(const wxDisplayModeInfo& mode);
+
private:
DECLARE_DYNAMIC_CLASS(wxApp)
DECLARE_EVENT_TABLE()
wxEventLoop *m_mainLoop;
private:
DECLARE_DYNAMIC_CLASS(wxApp)
DECLARE_EVENT_TABLE()
wxEventLoop *m_mainLoop;
+ wxDisplayModeInfo m_displayMode;
};
int WXDLLEXPORT wxEntry(int argc, char *argv[]);
};
int WXDLLEXPORT wxEntry(int argc, char *argv[]);
// MGL initialization
//-----------------------------------------------------------------------------
// MGL initialization
//-----------------------------------------------------------------------------
-static bool wxCreateMGL_WM()
+static bool wxCreateMGL_WM(const wxDisplayModeInfo& displayMode)
- int width = 640, height = 480, depth = 16;
int refresh = MGL_DEFAULT_REFRESH;
#if wxUSE_SYSTEM_OPTIONS
int refresh = MGL_DEFAULT_REFRESH;
#if wxUSE_SYSTEM_OPTIONS
refresh = wxSystemOptions::GetOptionInt(wxT("mgl.screen-refresh"));
#endif
refresh = wxSystemOptions::GetOptionInt(wxT("mgl.screen-refresh"));
#endif
- mode = MGL_findMode(width, height, depth);
+ mode = MGL_findMode(displayMode.GetScreenSize().x,
+ displayMode.GetScreenSize().y,
+ displayMode.GetDepth());
- wxLogWarning(_("Mode %ix%i-%i not available, falling back to default mode."), width, height, depth);
+ wxLogWarning(_("Mode %ix%i-%i not available, falling back to default mode."),
+ displayMode.GetScreenSize().x,
+ displayMode.GetScreenSize().y,
+ displayMode.GetDepth());
mode = 0; // always available
}
g_displayDC = new MGLDisplayDC(mode, 1, refresh);
mode = 0; // always available
}
g_displayDC = new MGLDisplayDC(mode, 1, refresh);
wxApp::wxApp() : m_mainLoop(NULL)
{
wxApp::wxApp() : m_mainLoop(NULL)
{
+ m_displayMode = wxDisplayModeInfo(wxSize(640, 480), 16);
+bool wxApp::SetDisplayMode(const wxDisplayModeInfo& mode)
+{
+ if ( !mode.IsOk() )
+ {
+ return FALSE;
+ }
+ if ( g_displayDC != NULL )
+ {
+ // FIXME_MGL -- we currently don't allow to switch video mode
+ // at runtime. This can hopefully be changed...
+ wxFAIL_MSG(wxT("Can't change display mode after intialization!"));
+ return FALSE;
+ }
+ m_displayMode = mode;
+ return TRUE;
+}
+
bool wxApp::OnInitGui()
{
bool wxApp::OnInitGui()
{
- if ( !wxCreateMGL_WM() )
+ if ( !wxCreateMGL_WM(m_displayMode) )
return FALSE;
// This has to be done *after* wxCreateMGL_WM() because it initializes
return FALSE;
// This has to be done *after* wxCreateMGL_WM() because it initializes
MGLDevCtx ctx(dc);
w->HandlePaint(&ctx);
}
MGLDevCtx ctx(dc);
w->HandlePaint(&ctx);
}
- // FIXME_MGL -- root window should be a regular window so that
- // enter/leave and activate/deactivate events work correctly
}
static ibool wxWindowMouseHandler(window_t *wnd, event_t *e)
}
static ibool wxWindowMouseHandler(window_t *wnd, event_t *e)