X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f58438058b1a0b0d5266c8ca6acafcbbfda27ed4..88ff049184c77fd73b60c01f4f831860d2ec5cef:/src/osx/listbox_osx.cpp diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index c8a037b899..c48607ea5a 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -1,10 +1,9 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/listbox.cpp +// Name: src/osx/listbox_osx.cpp // Purpose: wxListBox // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -24,8 +23,6 @@ #include "wx/dcclient.h" #endif -IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems) - BEGIN_EVENT_TABLE(wxListBox, wxControl) END_EVENT_TABLE() @@ -73,8 +70,11 @@ bool wxListBox::Create( const wxValidator& validator, const wxString& name ) { + DontCreatePeer(); m_blockEvents = false; - m_macIsUserPane = false; + + if ( ! (style & wxNO_BORDER) ) + style = (style & ~wxBORDER_MASK) | wxSUNKEN_BORDER ; wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED), wxT("only a single listbox selection mode can be specified") ); @@ -87,7 +87,7 @@ bool wxListBox::Create( else m_strings.unsorted = new wxArrayString; - m_peer = wxWidgetImpl::CreateListBox( this, parent, id, pos, size, style, GetExtraStyle() ); + SetPeer(wxWidgetImpl::CreateListBox( this, parent, id, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -108,7 +108,7 @@ wxListBox::~wxListBox() m_blockEvents = false; // make sure no native events get sent to a object in destruction - wxDELETE(m_peer); + SetPeer(NULL); if ( IsSorted() ) delete m_strings.sorted; @@ -132,6 +132,11 @@ void wxListBox::FreeData() void wxListBox::DoSetFirstItem(int n) { + // osx actually only has an implementation for ensuring the visibility of a row, it does so + // by scrolling the minimal amount necessary from the current scrolling position. + // in order to get the same behaviour I'd have to make sure first that the last line is visible, + // followed by a scrollRowToVisible for the desired line + GetListPeer()->ListScrollTo( GetCount()-1 ); GetListPeer()->ListScrollTo( n ); } @@ -329,7 +334,6 @@ int wxListBox::FindString(const wxString& s, bool bCase) const void wxListBox::OnItemInserted(unsigned int WXUNUSED(pos)) { - } int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, @@ -388,8 +392,8 @@ void wxListBox::SetString(unsigned int n, const wxString& s) void wxListBox::HandleLineEvent( unsigned int n, bool doubleClick ) { - wxCommandEvent event( doubleClick ? wxEVT_COMMAND_LISTBOX_DOUBLECLICKED : - wxEVT_COMMAND_LISTBOX_SELECTED, GetId() ); + wxCommandEvent event( doubleClick ? wxEVT_LISTBOX_DCLICK : + wxEVT_LISTBOX, GetId() ); event.SetEventObject( this ); if ( HasClientObjectData() ) event.SetClientObject( GetClientObject(n) );