summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3d777ef)
Override CanScroll() in wxScrolled to return the real state of the scrollbar
instead of just relying on the wx[HV]SCROLL styles.
Closes #15440.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74714
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// implement base class pure virtuals
virtual void AdjustScrollbars();
// implement base class pure virtuals
virtual void AdjustScrollbars();
+ virtual bool IsScrollbarShown(int orient) const;
protected:
virtual void DoScroll(int x, int y);
protected:
virtual void DoScroll(int x, int y);
bool noRefresh = false);
virtual void AdjustScrollbars();
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,
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);
int noUnitsX, int noUnitsY,
int xPos = 0, int yPos = 0,
bool noRefresh = false);
+ virtual bool IsScrollbarShown(int orient) const;
virtual void AdjustScrollbars();
protected:
virtual void AdjustScrollbars();
protected:
DoShowScrollbars(horz, vert);
}
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
// 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(); } \
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 \
virtual void DoSetVirtualSize(int x, int y) \
{ ScrollDoSetVirtualSize(x, y); } \
virtual wxSize GetBestVirtualSize() const \
m_yVisibility = wxSHOW_SB_DEFAULT;
}
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)
{
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
wxScrollbarVisibility vert)
{
+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)
{
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
wxScrollbarVisibility vert)
{
+bool wxScrollHelper::IsScrollbarShown(int WXUNUSED(orient)) const
+{
+ return true;
+}
+
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility WXUNUSED(horz),
wxScrollbarVisibility WXUNUSED(vert))
{
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility WXUNUSED(horz),
wxScrollbarVisibility WXUNUSED(vert))
{