wxDFB: fix rendering artefacts when scrolling wxScrolledWindow that contains other widgets
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -488,6 +488,8 @@ public:
|
|||||||
// update all menu item states in all menus
|
// update all menu item states in all menus
|
||||||
virtual void UpdateMenus();
|
virtual void UpdateMenus();
|
||||||
|
|
||||||
|
virtual bool CanBeOutsideClientArea() const { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the list of all our menus
|
// the list of all our menus
|
||||||
wxMenuList m_menus;
|
wxMenuList m_menus;
|
||||||
|
@@ -97,6 +97,8 @@ public:
|
|||||||
// don't want status bars to accept the focus at all
|
// don't want status bars to accept the focus at all
|
||||||
virtual bool AcceptsFocus() const { return false; }
|
virtual bool AcceptsFocus() const { return false; }
|
||||||
|
|
||||||
|
virtual bool CanBeOutsideClientArea() const { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// set the widths array to NULL
|
// set the widths array to NULL
|
||||||
void InitWidths();
|
void InitWidths();
|
||||||
|
@@ -1136,6 +1136,10 @@ public:
|
|||||||
// behaviour in the most common case
|
// behaviour in the most common case
|
||||||
virtual bool ShouldInheritColours() const { return false; }
|
virtual bool ShouldInheritColours() const { return false; }
|
||||||
|
|
||||||
|
// returns true if the window can be positioned outside of parent's client
|
||||||
|
// area (normal windows can't, but e.g. menubar or statusbar can):
|
||||||
|
virtual bool CanBeOutsideClientArea() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// event handling specific to wxWindow
|
// event handling specific to wxWindow
|
||||||
virtual bool TryValidator(wxEvent& event);
|
virtual bool TryValidator(wxEvent& event);
|
||||||
|
@@ -58,6 +58,11 @@ static wxRect GetUncoveredWindowArea(wxWindow *win)
|
|||||||
// coordinates; this will remove parts of 'r' that are outside of the
|
// coordinates; this will remove parts of 'r' that are outside of the
|
||||||
// parent's area:
|
// parent's area:
|
||||||
wxRect rp(GetUncoveredWindowArea(parent));
|
wxRect rp(GetUncoveredWindowArea(parent));
|
||||||
|
|
||||||
|
// normal windows cannot extend out of its parent's client area:
|
||||||
|
if ( !win->CanBeOutsideClientArea() )
|
||||||
|
rp.Intersect(parent->GetClientRect());
|
||||||
|
|
||||||
rp.Offset(-win->GetPosition());
|
rp.Offset(-win->GetPosition());
|
||||||
rp.Offset(-parent->GetClientAreaOrigin());
|
rp.Offset(-parent->GetClientAreaOrigin());
|
||||||
r.Intersect(rp);
|
r.Intersect(rp);
|
||||||
|
@@ -492,6 +492,15 @@ void wxWindowDFB::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
{
|
{
|
||||||
// queue both former and new position of the window for repainting:
|
// queue both former and new position of the window for repainting:
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
|
|
||||||
|
// only refresh the visible parts:
|
||||||
|
if ( !CanBeOutsideClientArea() )
|
||||||
|
{
|
||||||
|
wxRect parentClient(parent->GetClientSize());
|
||||||
|
oldpos.Intersect(parentClient);
|
||||||
|
newpos.Intersect(parentClient);
|
||||||
|
}
|
||||||
|
|
||||||
parent->RefreshRect(oldpos);
|
parent->RefreshRect(oldpos);
|
||||||
parent->RefreshRect(newpos);
|
parent->RefreshRect(newpos);
|
||||||
}
|
}
|
||||||
@@ -682,6 +691,11 @@ void wxWindowDFB::DoRefreshRect(const wxRect& rect)
|
|||||||
r.Offset(GetPosition());
|
r.Offset(GetPosition());
|
||||||
r.Offset(parent->GetClientAreaOrigin());
|
r.Offset(parent->GetClientAreaOrigin());
|
||||||
|
|
||||||
|
// normal windows cannot extend out of its parent's client area, so don't
|
||||||
|
// refresh any hidden parts:
|
||||||
|
if ( !CanBeOutsideClientArea() )
|
||||||
|
r.Intersect(parent->GetClientRect());
|
||||||
|
|
||||||
parent->DoRefreshRect(r);
|
parent->DoRefreshRect(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,6 +777,10 @@ void wxWindowDFB::PaintWindow(const wxRect& rect)
|
|||||||
|
|
||||||
m_updateRegion.Clear();
|
m_updateRegion.Clear();
|
||||||
|
|
||||||
|
// client area portion of 'rect':
|
||||||
|
wxRect rectClientOnly(rect);
|
||||||
|
rectClientOnly.Intersect(clientRect);
|
||||||
|
|
||||||
// paint the children:
|
// paint the children:
|
||||||
wxPoint origin = GetClientAreaOrigin();
|
wxPoint origin = GetClientAreaOrigin();
|
||||||
wxWindowList& children = GetChildren();
|
wxWindowList& children = GetChildren();
|
||||||
@@ -777,7 +795,12 @@ void wxWindowDFB::PaintWindow(const wxRect& rect)
|
|||||||
// compute child's area to repaint
|
// compute child's area to repaint
|
||||||
wxRect childrect(child->GetRect());
|
wxRect childrect(child->GetRect());
|
||||||
childrect.Offset(origin);
|
childrect.Offset(origin);
|
||||||
childrect.Intersect(rect);
|
|
||||||
|
if ( child->CanBeOutsideClientArea() )
|
||||||
|
childrect.Intersect(rect);
|
||||||
|
else
|
||||||
|
childrect.Intersect(rectClientOnly);
|
||||||
|
|
||||||
if ( childrect.IsEmpty() )
|
if ( childrect.IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -60,6 +60,29 @@
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// scrollbars class
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// This is scrollbar class used to implement wxWindow's "built-in" scrollbars;
|
||||||
|
// unlike the standard wxScrollBar class, this one is positioned outside of its
|
||||||
|
// parent's client area
|
||||||
|
class wxWindowScrollBar : public wxScrollBar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxWindowScrollBar(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxSB_HORIZONTAL)
|
||||||
|
: wxScrollBar(parent, id, pos, size, style)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool CanBeOutsideClientArea() const { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// event tables
|
// event tables
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -156,9 +179,9 @@ bool wxWindow::Create(wxWindow *parent,
|
|||||||
SetInsertIntoMain( true );
|
SetInsertIntoMain( true );
|
||||||
#endif
|
#endif
|
||||||
#if wxUSE_SCROLLBAR
|
#if wxUSE_SCROLLBAR
|
||||||
m_scrollbarVert = new wxScrollBar(this, wxID_ANY,
|
m_scrollbarVert = new wxWindowScrollBar(this, wxID_ANY,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxSB_VERTICAL);
|
wxSB_VERTICAL);
|
||||||
#endif // wxUSE_SCROLLBAR
|
#endif // wxUSE_SCROLLBAR
|
||||||
#if wxUSE_TWO_WINDOWS
|
#if wxUSE_TWO_WINDOWS
|
||||||
SetInsertIntoMain( false );
|
SetInsertIntoMain( false );
|
||||||
@@ -172,9 +195,9 @@ bool wxWindow::Create(wxWindow *parent,
|
|||||||
SetInsertIntoMain( true );
|
SetInsertIntoMain( true );
|
||||||
#endif
|
#endif
|
||||||
#if wxUSE_SCROLLBAR
|
#if wxUSE_SCROLLBAR
|
||||||
m_scrollbarHorz = new wxScrollBar(this, wxID_ANY,
|
m_scrollbarHorz = new wxWindowScrollBar(this, wxID_ANY,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxSB_HORIZONTAL);
|
wxSB_HORIZONTAL);
|
||||||
#endif // wxUSE_SCROLLBAR
|
#endif // wxUSE_SCROLLBAR
|
||||||
#if wxUSE_TWO_WINDOWS
|
#if wxUSE_TWO_WINDOWS
|
||||||
SetInsertIntoMain( false );
|
SetInsertIntoMain( false );
|
||||||
@@ -903,10 +926,10 @@ void wxWindow::SetScrollbar(int orient,
|
|||||||
#if wxUSE_TWO_WINDOWS
|
#if wxUSE_TWO_WINDOWS
|
||||||
SetInsertIntoMain( true );
|
SetInsertIntoMain( true );
|
||||||
#endif
|
#endif
|
||||||
scrollbar = new wxScrollBar(this, wxID_ANY,
|
scrollbar = new wxWindowScrollBar(this, wxID_ANY,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
orient & wxVERTICAL ? wxSB_VERTICAL
|
orient & wxVERTICAL ? wxSB_VERTICAL
|
||||||
: wxSB_HORIZONTAL);
|
: wxSB_HORIZONTAL);
|
||||||
#if wxUSE_TWO_WINDOWS
|
#if wxUSE_TWO_WINDOWS
|
||||||
SetInsertIntoMain( false );
|
SetInsertIntoMain( false );
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user