X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fcb35beb942ced9d2552b5ab5b4fe0df8e6df93a..bcce8f754fb8576a75a125cf9def8beda927c524:/src/mac/carbon/listbox.cpp diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index fe39a0a19f..8322a7a2f2 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -72,16 +72,19 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect Cell cell, short dataOffset, short dataLength, ListHandle listHandle ) { + wxListBox* list; + list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) ); + if ( list == NULL ) + return ; + GrafPtr savePort; GrafPtr grafPtr; RgnHandle savedClipRegion; SInt32 savedPenMode; - wxListBox* list; GetPort(&savePort); SetPort((**listHandle).port); grafPtr = (**listHandle).port ; // typecast our refCon - list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) ); // Calculate the cell rect. @@ -123,7 +126,7 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect { Rect frame = { drawRect->top, drawRect->left + 4, drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ; - CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , wxMacCFStringHolder(linetext) ) ; + CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , wxMacCFStringHolder(linetext , list->GetFont().GetEncoding()) ) ; ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ; ::DrawThemeTextBox( mString, kThemeCurrentPortFont, @@ -193,6 +196,20 @@ wxListBox::wxListBox() static ListDefUPP macListDefUPP = NULL ; +bool wxListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -272,11 +289,11 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, OptionBits options = 0; if ( style & wxLB_MULTIPLE ) { - options += lNoExtend ; + options += lExtendDrag + lUseSense ; } else if ( style & wxLB_EXTENDED ) { - options += lExtendDrag ; + // default behaviour } else { @@ -299,6 +316,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, wxListBox::~wxListBox() { FreeData() ; + // avoid access during destruction + SetControlReference( (ControlHandle) m_macControl , NULL ) ; if ( m_macList ) { #if !TARGET_CARBON @@ -622,7 +641,7 @@ wxSize wxListBox::DoGetBestSize() const #if wxUSE_UNICODE Point bounds={0,0} ; SInt16 baseline ; - ::GetThemeTextDimensions( wxMacCFStringHolder( str ) , + ::GetThemeTextDimensions( wxMacCFStringHolder( str , m_font.GetEncoding() ) , kThemeCurrentPortFont, kThemeStateActive, false, @@ -809,7 +828,7 @@ void wxListBox::MacScrollTo( int n ) // TODO implement scrolling } -void wxListBox::OnSize( const wxSizeEvent &event) +void wxListBox::OnSize( wxSizeEvent &event) { Point pt;