Fixed multiple inheritance structure of vscroll.h classes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2008-04-11 07:01:41 +00:00
parent 09a728e15e
commit 6f022dba69

View File

@@ -6,260 +6,6 @@
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/**
@class wxVarHScrollHelper
@wxheader{vscroll.h}
This class provides functions wrapping the
wxVarScrollHelperBase class, targeted for
horizontal-specific scrolling using wxHScrolledWindow.
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 those functions provided. You will likely want
to derive your window from wxHScrolledWindow rather than from here directly.
@library{wxcore}
@category{FIXME}
@see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
*/
class wxVarHScrollHelper : public wxVarScrollHelperBase
{
public:
/**
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.
*/
wxVarHScrollHelper(wxWindow* winToScroll);
/**
This class forwards calls from
wxVarScrollHelperBase::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.
Please note that this function will not be called if @c EstimateTotalSize()
is overridden in your derived class.
*/
virtual wxCoord EstimateTotalWidth() const;
/**
Returns the number of columns the target window contains.
@see SetColumnCount()
*/
size_t GetColumnCount() const;
/**
Returns the index of the first visible column based on the scroll position.
*/
size_t GetVisibleColumnsBegin() const;
/**
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.
*/
size_t GetVisibleColumnsEnd() const;
/**
Returns @true if the given column is currently visible (even if only
partially visible) or @false otherwise.
*/
bool IsColumnVisible(size_t column) const;
/**
This function must be overridden in the derived class, and should return the
width of the given column in pixels.
*/
virtual wxCoord OnGetColumnWidth(size_t column) 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.
@c 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 columnMin is inclusive, while columnMax is exclusive.
*/
virtual void OnGetColumnsWidthHint(size_t columnMin,
size_t columnMax) const;
/**
Triggers a refresh for just the given column's area of the window if it's
visible.
*/
virtual void RefreshColumn(size_t column);
/**
Triggers a refresh for the area between the specified range of columns given
(inclusively).
*/
virtual void RefreshColumns(size_t from, size_t to);
/**
Scroll by the specified number of pages which may be positive (to scroll right)
or negative (to scroll left).
*/
virtual bool ScrollColumnPages(int pages);
/**
Scroll by the specified number of columns which may be positive (to scroll
right)
or negative (to scroll left).
Returns @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).
*/
virtual bool ScrollColumns(int columns);
/**
Scroll to the specified column. It will become the first visible column in the
window.
Returns @true if we scrolled the window, @false if nothing was done.
*/
bool ScrollToColumn(size_t column);
/**
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.
*/
void SetColumnCount(size_t columnCount);
};
/**
@class wxVarVScrollHelper
@wxheader{vscroll.h}
This class provides functions wrapping the
wxVarScrollHelperBase class, targeted for
vertical-specific scrolling using wxVScrolledWindow.
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 those functions provided. You will likely want
to derive your window from wxVScrolledWindow rather than from here directly.
@library{wxcore}
@category{FIXME}
@see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
*/
class wxVarVScrollHelper : public wxVarScrollHelperBase
{
public:
/**
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.
*/
wxVarVScrollHelper(wxWindow* winToScroll);
/**
This class forwards calls from
wxVarScrollHelperBase::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.
Please note that this function will not be called if @c EstimateTotalSize()
is overridden in your derived class.
*/
virtual wxCoord EstimateTotalHeight() const;
/**
Returns the number of rows the target window contains.
@see SetRowCount()
*/
size_t GetRowCount() const;
/**
Returns the index of the first visible row based on the scroll position.
*/
size_t GetVisibleRowsBegin() const;
/**
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.
*/
size_t GetVisibleRowsEnd() const;
/**
Returns @true if the given row is currently visible (even if only
partially visible) or @false otherwise.
*/
bool IsRowVisible(size_t row) const;
/**
This function must be overridden in the derived class, and should return the
height of the given row in pixels.
*/
virtual wxCoord OnGetRowHeight(size_t row) const;
/**
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.
@c 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 rowMin is inclusive, while rowMax is exclusive.
*/
virtual void OnGetRowsHeightHint(size_t rowMin, size_t rowMax) const;
/**
Triggers a refresh for just the given row's area of the window if it's visible.
*/
virtual void RefreshRow(size_t row);
/**
Triggers a refresh for the area between the specified range of rows given
(inclusively).
*/
virtual void RefreshRows(size_t from, size_t to);
/**
Scroll by the specified number of pages which may be positive (to scroll down)
or negative (to scroll up).
*/
virtual bool ScrollRowPages(int pages);
/**
Scroll by the specified number of rows which may be positive (to scroll down)
or negative (to scroll up).
Returns @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).
*/
virtual bool ScrollRows(int rows);
/**
Scroll to the specified row. It will become the first visible row in the window.
Returns @true if we scrolled the window, @false if nothing was done.
*/
bool ScrollToRow(size_t row);
/**
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.
*/
void SetRowCount(size_t rowCount);
};
/** /**
@class wxVarScrollHelperBase @class wxVarScrollHelperBase
@wxheader{vscroll.h} @wxheader{vscroll.h}
@@ -442,197 +188,255 @@ public:
/** /**
@class wxVScrolledWindow @class wxVarVScrollHelper
@wxheader{vscroll.h} @wxheader{vscroll.h}
In the name of this class, "V" may stand for "variable" because it can be This class provides functions wrapping the
used for scrolling rows of variable heights; "virtual", because it is not wxVarScrollHelperBase class, targeted for
necessary to know the heights of all rows in advance -- only those which vertical-specific scrolling using wxVScrolledWindow.
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 Like wxVarScrollHelperBase, this class is mostly only useful to those classes
wxScrolledWindow class which can be only used when built into wxWidgets deriving from here, and this documentation is mostly
all rows have the same heights. It lacks some other wxScrolledWindow features only provided for referencing those functions provided. You will likely want
however, notably it can't scroll only a rectangle of the window and not its to derive your window from wxVScrolledWindow rather than from here directly.
entire client area.
To use this class, you need to derive from it and implement the
wxVarVScrollHelper::OnGetRowHeight pure virtual
method. You also must call wxVarVScrollHelper::SetRowCount
to let the base class know how many rows it should display, but from that
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
usual. You should use wxVarVScrollHelper::GetVisibleRowsBegin
and wxVarVScrollHelper::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.
@library{wxcore} @library{wxcore}
@category{miscwnd} @category{FIXME}
@see wxHScrolledWindow, wxHVScrolledWindow @see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
*/ */
class wxVScrolledWindow : public wxPanel class wxVarVScrollHelper : public wxVarScrollHelperBase
{ {
public: public:
//@{
/** /**
This is the normal constructor, no need to call @c Create() after using this Constructor taking the target window to be scrolled by this helper class.
one. This will attach scroll event handlers to the target window to catch and
Note that @c wxVSCROLL is always automatically added to our style, there is handle scroll events appropriately.
no need to specify it explicitly.
@param parent
The parent window, must not be @NULL
@param id
The identifier of this window, wxID_ANY by default
@param pos
The initial window position
@param size
The initial window size
@param style
The window style. There are no special style bits defined for
this class.
@param name
The name for this window; usually not used
*/ */
wxVScrolledWindow(); wxVarVScrollHelper(wxWindow* winToScroll);
wxVScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
//@}
/** /**
Same as the @ref wxvscrolledwindow() "non-default constuctor" This class forwards calls from
but returns status code: @true if ok, @false if the window couldn't wxVarScrollHelperBase::EstimateTotalSize
be created. to this function so derived classes can override either just the height or
Just as with the constructor above, the @c wxVSCROLL style is always used, the width estimation, or just estimate both differently if desired in any
there is no need to specify it explicitly. wxHVScrolledWindow derived class.
Please note that this function will not be called if @c EstimateTotalSize()
is overridden in your derived class.
*/ */
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, virtual wxCoord EstimateTotalHeight() const;
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
//@{
/** /**
The following functions provide backwards compatibility for applications Returns the number of rows the target window contains.
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.
Deprecated for wxVarVScrollHelper::SetRowCount. @see SetRowCount()
*/ */
size_t GetFirstVisibleLine(); size_t GetRowCount() const;
const size_t GetLastVisibleLine();
const size_t GetLineCount(); /**
const int HitTest(wxCoord x, wxCoord y); Returns the index of the first visible row based on the scroll position.
const int HitTest(const wxPoint& pt); */
const virtual wxCoord OnGetLineHeight(size_t line); size_t GetVisibleRowsBegin() const;
const virtual void OnGetLinesHint(size_t lineMin,
size_t lineMax); /**
const virtual void RefreshLine(size_t line); Returns the index of the last visible row based on the scroll position. This
virtual void RefreshLines(size_t from, size_t to); includes the last row even if it is only partially visible.
virtual bool ScrollLines(int lines); */
virtual bool ScrollPages(int pages); size_t GetVisibleRowsEnd() const;
bool ScrollToLine(size_t line);
void SetLineCount(size_t count); /**
//@} Returns @true if the given row is currently visible (even if only
partially visible) or @false otherwise.
*/
bool IsRowVisible(size_t row) const;
/**
This function must be overridden in the derived class, and should return the
height of the given row in pixels.
*/
virtual wxCoord OnGetRowHeight(size_t row) const;
/**
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.
@c 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 rowMin is inclusive, while rowMax is exclusive.
*/
virtual void OnGetRowsHeightHint(size_t rowMin, size_t rowMax) const;
/**
Triggers a refresh for just the given row's area of the window if it's visible.
*/
virtual void RefreshRow(size_t row);
/**
Triggers a refresh for the area between the specified range of rows given
(inclusively).
*/
virtual void RefreshRows(size_t from, size_t to);
/**
Scroll by the specified number of pages which may be positive (to scroll down)
or negative (to scroll up).
*/
virtual bool ScrollRowPages(int pages);
/**
Scroll by the specified number of rows which may be positive (to scroll down)
or negative (to scroll up).
Returns @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).
*/
virtual bool ScrollRows(int rows);
/**
Scroll to the specified row. It will become the first visible row in the window.
Returns @true if we scrolled the window, @false if nothing was done.
*/
bool ScrollToRow(size_t row);
/**
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.
*/
void SetRowCount(size_t rowCount);
}; };
/** /**
@class wxHVScrolledWindow @class wxVarHScrollHelper
@wxheader{vscroll.h} @wxheader{vscroll.h}
This window inherits all functionality of both vertical and horizontal, This class provides functions wrapping the
variable scrolled windows. It automatically handles everything needed to wxVarScrollHelperBase class, targeted for
scroll both axis simultaneously with both variable row heights and variable horizontal-specific scrolling using wxHScrolledWindow.
column widths.
This is a generalization of the wxScrolledWindow Like wxVarScrollHelperBase, this class is mostly only useful to those classes
class which can be only used when all rows and columns are the same size. It built into wxWidgets deriving from here, and this documentation is mostly
lacks some other wxScrolledWindow features however, notably it can't scroll only provided for referencing those functions provided. You will likely want
only a rectangle of the window and not its entire client area. to derive your window from wxHScrolledWindow rather than from here directly.
To use this class, you must derive from it and implement both the
wxVarVScrollHelper::OnGetRowHeight and
wxVarHScrollHelper::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
wxVarHVScrollHelper::GetVisibleBegin
and wxVarHVScrollHelper::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.
@library{wxcore} @library{wxcore}
@category{FIXME} @category{FIXME}
@see wxHScrolledWindow, wxVScrolledWindow @see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
*/ */
class wxHVScrolledWindow : public wxPanel class wxVarHScrollHelper : public wxVarScrollHelperBase
{ {
public: public:
//@{
/** /**
This is the normal constructor, no need to call @c Create() after using this Constructor taking the target window to be scrolled by this helper class.
one. This will attach scroll event handlers to the target window to catch and
Note that @c wxHSCROLL and @c wxVSCROLL are always automatically added handle scroll events appropriately.
to our styles, there is no need to specify it explicitly.
@param parent
The parent window, must not be @NULL
@param id
The identifier of this window, wxID_ANY by default
@param pos
The initial window position
@param size
The initial window size
@param style
The window style. There are no special style bits defined for
this class.
@param name
The name for this window; usually not used
*/ */
wxHVScrolledWindow(); wxVarHScrollHelper(wxWindow* winToScroll);
wxHVScrolledWindow(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
//@}
/** /**
Same as the @ref wxhvscrolledwindow() "non-default constuctor" This class forwards calls from
but returns status code: @true if ok, @false if the window couldn't wxVarScrollHelperBase::EstimateTotalSize
be created. to this function so derived classes can override either just the height or
Just as with the constructor above, the @c wxHSCROLL and @c wxVSCROLL the width estimation, or just estimate both differently if desired in any
styles are always used, there is no need to specify it explicitly. wxHVScrolledWindow derived class.
Please note that this function will not be called if @c EstimateTotalSize()
is overridden in your derived class.
*/ */
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, virtual wxCoord EstimateTotalWidth() const;
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, /**
long style = 0, Returns the number of columns the target window contains.
const wxString& name = wxPanelNameStr);
@see SetColumnCount()
*/
size_t GetColumnCount() const;
/**
Returns the index of the first visible column based on the scroll position.
*/
size_t GetVisibleColumnsBegin() const;
/**
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.
*/
size_t GetVisibleColumnsEnd() const;
/**
Returns @true if the given column is currently visible (even if only
partially visible) or @false otherwise.
*/
bool IsColumnVisible(size_t column) const;
/**
This function must be overridden in the derived class, and should return the
width of the given column in pixels.
*/
virtual wxCoord OnGetColumnWidth(size_t column) 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.
@c 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 columnMin is inclusive, while columnMax is exclusive.
*/
virtual void OnGetColumnsWidthHint(size_t columnMin,
size_t columnMax) const;
/**
Triggers a refresh for just the given column's area of the window if it's
visible.
*/
virtual void RefreshColumn(size_t column);
/**
Triggers a refresh for the area between the specified range of columns given
(inclusively).
*/
virtual void RefreshColumns(size_t from, size_t to);
/**
Scroll by the specified number of pages which may be positive (to scroll right)
or negative (to scroll left).
*/
virtual bool ScrollColumnPages(int pages);
/**
Scroll by the specified number of columns which may be positive (to scroll
right)
or negative (to scroll left).
Returns @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).
*/
virtual bool ScrollColumns(int columns);
/**
Scroll to the specified column. It will become the first visible column in the
window.
Returns @true if we scrolled the window, @false if nothing was done.
*/
bool ScrollToColumn(size_t column);
/**
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.
*/
void SetColumnCount(size_t columnCount);
}; };
@@ -662,7 +466,8 @@ public:
@see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow @see wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow
*/ */
class wxVarHVScrollHelper : public wxVarVScrollHelper class wxVarHVScrollHelper : public wxVarVScrollHelper,
public wxVarHScrollHelper
{ {
public: public:
/** /**
@@ -774,6 +579,120 @@ public:
/**
@class wxVScrolledWindow
@wxheader{vscroll.h}
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.
To use this class, you need to derive from it and implement the
wxVarVScrollHelper::OnGetRowHeight pure virtual
method. You also must call wxVarVScrollHelper::SetRowCount
to let the base class know how many rows it should display, but from that
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
usual. You should use wxVarVScrollHelper::GetVisibleRowsBegin
and wxVarVScrollHelper::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.
@library{wxcore}
@category{miscwnd}
@see wxHScrolledWindow, wxHVScrolledWindow
*/
class wxVScrolledWindow : public wxPanel, public wxVarVScrollHelper
{
public:
//@{
/**
This is the normal constructor, no need to call @c Create() after using this
one.
Note that @c wxVSCROLL is always automatically added to our style, there is
no need to specify it explicitly.
@param parent
The parent window, must not be @NULL
@param id
The identifier of this window, wxID_ANY by default
@param pos
The initial window position
@param size
The initial window size
@param style
The window style. There are no special style bits defined for
this class.
@param name
The name for this window; usually not used
*/
wxVScrolledWindow();
wxVScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
//@}
/**
Same as the @ref wxvscrolledwindow() "non-default constuctor"
but returns status code: @true if ok, @false if the window couldn't
be created.
Just as with the constructor above, the @c wxVSCROLL style is always used,
there is no need to specify it explicitly.
*/
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
//@{
/**
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.
Deprecated for wxVarVScrollHelper::SetRowCount.
*/
size_t GetFirstVisibleLine();
const size_t GetLastVisibleLine();
const size_t GetLineCount();
const int HitTest(wxCoord x, wxCoord y);
const int HitTest(const wxPoint& pt);
const virtual wxCoord OnGetLineHeight(size_t line);
const virtual void OnGetLinesHint(size_t lineMin,
size_t lineMax);
const virtual void RefreshLine(size_t line);
virtual void RefreshLines(size_t from, size_t to);
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
bool ScrollToLine(size_t line);
void SetLineCount(size_t count);
//@}
};
/** /**
@class wxHScrolledWindow @class wxHScrolledWindow
@wxheader{vscroll.h} @wxheader{vscroll.h}
@@ -806,7 +725,7 @@ public:
@see wxHVScrolledWindow, wxVScrolledWindow @see wxHVScrolledWindow, wxVScrolledWindow
*/ */
class wxHScrolledWindow : public wxPanel class wxHScrolledWindow : public wxPanel, public wxVarHScrollHelper
{ {
public: public:
//@{ //@{
@@ -852,3 +771,85 @@ public:
const wxString& name = wxPanelNameStr); const wxString& name = wxPanelNameStr);
}; };
/**
@class wxHVScrolledWindow
@wxheader{vscroll.h}
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.
This is a generalization of the wxScrolledWindow
class which can be only used when all rows and columns are the same size. It
lacks some other wxScrolledWindow features however, notably it can't scroll
only a rectangle of the window and not its entire client area.
To use this class, you must derive from it and implement both the
wxVarVScrollHelper::OnGetRowHeight and
wxVarHScrollHelper::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
wxVarHVScrollHelper::GetVisibleBegin
and wxVarHVScrollHelper::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.
@library{wxcore}
@category{FIXME}
@see wxHScrolledWindow, wxVScrolledWindow
*/
class wxHVScrolledWindow : public wxPanel, public wxVarHVScrollHelper
{
public:
//@{
/**
This is the normal constructor, no need to call @c Create() after using this
one.
Note that @c wxHSCROLL and @c wxVSCROLL are always automatically added
to our styles, there is no need to specify it explicitly.
@param parent
The parent window, must not be @NULL
@param id
The identifier of this window, wxID_ANY by default
@param pos
The initial window position
@param size
The initial window size
@param style
The window style. There are no special style bits defined for
this class.
@param name
The name for this window; usually not used
*/
wxHVScrolledWindow();
wxHVScrolledWindow(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
//@}
/**
Same as the @ref wxhvscrolledwindow() "non-default constuctor"
but returns status code: @true if ok, @false if the window couldn't
be created.
Just as with the constructor above, the @c wxHSCROLL and @c wxVSCROLL
styles are always used, there is no need to specify it explicitly.
*/
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
};