From: Ron Lee Date: Wed, 24 Apr 2002 20:31:46 +0000 (+0000) Subject: Added {S,G}etItem{Text,Background}Colour methods. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5b98eb2fa6602cc9d1f19870c063c8f5e9cbe68f Added {S,G}etItem{Text,Background}Colour methods. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index be16f28626..80423f5088 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -101,6 +101,10 @@ public: int GetColumnCount() const; void SetItemSpacing( int spacing, bool isSmall = FALSE ); int GetItemSpacing( bool isSmall ) const; + void SetItemTextColour( long item, const wxColour& col); + wxColour GetItemTextColour( long item ) const; + void SetItemBackgroundColour( long item, const wxColour &col); + wxColour GetItemBackgroundColour( long item ) const; int GetSelectedItemCount() const; wxColour GetTextColour() const; void SetTextColour(const wxColour& col); @@ -218,3 +222,5 @@ private: #endif // __LISTCTRLH_G__ + +// vi:sts=4:sw=4:et diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 47c58d65fe..2bce95d808 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -191,6 +191,14 @@ public: // view, otherwise the large icon view. int GetItemSpacing(bool isSmall) const; + // Foreground colour of an item. + void SetItemTextColour( long item, const wxColour& col); + wxColour GetItemTextColour( long item ) const; + + // Background colour of an item. + void SetItemBackgroundColour( long item, const wxColour &col); + wxColour GetItemBackgroundColour( long item ) const; + // Gets the number of selected items in the list control int GetSelectedItemCount() const; @@ -395,3 +403,5 @@ private: #endif // _WX_LISTCTRL_H_ + +// vi:sts=4:sw=4:et diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 3b9727dd86..b68ffb85ae 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4837,6 +4837,38 @@ int wxListCtrl::GetItemSpacing( bool isSmall ) const return m_mainWin->GetItemSpacing( isSmall ); } +void wxListCtrl::SetItemTextColour( long item, const wxColour &col ) +{ + wxListItem info; + info.m_itemId = item; + info.SetTextColour( col ); + m_mainWin->SetItem( info ); +} + +wxColour wxListCtrl::GetItemTextColour( long item ) const +{ + wxListItem info; + info.m_itemId = item; + m_mainWin->GetItem( info ); + return info.GetTextColour(); +} + +void wxListCtrl::SetItemBackgroundColour( long item, const wxColour &col ) +{ + wxListItem info; + info.m_itemId = item; + info.SetBackgroundColour( col ); + m_mainWin->SetItem( info ); +} + +wxColour wxListCtrl::GetItemBackgroundColour( long item ) const +{ + wxListItem info; + info.m_itemId = item; + m_mainWin->GetItem( info ); + return info.GetBackgroundColour(); +} + int wxListCtrl::GetSelectedItemCount() const { return m_mainWin->GetSelectedItemCount(); @@ -5265,3 +5297,5 @@ void wxListCtrl::Thaw() } #endif // wxUSE_LISTCTRL + +// vi:sts=4:sw=4:et diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 5c0482fb6a..c0a29caeac 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -910,6 +910,38 @@ int wxListCtrl::GetItemSpacing(bool isSmall) const return ListView_GetItemSpacing(GetHwnd(), (BOOL) isSmall); } +void wxListCtrl::SetItemTextColour( long item, const wxColour &col ) +{ + wxListItem info; + info.m_itemId = item; + info.SetTextColour( col ); + SetItem( info ); +} + +wxColour wxListCtrl::GetItemTextColour( long item ) const +{ + wxListItem info; + info.m_itemId = item; + GetItem( info ); + return info.GetTextColour(); +} + +void wxListCtrl::SetItemBackgroundColour( long item, const wxColour &col ) +{ + wxListItem info; + info.m_itemId = item; + info.SetBackgroundColour( col ); + SetItem( info ); +} + +wxColour wxListCtrl::GetItemBackgroundColour( long item ) const +{ + wxListItem info; + info.m_itemId = item; + GetItem( info ); + return info.GetBackgroundColour(); +} + // Gets the number of selected items in the list control int wxListCtrl::GetSelectedItemCount() const { @@ -2407,3 +2439,5 @@ static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item, } #endif // wxUSE_LISTCTRL + +// vi:sts=4:sw=4:et