X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7c74e7fe1de14f32dcd6f3c9cdd727de540bbd0e..8290d43d0d43369d007f1c47abf98a45da461a30:/src/mac/listbox.cpp?ds=sidebyside diff --git a/src/mac/listbox.cpp b/src/mac/listbox.cpp index 19b16e5fe7..c518ad035c 100644 --- a/src/mac/listbox.cpp +++ b/src/mac/listbox.cpp @@ -21,13 +21,11 @@ #include "wx/utils.h" #include "extldef.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) BEGIN_EVENT_TABLE(wxListBox, wxControl) EVT_SIZE( wxListBox::OnSize ) END_EVENT_TABLE() -#endif #include @@ -70,8 +68,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ; NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ; - (**m_macList).selFlags = lOnlyOne ; - if ( style & wxLB_MULTIPLE ) + (**m_macList).selFlags = 0 ; + if ( style & wxLB_MULTIPLE ) { (**m_macList).selFlags += lNoExtend ; } @@ -79,6 +77,10 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, { (**m_macList).selFlags += lExtendDrag ; } + else + { + (**m_macList).selFlags = lOnlyOne ; + } Point pt = (**m_macList).cellSize ; pt.v = 14 ; LCellSize( pt , m_macList ) ; @@ -153,6 +155,7 @@ void wxListBox::Delete(int N) } #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN m_stringArray.Remove( N ) ; + m_dataArray.Remove( N ) ; m_noItems --; MacDelete( N ) ; @@ -187,7 +190,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) wxASSERT_MSG(clientData[i] == NULL, wxT("Can't use client data with owner-drawn listboxes")); #else // !wxUSE_OWNER_DRAWN - Append( choices[i] , clientData[0] ) ; + Append( choices[i] , clientData[i] ) ; #endif } else @@ -300,7 +303,16 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data) wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes")); } #endif // wxUSE_OWNER_DRAWN - m_dataArray[N] = (char*) Client_data ; + wxASSERT_MSG( m_dataArray.GetCount() >= N , "invalid client_data array" ) ; + + if ( m_dataArray.GetCount() > N ) + { + m_dataArray[N] = (char*) Client_data ; + } + else + { + m_dataArray.Add( (char*) Client_data ) ; + } } void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) @@ -371,7 +383,7 @@ void wxListBox::SetString(int N, const wxString& s) MacSet( N , s ) ; } -wxSize wxListBox::DoGetBestSize() +wxSize wxListBox::DoGetBestSize() const { return wxSize(100, 100); }