1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/vscroll.cpp
3 // Purpose: wxVScrolledWindow implementation
4 // Author: Vadim Zeitlin
5 // Modified by: Brad Anderson, David Warkentin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
32 #include "wx/vscroll.h"
34 // ============================================================================
35 // wxVarScrollHelperEvtHandler declaration
36 // ============================================================================
38 // ----------------------------------------------------------------------------
39 // wxScrollHelperEvtHandler: intercept the events from the window and forward
40 // them to wxVarScrollHelperBase
41 // ----------------------------------------------------------------------------
43 class WXDLLEXPORT wxVarScrollHelperEvtHandler
: public wxEvtHandler
46 wxVarScrollHelperEvtHandler(wxVarScrollHelperBase
*scrollHelper
)
48 m_scrollHelper
= scrollHelper
;
51 virtual bool ProcessEvent(wxEvent
& event
);
54 wxVarScrollHelperBase
*m_scrollHelper
;
56 wxDECLARE_NO_COPY_CLASS(wxVarScrollHelperEvtHandler
);
59 // ============================================================================
60 // wxVarScrollHelperEvtHandler implementation
61 // ============================================================================
63 bool wxVarScrollHelperEvtHandler::ProcessEvent(wxEvent
& event
)
65 wxEventType evType
= event
.GetEventType();
67 // pass it on to the real handler
68 bool processed
= wxEvtHandler::ProcessEvent(event
);
70 // always process the size events ourselves, even if the user code handles
71 // them as well, as we need to AdjustScrollbars()
73 // NB: it is important to do it after processing the event in the normal
74 // way as HandleOnSize() may generate a wxEVT_SIZE itself if the
75 // scrollbar[s] (dis)appear and it should be seen by the user code
77 if ( evType
== wxEVT_SIZE
)
79 m_scrollHelper
->HandleOnSize((wxSizeEvent
&)event
);
81 return !event
.GetSkipped();
86 // normally, nothing more to do here - except if we have a command
88 if ( event
.IsCommandEvent() )
94 // reset the skipped flag (which might have been set to true in
95 // ProcessEvent() above) to be able to test it below
96 bool wasSkipped
= event
.GetSkipped();
100 if ( evType
== wxEVT_SCROLLWIN_TOP
||
101 evType
== wxEVT_SCROLLWIN_BOTTOM
||
102 evType
== wxEVT_SCROLLWIN_LINEUP
||
103 evType
== wxEVT_SCROLLWIN_LINEDOWN
||
104 evType
== wxEVT_SCROLLWIN_PAGEUP
||
105 evType
== wxEVT_SCROLLWIN_PAGEDOWN
||
106 evType
== wxEVT_SCROLLWIN_THUMBTRACK
||
107 evType
== wxEVT_SCROLLWIN_THUMBRELEASE
)
109 m_scrollHelper
->HandleOnScroll((wxScrollWinEvent
&)event
);
110 if ( !event
.GetSkipped() )
112 // it makes sense to indicate that we processed the message as we
113 // did scroll the window (and also notice that wxAutoScrollTimer
114 // relies on our return value for continuous scrolling)
120 else if ( evType
== wxEVT_MOUSEWHEEL
)
122 m_scrollHelper
->HandleOnMouseWheel((wxMouseEvent
&)event
);
124 #endif // wxUSE_MOUSEWHEEL
126 event
.Skip(wasSkipped
);
132 // ============================================================================
133 // wxVarScrollHelperBase implementation
134 // ============================================================================
136 // ----------------------------------------------------------------------------
137 // wxVarScrollHelperBase initialization
138 // ----------------------------------------------------------------------------
140 wxVarScrollHelperBase::wxVarScrollHelperBase(wxWindow
*win
)
142 wxASSERT_MSG( win
, wxT("associated window can't be NULL in wxVarScrollHelperBase") );
145 m_sumWheelRotation
= 0;
153 m_targetWindow
= NULL
;
155 m_physicalScrolling
= true;
160 // by default, the associated window is also the target window
161 DoSetTargetWindow(win
);
165 wxVarScrollHelperBase::~wxVarScrollHelperBase()
170 // ----------------------------------------------------------------------------
171 // wxVarScrollHelperBase various helpers
172 // ----------------------------------------------------------------------------
175 wxVarScrollHelperBase::AssignOrient(wxCoord
& x
,
180 if ( GetOrientation() == wxVERTICAL
)
193 wxVarScrollHelperBase::IncOrient(wxCoord
& x
, wxCoord
& y
, wxCoord inc
)
195 if ( GetOrientation() == wxVERTICAL
)
201 wxCoord
wxVarScrollHelperBase::DoEstimateTotalSize() const
203 // estimate the total height: it is impossible to call
204 // OnGetUnitSize() for every unit because there may be too many of
205 // them, so we just make a guess using some units in the beginning,
206 // some in the end and some in the middle
207 static const size_t NUM_UNITS_TO_SAMPLE
= 10;
210 if ( m_unitMax
< 3*NUM_UNITS_TO_SAMPLE
)
212 // in this case, full calculations are faster and more correct than
214 sizeTotal
= GetUnitsSize(0, m_unitMax
);
216 else // too many units to calculate exactly
218 // look at some units in the beginning/middle/end
220 GetUnitsSize(0, NUM_UNITS_TO_SAMPLE
) +
221 GetUnitsSize(m_unitMax
- NUM_UNITS_TO_SAMPLE
,
223 GetUnitsSize(m_unitMax
/2 - NUM_UNITS_TO_SAMPLE
/2,
224 m_unitMax
/2 + NUM_UNITS_TO_SAMPLE
/2);
226 // use the height of the units we looked as the average
227 sizeTotal
= (wxCoord
)
228 (((float)sizeTotal
/ (3*NUM_UNITS_TO_SAMPLE
)) * m_unitMax
);
234 wxCoord
wxVarScrollHelperBase::GetUnitsSize(size_t unitMin
, size_t unitMax
) const
236 if ( unitMin
== unitMax
)
238 else if ( unitMin
> unitMax
)
239 return -GetUnitsSize(unitMax
, unitMin
);
240 //else: unitMin < unitMax
242 // let the user code know that we're going to need all these units
243 OnGetUnitsSizeHint(unitMin
, unitMax
);
245 // sum up their sizes
247 for ( size_t unit
= unitMin
; unit
< unitMax
; ++unit
)
249 size
+= OnGetUnitSize(unit
);
255 size_t wxVarScrollHelperBase::FindFirstVisibleFromLast(size_t unitLast
, bool full
) const
257 const wxCoord sWindow
= GetOrientationTargetSize();
259 // go upwards until we arrive at a unit such that unitLast is not visible
260 // any more when it is shown
261 size_t unitFirst
= unitLast
;
265 s
+= OnGetUnitSize(unitFirst
);
269 // for this unit to be fully visible we need to go one unit
270 // down, but if it is enough for it to be only partly visible then
271 // this unit will do as well
289 size_t wxVarScrollHelperBase::GetNewScrollPosition(wxScrollWinEvent
& event
) const
291 wxEventType evtType
= event
.GetEventType();
293 if ( evtType
== wxEVT_SCROLLWIN_TOP
)
297 else if ( evtType
== wxEVT_SCROLLWIN_BOTTOM
)
301 else if ( evtType
== wxEVT_SCROLLWIN_LINEUP
)
303 return m_unitFirst
? m_unitFirst
- 1 : 0;
305 else if ( evtType
== wxEVT_SCROLLWIN_LINEDOWN
)
307 return m_unitFirst
+ 1;
309 else if ( evtType
== wxEVT_SCROLLWIN_PAGEUP
)
311 return FindFirstVisibleFromLast(m_unitFirst
);
313 else if ( evtType
== wxEVT_SCROLLWIN_PAGEDOWN
)
315 if ( GetVisibleEnd() )
316 return GetVisibleEnd() - 1;
318 return GetVisibleEnd();
320 else if ( evtType
== wxEVT_SCROLLWIN_THUMBRELEASE
)
322 return event
.GetPosition();
324 else if ( evtType
== wxEVT_SCROLLWIN_THUMBTRACK
)
326 return event
.GetPosition();
329 // unknown scroll event?
330 wxFAIL_MSG( wxT("unknown scroll event type?") );
334 void wxVarScrollHelperBase::UpdateScrollbar()
336 // if there is nothing to scroll, remove the scrollbar
343 // see how many units can we fit on screen
344 const wxCoord sWindow
= GetOrientationTargetSize();
346 // do vertical calculations
349 for ( unit
= m_unitFirst
; unit
< m_unitMax
; ++unit
)
354 s
+= OnGetUnitSize(unit
);
357 m_nUnitsVisible
= unit
- m_unitFirst
;
359 int unitsPageSize
= m_nUnitsVisible
;
362 // last unit is only partially visible, we still need the scrollbar and
363 // so we have to "fix" pageSize because if it is equal to m_unitMax
364 // the scrollbar is not shown at all under MSW
368 // set the scrollbar parameters to reflect this
369 m_win
->SetScrollbar(GetOrientation(), m_unitFirst
, unitsPageSize
, m_unitMax
);
372 void wxVarScrollHelperBase::RemoveScrollbar()
375 m_nUnitsVisible
= m_unitMax
;
376 m_win
->SetScrollbar(GetOrientation(), 0, 0, 0);
379 void wxVarScrollHelperBase::DeleteEvtHandler()
381 // search for m_handler in the handler list
382 if ( m_win
&& m_handler
)
384 if ( m_win
->RemoveEventHandler(m_handler
) )
388 //else: something is very wrong, so better [maybe] leak memory than
389 // risk a crash because of double deletion
395 void wxVarScrollHelperBase::DoSetTargetWindow(wxWindow
*target
)
397 m_targetWindow
= target
;
399 target
->MacSetClipChildren( true ) ;
402 // install the event handler which will intercept the events we're
403 // interested in (but only do it for our real window, not the target window
404 // which we scroll - we don't need to hijack its events)
405 if ( m_targetWindow
== m_win
)
407 // if we already have a handler, delete it first
410 m_handler
= new wxVarScrollHelperEvtHandler(this);
411 m_targetWindow
->PushEventHandler(m_handler
);
415 // ----------------------------------------------------------------------------
416 // wxVarScrollHelperBase operations
417 // ----------------------------------------------------------------------------
419 void wxVarScrollHelperBase::SetTargetWindow(wxWindow
*target
)
421 wxCHECK_RET( target
, wxT("target window must not be NULL") );
423 if ( target
== m_targetWindow
)
426 DoSetTargetWindow(target
);
429 void wxVarScrollHelperBase::SetUnitCount(size_t count
)
431 // save the number of units
434 // and our estimate for their total height
435 m_sizeTotal
= EstimateTotalSize();
437 // ScrollToUnit() will update the scrollbar itself if it changes the unit
438 // we pass to it because it's out of [new] range
439 size_t oldScrollPos
= m_unitFirst
;
440 DoScrollToUnit(m_unitFirst
);
441 if ( oldScrollPos
== m_unitFirst
)
443 // but if it didn't do it, we still need to update the scrollbar to
444 // reflect the changed number of units ourselves
449 void wxVarScrollHelperBase::RefreshUnit(size_t unit
)
451 // is this unit visible?
452 if ( !IsVisible(unit
) )
454 // no, it is useless to do anything
458 // calculate the rect occupied by this unit on screen
460 AssignOrient(rect
.width
, rect
.height
,
461 GetNonOrientationTargetSize(), OnGetUnitSize(unit
));
463 for ( size_t n
= GetVisibleBegin(); n
< unit
; ++n
)
465 IncOrient(rect
.x
, rect
.y
, OnGetUnitSize(n
));
469 m_targetWindow
->RefreshRect(rect
);
472 void wxVarScrollHelperBase::RefreshUnits(size_t from
, size_t to
)
474 wxASSERT_MSG( from
<= to
, wxT("RefreshUnits(): empty range") );
476 // clump the range to just the visible units -- it is useless to refresh
478 if ( from
< GetVisibleBegin() )
479 from
= GetVisibleBegin();
481 if ( to
> GetVisibleEnd() )
482 to
= GetVisibleEnd();
484 // calculate the rect occupied by these units on screen
485 int orient_size
, nonorient_size
, orient_pos
;
486 orient_size
= nonorient_size
= orient_pos
= 0;
488 nonorient_size
= GetNonOrientationTargetSize();
490 for ( size_t nBefore
= GetVisibleBegin();
494 orient_pos
+= OnGetUnitSize(nBefore
);
497 for ( size_t nBetween
= from
; nBetween
<= to
; nBetween
++ )
499 orient_size
+= OnGetUnitSize(nBetween
);
503 AssignOrient(rect
.x
, rect
.y
, 0, orient_pos
);
504 AssignOrient(rect
.width
, rect
.height
, nonorient_size
, orient_size
);
507 m_targetWindow
->RefreshRect(rect
);
510 void wxVarScrollHelperBase::RefreshAll()
514 m_targetWindow
->Refresh();
517 bool wxVarScrollHelperBase::ScrollLayout()
519 if ( m_targetWindow
->GetSizer() && m_physicalScrolling
)
521 // adjust the sizer dimensions/position taking into account the
522 // virtual size and scrolled position of the window.
525 AssignOrient(x
, y
, 0, -GetScrollOffset());
528 m_targetWindow
->GetVirtualSize(&w
, &h
);
530 m_targetWindow
->GetSizer()->SetDimension(x
, y
, w
, h
);
534 // fall back to default for LayoutConstraints
535 return m_targetWindow
->wxWindow::Layout();
538 int wxVarScrollHelperBase::VirtualHitTest(wxCoord coord
) const
540 const size_t unitMax
= GetVisibleEnd();
541 for ( size_t unit
= GetVisibleBegin(); unit
< unitMax
; ++unit
)
543 coord
-= OnGetUnitSize(unit
);
551 // ----------------------------------------------------------------------------
552 // wxVarScrollHelperBase scrolling
553 // ----------------------------------------------------------------------------
555 bool wxVarScrollHelperBase::DoScrollToUnit(size_t unit
)
559 // we're empty, code below doesn't make sense in this case
563 // determine the real first unit to scroll to: we shouldn't scroll beyond
565 size_t unitFirstLast
= FindFirstVisibleFromLast(m_unitMax
- 1, true);
566 if ( unit
> unitFirstLast
)
567 unit
= unitFirstLast
;
570 if ( unit
== m_unitFirst
)
577 // remember the currently shown units for the refresh code below
578 size_t unitFirstOld
= GetVisibleBegin(),
579 unitLastOld
= GetVisibleEnd();
584 // the size of scrollbar thumb could have changed
587 // finally refresh the display -- but only redraw as few units as possible
588 // to avoid flicker. We can't do this if we have children because they
590 if ( m_targetWindow
->GetChildren().empty() &&
591 (GetVisibleBegin() >= unitLastOld
|| GetVisibleEnd() <= unitFirstOld
) )
593 // the simplest case: we don't have any old units left, just redraw
595 m_targetWindow
->Refresh();
597 else // scroll the window
599 // Avoid scrolling visible parts of the screen on Mac
601 if (m_physicalScrolling
&& m_targetWindow
->IsShownOnScreen())
603 if ( m_physicalScrolling
)
607 dy
= GetUnitsSize(GetVisibleBegin(), unitFirstOld
);
609 if ( GetOrientation() == wxHORIZONTAL
)
616 m_targetWindow
->ScrollWindow(dx
, dy
);
618 else // !m_physicalScrolling
620 // we still need to invalidate but we can't use ScrollWindow
621 // because physical scrolling is disabled (the user either didn't
622 // want children scrolled and/or doesn't want pixels to be
623 // physically scrolled).
624 m_targetWindow
->Refresh();
631 bool wxVarScrollHelperBase::DoScrollUnits(int units
)
633 units
+= m_unitFirst
;
637 return DoScrollToUnit(units
);
640 bool wxVarScrollHelperBase::DoScrollPages(int pages
)
642 bool didSomething
= false;
649 unit
= GetVisibleEnd();
656 unit
= FindFirstVisibleFromLast(GetVisibleEnd());
660 didSomething
= DoScrollToUnit(unit
);
666 // ----------------------------------------------------------------------------
668 // ----------------------------------------------------------------------------
670 void wxVarScrollHelperBase::HandleOnSize(wxSizeEvent
& event
)
674 // sometimes change in varscrollable window's size can result in
675 // unused empty space after the last item. Fix it by decrementing
676 // first visible item position according to the available space.
678 // determine free space
679 const wxCoord sWindow
= GetOrientationTargetSize();
682 for ( unit
= m_unitFirst
; unit
< m_unitMax
; ++unit
)
687 s
+= OnGetUnitSize(unit
);
689 wxCoord freeSpace
= sWindow
- s
;
691 // decrement first visible item index as long as there is free space
692 size_t idealUnitFirst
;
693 for ( idealUnitFirst
= m_unitFirst
;
697 wxCoord us
= OnGetUnitSize(idealUnitFirst
-1);
698 if ( freeSpace
< us
)
702 m_unitFirst
= idealUnitFirst
;
710 void wxVarScrollHelperBase::HandleOnScroll(wxScrollWinEvent
& event
)
712 if (GetOrientation() != event
.GetOrientation())
718 DoScrollToUnit(GetNewScrollPosition(event
));
721 UpdateMacScrollWindow();
725 void wxVarScrollHelperBase::DoPrepareDC(wxDC
& dc
)
727 if ( m_physicalScrolling
)
729 wxPoint pt
= dc
.GetDeviceOrigin();
731 IncOrient(pt
.x
, pt
.y
, -GetScrollOffset());
733 dc
.SetDeviceOrigin(pt
.x
, pt
.y
);
737 int wxVarScrollHelperBase::DoCalcScrolledPosition(int coord
) const
739 return coord
- GetScrollOffset();
742 int wxVarScrollHelperBase::DoCalcUnscrolledPosition(int coord
) const
744 return coord
+ GetScrollOffset();
749 void wxVarScrollHelperBase::HandleOnMouseWheel(wxMouseEvent
& event
)
751 // we only want to process wheel events for vertical implementations.
752 // There is no way to determine wheel orientation (and on MSW horizontal
753 // wheel rotation just fakes scroll events, rather than sending a MOUSEWHEEL
755 if ( GetOrientation() != wxVERTICAL
)
758 m_sumWheelRotation
+= event
.GetWheelRotation();
759 int delta
= event
.GetWheelDelta();
761 // how much to scroll this time
762 int units_to_scroll
= -(m_sumWheelRotation
/delta
);
763 if ( !units_to_scroll
)
766 m_sumWheelRotation
+= units_to_scroll
*delta
;
768 if ( !event
.IsPageScroll() )
769 DoScrollUnits( units_to_scroll
*event
.GetLinesPerAction() );
770 else // scroll pages instead of units
771 DoScrollPages( units_to_scroll
);
774 #endif // wxUSE_MOUSEWHEEL
777 // ============================================================================
778 // wxVarHVScrollHelper implementation
779 // ============================================================================
781 // ----------------------------------------------------------------------------
782 // wxVarHVScrollHelper operations
783 // ----------------------------------------------------------------------------
785 void wxVarHVScrollHelper::SetRowColumnCount(size_t rowCount
, size_t columnCount
)
787 SetRowCount(rowCount
);
788 SetColumnCount(columnCount
);
791 bool wxVarHVScrollHelper::ScrollToRowColumn(size_t row
, size_t column
)
794 result
|= ScrollToRow(row
);
795 result
|= ScrollToColumn(column
);
799 void wxVarHVScrollHelper::RefreshRowColumn(size_t row
, size_t column
)
801 // is this unit visible?
802 if ( !IsRowVisible(row
) || !IsColumnVisible(column
) )
804 // no, it is useless to do anything
808 // calculate the rect occupied by this cell on screen
809 wxRect v_rect
, h_rect
;
810 v_rect
.height
= OnGetRowHeight(row
);
811 h_rect
.width
= OnGetColumnWidth(column
);
815 for ( n
= GetVisibleRowsBegin(); n
< row
; n
++ )
817 v_rect
.y
+= OnGetRowHeight(n
);
820 for ( n
= GetVisibleColumnsBegin(); n
< column
; n
++ )
822 h_rect
.x
+= OnGetColumnWidth(n
);
825 // refresh but specialize the behavior if we have a single target window
826 if ( wxVarVScrollHelper::GetTargetWindow() == wxVarHScrollHelper::GetTargetWindow() )
829 v_rect
.width
= h_rect
.width
;
830 wxVarVScrollHelper::GetTargetWindow()->RefreshRect(v_rect
);
835 v_rect
.width
= wxVarVScrollHelper::GetNonOrientationTargetSize();
837 h_rect
.width
= wxVarHScrollHelper::GetNonOrientationTargetSize();
839 wxVarVScrollHelper::GetTargetWindow()->RefreshRect(v_rect
);
840 wxVarHScrollHelper::GetTargetWindow()->RefreshRect(h_rect
);
844 void wxVarHVScrollHelper::RefreshRowsColumns(size_t fromRow
, size_t toRow
,
845 size_t fromColumn
, size_t toColumn
)
847 wxASSERT_MSG( fromRow
<= toRow
|| fromColumn
<= toColumn
,
848 wxT("RefreshRowsColumns(): empty range") );
850 // clump the range to just the visible units -- it is useless to refresh
852 if ( fromRow
< GetVisibleRowsBegin() )
853 fromRow
= GetVisibleRowsBegin();
855 if ( toRow
> GetVisibleRowsEnd() )
856 toRow
= GetVisibleRowsEnd();
858 if ( fromColumn
< GetVisibleColumnsBegin() )
859 fromColumn
= GetVisibleColumnsBegin();
861 if ( toColumn
> GetVisibleColumnsEnd() )
862 toColumn
= GetVisibleColumnsEnd();
864 // calculate the rect occupied by these units on screen
865 wxRect v_rect
, h_rect
;
866 size_t nBefore
, nBetween
;
868 for ( nBefore
= GetVisibleRowsBegin();
872 v_rect
.y
+= OnGetRowHeight(nBefore
);
875 for ( nBetween
= fromRow
; nBetween
<= toRow
; nBetween
++ )
877 v_rect
.height
+= OnGetRowHeight(nBetween
);
880 for ( nBefore
= GetVisibleColumnsBegin();
881 nBefore
< fromColumn
;
884 h_rect
.x
+= OnGetColumnWidth(nBefore
);
887 for ( nBetween
= fromColumn
; nBetween
<= toColumn
; nBetween
++ )
889 h_rect
.width
+= OnGetColumnWidth(nBetween
);
892 // refresh but specialize the behavior if we have a single target window
893 if ( wxVarVScrollHelper::GetTargetWindow() == wxVarHScrollHelper::GetTargetWindow() )
896 v_rect
.width
= h_rect
.width
;
897 wxVarVScrollHelper::GetTargetWindow()->RefreshRect(v_rect
);
902 v_rect
.width
= wxVarVScrollHelper::GetNonOrientationTargetSize();
904 h_rect
.width
= wxVarHScrollHelper::GetNonOrientationTargetSize();
906 wxVarVScrollHelper::GetTargetWindow()->RefreshRect(v_rect
);
907 wxVarHScrollHelper::GetTargetWindow()->RefreshRect(h_rect
);
911 wxPosition
wxVarHVScrollHelper::VirtualHitTest(wxCoord x
, wxCoord y
) const
913 return wxPosition(wxVarVScrollHelper::VirtualHitTest(y
),
914 wxVarHScrollHelper::VirtualHitTest(x
));
917 void wxVarHVScrollHelper::DoPrepareDC(wxDC
& dc
)
919 wxVarVScrollHelper::DoPrepareDC(dc
);
920 wxVarHScrollHelper::DoPrepareDC(dc
);
923 bool wxVarHVScrollHelper::ScrollLayout()
925 bool layout_result
= false;
926 layout_result
|= wxVarVScrollHelper::ScrollLayout();
927 layout_result
|= wxVarHScrollHelper::ScrollLayout();
928 return layout_result
;
931 wxSize
wxVarHVScrollHelper::GetRowColumnCount() const
933 return wxSize(GetColumnCount(), GetRowCount());
936 wxPosition
wxVarHVScrollHelper::GetVisibleBegin() const
938 return wxPosition(GetVisibleRowsBegin(), GetVisibleColumnsBegin());
941 wxPosition
wxVarHVScrollHelper::GetVisibleEnd() const
943 return wxPosition(GetVisibleRowsEnd(), GetVisibleColumnsEnd());
946 bool wxVarHVScrollHelper::IsVisible(size_t row
, size_t column
) const
948 return IsRowVisible(row
) && IsColumnVisible(column
);
952 // ============================================================================
953 // wx[V/H/HV]ScrolledWindow implementations
954 // ============================================================================
956 IMPLEMENT_ABSTRACT_CLASS(wxVScrolledWindow
, wxPanel
)
957 IMPLEMENT_ABSTRACT_CLASS(wxHScrolledWindow
, wxPanel
)
958 IMPLEMENT_ABSTRACT_CLASS(wxHVScrolledWindow
, wxPanel
)
961 #if WXWIN_COMPATIBILITY_2_8
963 // ===========================================================================
964 // wxVarVScrollLegacyAdaptor
965 // ===========================================================================
967 size_t wxVarVScrollLegacyAdaptor::GetFirstVisibleLine() const
968 { return GetVisibleRowsBegin(); }
970 size_t wxVarVScrollLegacyAdaptor::GetLastVisibleLine() const
971 { return GetVisibleRowsEnd() - 1; }
973 size_t wxVarVScrollLegacyAdaptor::GetLineCount() const
974 { return GetRowCount(); }
976 void wxVarVScrollLegacyAdaptor::SetLineCount(size_t count
)
977 { SetRowCount(count
); }
979 void wxVarVScrollLegacyAdaptor::RefreshLine(size_t line
)
980 { RefreshRow(line
); }
982 void wxVarVScrollLegacyAdaptor::RefreshLines(size_t from
, size_t to
)
983 { RefreshRows(from
, to
); }
985 bool wxVarVScrollLegacyAdaptor::ScrollToLine(size_t line
)
986 { return ScrollToRow(line
); }
988 bool wxVarVScrollLegacyAdaptor::ScrollLines(int lines
)
989 { return ScrollRows(lines
); }
991 bool wxVarVScrollLegacyAdaptor::ScrollPages(int pages
)
992 { return ScrollRowPages(pages
); }
994 wxCoord
wxVarVScrollLegacyAdaptor::OnGetLineHeight(size_t WXUNUSED(n
)) const
996 wxFAIL_MSG( wxT("OnGetLineHeight() must be overridden if OnGetRowHeight() isn't!") );
1000 void wxVarVScrollLegacyAdaptor::OnGetLinesHint(size_t WXUNUSED(lineMin
),
1001 size_t WXUNUSED(lineMax
)) const
1005 wxCoord
wxVarVScrollLegacyAdaptor::OnGetRowHeight(size_t n
) const
1007 return OnGetLineHeight(n
);
1010 void wxVarVScrollLegacyAdaptor::OnGetRowsHeightHint(size_t rowMin
,
1011 size_t rowMax
) const
1013 OnGetLinesHint(rowMin
, rowMax
);
1016 #endif // WXWIN_COMPATIBILITY_2_8