2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: vscroll.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxVarHScrollHelper
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
@class wxVarScrollHelperBase
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
This class provides all common base functionality for scroll calculations
|
|
|
|
shared among all variable scrolled window implementations as well as
|
|
|
|
automatic scrollbar functionality, saved scroll positions, controlling
|
|
|
|
target windows to be scrolled, as well as defining all required virtual
|
|
|
|
functions that need to be implemented for any orientation specific work.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
Documentation of this class is provided specifically for referencing use
|
|
|
|
of the functions provided by this class for use with the variable scrolled
|
|
|
|
windows that derive from here. You will likely want to derive your window
|
|
|
|
from one of the already implemented variable scrolled windows rather than
|
|
|
|
from wxVarScrollHelperBase directly.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-05-01 01:38:05 -04:00
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
class wxVarScrollHelperBase
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Constructor taking the target window to be scrolled by this helper
|
|
|
|
class. This will attach scroll event handlers to the target window to
|
|
|
|
catch and handle scroll events appropriately.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
wxVarScrollHelperBase(wxWindow* winToScroll);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Virtual destructor for detaching scroll event handlers attached with
|
|
|
|
this helper class.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-05-01 01:38:05 -04:00
|
|
|
virtual ~wxVarScrollHelperBase();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Translates the logical coordinate given to the current device
|
|
|
|
coordinate. For example, if the window is scrolled 10 units and each
|
|
|
|
scroll unit represents 10 device units (which may not be the case since
|
|
|
|
this class allows for variable scroll unit sizes), a call to this
|
|
|
|
function with a coordinate of 15 will return -85.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
@see CalcUnscrolledPosition()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
int CalcScrolledPosition(int coord) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
Translates the device coordinate given to the corresponding logical
|
2008-05-01 01:38:05 -04:00
|
|
|
coordinate. For example, if the window is scrolled 10 units and each
|
|
|
|
scroll unit represents 10 device units (which may not be the case since
|
|
|
|
this class allows for variable scroll unit sizes), a call to this
|
|
|
|
function with a coordinate of 15 will return 115.
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
@see CalcScrolledPosition()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
int CalcUnscrolledPosition(int coord) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
With physical scrolling on (when this is @true), the device origin is
|
2008-05-01 01:38:05 -04:00
|
|
|
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. When this is @false, you are responsible for
|
|
|
|
repainting any invalidated areas of the window yourself to account for
|
|
|
|
the new scroll position.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
void EnablePhysicalScrolling(bool scrolling = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
This function needs to be overridden in the in the derived class to
|
|
|
|
return the window size with respect to the opposing orientation. If
|
|
|
|
this is a vertical scrolled window, it should return the height.
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
@see GetOrientationTargetSize()
|
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual int GetNonOrientationTargetSize() const = 0;
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
This function need to be overridden to return the orientation that this
|
|
|
|
helper is working with, either @c wxHORIZONTAL or @c wxVERTICAL.
|
2008-04-11 03:01:41 -04:00
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual wxOrientation GetOrientation() const = 0;
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
This function needs to be overridden in the in the derived class to
|
|
|
|
return the window size with respect to the orientation this helper is
|
|
|
|
working with. If this is a vertical scrolled window, it should return
|
|
|
|
the width.
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
@see GetNonOrientationTargetSize()
|
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual int GetOrientationTargetSize() const = 0;
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
This function will return the target window this helper class is
|
|
|
|
currently scrolling.
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
@see SetTargetWindow()
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxWindow* GetTargetWindow() const;
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the index of the first visible unit based on the scroll
|
|
|
|
position.
|
2008-04-11 03:01:41 -04:00
|
|
|
*/
|
|
|
|
size_t GetVisibleBegin() const;
|
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the index of the last visible unit based on the scroll
|
|
|
|
position. This includes the last unit even if it is only partially
|
|
|
|
visible.
|
2008-04-11 03:01:41 -04:00
|
|
|
*/
|
|
|
|
size_t GetVisibleEnd() const;
|
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns @true if the given scroll unit is currently visible (even if
|
|
|
|
only partially visible) or @false otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
bool IsVisible(size_t unit) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
Recalculate all parameters and repaint all units.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
virtual void RefreshAll();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Normally the window 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 like a
|
|
|
|
spreadsheet where only the cell area will move).
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
@see GetTargetWindow()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetTargetWindow(wxWindow* target);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
Update the thumb size shown by the scrollbar.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
virtual void UpdateScrollbar();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the virtual scroll unit under the device unit given accounting
|
|
|
|
for scroll position or @c wxNOT_FOUND if none (i.e. if it is below the
|
|
|
|
last item).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
int VirtualHitTest(wxCoord coord) const;
|
2008-10-13 07:29:37 -04:00
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2008-10-29 14:55:57 -04:00
|
|
|
/**
|
|
|
|
This function doesn't have to be overridden but it may be useful to do
|
|
|
|
so if calculating the units' sizes is a relatively expensive operation
|
|
|
|
as it gives your code a chance to calculate several of them at once and
|
|
|
|
cache the result if necessary.
|
|
|
|
|
|
|
|
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 OnGetUnitSize() will
|
|
|
|
be called for units outside of this interval, so this is really just a
|
|
|
|
hint, not a promise.
|
|
|
|
|
|
|
|
Finally, note that @a unitMin is inclusive, while @a unitMax is
|
|
|
|
exclusive.
|
|
|
|
*/
|
|
|
|
virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
When the number of scroll units change, we try to estimate the total
|
|
|
|
size of all units when the full window size is needed (i.e. to
|
|
|
|
calculate the scrollbar thumb size). This is a rather expensive
|
|
|
|
operation in terms of unit access, so if the user code may estimate the
|
|
|
|
average size better or faster than we do, it should override this
|
|
|
|
function to implement its own logic. This function should return the
|
|
|
|
best guess for the total virtual window size.
|
|
|
|
|
|
|
|
@note Although returning a totally wrong value would still work, it
|
|
|
|
risks resulting in very strange scrollbar behaviour so this
|
|
|
|
function should really try to make the best guess possible.
|
|
|
|
*/
|
|
|
|
virtual wxCoord EstimateTotalSize() const;
|
|
|
|
|
2008-10-13 07:29:37 -04:00
|
|
|
/**
|
|
|
|
This function must be overridden in the derived class, and should
|
|
|
|
return the size of the given unit in pixels.
|
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual wxCoord OnGetUnitSize(size_t unit) const = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxVarVScrollHelper
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-01 01:38:05 -04:00
|
|
|
This class provides functions wrapping the wxVarScrollHelperBase class,
|
|
|
|
targeted for vertical-specific scrolling.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-01 01:38:05 -04:00
|
|
|
Like wxVarScrollHelperBase, this class is mostly only useful to those
|
|
|
|
classes built into wxWidgets deriving from here, and this documentation is
|
|
|
|
mostly only provided for referencing the functions provided by this class.
|
|
|
|
You will likely want to derive your window from wxVScrolledWindow rather
|
|
|
|
than from here directly.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-05-01 01:38:05 -04:00
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxVarVScrollHelper : public wxVarScrollHelperBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Constructor taking the target window to be scrolled by this helper
|
|
|
|
class. This will attach scroll event handlers to the target window to
|
|
|
|
catch and handle scroll events appropriately.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxVarVScrollHelper(wxWindow* winToScroll);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of rows the target window contains.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetRowCount()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
size_t GetRowCount() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the index of the first visible row based on the scroll
|
|
|
|
position.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
size_t GetVisibleRowsBegin() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the index of the last visible row based on the scroll position.
|
|
|
|
This includes the last row even if it is only partially visible.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
size_t GetVisibleRowsEnd() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the given row is currently visible (even if only
|
|
|
|
partially visible) or @false otherwise.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsRowVisible(size_t row) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Triggers a refresh for just the given row's area of the window if it's
|
|
|
|
visible.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual void RefreshRow(size_t row);
|
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Triggers a refresh for the area between the specified range of rows
|
|
|
|
given (inclusively).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual void RefreshRows(size_t from, size_t to);
|
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Scroll by the specified number of pages which may be positive (to
|
|
|
|
scroll down) or negative (to scroll up).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual bool ScrollRowPages(int pages);
|
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Scroll by the specified number of rows which may be positive (to scroll
|
|
|
|
down) or negative (to scroll up).
|
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @true if the window was scrolled, @false otherwise (for
|
|
|
|
example, if we're trying to scroll down but we are already
|
|
|
|
showing the last row).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual bool ScrollRows(int rows);
|
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Scroll to the specified row. It will become the first visible row in
|
|
|
|
the window.
|
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @true if we scrolled the window, @false if nothing was done.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool ScrollToRow(size_t row);
|
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Set the number of rows the window contains. The derived class must
|
|
|
|
provide the heights for all rows with indices up to the one given here
|
|
|
|
in it's OnGetRowHeight() implementation.
|
|
|
|
|
|
|
|
@see GetRowCount()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetRowCount(size_t rowCount);
|
2008-10-13 07:29:37 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2008-10-29 14:55:57 -04:00
|
|
|
/**
|
|
|
|
This function doesn't have to be overridden but it may be useful to do
|
|
|
|
so if calculating the rows' sizes is a relatively expensive operation
|
|
|
|
as it gives your code a chance to calculate several of them at once and
|
|
|
|
cache the result if necessary.
|
|
|
|
|
|
|
|
OnGetRowsHeightHint() is normally called just before OnGetRowHeight()
|
|
|
|
but you shouldn't rely on the latter being called for all rows in the
|
|
|
|
interval specified here. It is also possible that OnGetRowHeight() will
|
|
|
|
be called for units outside of this interval, so this is really just a
|
|
|
|
hint, not a promise.
|
|
|
|
|
|
|
|
Finally, note that @a rowMin is inclusive, while @a rowMax is
|
|
|
|
exclusive.
|
|
|
|
*/
|
|
|
|
virtual void OnGetRowsHeightHint(size_t rowMin, size_t rowMax) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
This class forwards calls from EstimateTotalSize() to this function so
|
|
|
|
derived classes can override either just the height or the width
|
|
|
|
estimation, or just estimate both differently if desired in any
|
|
|
|
wxHVScrolledWindow derived class.
|
|
|
|
|
|
|
|
@note This function will not be called if EstimateTotalSize() is
|
|
|
|
overridden in your derived class.
|
|
|
|
*/
|
|
|
|
virtual wxCoord EstimateTotalHeight() const;
|
|
|
|
|
2008-10-13 07:29:37 -04:00
|
|
|
/**
|
|
|
|
This function must be overridden in the derived class, and should
|
|
|
|
return the height of the given row in pixels.
|
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual wxCoord OnGetRowHeight(size_t row) const = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
@class wxVarHScrollHelper
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-01 01:38:05 -04:00
|
|
|
This class provides functions wrapping the wxVarScrollHelperBase class,
|
|
|
|
targeted for horizontal-specific scrolling.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-01 01:38:05 -04:00
|
|
|
Like wxVarScrollHelperBase, this class is mostly only useful to those
|
|
|
|
classes built into wxWidgets deriving from here, and this documentation is
|
|
|
|
mostly only provided for referencing the functions provided by this class.
|
|
|
|
You will likely want to derive your window from wxHScrolledWindow rather
|
|
|
|
than from here directly.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-05-01 01:38:05 -04:00
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
class wxVarHScrollHelper : public wxVarScrollHelperBase
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Constructor taking the target window to be scrolled by this helper
|
|
|
|
class. This will attach scroll event handlers to the target window to
|
|
|
|
catch and handle scroll events appropriately.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
wxVarHScrollHelper(wxWindow* winToScroll);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
Returns the number of columns the target window contains.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
@see SetColumnCount()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
size_t GetColumnCount() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the index of the first visible column based on the scroll
|
|
|
|
position.
|
2008-04-11 03:01:41 -04:00
|
|
|
*/
|
|
|
|
size_t GetVisibleColumnsBegin() const;
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the index of the last visible column based on the scroll
|
|
|
|
position. This includes the last column even if it is only partially
|
|
|
|
visible.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
size_t GetVisibleColumnsEnd() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
Returns @true if the given column is currently visible (even if only
|
|
|
|
partially visible) or @false otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
bool IsColumnVisible(size_t column) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Triggers a refresh for just the given column's area of the window if
|
|
|
|
it's visible.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
virtual void RefreshColumn(size_t column);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Triggers a refresh for the area between the specified range of columns
|
|
|
|
given (inclusively).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
virtual void RefreshColumns(size_t from, size_t to);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Scroll by the specified number of pages which may be positive (to
|
|
|
|
scroll right) or negative (to scroll left).
|
2008-04-11 03:01:41 -04:00
|
|
|
*/
|
|
|
|
virtual bool ScrollColumnPages(int pages);
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Scroll by the specified number of columns which may be positive (to
|
|
|
|
scroll right) or negative (to scroll left).
|
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @true if the window was scrolled, @false otherwise (for
|
|
|
|
example, if we're trying to scroll right but we are already
|
|
|
|
showing the last column).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
virtual bool ScrollColumns(int columns);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Scroll to the specified column. It will become the first visible column
|
|
|
|
in the window.
|
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @true if we scrolled the window, @false if nothing was done.
|
2008-04-11 03:01:41 -04:00
|
|
|
*/
|
|
|
|
bool ScrollToColumn(size_t column);
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Set the number of columns the window contains. The derived class must
|
|
|
|
provide the widths for all columns with indices up to the one given
|
|
|
|
here in it's OnGetColumnWidth() implementation.
|
|
|
|
|
|
|
|
@see GetColumnCount()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
void SetColumnCount(size_t columnCount);
|
2008-10-13 07:29:37 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2008-10-29 14:55:57 -04:00
|
|
|
/**
|
|
|
|
This class forwards calls from EstimateTotalSize() to this function so
|
|
|
|
derived classes can override either just the height or the width
|
|
|
|
estimation, or just estimate both differently if desired in any
|
|
|
|
wxHVScrolledWindow derived class.
|
|
|
|
|
|
|
|
@note This function will not be called if EstimateTotalSize() is
|
|
|
|
overridden in your derived class.
|
|
|
|
*/
|
|
|
|
virtual wxCoord EstimateTotalWidth() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
This function doesn't have to be overridden but it may be useful to do
|
|
|
|
so if calculating the columns' sizes is a relatively expensive
|
|
|
|
operation as it gives your code a chance to calculate several of them
|
|
|
|
at once and cache the result if necessary.
|
|
|
|
|
|
|
|
OnGetColumnsWidthHint() is normally called just before
|
|
|
|
OnGetColumnWidth() but you shouldn't rely on the latter being called
|
|
|
|
for all columns in the interval specified here. It is also possible
|
|
|
|
that OnGetColumnWidth() will be called for units outside of this
|
|
|
|
interval, so this is really just a hint, not a promise.
|
|
|
|
|
|
|
|
Finally, note that @a columnMin is inclusive, while @a columnMax is
|
|
|
|
exclusive.
|
|
|
|
*/
|
|
|
|
virtual void OnGetColumnsWidthHint(size_t columnMin,
|
|
|
|
size_t columnMax) const;
|
|
|
|
|
2008-10-13 07:29:37 -04:00
|
|
|
/**
|
|
|
|
This function must be overridden in the derived class, and should
|
|
|
|
return the width of the given column in pixels.
|
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual wxCoord OnGetColumnWidth(size_t column) const = 0;
|
2008-04-11 03:01:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxVarHVScrollHelper
|
|
|
|
|
2008-05-01 01:38:05 -04:00
|
|
|
This class provides functions wrapping the wxVarHScrollHelper and
|
|
|
|
wxVarVScrollHelper classes, targeted for scrolling a window in both axis.
|
|
|
|
Since this class is also the join class of the horizontal and vertical
|
|
|
|
scrolling functionality, it also addresses some wrappers that help avoid
|
|
|
|
the need to specify class scope in your wxHVScrolledWindow derived class
|
|
|
|
when using wxVarScrollHelperBase functionality.
|
|
|
|
|
2021-03-10 14:28:20 -05:00
|
|
|
Like all three of its scroll helper base classes, this class is mostly
|
2008-05-01 01:38:05 -04:00
|
|
|
only useful to those classes built into wxWidgets deriving from here, and
|
|
|
|
this documentation is mostly only provided for referencing the functions
|
|
|
|
provided by this class. You will likely want to derive your window from
|
|
|
|
wxHVScrolledWindow rather than from here directly.
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
@library{wxcore}
|
2008-05-01 01:38:05 -04:00
|
|
|
@category{miscwnd}
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
@see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
|
|
|
|
*/
|
|
|
|
class wxVarHVScrollHelper : public wxVarVScrollHelper,
|
|
|
|
public wxVarHScrollHelper
|
|
|
|
{
|
|
|
|
public:
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Constructor taking the target window to be scrolled by this helper
|
|
|
|
class. This will attach scroll event handlers to the target window to
|
|
|
|
catch and handle scroll events appropriately.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
wxVarHVScrollHelper(wxWindow* winToScroll);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
With physical scrolling on (when this is @true), the device origin is
|
2008-05-01 01:38:05 -04:00
|
|
|
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. When this is @false, you are responsible for
|
|
|
|
repainting any invalidated areas of the window yourself to account for
|
|
|
|
the new scroll position.
|
2008-04-11 03:01:41 -04:00
|
|
|
|
|
|
|
@param vscrolling
|
|
|
|
Specifies if physical scrolling should be turned on when scrolling
|
2008-05-01 01:38:05 -04:00
|
|
|
vertically.
|
2008-04-11 03:01:41 -04:00
|
|
|
@param hscrolling
|
|
|
|
Specifies if physical scrolling should be turned on when scrolling
|
2008-05-01 01:38:05 -04:00
|
|
|
horizontally.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
void EnablePhysicalScrolling(bool vscrolling = true,
|
|
|
|
bool hscrolling = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
Returns the number of columns and rows the target window contains.
|
|
|
|
|
|
|
|
@see SetRowColumnCount()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
wxSize GetRowColumnCount() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the index of the first visible column and row based on the
|
|
|
|
current scroll position.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
wxPosition GetVisibleBegin() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the index of the last visible column and row based on the
|
|
|
|
scroll position. This includes any partially visible columns or rows.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
wxPosition GetVisibleEnd() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
//@{
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
Returns @true if both the given row and column are currently visible
|
|
|
|
(even if only partially visible) or @false otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
bool IsVisible(size_t row, size_t column) const;
|
2008-05-01 01:38:05 -04:00
|
|
|
bool IsVisible(const wxPosition& pos) const;
|
2008-04-11 03:01:41 -04:00
|
|
|
//@}
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
//@{
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Triggers a refresh for just the area shared between the given row and
|
|
|
|
column of the window if it is visible.
|
2008-04-11 03:01:41 -04:00
|
|
|
*/
|
|
|
|
virtual void RefreshRowColumn(size_t row, size_t column);
|
|
|
|
virtual void RefreshRowColumn(const wxPosition& pos);
|
|
|
|
//@}
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
//@{
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Triggers a refresh for the visible area shared between all given rows
|
|
|
|
and columns (inclusive) of the window. 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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
virtual void RefreshRowsColumns(size_t fromRow, size_t toRow,
|
2008-05-01 01:38:05 -04:00
|
|
|
size_t fromColumn, size_t toColumn);
|
2008-04-11 03:01:41 -04:00
|
|
|
virtual void RefreshRowsColumns(const wxPosition& from,
|
|
|
|
const wxPosition& to);
|
|
|
|
//@}
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
//@{
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Scroll to the specified row and column. It will become the first
|
|
|
|
visible row and column in the window. Returns @true if we scrolled the
|
|
|
|
window, @false if nothing was done.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
bool ScrollToRowColumn(size_t row, size_t column);
|
|
|
|
bool ScrollToRowColumn(const wxPosition& pos);
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the number of rows and columns the target window will contain. The
|
2008-05-01 01:38:05 -04:00
|
|
|
derived class must provide the sizes for all rows and columns with
|
|
|
|
indices up to the ones given here in it's OnGetRowHeight() and
|
|
|
|
OnGetColumnWidth() implementations, respectively.
|
|
|
|
|
|
|
|
@see GetRowColumnCount()
|
2008-04-11 03:01:41 -04:00
|
|
|
*/
|
|
|
|
void SetRowColumnCount(size_t rowCount, size_t columnCount);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
//@{
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Returns the virtual scroll unit under the device unit given accounting
|
|
|
|
for scroll position or @c wxNOT_FOUND (for the row, column, or possibly
|
|
|
|
both values) if none.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
wxPosition VirtualHitTest(wxCoord x, wxCoord y) const;
|
2008-05-01 01:38:05 -04:00
|
|
|
wxPosition VirtualHitTest(const wxPoint& pos) const;
|
2008-04-11 03:01:41 -04:00
|
|
|
//@}
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxVScrolledWindow
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05: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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-17 03:06:20 -04:00
|
|
|
In any case, this is a generalization of wxScrolled which can be only used
|
|
|
|
when all rows have the same heights. It lacks some other wxScrolled
|
2008-05-01 01:38:05 -04:00
|
|
|
features however, notably it can't scroll specific pixel sizes of the
|
|
|
|
window or its exact client area size.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
To use this class, you need to derive from it and implement the
|
2008-05-01 01:38:05 -04:00
|
|
|
OnGetRowHeight() pure virtual method. You also must call SetRowCount() to
|
|
|
|
let the base class know how many rows it should display, but from that
|
2008-03-08 08:52:38 -05:00
|
|
|
moment on the scrolling is handled entirely by wxVScrolledWindow. You only
|
|
|
|
need to draw the visible part of contents in your @c OnPaint() method as
|
2008-05-01 01:38:05 -04:00
|
|
|
usual. You should use GetVisibleRowsBegin() and GetVisibleRowsEnd() to
|
|
|
|
select the lines to display. Note that the device context origin is not
|
|
|
|
shifted so the first visible row always appears at the point (0, 0) in
|
|
|
|
physical as well as logical coordinates.
|
|
|
|
|
2008-10-19 11:30:20 -04:00
|
|
|
@section vscrolledwindow_compat wxWidgets 2.8 Compatibility Functions
|
2008-05-01 01:38:05 -04:00
|
|
|
|
|
|
|
The following functions provide backwards compatibility for applications
|
|
|
|
originally built using wxVScrolledWindow in 2.6 or 2.8. Originally,
|
|
|
|
wxVScrolledWindow referred to scrolling "lines". We now 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.
|
|
|
|
|
|
|
|
You are encouraged to update any existing code using these function to use
|
|
|
|
the new replacements mentioned below, and avoid using these functions for
|
|
|
|
any new code as they are deprecated.
|
|
|
|
|
|
|
|
@beginTable
|
|
|
|
@row2col{ <tt>size_t %GetFirstVisibleLine() const</tt>,
|
|
|
|
Deprecated for GetVisibleRowsBegin(). }
|
|
|
|
@row2col{ <tt>size_t %GetLastVisibleLine() const</tt>,
|
|
|
|
Deprecated for GetVisibleRowsEnd(). This function originally had a
|
|
|
|
slight design flaw in that it was possible to return
|
|
|
|
<tt>(size_t)-1</tt> (ie: a large positive number) if the scroll
|
|
|
|
position was 0 and the first line wasn't completely visible. }
|
|
|
|
@row2col{ <tt>size_t %GetLineCount() const</tt>,
|
|
|
|
Deprecated for GetRowCount(). }
|
|
|
|
@row2col{ <tt>int %HitTest(wxCoord x\, wxCoord y) const
|
|
|
|
@n int %HitTest(const wxPoint& pt) const</tt>,
|
|
|
|
Deprecated for VirtualHitTest(). }
|
|
|
|
@row2col{ <tt>virtual wxCoord %OnGetLineHeight(size_t line) const</tt>,
|
|
|
|
Deprecated for OnGetRowHeight(). }
|
|
|
|
@row2col{ <tt>virtual void %OnGetLinesHint(size_t lineMin\, size_t lineMax) const</tt>,
|
|
|
|
Deprecated for OnGetRowsHeightHint(). }
|
|
|
|
@row2col{ <tt>virtual void %RefreshLine(size_t line)</tt>,
|
|
|
|
Deprecated for RefreshRow(). }
|
|
|
|
@row2col{ <tt>virtual void %RefreshLines(size_t from\, size_t to)</tt>,
|
|
|
|
Deprecated for RefreshRows(). }
|
|
|
|
@row2col{ <tt>virtual bool %ScrollLines(int lines)</tt>,
|
|
|
|
Deprecated for ScrollRows(). }
|
|
|
|
@row2col{ <tt>virtual bool %ScrollPages(int pages)</tt>,
|
|
|
|
Deprecated for ScrollRowPages(). }
|
|
|
|
@row2col{ <tt>bool %ScrollToLine(size_t line)</tt>,
|
|
|
|
Deprecated for ScrollToRow(). }
|
|
|
|
@row2col{ <tt>void %SetLineCount(size_t count)</tt>,
|
|
|
|
Deprecated for SetRowCount(). }
|
|
|
|
@endTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxHScrolledWindow, wxHVScrolledWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
class wxVScrolledWindow : public wxPanel, public wxVarVScrollHelper
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Default constructor, you must call Create() later.
|
|
|
|
*/
|
|
|
|
wxVScrolledWindow();
|
|
|
|
/**
|
|
|
|
This is the normal constructor, no need to call Create() after using
|
|
|
|
this constructor.
|
|
|
|
|
|
|
|
@note @c wxVSCROLL is always automatically added to the style, there is
|
|
|
|
no need to specify it explicitly.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-05-01 01:38:05 -04:00
|
|
|
The parent window, must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-05-01 01:38:05 -04:00
|
|
|
The identifier of this window, wxID_ANY by default.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-05-01 01:38:05 -04:00
|
|
|
The initial window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-05-01 01:38:05 -04:00
|
|
|
The initial window size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-05-01 01:38:05 -04:00
|
|
|
The window style. There are no special style bits defined for this
|
|
|
|
class.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-05-01 01:38:05 -04:00
|
|
|
The name for this window; usually not used.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxVScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-05-01 01:38:05 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxString& name = wxPanelNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2011-04-03 16:31:32 -04:00
|
|
|
Same as the non-default constructor, but returns a status code: @true if
|
2008-05-01 01:38:05 -04:00
|
|
|
ok, @false if the window couldn't be created.
|
|
|
|
|
|
|
|
Just as with the constructor, the @c wxVSCROLL style is always used,
|
2008-03-08 08:52:38 -05:00
|
|
|
there is no need to specify it explicitly.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-05-01 01:38:05 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxString& name = wxPanelNameStr);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
@class wxHScrolledWindow
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-17 03:06:20 -04:00
|
|
|
In any case, this is a generalization of wxScrolled which can be only used
|
|
|
|
when all columns have the same widths. It lacks some other wxScrolled
|
2008-05-01 01:38:05 -04:00
|
|
|
features however, notably it can't scroll specific pixel sizes of the
|
|
|
|
window or its exact client area size.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
To use this class, you need to derive from it and implement the
|
2008-05-01 01:38:05 -04:00
|
|
|
OnGetColumnWidth() pure virtual method. You also must call SetColumnCount()
|
|
|
|
to let the base class know how many columns it should display, but from
|
|
|
|
that moment on the scrolling is handled entirely by wxHScrolledWindow. You
|
|
|
|
only need to draw the visible part of contents in your @c OnPaint() method
|
|
|
|
as usual. You should use GetVisibleColumnsBegin() and
|
|
|
|
GetVisibleColumnsEnd() to select the lines to display. Note that the device
|
|
|
|
context origin is not shifted so the first visible column always appears at
|
|
|
|
the point (0, 0) in physical as well as logical coordinates.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-05-01 01:38:05 -04:00
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
@see wxHVScrolledWindow, wxVScrolledWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
class wxHScrolledWindow : public wxPanel, public wxVarHScrollHelper
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Default constructor, you must call Create() later.
|
|
|
|
*/
|
|
|
|
wxHScrolledWindow();
|
|
|
|
/**
|
|
|
|
This is the normal constructor, no need to call Create() after using
|
|
|
|
this constructor.
|
|
|
|
|
|
|
|
@note @c wxHSCROLL is always automatically added to the style, there is
|
|
|
|
no need to specify it explicitly.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-05-01 01:38:05 -04:00
|
|
|
The parent window, must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-05-01 01:38:05 -04:00
|
|
|
The identifier of this window, wxID_ANY by default.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-05-01 01:38:05 -04:00
|
|
|
The initial window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-05-01 01:38:05 -04:00
|
|
|
The initial window size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-05-01 01:38:05 -04:00
|
|
|
The window style. There are no special style bits defined for this
|
|
|
|
class.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-05-01 01:38:05 -04:00
|
|
|
The name for this window; usually not used.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
wxHScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-05-01 01:38:05 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
2008-04-11 03:01:41 -04:00
|
|
|
const wxString& name = wxPanelNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2011-04-03 16:31:32 -04:00
|
|
|
Same as the non-default constructor, but returns a status code: @true if
|
2008-05-01 01:38:05 -04:00
|
|
|
ok, @false if the window couldn't be created.
|
|
|
|
|
|
|
|
Just as with the constructor, the @c wxHSCROLL style is always used,
|
2008-04-11 03:01:41 -04:00
|
|
|
there is no need to specify it explicitly.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-05-01 01:38:05 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxString& name = wxPanelNameStr);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-11 03:01:41 -04:00
|
|
|
@class wxHVScrolledWindow
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
This window inherits all functionality of both vertical and horizontal,
|
|
|
|
variable scrolled windows. It automatically handles everything needed to
|
|
|
|
scroll both axis simultaneously with both variable row heights and variable
|
|
|
|
column widths.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-17 03:06:20 -04:00
|
|
|
In any case, this is a generalization of wxScrolled which can be only used
|
|
|
|
when all rows and columns are the same size. It lacks some other wxScrolled
|
2008-05-01 01:38:05 -04:00
|
|
|
features however, notably it can't scroll specific pixel sizes of the
|
|
|
|
window or its exact client area size.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
To use this class, you must derive from it and implement both the
|
2008-05-01 01:38:05 -04:00
|
|
|
OnGetRowHeight() and OnGetColumnWidth() pure virtual methods to let the
|
|
|
|
base class know how many rows and columns it should display. You also need
|
|
|
|
to set the total rows and columns the window contains, but from that moment
|
|
|
|
on the scrolling is handled entirely by wxHVScrolledWindow. You only need
|
|
|
|
to draw the visible part of contents in your @c OnPaint() method as usual.
|
|
|
|
You should use GetVisibleBegin() and GetVisibleEnd() to select the lines to
|
|
|
|
display. Note that the device context origin is not shifted so the first
|
|
|
|
visible row and column always appear at the point (0, 0) in physical as
|
|
|
|
well as logical coordinates.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-05-01 01:38:05 -04:00
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-11 03:01:41 -04:00
|
|
|
@see wxHScrolledWindow, wxVScrolledWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-04-11 03:01:41 -04:00
|
|
|
class wxHVScrolledWindow : public wxPanel, public wxVarHVScrollHelper
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-01 01:38:05 -04:00
|
|
|
Default constructor, you must call Create() later.
|
|
|
|
*/
|
|
|
|
wxHVScrolledWindow();
|
|
|
|
/**
|
|
|
|
This is the normal constructor, no need to call Create() after using
|
|
|
|
this constructor.
|
|
|
|
|
|
|
|
@note @c wxHSCROLL and @c wxVSCROLL are always automatically added to
|
|
|
|
the style, there is no need to specify it explicitly.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-05-01 01:38:05 -04:00
|
|
|
The parent window, must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-05-01 01:38:05 -04:00
|
|
|
The identifier of this window, wxID_ANY by default.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-05-01 01:38:05 -04:00
|
|
|
The initial window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-05-01 01:38:05 -04:00
|
|
|
The initial window size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-05-01 01:38:05 -04:00
|
|
|
The window style. There are no special style bits defined for this
|
|
|
|
class.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-05-01 01:38:05 -04:00
|
|
|
The name for this window; usually not used.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-05-01 01:38:05 -04:00
|
|
|
wxHVScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
|
2008-04-11 03:01:41 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-05-01 01:38:05 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
2008-04-11 03:01:41 -04:00
|
|
|
const wxString& name = wxPanelNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2011-04-03 16:31:32 -04:00
|
|
|
Same as the non-default constructor, but returns a status code: @true if
|
2008-05-01 01:38:05 -04:00
|
|
|
ok, @false if the window couldn't be created.
|
|
|
|
|
|
|
|
Just as with the constructor, the @c wxHSCROLL and @c wxVSCROLL styles
|
|
|
|
are always used, there is no need to specify them explicitly.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-05-01 01:38:05 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxString& name = wxPanelNameStr);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|