int wxApp::MainLoop()
{
+ int rt;
gs_mainEventLoop = new wxEventLoop;
- return gs_mainEventLoop->Run();
+ rt = gs_mainEventLoop->Run();
delete gs_mainEventLoop;
gs_mainEventLoop = NULL;
+ return rt;
}
void wxApp::ExitMainLoop()
bool wxApp::Initialized()
{
- return (GetTopWindow() != NULL);
+ // FIXME_MGL -- only for now because we don't have wxFrame/wxDialog yet
+ return TRUE;
+ //return (wxTopLevelWindows.GetCount() != 0);
}
bool wxApp::Pending()
call OnRun() */
wxTheApp->DeletePendingObjects();
- if ( wxTheApp->Initialized() &&
- wxTopLevelWindows.GetCount() != 0 )
+ if ( wxTheApp->Initialized() )
{
wxTheApp->OnRun();
if ( m_globalClippingRegion )
{
- m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion()
+ m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion()
& *m_globalClippingRegion);
}
else
if ( m_globalClippingRegion )
{
- m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion()
+ m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion()
& *m_globalClippingRegion);
}
else
wxCHECK_RET( Ok(), wxT("invalid dc") );
m_MGLDC->makeCurrent(); // will go away with MGL6.0
- m_MGLDC->clearDevice();
- if ( m_backgroundBrush.GetStyle() != wxSOLID &&
- m_backgroundBrush.GetStyle() != wxTRANSPARENT )
+ if ( m_backgroundBrush.GetStyle() != wxTRANSPARENT )
{
int w, h;
wxBrush oldb = m_brush;
void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
{
- if ( m_pen.GetStyle() == wxTRANSPARENT ) return;
m_MGLDC->makeCurrent(); // will go away with MGL6.0
DrawAnyText(text, x, y);
wxCoord x, wxCoord y,
double angle)
{
- if ( m_pen.GetStyle() == wxTRANSPARENT ) return;
m_MGLDC->makeCurrent(); // will go away with MGL6.0
if ( angle == 0 )
wxCHECK_MSG( IsRunning(), FALSE, _T("can't call Dispatch() if not running") );
event_t evt;
- ibool rc = EVT_getNext(&evt, EVT_EVERYEVT);
-
- if ( !rc )
+ ibool rc;
+
+ rc = EVT_getNext(&evt, EVT_EVERYEVT);
+ while ( !rc )
{
- wxLogError(_T("events queue empty even though Pending() returned true"));
- return FALSE;
+ wxUsleep(1000);
+ if ( !m_impl->GetKeepLooping() )
+ return FALSE;
+ rc = EVT_getNext(&evt, EVT_EVERYEVT);
}
-
- // FIXME_MGL -- there must be some way to programatically exit
- // the loop, like WM_QUIT under Windows -- perhaps we need custom
- // event to indicate this??
m_impl->ProcessEvent(&evt);
return m_impl->GetKeepLooping();
}
-
wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font)
{
wxMGLFontFamily *family;
- wxString facename;
int type;
+ wxString facename = font->GetFaceName();
- if ( facename )
- family = GetFamily(font->GetFaceName());
+ if ( !facename.IsEmpty() )
+ family = GetFamily(facename);
else
family = NULL;
- if ( family )
- facename = font->GetFaceName();
- else
- facename.Empty();
-
+
if ( !family )
{
+ facename.Empty();
switch (font->GetFamily())
{
case wxSCRIPT:
wxFont wxSystemSettings::GetSystemFont(int WXUNUSED(index))
{
// FIXME_MGL
- return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL);
+ return wxFont(12, wxSWISS, wxNORMAL, wxNORMAL);
}
int wxSystemSettings::GetSystemMetric(int WXUNUSED(index))
// b) the app has plenty of time in wxApp::OnInit to feed wxSystemOptions
// with desired settings
+// FIXME_MGL -- move to app.cpp??
bool wxCreateMGL_WM()
{
int mode;
m_wnd = MGL_wmCreateWindow(g_winMng,
parent ? parent->GetHandle() : NULL,
pos.x, pos.y, size.x, size.y);
+ MGL_wmShowWindow(m_wnd, m_isShown);
MGL_wmSetWindowUserData(m_wnd, (void*) this);
MGL_wmSetWindowPainter(m_wnd, wxWindowPainter);
return TRUE;
void wxWindowMGL::Update()
{
- Refresh();
if ( !m_frozen )
MGL_wmUpdateDC(g_winMng);
}
if ( m_frozen )
{
// Don't paint anything if the window is frozen.
+ m_refreshAfterThaw = TRUE;
return;
}
- region_t clip;
- MGL_getClipRegionDC(*dc, &clip);
- m_updateRegion = wxRegion(MGLRegion(&clip));
+ MGLRegion clip;
+ dc->getClipRegion(clip);
+ m_updateRegion = wxRegion(clip);
m_paintMGLDC = dc;
{
GetEventHandler()->ProcessEvent(eventPt);
m_paintMGLDC = NULL;
+ m_updateRegion.Clear();
}