From 5db8d758b8da4140ba727c51638a69b2700c751d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 14 Sep 2003 16:06:27 +0000 Subject: [PATCH] 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 --- docs/latex/wx/listctrl.tex | 10 ++++++---- include/wx/generic/listctrl.h | 6 +++++- include/wx/msw/listctrl.h | 10 ++++++---- src/generic/listctrl.cpp | 7 +++++++ src/msw/listctrl.cpp | 10 +++++++--- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/docs/latex/wx/listctrl.tex b/docs/latex/wx/listctrl.tex index b4e57c7a4f..03cd4fd808 100644 --- a/docs/latex/wx/listctrl.tex +++ b/docs/latex/wx/listctrl.tex @@ -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} diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 15b8eef98c..e39a1d554e 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -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 // ------------------------------- diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 3e780f13f2..283eccd872 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -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(); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index ceb79f49f2..dee130a103 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -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 ); diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 020353af2a..8338025dba 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -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); -- 2.45.2