wxT("invalid index in wxListBox::Delete") );
#if wxUSE_OWNER_DRAWN
- delete m_aItems[n];
- m_aItems.RemoveAt(n);
+ if ( HasFlag(wxLB_OWNERDRAW) )
+ {
+ delete m_aItems[n];
+ m_aItems.RemoveAt(n);
+ }
#endif // wxUSE_OWNER_DRAWN
SendMessage(GetHwnd(), LB_DELETESTRING, n, 0);
void wxListBox::DoClear()
{
#if wxUSE_OWNER_DRAWN
- if ( m_windowStyle & wxLB_OWNERDRAW )
+ if ( HasFlag(wxLB_OWNERDRAW) )
{
WX_CLEAR_ARRAY(m_aItems);
}
}
// ----------------------------------------------------------------------------
-// wxCheckListBox support
+// owner-drawn list boxes support
// ----------------------------------------------------------------------------
#if wxUSE_OWNER_DRAWN
// misc overloaded methods
// -----------------------
-void wxListBox::Delete(unsigned int n)
-{
- wxCHECK_RET( IsValid(n),
- wxT("invalid index in wxListBox::Delete") );
-
- wxListBoxBase::Delete(n);
-
- // free memory
- delete m_aItems[n];
- m_aItems.RemoveAt(n);
-}
-
bool wxListBox::SetFont(const wxFont &font)
{
- unsigned int i;
- for ( i = 0; i < m_aItems.GetCount(); i++ )
- m_aItems[i]->SetFont(font);
+ if ( HasFlag(wxLB_OWNERDRAW) )
+ {
+ const unsigned count = m_aItems.GetCount();
+ for ( unsigned i = 0; i < count; i++ )
+ m_aItems[i]->SetFont(font);
+ }
wxListBoxBase::SetFont(font);
bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
{
// only owner-drawn control should receive this message
- wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), false );
+ wxCHECK( HasFlag(wxLB_OWNERDRAW), false );
MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item;
bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
{
// only owner-drawn control should receive this message
- wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), false );
+ wxCHECK( HasFlag(wxLB_OWNERDRAW), false );
DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)item;