こっちはGTKのRefreshとUpdate。あまりひねりはなさそう。
void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground),
const wxRect *rect)
{
if (!m_widget)
return;
if (!m_widget->window)
return;
if (m_wxwindow)
{
if (m_wxwindow->window == NULL) return;
GdkRectangle gdk_rect,
*p;
if (rect)
{
gdk_rect.x = rect->x;
gdk_rect.y = rect->y;
gdk_rect.width = rect->width;
gdk_rect.height = rect->height;
if (GetLayoutDirection() == wxLayout_RightToLeft)
gdk_rect.x = GetClientSize().x - gdk_rect.x - gdk_rect.width;
p = &gdk_rect;
}
else // invalidate everything
{
p = NULL;
}
gdk_window_invalidate_rect(m_wxwindow->window, p, true);
}
}
void wxWindowGTK::Update()
{
GtkUpdate();
// when we call Update() we really want to update the window immediately on
// screen, even if it means flushing the entire queue and hence slowing down
// everything -- but it should still be done, it's just that Update() should
// be called very rarely
gdk_flush();
}
void wxWindowGTK::GtkUpdate()
{
if (m_wxwindow && m_wxwindow->window)
gdk_window_process_updates(m_wxwindow->window, false);
if (m_widget && m_widget->window && (m_wxwindow != m_widget))
gdk_window_process_updates( m_widget->window, FALSE );
// for consistency with other platforms (and also because it's convenient
// to be able to update an entire TLW by calling Update() only once), we
// should also update all our children here
for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
node->GetData()->GtkUpdate();
}
}
んで、macはどうかというと、ちょっと?なかんじ。HIXXってなんぞや?
src/mac/window.cpp
/*
* Rect is given in client coordinates, for further reading, read wxTopLevelWindowMac::InvalidateRect
* we always intersect with the entire window, not only with the client area
*/
void wxWindowMac::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect)
{
if ( m_peer == NULL )
return ;
if ( !IsShownOnScreen() )
return ;
if ( rect )
{
Rect r ;
wxMacRectToNative( rect , &r ) ;
m_peer->SetNeedsDisplay( &r ) ;
}
else
{
m_peer->SetNeedsDisplay() ;
}
}
SetNeedsDisplayはなにものかというと、src/mac/carbon/utils.cppのなかにいらっしゃって、
void wxMacControl::SetNeedsDisplay( RgnHandle where )
{
if ( !IsVisible() )
return;
HIViewSetNeedsDisplayInRegion( m_controlRef , where , true );
}
ふたたびsrc/mac/window.cppのなかにもどってUpdateがどうなっているかというと、
void wxWindowMac::Update()
{
wxNonOwnedWindow* top = MacGetTopLevelWindow();
if (top)
top->MacPerformUpdates() ;
}
src/mac/carbon/nonownedwnd.cpp
void wxNonOwnedWindow::MacPerformUpdates()
{
// for composited windows this also triggers a redraw of all
// invalid views in the window
HIWindowFlush((WindowRef) m_macWindow) ;
}
0 件のコメント:
コメントを投稿