{
// queue both former and new position of the window for repainting:
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(newpos);
}
r.Offset(GetPosition());
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);
}
m_updateRegion.Clear();
+ // client area portion of 'rect':
+ wxRect rectClientOnly(rect);
+ rectClientOnly.Intersect(clientRect);
+
// paint the children:
wxPoint origin = GetClientAreaOrigin();
wxWindowList& children = GetChildren();
// compute child's area to repaint
wxRect childrect(child->GetRect());
childrect.Offset(origin);
- childrect.Intersect(rect);
+
+ if ( child->CanBeOutsideClientArea() )
+ childrect.Intersect(rect);
+ else
+ childrect.Intersect(rectClientOnly);
+
if ( childrect.IsEmpty() )
continue;
// 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
// ----------------------------------------------------------------------------
SetInsertIntoMain( true );
#endif
#if wxUSE_SCROLLBAR
- m_scrollbarVert = new wxScrollBar(this, wxID_ANY,
- wxDefaultPosition, wxDefaultSize,
- wxSB_VERTICAL);
+ m_scrollbarVert = new wxWindowScrollBar(this, wxID_ANY,
+ wxDefaultPosition, wxDefaultSize,
+ wxSB_VERTICAL);
#endif // wxUSE_SCROLLBAR
#if wxUSE_TWO_WINDOWS
SetInsertIntoMain( false );
SetInsertIntoMain( true );
#endif
#if wxUSE_SCROLLBAR
- m_scrollbarHorz = new wxScrollBar(this, wxID_ANY,
- wxDefaultPosition, wxDefaultSize,
- wxSB_HORIZONTAL);
+ m_scrollbarHorz = new wxWindowScrollBar(this, wxID_ANY,
+ wxDefaultPosition, wxDefaultSize,
+ wxSB_HORIZONTAL);
#endif // wxUSE_SCROLLBAR
#if wxUSE_TWO_WINDOWS
SetInsertIntoMain( false );
#if wxUSE_TWO_WINDOWS
SetInsertIntoMain( true );
#endif
- scrollbar = new wxScrollBar(this, wxID_ANY,
- wxDefaultPosition, wxDefaultSize,
- orient & wxVERTICAL ? wxSB_VERTICAL
- : wxSB_HORIZONTAL);
+ scrollbar = new wxWindowScrollBar(this, wxID_ANY,
+ wxDefaultPosition, wxDefaultSize,
+ orient & wxVERTICAL ? wxSB_VERTICAL
+ : wxSB_HORIZONTAL);
#if wxUSE_TWO_WINDOWS
SetInsertIntoMain( false );
#endif