2003-05-30 17:08:31 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: include/wx/vscroll.h
|
2007-04-07 21:58:16 -04:00
|
|
|
// Purpose: Variable scrolled windows (wx[V/H/HV]ScrolledWindow)
|
2003-05-30 17:08:31 -04:00
|
|
|
// Author: Vadim Zeitlin
|
2007-04-07 21:58:16 -04:00
|
|
|
// Modified by: Brad Anderson, Bryan Petty
|
2003-05-30 17:08:31 -04:00
|
|
|
// Created: 30.05.03
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 10:56:36 -04:00
|
|
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2003-05-30 17:08:31 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_VSCROLL_H_
|
|
|
|
#define _WX_VSCROLL_H_
|
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
#include "wx/panel.h"
|
|
|
|
#include "wx/position.h"
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxVarScrollHelperEvtHandler;
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
// Using the same techniques as the wxScrolledWindow class |
|
|
|
|
// hierarchy, the wx[V/H/HV]ScrolledWindow classes are slightly |
|
|
|
|
// more complex (compare with the diagram outlined in |
|
|
|
|
// scrolwin.h) for the purpose of reducing code duplication |
|
|
|
|
// through the use of mix-in classes. |
|
|
|
|
// |
|
|
|
|
// wxVarScrollHelperBase |
|
|
|
|
// / \ |
|
|
|
|
// / \ |
|
|
|
|
// V V |
|
|
|
|
// wxVarHScrollHelper wxVarVScrollHelper |
|
|
|
|
// | \ / | |
|
|
|
|
// | \ / | |
|
|
|
|
// | V V | |
|
|
|
|
// | wxVarHVScrollHelper | |
|
|
|
|
// | | | |
|
|
|
|
// | | V |
|
|
|
|
// | wxPanel | wxVarVScrollLegacyAdaptor |
|
|
|
|
// | / \ \ | | |
|
|
|
|
// | / \ `-----|----------. | |
|
|
|
|
// | / \ | \ | |
|
|
|
|
// | / \ | \ | |
|
|
|
|
// V V \ | V V |
|
|
|
|
// wxHScrolledWindow \ | wxVScrolledWindow |
|
|
|
|
// V V |
|
|
|
|
// wxHVScrolledWindow |
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// Border added to suppress GCC multi-line comment warnings ->|
|
|
|
|
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// wxVarScrollHelperBase
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
// Provides all base common scroll calculations needed for either orientation,
|
|
|
|
// automatic scrollbar functionality, saved scroll positions, functionality
|
|
|
|
// for changing the target window to be scrolled, as well as defining all
|
|
|
|
// required virtual functions that need to be implemented for any orientation
|
|
|
|
// specific work.
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxVarScrollHelperBase
|
2003-05-30 17:08:31 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
wxVarScrollHelperBase(wxWindow *winToScroll);
|
|
|
|
virtual ~wxVarScrollHelperBase();
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// operations
|
|
|
|
// ----------
|
|
|
|
|
|
|
|
// with physical scrolling on, the device origin is changed properly when
|
|
|
|
// a wxPaintDC is prepared, children are actually moved and laid out
|
|
|
|
// properly, and the contents of the window (pixels) are actually moved
|
|
|
|
void EnablePhysicalScrolling(bool scrolling = true)
|
|
|
|
{ m_physicalScrolling = scrolling; }
|
|
|
|
|
|
|
|
// wxNOT_FOUND if none, i.e. if it is below the last item
|
2007-04-26 06:50:54 -04:00
|
|
|
int VirtualHitTest(wxCoord coord) const;
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// recalculate all our parameters and redisplay all units
|
|
|
|
virtual void RefreshAll();
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
|
|
|
|
|
|
|
// get the first currently visible unit
|
|
|
|
size_t GetVisibleBegin() const { return m_unitFirst; }
|
|
|
|
|
|
|
|
// get the last currently visible unit
|
|
|
|
size_t GetVisibleEnd() const
|
|
|
|
{ return m_unitFirst + m_nUnitsVisible; }
|
|
|
|
|
|
|
|
// is this unit currently visible?
|
|
|
|
bool IsVisible(size_t unit) const
|
|
|
|
{ return unit >= m_unitFirst && unit < GetVisibleEnd(); }
|
|
|
|
|
|
|
|
// translate between scrolled and unscrolled coordinates
|
|
|
|
int CalcScrolledPosition(int coord) const
|
|
|
|
{ return DoCalcScrolledPosition(coord); }
|
|
|
|
int CalcUnscrolledPosition(int coord) const
|
|
|
|
{ return DoCalcUnscrolledPosition(coord); }
|
|
|
|
|
|
|
|
virtual int DoCalcScrolledPosition(int coord) const;
|
|
|
|
virtual int DoCalcUnscrolledPosition(int coord) const;
|
|
|
|
|
|
|
|
// update the thumb size shown by the scrollbar
|
|
|
|
virtual void UpdateScrollbar();
|
|
|
|
void RemoveScrollbar();
|
|
|
|
|
|
|
|
// Normally the wxScrolledWindow will scroll itself, but in some rare
|
|
|
|
// occasions you might want it to scroll [part of] another window (e.g. a
|
|
|
|
// child of it in order to scroll only a portion the area between the
|
|
|
|
// scrollbars (spreadsheet: only cell area will move).
|
|
|
|
virtual void SetTargetWindow(wxWindow *target);
|
|
|
|
virtual wxWindow *GetTargetWindow() const { return m_targetWindow; }
|
|
|
|
|
|
|
|
// Override this function to draw the graphic (or just process EVT_PAINT)
|
|
|
|
//virtual void OnDraw(wxDC& WXUNUSED(dc)) { }
|
|
|
|
|
|
|
|
// change the DC origin according to the scroll position. To properly
|
|
|
|
// forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER()
|
|
|
|
// derived class
|
|
|
|
virtual void DoPrepareDC(wxDC& dc);
|
|
|
|
|
|
|
|
// the methods to be called from the window event handlers
|
|
|
|
void HandleOnScroll(wxScrollWinEvent& event);
|
|
|
|
void HandleOnSize(wxSizeEvent& event);
|
|
|
|
#if wxUSE_MOUSEWHEEL
|
|
|
|
void HandleOnMouseWheel(wxMouseEvent& event);
|
|
|
|
#endif // wxUSE_MOUSEWHEEL
|
|
|
|
|
|
|
|
// these functions must be overidden in the derived class to return
|
|
|
|
// orientation specific data (e.g. the width for vertically scrolling
|
|
|
|
// derivatives in the case of GetOrientationTargetSize())
|
|
|
|
virtual int GetOrientationTargetSize() const = 0;
|
|
|
|
virtual int GetNonOrientationTargetSize() const = 0;
|
|
|
|
virtual wxOrientation GetOrientation() const = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// all *Unit* functions are protected to be exposed by
|
|
|
|
// wxVarScrollHelperBase implementations (with appropriate names)
|
|
|
|
|
|
|
|
// get the number of units this window contains (previously set by
|
|
|
|
// SetUnitCount())
|
|
|
|
size_t GetUnitCount() const { return m_unitMax; }
|
|
|
|
|
|
|
|
// set the number of units the helper contains: the derived class must
|
|
|
|
// provide the sizes for all units with indices up to the one given here
|
|
|
|
// in its OnGetUnitSize()
|
|
|
|
void SetUnitCount(size_t count);
|
|
|
|
|
|
|
|
// redraw the specified unit
|
|
|
|
virtual void RefreshUnit(size_t unit);
|
|
|
|
|
|
|
|
// redraw all units in the specified range (inclusive)
|
|
|
|
virtual void RefreshUnits(size_t from, size_t to);
|
|
|
|
|
|
|
|
// scroll to the specified unit: it will become the first visible unit in
|
|
|
|
// the window
|
2003-05-30 17:08:31 -04:00
|
|
|
//
|
2007-04-07 21:58:16 -04:00
|
|
|
// return true if we scrolled the window, false if nothing was done
|
|
|
|
bool DoScrollToUnit(size_t unit);
|
|
|
|
|
|
|
|
// scroll by the specified number of units/pages
|
|
|
|
virtual bool DoScrollUnits(int units);
|
|
|
|
virtual bool DoScrollPages(int pages);
|
|
|
|
|
|
|
|
// this function must be overridden in the derived class and it should
|
|
|
|
// return the size of the given unit in pixels
|
|
|
|
virtual wxCoord OnGetUnitSize(size_t n) const = 0;
|
|
|
|
|
|
|
|
// this function doesn't have to be overridden but it may be useful to do
|
|
|
|
// it if calculating the units' sizes is a relatively expensive operation
|
|
|
|
// as it gives the user code a possibility to calculate several of them at
|
|
|
|
// once
|
|
|
|
//
|
|
|
|
// OnGetUnitsSizeHint() is normally called just before OnGetUnitSize() but
|
|
|
|
// you shouldn't rely on the latter being called for all units in the
|
|
|
|
// interval specified here. It is also possible that OnGetUnitHeight() will
|
|
|
|
// be called for the units outside of this interval, so this is really just
|
|
|
|
// a hint, not a promise.
|
|
|
|
//
|
|
|
|
// finally note that unitMin is inclusive, while unitMax is exclusive, as
|
|
|
|
// usual
|
|
|
|
virtual void OnGetUnitsSizeHint(size_t WXUNUSED(unitMin),
|
|
|
|
size_t WXUNUSED(unitMax)) const
|
|
|
|
{ }
|
|
|
|
|
|
|
|
// when the number of units changes, we try to estimate the total size
|
|
|
|
// of all units which is a rather expensive operation in terms of unit
|
|
|
|
// access, so if the user code may estimate the average size
|
|
|
|
// better/faster than we do, it should override this function to implement
|
|
|
|
// its own logic
|
|
|
|
//
|
|
|
|
// this function should return the best guess for the total size it may
|
|
|
|
// make
|
|
|
|
virtual wxCoord EstimateTotalSize() const { return DoEstimateTotalSize(); }
|
|
|
|
|
|
|
|
wxCoord DoEstimateTotalSize() const;
|
|
|
|
|
|
|
|
// find the index of the unit we need to show to fit the specified unit on
|
|
|
|
// the opposite side either fully or partially (depending on fullyVisible)
|
|
|
|
size_t FindFirstVisibleFromLast(size_t last,
|
|
|
|
bool fullyVisible = false) const;
|
|
|
|
|
|
|
|
// get the total size of the units between unitMin (inclusive) and
|
|
|
|
// unitMax (exclusive)
|
|
|
|
wxCoord GetUnitsSize(size_t unitMin, size_t unitMax) const;
|
|
|
|
|
|
|
|
// get the offset of the first visible unit
|
|
|
|
wxCoord GetScrollOffset() const
|
|
|
|
{ return GetUnitsSize(0, GetVisibleBegin()); }
|
|
|
|
|
|
|
|
// get the size of the target window
|
|
|
|
wxSize GetTargetSize() const { return m_targetWindow->GetClientSize(); }
|
|
|
|
|
|
|
|
void GetTargetSize(int *w, int *h)
|
2003-05-30 17:08:31 -04:00
|
|
|
{
|
2007-04-07 21:58:16 -04:00
|
|
|
wxSize size = GetTargetSize();
|
|
|
|
if ( w )
|
|
|
|
*w = size.x;
|
|
|
|
if ( h )
|
|
|
|
*h = size.y;
|
|
|
|
}
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// calculate the new scroll position based on scroll event type
|
|
|
|
size_t GetNewScrollPosition(wxScrollWinEvent& event) const;
|
|
|
|
|
|
|
|
// replacement implementation of wxWindow::Layout virtual method. To
|
|
|
|
// properly forward calls to wxWindow::Layout use
|
|
|
|
// WX_FORWARD_TO_SCROLL_HELPER() derived class
|
|
|
|
bool ScrollLayout();
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
// queue mac window update after handling scroll event
|
|
|
|
virtual void UpdateMacScrollWindow() = 0;
|
|
|
|
#endif // __WXMAC__
|
|
|
|
|
|
|
|
// change the target window
|
|
|
|
void DoSetTargetWindow(wxWindow *target);
|
|
|
|
|
|
|
|
// delete the event handler we installed
|
|
|
|
void DeleteEvtHandler();
|
|
|
|
|
|
|
|
// helper function abstracting the orientation test: with vertical
|
|
|
|
// orientation, it assigns the first value to x and the second one to y,
|
|
|
|
// with horizontal orientation it reverses them, i.e. the first value is
|
|
|
|
// assigned to y and the second one to x
|
|
|
|
void AssignOrient(wxCoord& x, wxCoord& y, wxCoord first, wxCoord second);
|
|
|
|
|
|
|
|
// similar to "oriented assignment" above but does "oriented increment":
|
|
|
|
// for vertical orientation, y is incremented by the given value and x if
|
|
|
|
// left unchanged, for horizontal orientation x is incremented
|
|
|
|
void IncOrient(wxCoord& x, wxCoord& y, wxCoord inc);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// the window that receives the scroll events and the window to actually
|
|
|
|
// scroll, respectively
|
|
|
|
wxWindow *m_win,
|
|
|
|
*m_targetWindow;
|
|
|
|
|
|
|
|
// the total number of (logical) units
|
|
|
|
size_t m_unitMax;
|
|
|
|
|
|
|
|
// the total (estimated) size
|
|
|
|
wxCoord m_sizeTotal;
|
|
|
|
|
|
|
|
// the first currently visible unit
|
|
|
|
size_t m_unitFirst;
|
|
|
|
|
|
|
|
// the number of currently visible units (including the last, possibly only
|
|
|
|
// partly, visible one)
|
|
|
|
size_t m_nUnitsVisible;
|
|
|
|
|
|
|
|
// accumulated mouse wheel rotation
|
|
|
|
#if wxUSE_MOUSEWHEEL
|
|
|
|
int m_sumWheelRotation;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// do child scrolling (used in DoPrepareDC())
|
|
|
|
bool m_physicalScrolling;
|
|
|
|
|
|
|
|
// handler injected into target window to forward some useful events to us
|
|
|
|
wxVarScrollHelperEvtHandler *m_handler;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// wxVarVScrollHelper
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
// Provides public API functions targeted for vertical-specific scrolling,
|
|
|
|
// wrapping the functionality of wxVarScrollHelperBase.
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxVarVScrollHelper : public wxVarScrollHelperBase
|
2007-04-07 21:58:16 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
|
|
|
|
// ctor must be given the associated window
|
|
|
|
wxVarVScrollHelper(wxWindow *winToScroll)
|
|
|
|
: wxVarScrollHelperBase(winToScroll)
|
|
|
|
{
|
2003-05-30 17:08:31 -04:00
|
|
|
}
|
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// operators
|
|
|
|
|
|
|
|
void SetRowCount(size_t rowCount) { SetUnitCount(rowCount); }
|
|
|
|
bool ScrollToRow(size_t row) { return DoScrollToUnit(row); }
|
|
|
|
|
|
|
|
virtual bool ScrollRows(int rows)
|
|
|
|
{ return DoScrollUnits(rows); }
|
|
|
|
virtual bool ScrollRowPages(int pages)
|
|
|
|
{ return DoScrollPages(pages); }
|
|
|
|
|
|
|
|
virtual void RefreshRow(size_t row)
|
|
|
|
{ RefreshUnit(row); }
|
|
|
|
virtual void RefreshRows(size_t from, size_t to)
|
|
|
|
{ RefreshUnits(from, to); }
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
size_t GetRowCount() const { return GetUnitCount(); }
|
|
|
|
size_t GetVisibleRowsBegin() const { return GetVisibleBegin(); }
|
|
|
|
size_t GetVisibleRowsEnd() const { return GetVisibleEnd(); }
|
|
|
|
bool IsRowVisible(size_t row) const { return IsVisible(row); }
|
|
|
|
|
|
|
|
virtual int GetOrientationTargetSize() const
|
|
|
|
{ return GetTargetWindow()->GetClientSize().y; }
|
|
|
|
virtual int GetNonOrientationTargetSize() const
|
|
|
|
{ return GetTargetWindow()->GetClientSize().x; }
|
|
|
|
virtual wxOrientation GetOrientation() const { return wxVERTICAL; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// this function must be overridden in the derived class and it should
|
|
|
|
// return the size of the given row in pixels
|
|
|
|
virtual wxCoord OnGetRowHeight(size_t n) const = 0;
|
|
|
|
wxCoord OnGetUnitSize(size_t n) const { return OnGetRowHeight(n); }
|
|
|
|
|
|
|
|
virtual void OnGetRowsHeightHint(size_t WXUNUSED(rowMin),
|
|
|
|
size_t WXUNUSED(rowMax)) const { }
|
|
|
|
|
|
|
|
// forward calls to OnGetRowsHeightHint()
|
|
|
|
virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const
|
2007-04-15 12:43:37 -04:00
|
|
|
{ OnGetRowsHeightHint(unitMin, unitMax); }
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// again, if not overridden, it will fall back on default method
|
|
|
|
virtual wxCoord EstimateTotalHeight() const
|
|
|
|
{ return DoEstimateTotalSize(); }
|
|
|
|
|
|
|
|
// forward calls to EstimateTotalHeight()
|
|
|
|
virtual wxCoord EstimateTotalSize() const { return EstimateTotalHeight(); }
|
|
|
|
|
|
|
|
wxCoord GetRowsHeight(size_t rowMin, size_t rowMax) const
|
|
|
|
{ return GetUnitsSize(rowMin, rowMax); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// wxVarHScrollHelper
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
// Provides public API functions targeted for horizontal-specific scrolling,
|
|
|
|
// wrapping the functionality of wxVarScrollHelperBase.
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxVarHScrollHelper : public wxVarScrollHelperBase
|
2007-04-07 21:58:16 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
|
|
|
|
// ctor must be given the associated window
|
|
|
|
wxVarHScrollHelper(wxWindow *winToScroll)
|
|
|
|
: wxVarScrollHelperBase(winToScroll)
|
2003-05-30 17:08:31 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// operators
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
void SetColumnCount(size_t columnCount)
|
|
|
|
{ SetUnitCount(columnCount); }
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
bool ScrollToColumn(size_t column)
|
|
|
|
{ return DoScrollToUnit(column); }
|
|
|
|
virtual bool ScrollColumns(int columns)
|
|
|
|
{ return DoScrollUnits(columns); }
|
|
|
|
virtual bool ScrollColumnPages(int pages)
|
|
|
|
{ return DoScrollPages(pages); }
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
virtual void RefreshColumn(size_t column)
|
|
|
|
{ RefreshUnit(column); }
|
|
|
|
virtual void RefreshColumns(size_t from, size_t to)
|
|
|
|
{ RefreshUnits(from, to); }
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// accessors
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
size_t GetColumnCount() const
|
|
|
|
{ return GetUnitCount(); }
|
|
|
|
size_t GetVisibleColumnsBegin() const
|
|
|
|
{ return GetVisibleBegin(); }
|
|
|
|
size_t GetVisibleColumnsEnd() const
|
|
|
|
{ return GetVisibleEnd(); }
|
|
|
|
bool IsColumnVisible(size_t column) const
|
|
|
|
{ return IsVisible(column); }
|
2003-06-01 09:35:26 -04:00
|
|
|
|
2003-06-11 07:37:52 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
virtual int GetOrientationTargetSize() const
|
|
|
|
{ return GetTargetWindow()->GetClientSize().x; }
|
|
|
|
virtual int GetNonOrientationTargetSize() const
|
|
|
|
{ return GetTargetWindow()->GetClientSize().y; }
|
|
|
|
virtual wxOrientation GetOrientation() const { return wxHORIZONTAL; }
|
2003-06-13 13:17:46 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
protected:
|
|
|
|
// this function must be overridden in the derived class and it should
|
|
|
|
// return the size of the given column in pixels
|
|
|
|
virtual wxCoord OnGetColumnWidth(size_t n) const = 0;
|
|
|
|
wxCoord OnGetUnitSize(size_t n) const { return OnGetColumnWidth(n); }
|
2003-06-01 09:35:26 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
virtual void OnGetColumnsWidthHint(size_t WXUNUSED(columnMin),
|
|
|
|
size_t WXUNUSED(columnMax)) const
|
|
|
|
{ }
|
2003-06-02 18:58:38 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// forward calls to OnGetColumnsWidthHint()
|
|
|
|
virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const
|
2007-04-18 04:32:19 -04:00
|
|
|
{ OnGetColumnsWidthHint(unitMin, unitMax); }
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// again, if not overridden, it will fall back on default method
|
|
|
|
virtual wxCoord EstimateTotalWidth() const { return DoEstimateTotalSize(); }
|
|
|
|
|
|
|
|
// forward calls to EstimateTotalWidth()
|
|
|
|
virtual wxCoord EstimateTotalSize() const { return EstimateTotalWidth(); }
|
|
|
|
|
|
|
|
wxCoord GetColumnsWidth(size_t columnMin, size_t columnMax) const
|
|
|
|
{ return GetUnitsSize(columnMin, columnMax); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// wxVarHVScrollHelper
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
// Provides public API functions targeted at functions with similar names in
|
|
|
|
// both wxVScrollHelper and wxHScrollHelper so class scope doesn't need to be
|
|
|
|
// specified (since we are using multiple inheritance). It also provides
|
|
|
|
// functions to make changing values for both orientations at the same time
|
|
|
|
// easier.
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxVarHVScrollHelper : public wxVarVScrollHelper,
|
2007-04-07 21:58:16 -04:00
|
|
|
public wxVarHScrollHelper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
|
|
|
|
// ctor must be given the associated window
|
|
|
|
wxVarHVScrollHelper(wxWindow *winToScroll)
|
|
|
|
: wxVarVScrollHelper(winToScroll), wxVarHScrollHelper(winToScroll) { }
|
|
|
|
|
|
|
|
// operators
|
|
|
|
// ---------
|
|
|
|
|
|
|
|
// set the number of units the window contains for each axis: the derived
|
|
|
|
// class must provide the widths and heights for all units with indices up
|
|
|
|
// to each of the one given here in its OnGetColumnWidth() and
|
|
|
|
// OnGetRowHeight()
|
|
|
|
void SetRowColumnCount(size_t rowCount, size_t columnCount);
|
|
|
|
|
|
|
|
|
|
|
|
// with physical scrolling on, the device origin is changed properly when
|
|
|
|
// a wxPaintDC is prepared, children are actually moved and laid out
|
|
|
|
// properly, and the contents of the window (pixels) are actually moved
|
|
|
|
void EnablePhysicalScrolling(bool vscrolling = true, bool hscrolling = true)
|
|
|
|
{
|
|
|
|
wxVarVScrollHelper::EnablePhysicalScrolling(vscrolling);
|
|
|
|
wxVarHScrollHelper::EnablePhysicalScrolling(hscrolling);
|
|
|
|
}
|
|
|
|
|
|
|
|
// scroll to the specified row/column: it will become the first visible
|
|
|
|
// cell in the window
|
|
|
|
//
|
|
|
|
// return true if we scrolled the window, false if nothing was done
|
|
|
|
bool ScrollToRowColumn(size_t row, size_t column);
|
|
|
|
bool ScrollToRowColumn(const wxPosition &pos)
|
|
|
|
{ return ScrollToRowColumn(pos.GetRow(), pos.GetColumn()); }
|
|
|
|
|
|
|
|
// redraw the specified cell
|
|
|
|
virtual void RefreshRowColumn(size_t row, size_t column);
|
|
|
|
virtual void RefreshRowColumn(const wxPosition &pos)
|
|
|
|
{ RefreshRowColumn(pos.GetRow(), pos.GetColumn()); }
|
|
|
|
|
|
|
|
// redraw the specified regions (inclusive). If the target window for
|
|
|
|
// both orientations is the same the rectangle of cells is refreshed; if
|
|
|
|
// the target windows differ the entire client size opposite the
|
|
|
|
// orientation direction is refreshed between the specified limits
|
|
|
|
virtual void RefreshRowsColumns(size_t fromRow, size_t toRow,
|
|
|
|
size_t fromColumn, size_t toColumn);
|
|
|
|
virtual void RefreshRowsColumns(const wxPosition& from,
|
|
|
|
const wxPosition& to)
|
|
|
|
{
|
|
|
|
RefreshRowsColumns(from.GetRow(), to.GetRow(),
|
|
|
|
from.GetColumn(), to.GetColumn());
|
|
|
|
}
|
|
|
|
|
2007-04-26 06:50:54 -04:00
|
|
|
// locate the virtual position from the given device coordinates
|
|
|
|
wxPosition VirtualHitTest(wxCoord x, wxCoord y) const;
|
|
|
|
wxPosition VirtualHitTest(const wxPoint &pos) const
|
|
|
|
{ return VirtualHitTest(pos.x, pos.y); }
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// change the DC origin according to the scroll position. To properly
|
|
|
|
// forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER()
|
|
|
|
// derived class. We use this version to call both base classes'
|
|
|
|
// DoPrepareDC()
|
|
|
|
virtual void DoPrepareDC(wxDC& dc);
|
|
|
|
|
|
|
|
// replacement implementation of wxWindow::Layout virtual method. To
|
|
|
|
// properly forward calls to wxWindow::Layout use
|
|
|
|
// WX_FORWARD_TO_SCROLL_HELPER() derived class. We use this version to
|
|
|
|
// call both base classes' ScrollLayout()
|
|
|
|
bool ScrollLayout();
|
2003-05-30 17:08:31 -04:00
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// get the number of units this window contains (previously set by
|
|
|
|
// Set[Column/Row/RowColumn/Unit]Count())
|
|
|
|
wxSize GetRowColumnCount() const;
|
|
|
|
|
|
|
|
// get the first currently visible units
|
|
|
|
wxPosition GetVisibleBegin() const;
|
|
|
|
wxPosition GetVisibleEnd() const;
|
|
|
|
|
|
|
|
// is this cell currently visible?
|
|
|
|
bool IsVisible(size_t row, size_t column) const;
|
|
|
|
bool IsVisible(const wxPosition &pos) const
|
|
|
|
{ return IsVisible(pos.GetRow(), pos.GetColumn()); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
#if WXWIN_COMPATIBILITY_2_8
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// ===========================================================================
|
|
|
|
// wxVarVScrollLegacyAdaptor
|
|
|
|
// ===========================================================================
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// Provides backwards compatible API for applications originally built using
|
|
|
|
// wxVScrolledWindow in 2.6 or 2.8. Originally, wxVScrolledWindow referred
|
|
|
|
// to scrolling "lines". We use "units" in wxVarScrollHelperBase to avoid
|
|
|
|
// implying any orientation (since the functions are used for both horizontal
|
|
|
|
// and vertical scrolling in derived classes). And in the new
|
|
|
|
// wxVScrolledWindow and wxHScrolledWindow classes, we refer to them as
|
|
|
|
// "rows" and "columns", respectively. This is to help clear some confusion
|
|
|
|
// in not only those classes, but also in wxHVScrolledWindow where functions
|
|
|
|
// are inherited from both.
|
2005-04-05 18:43:41 -04:00
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxVarVScrollLegacyAdaptor : public wxVarVScrollHelper
|
2007-04-07 21:58:16 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
wxVarVScrollLegacyAdaptor(wxWindow *winToScroll)
|
|
|
|
: wxVarVScrollHelper(winToScroll)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
2005-04-05 18:43:41 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// this is the same as GetVisibleRowsBegin(), exists to match
|
2005-04-05 18:43:41 -04:00
|
|
|
// GetLastVisibleLine() and for backwards compatibility only
|
2007-07-07 10:09:22 -04:00
|
|
|
wxDEPRECATED( size_t GetFirstVisibleLine() const );
|
2005-04-05 18:43:41 -04:00
|
|
|
|
|
|
|
// get the last currently visible line
|
|
|
|
//
|
|
|
|
// this function is unsafe as it returns (size_t)-1 (i.e. a huge positive
|
2007-04-07 21:58:16 -04:00
|
|
|
// number) if the control is empty, use GetVisibleRowsEnd() instead, this
|
|
|
|
// one is kept for backwards compatibility
|
2007-07-07 10:09:22 -04:00
|
|
|
wxDEPRECATED( size_t GetLastVisibleLine() const );
|
2003-06-01 09:35:26 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// "line" to "unit" compatibility functions
|
|
|
|
// ----------------------------------------
|
|
|
|
|
|
|
|
// get the number of lines this window contains (set by SetLineCount())
|
2007-07-07 10:09:22 -04:00
|
|
|
wxDEPRECATED( size_t GetLineCount() const );
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// set the number of lines the helper contains: the derived class must
|
|
|
|
// provide the sizes for all lines with indices up to the one given here
|
|
|
|
// in its OnGetLineHeight()
|
2007-07-07 10:09:22 -04:00
|
|
|
wxDEPRECATED( void SetLineCount(size_t count) );
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// redraw the specified line
|
2007-07-07 10:09:22 -04:00
|
|
|
wxDEPRECATED( virtual void RefreshLine(size_t line) );
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// redraw all lines in the specified range (inclusive)
|
2007-07-07 10:09:22 -04:00
|
|
|
wxDEPRECATED( virtual void RefreshLines(size_t from, size_t to) );
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// scroll to the specified line: it will become the first visible line in
|
|
|
|
// the window
|
|
|
|
//
|
|
|
|
// return true if we scrolled the window, false if nothing was done
|
2007-07-07 10:09:22 -04:00
|
|
|
wxDEPRECATED( bool ScrollToLine(size_t line) );
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
// scroll by the specified number of lines/pages
|
2007-07-07 10:09:22 -04:00
|
|
|
wxDEPRECATED( virtual bool ScrollLines(int lines) );
|
|
|
|
wxDEPRECATED( virtual bool ScrollPages(int pages) );
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2003-06-01 09:35:26 -04:00
|
|
|
protected:
|
2007-04-09 07:37:04 -04:00
|
|
|
// unless the code has been updated to override OnGetRowHeight() instead,
|
2003-05-30 17:08:31 -04:00
|
|
|
// this function must be overridden in the derived class and it should
|
2007-04-07 21:58:16 -04:00
|
|
|
// return the height of the given row in pixels
|
2007-07-05 17:42:39 -04:00
|
|
|
wxDEPRECATED_BUT_USED_INTERNALLY(
|
2007-07-07 10:09:22 -04:00
|
|
|
virtual wxCoord OnGetLineHeight(size_t n) const );
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// forwards the calls from base class pure virtual function to pure virtual
|
|
|
|
// OnGetLineHeight instead (backwards compatible name)
|
|
|
|
// note that we don't need to forward OnGetUnitSize() as it is already
|
|
|
|
// forwarded to OnGetRowHeight() in wxVarVScrollHelper
|
2007-07-25 13:42:43 -04:00
|
|
|
virtual wxCoord OnGetRowHeight(size_t n) const;
|
2007-04-07 21:58:16 -04:00
|
|
|
|
2003-05-30 17:08:31 -04:00
|
|
|
// this function doesn't have to be overridden but it may be useful to do
|
|
|
|
// it if calculating the lines heights is a relatively expensive operation
|
|
|
|
// as it gives the user code a possibility to calculate several of them at
|
|
|
|
// once
|
|
|
|
//
|
|
|
|
// OnGetLinesHint() is normally called just before OnGetLineHeight() but you
|
|
|
|
// shouldn't rely on the latter being called for all lines in the interval
|
|
|
|
// specified here. It is also possible that OnGetLineHeight() will be
|
|
|
|
// called for the lines outside of this interval, so this is really just a
|
|
|
|
// hint, not a promise.
|
|
|
|
//
|
|
|
|
// finally note that lineMin is inclusive, while lineMax is exclusive, as
|
|
|
|
// usual
|
2007-07-05 17:42:39 -04:00
|
|
|
wxDEPRECATED_BUT_USED_INTERNALLY( virtual void OnGetLinesHint(
|
2007-07-07 10:09:22 -04:00
|
|
|
size_t lineMin, size_t lineMax) const );
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// forwards the calls from base class pure virtual function to pure virtual
|
|
|
|
// OnGetLinesHint instead (backwards compatible name)
|
2007-07-25 13:42:43 -04:00
|
|
|
void OnGetRowsHeightHint(size_t rowMin, size_t rowMax) const;
|
2007-04-07 21:58:16 -04:00
|
|
|
};
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
#else // !WXWIN_COMPATIBILITY_2_8
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// shortcut to avoid checking compatibility modes later
|
2007-04-08 09:55:36 -04:00
|
|
|
// remove this and all references to wxVarVScrollLegacyAdaptor once
|
2007-04-07 21:58:16 -04:00
|
|
|
// wxWidgets 2.6 and 2.8 compatibility is removed
|
2007-04-08 09:55:36 -04:00
|
|
|
typedef wxVarVScrollHelper wxVarVScrollLegacyAdaptor;
|
2006-04-25 20:17:52 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8
|
2003-05-30 17:08:31 -04:00
|
|
|
|
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// this macro must be used in declaration of wxVarScrollHelperBase-derived
|
|
|
|
// classes
|
|
|
|
#define WX_FORWARD_TO_VAR_SCROLL_HELPER() \
|
|
|
|
public: \
|
|
|
|
virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \
|
|
|
|
virtual bool Layout() { return ScrollLayout(); }
|
2003-05-30 17:08:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// ===========================================================================
|
|
|
|
// wxVScrolledWindow
|
|
|
|
// ===========================================================================
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
// In the name of this class, "V" may stand for "variable" because it can be
|
|
|
|
// used for scrolling rows of variable heights; "virtual", because it is not
|
|
|
|
// necessary to know the heights of all rows in advance -- only those which
|
|
|
|
// are shown on the screen need to be measured; or even "vertical", because
|
|
|
|
// this class only supports scrolling vertically.
|
|
|
|
|
|
|
|
// In any case, this is a generalization of the wxScrolledWindow class which
|
|
|
|
// can be only used when all rows have the same heights. It lacks some other
|
|
|
|
// wxScrolledWindow features however, notably it can't scroll only a rectangle
|
|
|
|
// of the window and not its entire client area.
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxVScrolledWindow : public wxPanel,
|
2007-04-07 21:58:16 -04:00
|
|
|
public wxVarVScrollLegacyAdaptor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
|
|
|
|
// default ctor, you must call Create() later
|
|
|
|
wxVScrolledWindow() : wxVarVScrollLegacyAdaptor(this) { }
|
|
|
|
|
|
|
|
// normal ctor, no need to call Create() after this one
|
|
|
|
//
|
|
|
|
// note that wxVSCROLL is always automatically added to our style, there is
|
|
|
|
// no need to specify it explicitly
|
|
|
|
wxVScrolledWindow(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
: wxVarVScrollLegacyAdaptor(this)
|
|
|
|
{
|
|
|
|
(void)Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// same as the previous ctor but returns status code: true if ok
|
|
|
|
//
|
|
|
|
// just as with the ctor above, wxVSCROLL style is always used, there is no
|
|
|
|
// need to specify it
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
{
|
|
|
|
return wxPanel::Create(parent, id, pos, size, style | wxVSCROLL, name);
|
|
|
|
}
|
|
|
|
|
2007-04-26 06:50:54 -04:00
|
|
|
#if WXWIN_COMPATIBILITY_2_8
|
2007-04-07 21:58:16 -04:00
|
|
|
// Make sure we prefer our version of HitTest rather than wxWindow's
|
2007-04-26 06:50:54 -04:00
|
|
|
// These functions should no longer be masked in favor of VirtualHitTest()
|
2007-04-07 21:58:16 -04:00
|
|
|
int HitTest(wxCoord WXUNUSED(x), wxCoord y) const
|
2007-04-26 06:50:54 -04:00
|
|
|
{ return wxVarVScrollHelper::VirtualHitTest(y); }
|
2007-04-07 21:58:16 -04:00
|
|
|
int HitTest(const wxPoint& pt) const
|
|
|
|
{ return HitTest(pt.x, pt.y); }
|
2007-04-26 06:50:54 -04:00
|
|
|
#endif // WXWIN_COMPATIBILITY_2_8
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
WX_FORWARD_TO_VAR_SCROLL_HELPER()
|
2003-05-30 17:08:31 -04:00
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
protected:
|
|
|
|
virtual void UpdateMacScrollWindow() { Update(); }
|
|
|
|
#endif // __WXMAC__
|
|
|
|
|
|
|
|
private:
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxVScrolledWindow);
|
2003-08-08 17:23:33 -04:00
|
|
|
DECLARE_ABSTRACT_CLASS(wxVScrolledWindow)
|
2003-05-30 17:08:31 -04:00
|
|
|
};
|
|
|
|
|
2007-04-07 21:58:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// wxHScrolledWindow
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
// In the name of this class, "H" stands for "horizontal" because it can be
|
|
|
|
// used for scrolling columns of variable widths. It is not necessary to know
|
|
|
|
// the widths of all columns in advance -- only those which are shown on the
|
|
|
|
// screen need to be measured.
|
|
|
|
|
|
|
|
// This is a generalization of the wxScrolledWindow class which can be only
|
|
|
|
// used when all columns have the same width. It lacks some other
|
|
|
|
// wxScrolledWindow features however, notably it can't scroll only a rectangle
|
|
|
|
// of the window and not its entire client area.
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxHScrolledWindow : public wxPanel,
|
2007-04-07 21:58:16 -04:00
|
|
|
public wxVarHScrollHelper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
|
|
|
|
// default ctor, you must call Create() later
|
|
|
|
wxHScrolledWindow() : wxVarHScrollHelper(this) { }
|
|
|
|
|
|
|
|
// normal ctor, no need to call Create() after this one
|
|
|
|
//
|
|
|
|
// note that wxHSCROLL is always automatically added to our style, there is
|
|
|
|
// no need to specify it explicitly
|
|
|
|
wxHScrolledWindow(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
: wxVarHScrollHelper(this)
|
|
|
|
{
|
|
|
|
(void)Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// same as the previous ctor but returns status code: true if ok
|
|
|
|
//
|
|
|
|
// just as with the ctor above, wxHSCROLL style is always used, there is no
|
|
|
|
// need to specify it
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
{
|
|
|
|
return wxPanel::Create(parent, id, pos, size, style | wxHSCROLL, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
WX_FORWARD_TO_VAR_SCROLL_HELPER()
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
protected:
|
|
|
|
virtual void UpdateMacScrollWindow() { Update(); }
|
|
|
|
#endif // __WXMAC__
|
|
|
|
|
|
|
|
private:
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxHScrolledWindow);
|
2007-04-07 21:58:16 -04:00
|
|
|
DECLARE_ABSTRACT_CLASS(wxHScrolledWindow)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
// wxHVScrolledWindow
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
// This window inherits all functionality of both vertical and horizontal
|
|
|
|
// scrolled windows automatically handling everything needed to scroll both
|
|
|
|
// axis simultaneously.
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxHVScrolledWindow : public wxPanel,
|
2007-04-07 21:58:16 -04:00
|
|
|
public wxVarHVScrollHelper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
|
|
|
|
// default ctor, you must call Create() later
|
|
|
|
wxHVScrolledWindow()
|
|
|
|
: wxPanel(),
|
|
|
|
wxVarHVScrollHelper(this) { }
|
|
|
|
|
|
|
|
// normal ctor, no need to call Create() after this one
|
|
|
|
//
|
|
|
|
// note that wxVSCROLL and wxHSCROLL are always automatically added to our
|
|
|
|
// style, there is no need to specify them explicitly
|
|
|
|
wxHVScrolledWindow(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
: wxPanel(),
|
|
|
|
wxVarHVScrollHelper(this)
|
|
|
|
{
|
|
|
|
(void)Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// same as the previous ctor but returns status code: true if ok
|
|
|
|
//
|
|
|
|
// just as with the ctor above, wxVSCROLL and wxHSCROLL styles are always
|
|
|
|
// used, there is no need to specify them
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
{
|
|
|
|
return wxPanel::Create(parent, id, pos, size,
|
|
|
|
style | wxVSCROLL | wxHSCROLL, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
WX_FORWARD_TO_VAR_SCROLL_HELPER()
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
protected:
|
|
|
|
virtual void UpdateMacScrollWindow() { Update(); }
|
|
|
|
#endif // __WXMAC__
|
|
|
|
|
|
|
|
private:
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxHVScrolledWindow);
|
2007-04-07 21:58:16 -04:00
|
|
|
DECLARE_ABSTRACT_CLASS(wxHVScrolledWindow)
|
|
|
|
};
|
|
|
|
|
2003-05-30 17:08:31 -04:00
|
|
|
#endif // _WX_VSCROLL_H_
|
|
|
|
|