// implement base class pure virtuals
virtual void AdjustScrollbars();
+ virtual bool IsScrollbarShown(int orient) const;
protected:
virtual void DoScroll(int x, int y);
bool noRefresh = false);
virtual void AdjustScrollbars();
+ virtual bool IsScrollbarShown(int orient) const;
+
protected:
virtual void DoScroll(int x, int y);
virtual void DoShowScrollbars(wxScrollbarVisibility horz,
int noUnitsX, int noUnitsY,
int xPos = 0, int yPos = 0,
bool noRefresh = false);
+ virtual bool IsScrollbarShown(int orient) const;
virtual void AdjustScrollbars();
protected:
DoShowScrollbars(horz, vert);
}
+ // Test whether the specified scrollbar is shown.
+ virtual bool IsScrollbarShown(int orient) const = 0;
+
// Enable/disable Windows scrolling in either direction. If true, wxWidgets
// scrolls the canvas and only a bit of the canvas is invalidated; no
// Clear() is necessary. If false, the whole canvas is invalidated and a
public: \
virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \
virtual bool Layout() { return ScrollLayout(); } \
+ virtual bool CanScroll(int orient) const \
+ { return IsScrollbarShown(orient); } \
virtual void DoSetVirtualSize(int x, int y) \
{ ScrollDoSetVirtualSize(x, y); } \
virtual wxSize GetBestVirtualSize() const \
m_yVisibility = wxSHOW_SB_DEFAULT;
}
+bool wxScrollHelper::IsScrollbarShown(int orient) const
+{
+ wxScrollbarVisibility visibility = orient == wxHORIZONTAL ? m_xVisibility
+ : m_yVisibility;
+
+ return visibility != wxSHOW_SB_NEVER;
+}
+
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
wxScrollbarVisibility vert)
{
} // anonymous namespace
+bool wxScrollHelper::IsScrollbarShown(int orient) const
+{
+ GtkScrolledWindow * const scrolled = GTK_SCROLLED_WINDOW(m_win->m_widget);
+ if ( !scrolled )
+ {
+ // By default, all windows are scrollable.
+ return true;
+ }
+
+ GtkPolicyType hpolicy, vpolicy;
+ gtk_scrolled_window_get_policy(scrolled, &hpolicy, &vpolicy);
+
+ GtkPolicyType policy = orient == wxHORIZONTAL ? hpolicy : vpolicy;
+
+ return policy != GTK_POLICY_NEVER;
+}
+
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
wxScrollbarVisibility vert)
{
&m_yScrollPosition);
}
+bool wxScrollHelper::IsScrollbarShown(int WXUNUSED(orient)) const
+{
+ return true;
+}
+
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility WXUNUSED(horz),
wxScrollbarVisibility WXUNUSED(vert))
{