#include "wx/string.h"
#include "wx/gdicmn.h"
#include "wx/icon.h"
-#include "wx/scrolbar.h" // for wxScrollBar::Element
// helper class used by wxMenu-related functions
class WXDLLEXPORT wxMenuGeometryInfo
virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0;
#if wxUSE_SCROLLBAR
-
// get the size of a scrollbar arrow
virtual wxSize GetScrollbarArrowSize() const = 0;
-
- // gets the bounding box for a scrollbar element for the given (by default
- // - current) thumb position
- virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
- wxScrollBar::Element elem,
- int thumbPos = -1) const = 0;
-
- // returns the size of the scrollbar shaft excluding the arrows
- virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar) = 0;
-
- // returns one of wxHT_SCROLLBAR_XXX constants
- virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
- const wxPoint& pt) const = 0;
-
- // translate the scrollbar position (in logical units) into physical
- // coordinate (in pixels) and the other way round
- virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
- int thumbPos = -1) = 0;
- virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
- wxCoord coord) = 0;
-
#endif // wxUSE_SCROLLBAR
// get the height of a listbox item from the base font height
#if wxUSE_SCROLLBAR
virtual wxSize GetScrollbarArrowSize() const
{ return m_renderer->GetScrollbarArrowSize(); }
- virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
- wxScrollBar::Element elem,
- int thumbPos = -1) const
- { return m_renderer->GetScrollbarRect(scrollbar, elem, thumbPos); }
- virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar)
- { return m_renderer->GetScrollbarSize(scrollbar); }
- virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
- const wxPoint& pt) const
- { return m_renderer->HitTestScrollbar(scrollbar, pt); }
- virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
- int thumbPos = -1)
- { return m_renderer->ScrollbarToPixel(scrollbar, thumbPos); }
- virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
- wxCoord coord)
- { return m_renderer->PixelToScrollbar(scrollbar, coord); }
#endif // wxUSE_SCROLLBAR
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
// for wxControlRenderer::DrawScrollbar() only
const wxScrollArrows& GetArrows() const { return m_arrows; }
+ // returns one of wxHT_SCROLLBAR_XXX constants
+ wxHitTest HitTestBar(const wxPoint& pt) const;
+
// idle processing
virtual void OnInternalIdle();
// is this scrollbar attached to a window or a standalone control?
bool IsStandalone() const;
+ // scrollbar geometry methods:
+
+ // gets the bounding box for a scrollbar element for the given (by default
+ // - current) thumb position
+ wxRect GetScrollbarRect(wxScrollBar::Element elem, int thumbPos = -1) const;
+
+ // returns the size of the scrollbar shaft excluding the arrows
+ wxCoord GetScrollbarSize() const;
+
+ // translate the scrollbar position (in logical units) into physical
+ // coordinate (in pixels) and the other way round
+ wxCoord ScrollbarToPixel(int thumbPos = -1);
+ int PixelToScrollbar(wxCoord coord);
+
+ // return the starting and ending positions, in pixels, of the thumb of a
+ // scrollbar with the given logical position, thumb size and range and the
+ // given physical length
+ static void GetScrollBarThumbSize(wxCoord length,
+ int thumbPos,
+ int thumbSize,
+ int range,
+ wxCoord *thumbStart,
+ wxCoord *thumbEnd);
+
private:
// total range of the scrollbar in logical units
int m_range;
// the object handling the arrows
wxScrollArrows m_arrows;
+ friend WXDLLEXPORT class wxControlRenderer; // for geometry methods
+ friend class wxStdScrollBarInputHandler; // for geometry methods
+
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxScrollBar)
};
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight);
-#if wxUSE_SCROLLBAR
- virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
- wxScrollBar::Element elem,
- int thumbPos = -1) const;
-
- virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar);
-
- virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
- const wxPoint& pt) const;
-
- virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
- int thumbPos = -1);
- virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
-#endif // wxUSE_SCROLLBAR
-
#if wxUSE_STATUSBAR
virtual void DrawStatusField(wxDC& dc,
const wxRect& rect,
virtual int GetTextBorderWidth(const wxTextCtrl *text) const;
#endif // wxUSE_TEXTCTRL
- // return the starting and ending positions, in pixels, of the thumb of a
- // scrollbar with the given logical position, thumb size and range and the
- // given physical length
- static void GetScrollBarThumbSize(wxCoord length,
- int thumbPos,
- int thumbSize,
- int range,
- wxCoord *thumbStart,
- wxCoord *thumbEnd);
-
// GDI objects we often use
wxPen m_penBlack,
m_penDarkGrey,
wxScrollBar::Element elem =
(wxScrollBar::Element)(wxScrollBar::Element_Bar_1 + nBar);
- wxRect rectBar = m_renderer->GetScrollbarRect(scrollbar, elem);
+ wxRect rectBar = scrollbar->GetScrollbarRect(elem);
if ( rgnUpdate.Contains(rectBar) )
{
wxScrollBar::Element elem =
(wxScrollBar::Element)(wxScrollBar::Element_Arrow_Line_1 + nArrow);
- wxRect rectArrow = m_renderer->GetScrollbarRect(scrollbar, elem);
+ wxRect rectArrow = scrollbar->GetScrollbarRect(elem);
if ( rgnUpdate.Contains(rectArrow) )
{
wxLogTrace(_T("scrollbar"),
// and the thumb
wxScrollBar::Element elem = wxScrollBar::Element_Thumb;
- wxRect rectThumb = m_renderer->GetScrollbarRect(scrollbar, elem);
+ wxRect rectThumb = scrollbar->GetScrollbarRect(elem);
if ( rectThumb.width && rectThumb.height && rgnUpdate.Contains(rectThumb) )
{
wxLogTrace(_T("scrollbar"),
wxScrollArrows::Arrow wxScrollBar::HitTestArrow(const wxPoint& pt) const
{
- switch ( m_renderer->HitTestScrollbar(this, pt) )
+ switch ( HitTestBar(pt) )
{
case wxHT_SCROLLBAR_ARROW_LINE_1:
return wxScrollArrows::Arrow_First;
}
}
+wxHitTest wxScrollBar::HitTestBar(const wxPoint& pt) const
+{
+ // we only need to work with either x or y coord depending on the
+ // orientation, choose one (but still check the other one to verify if the
+ // mouse is in the window at all)
+ const wxSize sizeArrowSB = m_renderer->GetScrollbarArrowSize();
+
+ wxCoord coord, sizeArrow, sizeTotal;
+ wxSize size = GetSize();
+ if ( GetWindowStyle() & wxVERTICAL )
+ {
+ if ( pt.x < 0 || pt.x > size.x )
+ return wxHT_NOWHERE;
+
+ coord = pt.y;
+ sizeArrow = sizeArrowSB.y;
+ sizeTotal = size.y;
+ }
+ else // horizontal
+ {
+ if ( pt.y < 0 || pt.y > size.y )
+ return wxHT_NOWHERE;
+
+ coord = pt.x;
+ sizeArrow = sizeArrowSB.x;
+ sizeTotal = size.x;
+ }
+
+ // test for the arrows first as it's faster
+ if ( coord < 0 || coord > sizeTotal )
+ {
+ return wxHT_NOWHERE;
+ }
+ else if ( coord < sizeArrow )
+ {
+ return wxHT_SCROLLBAR_ARROW_LINE_1;
+ }
+ else if ( coord > sizeTotal - sizeArrow )
+ {
+ return wxHT_SCROLLBAR_ARROW_LINE_2;
+ }
+ else
+ {
+ // calculate the thumb position in pixels
+ sizeTotal -= 2*sizeArrow;
+ wxCoord thumbStart, thumbEnd;
+ int range = GetRange();
+ if ( !range )
+ {
+ // clicking the scrollbar without range has no effect
+ return wxHT_NOWHERE;
+ }
+ else
+ {
+ GetScrollBarThumbSize(sizeTotal,
+ GetThumbPosition(),
+ GetThumbSize(),
+ range,
+ &thumbStart,
+ &thumbEnd);
+ }
+
+ // now compare with the thumb position
+ coord -= sizeArrow;
+ if ( coord < thumbStart )
+ return wxHT_SCROLLBAR_BAR_1;
+ else if ( coord > thumbEnd )
+ return wxHT_SCROLLBAR_BAR_2;
+ else
+ return wxHT_SCROLLBAR_THUMB;
+ }
+}
+
+/* static */
+void wxScrollBar::GetScrollBarThumbSize(wxCoord length,
+ int thumbPos,
+ int thumbSize,
+ int range,
+ wxCoord *thumbStart,
+ wxCoord *thumbEnd)
+{
+ // the thumb can't be made less than this number of pixels
+ static const wxCoord thumbMinWidth = 8; // FIXME: should be configurable
+
+ *thumbStart = (length*thumbPos) / range;
+ *thumbEnd = (length*(thumbPos + thumbSize)) / range;
+
+ if ( *thumbEnd - *thumbStart < thumbMinWidth )
+ {
+ // adjust the end if possible
+ if ( *thumbStart <= length - thumbMinWidth )
+ {
+ // yes, just make it wider
+ *thumbEnd = *thumbStart + thumbMinWidth;
+ }
+ else // it is at the bottom of the scrollbar
+ {
+ // so move it a bit up
+ *thumbStart = length - thumbMinWidth;
+ *thumbEnd = length;
+ }
+ }
+}
+
+wxRect wxScrollBar::GetScrollbarRect(wxScrollBar::Element elem,
+ int thumbPos) const
+{
+ if ( thumbPos == -1 )
+ {
+ thumbPos = GetThumbPosition();
+ }
+
+ const wxSize sizeArrow = m_renderer->GetScrollbarArrowSize();
+
+ wxSize sizeTotal = GetClientSize();
+ wxCoord *start, *width;
+ wxCoord length, arrow;
+ wxRect rect;
+ if ( IsVertical() )
+ {
+ rect.x = 0;
+ rect.width = sizeTotal.x;
+ length = sizeTotal.y;
+ start = &rect.y;
+ width = &rect.height;
+ arrow = sizeArrow.y;
+ }
+ else // horizontal
+ {
+ rect.y = 0;
+ rect.height = sizeTotal.y;
+ length = sizeTotal.x;
+ start = &rect.x;
+ width = &rect.width;
+ arrow = sizeArrow.x;
+ }
+
+ switch ( elem )
+ {
+ case wxScrollBar::Element_Arrow_Line_1:
+ *start = 0;
+ *width = arrow;
+ break;
+
+ case wxScrollBar::Element_Arrow_Line_2:
+ *start = length - arrow;
+ *width = arrow;
+ break;
+
+ case wxScrollBar::Element_Arrow_Page_1:
+ case wxScrollBar::Element_Arrow_Page_2:
+ // we don't have them at all
+ break;
+
+ case wxScrollBar::Element_Thumb:
+ case wxScrollBar::Element_Bar_1:
+ case wxScrollBar::Element_Bar_2:
+ // we need to calculate the thumb position - do it
+ {
+ length -= 2*arrow;
+ wxCoord thumbStart, thumbEnd;
+ int range = GetRange();
+ if ( !range )
+ {
+ thumbStart =
+ thumbEnd = 0;
+ }
+ else
+ {
+ GetScrollBarThumbSize(length,
+ thumbPos,
+ GetThumbSize(),
+ range,
+ &thumbStart,
+ &thumbEnd);
+ }
+
+ if ( elem == wxScrollBar::Element_Thumb )
+ {
+ *start = thumbStart;
+ *width = thumbEnd - thumbStart;
+ }
+ else if ( elem == wxScrollBar::Element_Bar_1 )
+ {
+ *start = 0;
+ *width = thumbStart;
+ }
+ else // elem == wxScrollBar::Element_Bar_2
+ {
+ *start = thumbEnd;
+ *width = length - thumbEnd;
+ }
+
+ // everything is relative to the start of the shaft so far
+ *start += arrow;
+ }
+ break;
+
+ case wxScrollBar::Element_Max:
+ default:
+ wxFAIL_MSG( _T("unknown scrollbar element") );
+ }
+
+ return rect;
+}
+
+wxCoord wxScrollBar::GetScrollbarSize() const
+{
+ const wxSize sizeArrowSB = m_renderer->GetScrollbarArrowSize();
+
+ wxCoord sizeArrow, sizeTotal;
+ if ( GetWindowStyle() & wxVERTICAL )
+ {
+ sizeArrow = sizeArrowSB.y;
+ sizeTotal = GetSize().y;
+ }
+ else // horizontal
+ {
+ sizeArrow = sizeArrowSB.x;
+ sizeTotal = GetSize().x;
+ }
+
+ return sizeTotal - 2*sizeArrow;
+}
+
+
+wxCoord wxScrollBar::ScrollbarToPixel(int thumbPos)
+{
+ int range = GetRange();
+ if ( !range )
+ {
+ // the only valid position anyhow
+ return 0;
+ }
+
+ if ( thumbPos == -1 )
+ {
+ // by default use the current thumb position
+ thumbPos = GetThumbPosition();
+ }
+
+ const wxSize sizeArrow = m_renderer->GetScrollbarArrowSize();
+ return (thumbPos * GetScrollbarSize()) / range
+ + (IsVertical() ? sizeArrow.y : sizeArrow.x);
+}
+
+int wxScrollBar::PixelToScrollbar(wxCoord coord)
+{
+ const wxSize sizeArrow = m_renderer->GetScrollbarArrowSize();
+ return ((coord - (IsVertical() ? sizeArrow.y : sizeArrow.x)) *
+ GetRange() ) / GetScrollbarSize();
+}
+
// ----------------------------------------------------------------------------
// drawing
// ----------------------------------------------------------------------------
{
if ( m_elementsState[n] & wxCONTROL_DIRTY )
{
- wxRect rect = GetRenderer()->GetScrollbarRect(this, (Element)n);
+ wxRect rect = GetScrollbarRect((Element)n);
if ( rect.width && rect.height )
{
}
#else // efficient version: only repaint the area occupied by
// the thumb previously - we can't do better than this
- rect = GetRenderer()->GetScrollbarRect(this,
- Element_Thumb,
- m_thumbPosOld);
+ rect = GetScrollbarRect(Element_Thumb, m_thumbPosOld);
#endif // 0/1
}
const wxMouseEvent& event)
{
int thumbPos = GetMouseCoord(scrollbar, event) - m_ofsMouse;
- thumbPos = m_renderer->PixelToScrollbar(scrollbar, thumbPos);
+ thumbPos = scrollbar->PixelToScrollbar(thumbPos);
scrollbar->PerformAction(wxACTION_SCROLL_THUMB_MOVE, thumbPos);
}
{
// determine which part of the window mouse is in
wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar);
- wxHitTest ht = m_renderer->HitTestScrollbar
- (
- scrollbar,
- event.GetPosition()
- );
+ wxHitTest ht = scrollbar->HitTest(event.GetPosition());
// when the mouse is pressed on any scrollbar element, we capture it
// and hold capture until the same mouse button is released
case wxHT_SCROLLBAR_THUMB:
consumer->PerformAction(wxACTION_SCROLL_THUMB_DRAG);
m_ofsMouse = GetMouseCoord(scrollbar, event) -
- m_renderer->ScrollbarToPixel(scrollbar);
+ scrollbar->ScrollbarToPixel();
// fall through: there is no immediate action
if ( event.Dragging() )
{
- wxHitTest ht = m_renderer->HitTestScrollbar
- (
- scrollbar,
- event.GetPosition()
- );
+ wxHitTest ht = scrollbar->HitTestBar(event.GetPosition());
if ( ht == m_htLast )
{
// nothing changed
DrawSolidRect(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
}
-// ----------------------------------------------------------------------------
-// scrollbars geometry
-// ----------------------------------------------------------------------------
-
-#if wxUSE_SCROLLBAR
-
-/* static */
-void wxStdRenderer::GetScrollBarThumbSize(wxCoord length,
- int thumbPos,
- int thumbSize,
- int range,
- wxCoord *thumbStart,
- wxCoord *thumbEnd)
-{
- // the thumb can't be made less than this number of pixels
- static const wxCoord thumbMinWidth = 8; // FIXME: should be configurable
-
- *thumbStart = (length*thumbPos) / range;
- *thumbEnd = (length*(thumbPos + thumbSize)) / range;
-
- if ( *thumbEnd - *thumbStart < thumbMinWidth )
- {
- // adjust the end if possible
- if ( *thumbStart <= length - thumbMinWidth )
- {
- // yes, just make it wider
- *thumbEnd = *thumbStart + thumbMinWidth;
- }
- else // it is at the bottom of the scrollbar
- {
- // so move it a bit up
- *thumbStart = length - thumbMinWidth;
- *thumbEnd = length;
- }
- }
-}
-
-wxRect wxStdRenderer::GetScrollbarRect(const wxScrollBar *scrollbar,
- wxScrollBar::Element elem,
- int thumbPos) const
-{
- if ( thumbPos == -1 )
- {
- thumbPos = scrollbar->GetThumbPosition();
- }
-
- const wxSize sizeArrow = GetScrollbarArrowSize();
-
- wxSize sizeTotal = scrollbar->GetClientSize();
- wxCoord *start, *width;
- wxCoord length, arrow;
- wxRect rect;
- if ( scrollbar->IsVertical() )
- {
- rect.x = 0;
- rect.width = sizeTotal.x;
- length = sizeTotal.y;
- start = &rect.y;
- width = &rect.height;
- arrow = sizeArrow.y;
- }
- else // horizontal
- {
- rect.y = 0;
- rect.height = sizeTotal.y;
- length = sizeTotal.x;
- start = &rect.x;
- width = &rect.width;
- arrow = sizeArrow.x;
- }
-
- switch ( elem )
- {
- case wxScrollBar::Element_Arrow_Line_1:
- *start = 0;
- *width = arrow;
- break;
-
- case wxScrollBar::Element_Arrow_Line_2:
- *start = length - arrow;
- *width = arrow;
- break;
-
- case wxScrollBar::Element_Arrow_Page_1:
- case wxScrollBar::Element_Arrow_Page_2:
- // we don't have them at all
- break;
-
- case wxScrollBar::Element_Thumb:
- case wxScrollBar::Element_Bar_1:
- case wxScrollBar::Element_Bar_2:
- // we need to calculate the thumb position - do it
- {
- length -= 2*arrow;
- wxCoord thumbStart, thumbEnd;
- int range = scrollbar->GetRange();
- if ( !range )
- {
- thumbStart =
- thumbEnd = 0;
- }
- else
- {
- GetScrollBarThumbSize(length,
- thumbPos,
- scrollbar->GetThumbSize(),
- range,
- &thumbStart,
- &thumbEnd);
- }
-
- if ( elem == wxScrollBar::Element_Thumb )
- {
- *start = thumbStart;
- *width = thumbEnd - thumbStart;
- }
- else if ( elem == wxScrollBar::Element_Bar_1 )
- {
- *start = 0;
- *width = thumbStart;
- }
- else // elem == wxScrollBar::Element_Bar_2
- {
- *start = thumbEnd;
- *width = length - thumbEnd;
- }
-
- // everything is relative to the start of the shaft so far
- *start += arrow;
- }
- break;
-
- case wxScrollBar::Element_Max:
- default:
- wxFAIL_MSG( _T("unknown scrollbar element") );
- }
-
- return rect;
-}
-
-wxCoord wxStdRenderer::GetScrollbarSize(const wxScrollBar *scrollbar)
-{
- const wxSize sizeArrowSB = GetScrollbarArrowSize();
-
- wxCoord sizeArrow, sizeTotal;
- if ( scrollbar->GetWindowStyle() & wxVERTICAL )
- {
- sizeArrow = sizeArrowSB.y;
- sizeTotal = scrollbar->GetSize().y;
- }
- else // horizontal
- {
- sizeArrow = sizeArrowSB.x;
- sizeTotal = scrollbar->GetSize().x;
- }
-
- return sizeTotal - 2*sizeArrow;
-}
-
-wxHitTest
-wxStdRenderer::HitTestScrollbar(const wxScrollBar *scrollbar, const wxPoint& pt) const
-{
- // we only need to work with either x or y coord depending on the
- // orientation, choose one (but still check the other one to verify if the
- // mouse is in the window at all)
- const wxSize sizeArrowSB = GetScrollbarArrowSize();
-
- wxCoord coord, sizeArrow, sizeTotal;
- wxSize size = scrollbar->GetSize();
- if ( scrollbar->GetWindowStyle() & wxVERTICAL )
- {
- if ( pt.x < 0 || pt.x > size.x )
- return wxHT_NOWHERE;
-
- coord = pt.y;
- sizeArrow = sizeArrowSB.y;
- sizeTotal = size.y;
- }
- else // horizontal
- {
- if ( pt.y < 0 || pt.y > size.y )
- return wxHT_NOWHERE;
-
- coord = pt.x;
- sizeArrow = sizeArrowSB.x;
- sizeTotal = size.x;
- }
-
- // test for the arrows first as it's faster
- if ( coord < 0 || coord > sizeTotal )
- {
- return wxHT_NOWHERE;
- }
- else if ( coord < sizeArrow )
- {
- return wxHT_SCROLLBAR_ARROW_LINE_1;
- }
- else if ( coord > sizeTotal - sizeArrow )
- {
- return wxHT_SCROLLBAR_ARROW_LINE_2;
- }
- else
- {
- // calculate the thumb position in pixels
- sizeTotal -= 2*sizeArrow;
- wxCoord thumbStart, thumbEnd;
- int range = scrollbar->GetRange();
- if ( !range )
- {
- // clicking the scrollbar without range has no effect
- return wxHT_NOWHERE;
- }
- else
- {
- GetScrollBarThumbSize(sizeTotal,
- scrollbar->GetThumbPosition(),
- scrollbar->GetThumbSize(),
- range,
- &thumbStart,
- &thumbEnd);
- }
-
- // now compare with the thumb position
- coord -= sizeArrow;
- if ( coord < thumbStart )
- return wxHT_SCROLLBAR_BAR_1;
- else if ( coord > thumbEnd )
- return wxHT_SCROLLBAR_BAR_2;
- else
- return wxHT_SCROLLBAR_THUMB;
- }
-}
-
-
-wxCoord
-wxStdRenderer::ScrollbarToPixel(const wxScrollBar *scrollbar, int thumbPos)
-{
- int range = scrollbar->GetRange();
- if ( !range )
- {
- // the only valid position anyhow
- return 0;
- }
-
- if ( thumbPos == -1 )
- {
- // by default use the current thumb position
- thumbPos = scrollbar->GetThumbPosition();
- }
-
- const wxSize sizeArrow = GetScrollbarArrowSize();
- return (thumbPos*GetScrollbarSize(scrollbar)) / range
- + (scrollbar->IsVertical() ? sizeArrow.y : sizeArrow.x);
-}
-
-int wxStdRenderer::PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord)
-{
- const wxSize sizeArrow = GetScrollbarArrowSize();
- return ((coord - (scrollbar->IsVertical() ? sizeArrow.y : sizeArrow.x)) *
- scrollbar->GetRange() ) / GetScrollbarSize(scrollbar);
-}
-
-#endif // wxUSE_SCROLLBAR
-
// ----------------------------------------------------------------------------
// status bar
// ----------------------------------------------------------------------------
virtual void AdjustSize(wxSize *size, const wxWindow *window);
// geometry and hit testing
+#if wxUSE_SCROLLBAR
virtual wxSize GetScrollbarArrowSize() const
{ return m_sizeScrollbarArrow; }
-#if wxUSE_SCROLLBAR
- virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
- wxScrollBar::Element elem,
- int thumbPos = -1) const;
#endif // wxUSE_SCROLLBAR
virtual wxSize GetCheckBitmapSize() const
DrawSolidRect(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), rectBar);
}
-#if wxUSE_SCROLLBAR
-wxRect wxGTKRenderer::GetScrollbarRect(const wxScrollBar *scrollbar,
- wxScrollBar::Element elem,
- int thumbPos) const
-{
- // as GTK scrollbars can't be disabled, it makes no sense to remove the
- // thumb for a scrollbar with range 0 - instead, make it fill the entire
- // scrollbar shaft
- if ( (elem == wxScrollBar::Element_Thumb) && !scrollbar->GetRange() )
- {
- elem = wxScrollBar::Element_Bar_2;
- }
-
- return wxStdRenderer::GetScrollbarRect(scrollbar, elem, thumbPos);
-}
-
-#endif // wxUSE_SCROLLBAR
-
// ----------------------------------------------------------------------------
// size adjustments
// ----------------------------------------------------------------------------
bool stop = false;
if ( action == wxACTION_SCROLL_PAGE_DOWN )
{
- stop = m_renderer->HitTestScrollbar(scrollbar, m_ptStartScrolling)
- != wxHT_SCROLLBAR_BAR_2;
+ stop = scrollbar->HitTestBar(m_ptStartScrolling) != wxHT_SCROLLBAR_BAR_2;
}
else if ( action == wxACTION_SCROLL_PAGE_UP )
{
- stop = m_renderer->HitTestScrollbar(scrollbar, m_ptStartScrolling)
- != wxHT_SCROLLBAR_BAR_1;
+ stop = scrollbar->HitTestBar(m_ptStartScrolling) != wxHT_SCROLLBAR_BAR_1;
}
if ( stop )
return false;
}
- ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
+ ht = scrollbar->HitTestBar(event.GetPosition());
if ( ht == m_htLast )
{
// yes it did, resume scrolling
// Always let thumb jump back if we leave the scrollbar
if ( event.Moving() )
{
- ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
+ ht = scrollbar->HitTestBar(event.GetPosition());
}
else // event.Leaving()
{
if (pos.y > -40 && pos.y < scrollbar->GetSize().y+40)
pos.y = 5;
}
- ht = m_renderer->HitTestScrollbar(scrollbar, pos );
+ ht = scrollbar->HitTestBar(pos);
#endif
// if we're dragging the thumb and the mouse stays in the scrollbar, it