fixed GetItemSpacing() inconsistency by deprecating the old function and adding a new, easier to use, overload

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-09-14 16:06:27 +00:00
parent 4a06b34847
commit 5db8d758b8
5 changed files with 31 additions and 12 deletions

View File

@@ -369,13 +369,15 @@ ID and code and returns the wxRect.}
\perlnote{In wxPerl this method takes only the {\bf item} parameter and
returns a Wx::Rect ( or undef ).}
\membersection{wxListCtrl::GetItemSpacing}\label{wxlistctrlgetitemspacing}
\constfunc{int}{GetItemSpacing}{\param{bool }{isSmall}}
\constfunc{wxSize}{GetItemSpacing}{\void}
Retrieves the spacing between icons in pixels: horizontal spacing is returned
as \texttt{x} component of the \helpref{wxSize}{wxsize} object and the vertical
spacing as its \texttt{y} component.
Retrieves the spacing between icons in pixels.
If {\it small} is true, gets the spacing for the small icon
view, otherwise the large icon view.
\membersection{wxListCtrl::GetItemState}\label{wxlistctrlgetitemstate}

View File

@@ -109,7 +109,7 @@ public:
int GetItemCount() const;
int GetColumnCount() const;
void SetItemSpacing( int spacing, bool isSmall = FALSE );
int GetItemSpacing( bool isSmall ) const;
wxSize GetItemSpacing() const;
void SetItemTextColour( long item, const wxColour& col);
wxColour GetItemTextColour( long item ) const;
void SetItemBackgroundColour( long item, const wxColour &col);
@@ -162,6 +162,10 @@ public:
void RefreshItem(long item);
void RefreshItems(long itemFrom, long itemTo);
// obsolete, don't use
wxDEPRECATED( int GetItemSpacing( bool isSmall ) const );
// implementation only from now on
// -------------------------------

View File

@@ -189,10 +189,8 @@ public:
// Gets the number of columns in the list control
int GetColumnCount() const { return m_colCount; }
// Retrieves the spacing between icons in pixels.
// If small is TRUE, gets the spacing for the small icon
// view, otherwise the large icon view.
int GetItemSpacing(bool isSmall) const;
// get the horizontal and vertical components of the item spacing
wxSize GetItemSpacing() const;
// Foreground colour of an item.
void SetItemTextColour( long item, const wxColour& col);
@@ -355,6 +353,10 @@ public:
// Necessary for drawing hrules and vrules, if specified
void OnPaint(wxPaintEvent& event);
// obsolete stuff, for compatibility only -- don't use
wxDEPRECATED( int GetItemSpacing(bool isSmall) const);
protected:
// common part of all ctors
void Init();

View File

@@ -4757,6 +4757,13 @@ void wxGenericListCtrl::SetItemSpacing( int spacing, bool isSmall )
m_mainWin->SetItemSpacing( spacing, isSmall );
}
wxSize wxGenericListCtrl::GetItemSpacing() const
{
const int spacing = GetItemSpacing(HasFlag(wxLC_SMALL_ICON));
return wxSize(spacing, spacing);
}
int wxGenericListCtrl::GetItemSpacing( bool isSmall ) const
{
return m_mainWin->GetItemSpacing( isSmall );

View File

@@ -1110,9 +1110,13 @@ int wxListCtrl::GetItemCount() const
return m_count;
}
// Retrieves the spacing between icons in pixels.
// If small is TRUE, gets the spacing for the small icon
// view, otherwise the large icon view.
wxSize wxListCtrl::GetItemSpacing() const
{
const int spacing = GetItemSpacing(HasFlag(wxLC_SMALL_ICON));
return wxSize(LOWORD(spacing), HIWORD(spacing));
}
int wxListCtrl::GetItemSpacing(bool isSmall) const
{
return ListView_GetItemSpacing(GetHwnd(), (BOOL) isSmall);