removed mentions of wxUSE_OWNER_DRAWN: unless I miss something, this doesn't make any sense for Mac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,15 +23,6 @@
|
|||||||
#include "wx/dynarray.h"
|
#include "wx/dynarray.h"
|
||||||
#include "wx/arrstr.h"
|
#include "wx/arrstr.h"
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
class WXDLLEXPORT wxOwnerDrawn;
|
|
||||||
|
|
||||||
// define the array of list box items
|
|
||||||
#include "wx/dynarray.h"
|
|
||||||
|
|
||||||
WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray);
|
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
|
||||||
|
|
||||||
// forward decl for GetSelections()
|
// forward decl for GetSelections()
|
||||||
class wxArrayInt;
|
class wxArrayInt;
|
||||||
|
|
||||||
@@ -114,18 +105,6 @@ public:
|
|||||||
virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
|
virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
|
||||||
|
|
||||||
// wxCheckListBox support
|
// wxCheckListBox support
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
// plug-in for derived classes
|
|
||||||
virtual wxOwnerDrawn *CreateItem(size_t n);
|
|
||||||
|
|
||||||
// allows to get the item and use SetXXX functions to set it's appearance
|
|
||||||
wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
|
|
||||||
|
|
||||||
// get the index of the given item
|
|
||||||
int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
|
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
|
||||||
|
|
||||||
|
|
||||||
static wxVisualAttributes
|
static wxVisualAttributes
|
||||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||||
|
|
||||||
@@ -167,15 +146,9 @@ protected:
|
|||||||
|
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
// control items
|
|
||||||
wxListBoxItemsArray m_aItems;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxListBox)
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // _WX_LISTBOX_H_
|
||||||
// _WX_LISTBOX_H_
|
|
||||||
|
@@ -317,19 +317,6 @@ wxListBox::~wxListBox()
|
|||||||
|
|
||||||
void wxListBox::FreeData()
|
void wxListBox::FreeData()
|
||||||
{
|
{
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
if ( m_windowStyle & wxLB_OWNERDRAW )
|
|
||||||
{
|
|
||||||
size_t uiCount = m_aItems.Count();
|
|
||||||
while ( uiCount-- != 0 ) {
|
|
||||||
delete m_aItems[uiCount];
|
|
||||||
m_aItems[uiCount] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_aItems.Clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
{
|
{
|
||||||
for ( size_t n = 0; n < (size_t)m_noItems; n++ )
|
for ( size_t n = 0; n < (size_t)m_noItems; n++ )
|
||||||
@@ -356,15 +343,10 @@ void wxListBox::Delete(int N)
|
|||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||||
wxT("invalid index in wxListBox::Delete") );
|
wxT("invalid index in wxListBox::Delete") );
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
delete m_aItems[N];
|
|
||||||
m_aItems.RemoveAt(N);
|
|
||||||
#else // !wxUSE_OWNER_DRAWN
|
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
{
|
{
|
||||||
delete GetClientObject(N);
|
delete GetClientObject(N);
|
||||||
}
|
}
|
||||||
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
|
|
||||||
m_stringArray.RemoveAt( N ) ;
|
m_stringArray.RemoveAt( N ) ;
|
||||||
m_dataArray.RemoveAt( N ) ;
|
m_dataArray.RemoveAt( N ) ;
|
||||||
m_noItems --;
|
m_noItems --;
|
||||||
@@ -395,35 +377,11 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
|||||||
{
|
{
|
||||||
if ( clientData )
|
if ( clientData )
|
||||||
{
|
{
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
wxASSERT_MSG(clientData[i] == NULL,
|
|
||||||
wxT("Can't use client data with owner-drawn listboxes"));
|
|
||||||
#else // !wxUSE_OWNER_DRAWN
|
|
||||||
Append( choices[i] , clientData[i] ) ;
|
Append( choices[i] , clientData[i] ) ;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Append( choices[i] ) ;
|
Append( choices[i] ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
if ( m_windowStyle & wxLB_OWNERDRAW ) {
|
|
||||||
// first delete old items
|
|
||||||
size_t ui = m_aItems.Count();
|
|
||||||
while ( ui-- != 0 ) {
|
|
||||||
delete m_aItems[ui];
|
|
||||||
m_aItems[ui] = NULL;
|
|
||||||
}
|
|
||||||
m_aItems.Empty();
|
|
||||||
|
|
||||||
// then create new ones
|
|
||||||
for ( ui = 0; ui < (size_t)m_noItems; ui++ ) {
|
|
||||||
wxOwnerDrawn *pNewItem = CreateItem(ui);
|
|
||||||
pNewItem->SetName(choices[ui]);
|
|
||||||
m_aItems.Add(pNewItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::FindString(const wxString& s) const
|
int wxListBox::FindString(const wxString& s) const
|
||||||
@@ -518,14 +476,6 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
|
|||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||||
wxT("invalid index in wxListBox::SetClientData") );
|
wxT("invalid index in wxListBox::SetClientData") );
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
if ( m_windowStyle & wxLB_OWNERDRAW )
|
|
||||||
{
|
|
||||||
// client data must be pointer to wxOwnerDrawn, otherwise we would crash
|
|
||||||
// in OnMeasure/OnDraw.
|
|
||||||
wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
|
|
||||||
}
|
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
|
||||||
wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , wxT("invalid client_data array") ) ;
|
wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , wxT("invalid client_data array") ) ;
|
||||||
|
|
||||||
if ( m_dataArray.GetCount() > (size_t) N )
|
if ( m_dataArray.GetCount() > (size_t) N )
|
||||||
@@ -655,27 +605,6 @@ void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
|||||||
wxControl::Refresh( eraseBack , rect ) ;
|
wxControl::Refresh( eraseBack , rect ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
|
||||||
|
|
||||||
class wxListBoxItem : public wxOwnerDrawn
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxListBoxItem(const wxString& str = "");
|
|
||||||
};
|
|
||||||
|
|
||||||
wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE)
|
|
||||||
{
|
|
||||||
// no bitmaps/checkmarks
|
|
||||||
SetMarginWidth(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxOwnerDrawn *wxListBox::CreateItem(size_t n)
|
|
||||||
{
|
|
||||||
return new wxListBoxItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //USE_OWNER_DRAWN
|
|
||||||
|
|
||||||
|
|
||||||
// Some custom controls depend on this
|
// Some custom controls depend on this
|
||||||
/* static */ wxVisualAttributes
|
/* static */ wxVisualAttributes
|
||||||
|
Reference in New Issue
Block a user