X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7a21d83c54aac1ee558ba84b373c67f9a6545015..03bec791ddc73059a7627361ae74d1730ddca55d:/src/osx/listbox_osx.cpp diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index fc3251897f..f89fd924d0 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -88,7 +88,7 @@ bool wxListBox::Create( m_strings.unsorted = new wxArrayString; m_peer = wxWidgetImpl::CreateListBox( this, parent, id, pos, size, style, GetExtraStyle() ); - + MacPostControlCreate( pos, size ); m_textColumn = GetListPeer()->InsertTextColumn(0,wxEmptyString); @@ -108,8 +108,7 @@ wxListBox::~wxListBox() m_blockEvents = false; // make sure no native events get sent to a object in destruction - delete m_peer; - m_peer = NULL; + wxDELETE(m_peer); if ( IsSorted() ) delete m_strings.sorted; @@ -155,7 +154,7 @@ void wxListBox::DoDeleteOneItem(unsigned int n) GetListPeer()->ListDelete( n ); m_blockEvents = false; - + UpdateOldSelections(); } @@ -164,7 +163,7 @@ void wxListBox::DoClear() m_blockEvents = true; FreeData(); m_blockEvents = false; - + UpdateOldSelections(); } @@ -178,14 +177,14 @@ void wxListBox::DoSetSelection(int n, bool select) wxT("invalid index in wxListBox::SetSelection") ); m_blockEvents = true; - + if ( n == wxNOT_FOUND ) GetListPeer()->ListDeselectAll(); else GetListPeer()->ListSetSelection( n, select, HasMultipleSelection() ); - + m_blockEvents = false; - + UpdateOldSelections(); } @@ -208,6 +207,11 @@ int wxListBox::GetSelection() const return GetListPeer()->ListGetSelection(); } +int wxListBox::DoListHitTest(const wxPoint& inpoint) const +{ + return GetListPeer()->DoListHitTest( inpoint ); +} + // ---------------------------------------------------------------------------- // display // ---------------------------------------------------------------------------- @@ -225,7 +229,7 @@ void wxListBox::SetValueCallback( unsigned int WXUNUSED(n), wxListWidgetColumn* wxSize wxListBox::DoGetBestSize() const { int lbWidth = 100; // some defaults - int lbHeight = 110; + int lbHeight; int wLine; { @@ -275,7 +279,8 @@ wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ); attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ); - attr.font.CreateSystemFont(wxOSX_SYSTEM_FONT_VIEWS); + static wxFont font = wxFont(wxOSX_SYSTEM_FONT_VIEWS); + attr.font = font; return attr; } @@ -359,7 +364,7 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, void wxListBox::SetString(unsigned int n, const wxString& s) { - wxCHECK_RET( !IsSorted(), _T("can't set string in sorted listbox") ); + wxCHECK_RET( !IsSorted(), wxT("can't set string in sorted listbox") ); if ( IsSorted() ) (*m_strings.sorted)[n] = s; @@ -375,7 +380,7 @@ void wxListBox::SetString(unsigned int n, const wxString& s) void wxListBox::HandleLineEvent( unsigned int n, bool doubleClick ) { - wxCommandEvent event( doubleClick ? wxEVT_COMMAND_LISTBOX_DOUBLECLICKED : + wxCommandEvent event( doubleClick ? wxEVT_COMMAND_LISTBOX_DOUBLECLICKED : wxEVT_COMMAND_LISTBOX_SELECTED, GetId() ); event.SetEventObject( this ); if ( HasClientObjectData() ) @@ -388,4 +393,20 @@ void wxListBox::HandleLineEvent( unsigned int n, bool doubleClick ) HandleWindowEvent(event); } +// +// common list cell value operations +// + +void wxListWidgetCellValue::Check( bool check ) +{ + Set( check ? 1 : 0 ); +} + +bool wxListWidgetCellValue::IsChecked() const +{ + return GetIntValue() != 0; +} + + + #endif // wxUSE_LISTBOX