made Update() recursive under wxGTK2 (doesn't work for wxGTK1 because Refresh() is not recursive htere neither) and documented its behaviour
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33091 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2222,13 +2222,13 @@ or frame).
|
|||||||
|
|
||||||
\membersection{wxWindow::Refresh}\label{wxwindowrefresh}
|
\membersection{wxWindow::Refresh}\label{wxwindowrefresh}
|
||||||
|
|
||||||
\func{virtual void}{Refresh}{\param{bool}{ eraseBackground = {\tt true}}, \param{const wxRect* }{rect
|
\func{virtual void}{Refresh}{\param{bool}{ eraseBackground = {\tt true}}, \param{const wxRect* }{rect = NULL}}
|
||||||
= NULL}}
|
|
||||||
|
|
||||||
Causes this window, and all of its children recursively, to be repainted. Note
|
Causes this window, and all of its children recursively (except under wxGTK1
|
||||||
that repainting doesn't happen immediately but only during the next event loop
|
where this is not implemented), to be repainted. Note that repainting doesn't
|
||||||
iteration, if you need to update the window immediately you should use
|
happen immediately but only during the next event loop iteration, if you need
|
||||||
\helpref{Update}{wxwindowupdate} instead.
|
to update the window immediately you should use \helpref{Update}{wxwindowupdate}
|
||||||
|
instead.
|
||||||
|
|
||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
@@ -3489,12 +3489,12 @@ This function is currently only implemented under MSW.
|
|||||||
|
|
||||||
\func{virtual void}{Update}{\void}
|
\func{virtual void}{Update}{\void}
|
||||||
|
|
||||||
Calling this method immediately repaints the invalidated area of the window
|
Calling this method immediately repaints the invalidated area of the window and
|
||||||
while this would usually only happen when the flow of control returns to the
|
all of its children recursively while this would usually only happen when the
|
||||||
event loop. Notice that this function doesn't refresh the window and does
|
flow of control returns to the event loop. Notice that this function doesn't
|
||||||
nothing if the window hadn't been already repainted. Use
|
refresh the window and does nothing if the window hadn't been already
|
||||||
\helpref{Refresh}{wxwindowrefresh} first if you want to immediately redraw the
|
repainted. Use \helpref{Refresh}{wxwindowrefresh} first if you want to
|
||||||
window unconditionally.
|
immediately redraw the window unconditionally.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxWindow::UpdateWindowUI}\label{wxwindowupdatewindowui}
|
\membersection{wxWindow::UpdateWindowUI}\label{wxwindowupdatewindowui}
|
||||||
|
@@ -3927,35 +3927,38 @@ void wxWindowGTK::WarpPointer( int x, int y )
|
|||||||
|
|
||||||
void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
||||||
{
|
{
|
||||||
if (!m_widget) return;
|
if (!m_widget)
|
||||||
if (!m_widget->window) return;
|
return;
|
||||||
|
if (!m_widget->window)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifndef __WXGTK20__
|
#ifndef __WXGTK20__
|
||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
wxRect myRect(0,0,0,0);
|
wxRect myRect;
|
||||||
if (m_wxwindow && rect)
|
if (m_wxwindow && rect)
|
||||||
{
|
{
|
||||||
myRect.SetSize(wxSize( m_wxwindow->allocation.width,
|
myRect.SetSize(wxSize( m_wxwindow->allocation.width,
|
||||||
m_wxwindow->allocation.height));
|
m_wxwindow->allocation.height));
|
||||||
myRect.Intersect(*rect);
|
if ( myRect.Intersect(*rect).IsEmpty() )
|
||||||
if (!myRect.width || !myRect.height)
|
{
|
||||||
// nothing to do, rectangle is empty
|
// nothing to do, rectangle is empty
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rect = &myRect;
|
rect = &myRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// schedule the area for later updating in GtkUpdate()
|
||||||
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
if (rect)
|
if (rect)
|
||||||
{
|
{
|
||||||
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
|
|
||||||
m_clearRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
m_clearRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
|
|
||||||
m_clearRegion.Clear();
|
m_clearRegion.Clear();
|
||||||
m_clearRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
|
m_clearRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
|
||||||
}
|
}
|
||||||
@@ -3965,7 +3968,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
{
|
{
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
|
|
||||||
m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3982,7 +3984,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
{
|
{
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
|
|
||||||
m_updateRegion.Clear();
|
m_updateRegion.Clear();
|
||||||
m_updateRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
|
m_updateRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
|
||||||
}
|
}
|
||||||
@@ -3991,24 +3992,27 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
gtk_widget_draw( m_widget, (GdkRectangle*) NULL );
|
gtk_widget_draw( m_widget, (GdkRectangle*) NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else // GTK+ 2
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
|
GdkRectangle gdk_rect,
|
||||||
|
*p;
|
||||||
if (rect)
|
if (rect)
|
||||||
{
|
{
|
||||||
GdkRectangle gdk_rect;
|
|
||||||
gdk_rect.x = rect->x;
|
gdk_rect.x = rect->x;
|
||||||
gdk_rect.y = rect->y;
|
gdk_rect.y = rect->y;
|
||||||
gdk_rect.width = rect->width;
|
gdk_rect.width = rect->width;
|
||||||
gdk_rect.height = rect->height;
|
gdk_rect.height = rect->height;
|
||||||
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, &gdk_rect, TRUE );
|
p = &gdk_rect;
|
||||||
}
|
}
|
||||||
else
|
else // invalidate everything
|
||||||
{
|
{
|
||||||
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, NULL, TRUE );
|
p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, p, TRUE );
|
||||||
}
|
}
|
||||||
#endif
|
#endif // GTK+ 1/2
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::Update()
|
void wxWindowGTK::Update()
|
||||||
@@ -4031,6 +4035,16 @@ void wxWindowGTK::GtkUpdate()
|
|||||||
if (!m_updateRegion.IsEmpty())
|
if (!m_updateRegion.IsEmpty())
|
||||||
GtkSendPaintEvents();
|
GtkSendPaintEvents();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::GtkSendPaintEvents()
|
void wxWindowGTK::GtkSendPaintEvents()
|
||||||
|
@@ -3927,35 +3927,38 @@ void wxWindowGTK::WarpPointer( int x, int y )
|
|||||||
|
|
||||||
void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
||||||
{
|
{
|
||||||
if (!m_widget) return;
|
if (!m_widget)
|
||||||
if (!m_widget->window) return;
|
return;
|
||||||
|
if (!m_widget->window)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifndef __WXGTK20__
|
#ifndef __WXGTK20__
|
||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
wxRect myRect(0,0,0,0);
|
wxRect myRect;
|
||||||
if (m_wxwindow && rect)
|
if (m_wxwindow && rect)
|
||||||
{
|
{
|
||||||
myRect.SetSize(wxSize( m_wxwindow->allocation.width,
|
myRect.SetSize(wxSize( m_wxwindow->allocation.width,
|
||||||
m_wxwindow->allocation.height));
|
m_wxwindow->allocation.height));
|
||||||
myRect.Intersect(*rect);
|
if ( myRect.Intersect(*rect).IsEmpty() )
|
||||||
if (!myRect.width || !myRect.height)
|
{
|
||||||
// nothing to do, rectangle is empty
|
// nothing to do, rectangle is empty
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rect = &myRect;
|
rect = &myRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// schedule the area for later updating in GtkUpdate()
|
||||||
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
if (rect)
|
if (rect)
|
||||||
{
|
{
|
||||||
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
|
|
||||||
m_clearRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
m_clearRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
|
|
||||||
m_clearRegion.Clear();
|
m_clearRegion.Clear();
|
||||||
m_clearRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
|
m_clearRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
|
||||||
}
|
}
|
||||||
@@ -3965,7 +3968,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
{
|
{
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
|
|
||||||
m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
m_updateRegion.Union( rect->x, rect->y, rect->width, rect->height );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3982,7 +3984,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
{
|
{
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
// Schedule for later Updating in ::Update() or ::OnInternalIdle().
|
|
||||||
m_updateRegion.Clear();
|
m_updateRegion.Clear();
|
||||||
m_updateRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
|
m_updateRegion.Union( 0, 0, m_wxwindow->allocation.width, m_wxwindow->allocation.height );
|
||||||
}
|
}
|
||||||
@@ -3991,24 +3992,27 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
gtk_widget_draw( m_widget, (GdkRectangle*) NULL );
|
gtk_widget_draw( m_widget, (GdkRectangle*) NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else // GTK+ 2
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
|
GdkRectangle gdk_rect,
|
||||||
|
*p;
|
||||||
if (rect)
|
if (rect)
|
||||||
{
|
{
|
||||||
GdkRectangle gdk_rect;
|
|
||||||
gdk_rect.x = rect->x;
|
gdk_rect.x = rect->x;
|
||||||
gdk_rect.y = rect->y;
|
gdk_rect.y = rect->y;
|
||||||
gdk_rect.width = rect->width;
|
gdk_rect.width = rect->width;
|
||||||
gdk_rect.height = rect->height;
|
gdk_rect.height = rect->height;
|
||||||
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, &gdk_rect, TRUE );
|
p = &gdk_rect;
|
||||||
}
|
}
|
||||||
else
|
else // invalidate everything
|
||||||
{
|
{
|
||||||
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, NULL, TRUE );
|
p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, p, TRUE );
|
||||||
}
|
}
|
||||||
#endif
|
#endif // GTK+ 1/2
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::Update()
|
void wxWindowGTK::Update()
|
||||||
@@ -4031,6 +4035,16 @@ void wxWindowGTK::GtkUpdate()
|
|||||||
if (!m_updateRegion.IsEmpty())
|
if (!m_updateRegion.IsEmpty())
|
||||||
GtkSendPaintEvents();
|
GtkSendPaintEvents();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::GtkSendPaintEvents()
|
void wxWindowGTK::GtkSendPaintEvents()
|
||||||
|
Reference in New Issue
Block a user