Applied Patch #1424869: Implement wxListCtrl::SetItemColumnImage
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b4deaacba3
commit
06db67bcb0
@ -920,7 +920,8 @@ Sets the item's font.
|
||||
\func{bool}{SetItemImage}{\param{long }{item}, \param{int }{image}}
|
||||
|
||||
Sets the image associated with the item. The image is an index into the
|
||||
image list associated with the list control.
|
||||
image list associated with the list control. In report view, this only sets
|
||||
the image for the first column.
|
||||
|
||||
\func{bool}{SetItemImage}{\param{long }{item}, \param{int }{image}, \param{int }{selImage}}
|
||||
|
||||
@ -929,6 +930,14 @@ image list associated with the list control. This form is deprecated: {\it selIm
|
||||
used.
|
||||
|
||||
|
||||
\membersection{wxListCtrl::SetItemColumnImage}\label{wxlistctrlsetitemcolumnimage}
|
||||
|
||||
\func{bool}{SetItemImage}{\param{long }{item}, \param{long }{column}\param{int }{image}}
|
||||
|
||||
Sets the image associated with the item. In report view, you can specify the column.
|
||||
The image is an index into the image list associated with the list control.
|
||||
|
||||
|
||||
\membersection{wxListCtrl::SetItemPosition}\label{wxlistctrlsetitemposition}
|
||||
|
||||
\func{bool}{SetItemPosition}{\param{long }{item}, \param{const wxPoint\& }{pos}}
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
int GetItemState( long item, long stateMask ) const;
|
||||
bool SetItemState( long item, long state, long stateMask);
|
||||
bool SetItemImage( long item, int image, int selImage = -1 );
|
||||
bool SetItemColumnImage( long item, long column, int image );
|
||||
wxString GetItemText( long item ) const;
|
||||
void SetItemText( long item, const wxString& str );
|
||||
wxUIntPtr GetItemData( long item ) const;
|
||||
|
@ -223,6 +223,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
|
||||
// Sets the item image
|
||||
bool SetItemImage(long item, int image, int selImage) ;
|
||||
bool SetItemColumnImage(long item, long column, int image);
|
||||
|
||||
// Gets the item text
|
||||
wxString GetItemText(long item) const ;
|
||||
|
@ -223,6 +223,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
|
||||
// Sets the item image
|
||||
bool SetItemImage(long item, int image, int selImage) ;
|
||||
bool SetItemColumnImage(long item, long column, int image);
|
||||
|
||||
// Gets the item text
|
||||
wxString GetItemText(long item) const ;
|
||||
|
@ -157,6 +157,7 @@ public:
|
||||
|
||||
// Sets the item image
|
||||
bool SetItemImage(long item, int image, int selImage = -1) ;
|
||||
bool SetItemColumnImage(long item, long column, int image);
|
||||
|
||||
// Gets the item text
|
||||
wxString GetItemText(long item) const ;
|
||||
|
@ -133,6 +133,10 @@ public:
|
||||
,int nImage
|
||||
,int lSelImage
|
||||
);
|
||||
bool SetItemColumnImage( long lItem
|
||||
,long lColumn
|
||||
,int nImage
|
||||
);
|
||||
|
||||
//
|
||||
// Item text
|
||||
|
@ -154,6 +154,7 @@ public:
|
||||
|
||||
// Sets the item image
|
||||
bool SetItemImage(long item, int image, int selImage) ;
|
||||
bool SetItemColumnImage(long item, long column, int image);
|
||||
|
||||
// Gets the item text
|
||||
wxString GetItemText(long item) const ;
|
||||
|
@ -491,6 +491,15 @@ void MyFrame::InitWithReportItems()
|
||||
m_listCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
|
||||
m_listCtrl->SetColumnWidth( 2, wxLIST_AUTOSIZE );
|
||||
|
||||
// Set images in columns
|
||||
m_listCtrl->SetItemColumnImage(1, 1, 0);
|
||||
|
||||
wxListItem info;
|
||||
info.SetImage(0);
|
||||
info.SetId(3);
|
||||
info.SetColumn(2);
|
||||
m_listCtrl->SetItem(info);
|
||||
|
||||
// test SetItemFont too
|
||||
m_listCtrl->SetItemFont(0, *wxITALIC_FONT);
|
||||
}
|
||||
@ -1012,9 +1021,15 @@ wxString MyListCtrl::OnGetItemText(long item, long column) const
|
||||
}
|
||||
}
|
||||
|
||||
int MyListCtrl::OnGetItemImage(long WXUNUSED(item)) const
|
||||
int MyListCtrl::OnGetItemColumnImage(long item, long column) const
|
||||
{
|
||||
return 0;
|
||||
if (!column)
|
||||
return 0;
|
||||
|
||||
if (!(item %3) && column == 1)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxListItemAttr *MyListCtrl::OnGetItemAttr(long item) const
|
||||
|
@ -68,7 +68,7 @@ private:
|
||||
void LogColEvent(const wxListEvent& event, const wxChar *eventName);
|
||||
|
||||
virtual wxString OnGetItemText(long item, long column) const;
|
||||
virtual int OnGetItemImage(long item) const;
|
||||
virtual int OnGetItemColumnImage(long item, long column) const;
|
||||
virtual wxListItemAttr *OnGetItemAttr(long item) const;
|
||||
|
||||
wxListItemAttr m_attr;
|
||||
|
@ -4935,11 +4935,18 @@ bool wxGenericListCtrl::SetItemState( long item, long state, long stateMask )
|
||||
|
||||
bool
|
||||
wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) )
|
||||
{
|
||||
return SetItemColumnImage(item, 0, image);
|
||||
}
|
||||
|
||||
bool
|
||||
wxGenericListCtrl::SetItemColumnImage( long item, long column, int image )
|
||||
{
|
||||
wxListItem info;
|
||||
info.m_image = image;
|
||||
info.m_mask = wxLIST_MASK_IMAGE;
|
||||
info.m_itemId = item;
|
||||
info.m_col = column;
|
||||
m_mainWin->SetItem( info );
|
||||
return true;
|
||||
}
|
||||
|
@ -918,12 +918,19 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask)
|
||||
|
||||
// Sets the item image
|
||||
bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage))
|
||||
{
|
||||
return SetItemColumnImage(item, 0, image);
|
||||
}
|
||||
|
||||
// Sets the item image
|
||||
bool wxListCtrl::SetItemColumnImage(long item, long column, int image)
|
||||
{
|
||||
wxListItem info;
|
||||
|
||||
info.m_mask = wxLIST_MASK_IMAGE;
|
||||
info.m_image = image;
|
||||
info.m_itemId = item;
|
||||
info.m_col = column;
|
||||
|
||||
return SetItem(info);
|
||||
}
|
||||
|
@ -1543,14 +1543,24 @@ bool wxListCtrl::SetItemImage (
|
||||
long lItem
|
||||
, int nImage
|
||||
, int WXUNUSED(nSelImage))
|
||||
{
|
||||
return SetItemColumnInfo(lItem, 0, nImage);
|
||||
} // end of wxListCtrl::SetItemImage
|
||||
|
||||
// Sets the item image
|
||||
bool wxListCtrl::SetItemColumnImage (
|
||||
long lItem
|
||||
, long lColumn
|
||||
, int nImage
|
||||
{
|
||||
wxListItem vInfo;
|
||||
|
||||
vInfo.m_mask = wxLIST_MASK_IMAGE;
|
||||
vInfo.m_image = nImage;
|
||||
vInfo.m_itemId = lItem;
|
||||
vInfo.m_col = lColumn;
|
||||
return SetItem(vInfo);
|
||||
} // end of wxListCtrl::SetItemImage
|
||||
} // end of wxListCtrl::SetItemColumnImage
|
||||
|
||||
// Gets the item text
|
||||
wxString wxListCtrl::GetItemText (
|
||||
|
@ -284,6 +284,12 @@ bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Sets the item image
|
||||
bool wxListCtrl::SetItemColumnImage(long item, long column, int image)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gets the item text
|
||||
wxString wxListCtrl::GetItemText(long item) const
|
||||
{
|
||||
|
@ -513,6 +513,7 @@ public:
|
||||
|
||||
// Sets the item image
|
||||
bool SetItemImage(long item, int image, int selImage=-1) ;
|
||||
bool SetItemColumnImage( long item, long column, int image );
|
||||
|
||||
// Gets the item text
|
||||
wxString GetItemText(long item) const ;
|
||||
|
Loading…
Reference in New Issue
Block a user