From: Stefan Csomor Date: Thu, 9 Jul 2009 14:47:51 +0000 (+0000) Subject: adding special case for Carbon DataBrowser Checkbox X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/60ebcb8a491cf5132a326490cd148dcba384f729 adding special case for Carbon DataBrowser Checkbox git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61356 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/osx/carbon/private.h b/include/wx/osx/carbon/private.h index d8dc822342..19fafff74f 100644 --- a/include/wx/osx/carbon/private.h +++ b/include/wx/osx/carbon/private.h @@ -845,9 +845,10 @@ public : wxMacDataBrowserCellValue(DataBrowserItemDataRef data) : m_data(data) {} virtual ~wxMacDataBrowserCellValue() {} - virtual void Set( CFStringRef value ); + virtual void Set( CFStringRef value ); virtual void Set( const wxString& value ); virtual void Set( int value ) ; + virtual void Check( bool check ); virtual int GetIntValue() const ; virtual wxString GetStringValue() const ; diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index 41ffd3cbdb..0c3a9fb3ec 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -482,7 +482,9 @@ public : virtual void Set( CFStringRef value ) = 0; virtual void Set( const wxString& value ) = 0; virtual void Set( int value ) = 0; + virtual void Check( bool check ); + virtual bool IsChecked() const; virtual int GetIntValue() const = 0; virtual wxString GetStringValue() const = 0; } ; diff --git a/src/osx/carbon/listbox.cpp b/src/osx/carbon/listbox.cpp index e9d0776b22..f688c91dd1 100644 --- a/src/osx/carbon/listbox.cpp +++ b/src/osx/carbon/listbox.cpp @@ -608,9 +608,13 @@ void wxMacDataBrowserCellValue::Set( const wxString& value ) } void wxMacDataBrowserCellValue::Set( int value ) -{ +{ SetDataBrowserItemDataValue( m_data, value ); - // SetDataBrowserItemDataButtonValue( m_data, value ? kThemeButtonOn : kThemeButtonOff); +} + +void wxMacDataBrowserCellValue::Check( bool check ) +{ + SetDataBrowserItemDataButtonValue( m_data, check ? kThemeButtonOn : kThemeButtonOff); } int wxMacDataBrowserCellValue::GetIntValue() const diff --git a/src/osx/checklst_osx.cpp b/src/osx/checklst_osx.cpp index 1c3a1d5815..c177a21b72 100644 --- a/src/osx/checklst_osx.cpp +++ b/src/osx/checklst_osx.cpp @@ -108,7 +108,7 @@ void wxCheckListBox::Check(unsigned int n, bool check) void wxCheckListBox::GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ) { if ( col == m_checkColumn ) - value.Set( IsChecked( n ) ); + value.Check( IsChecked( n ) ); else wxListBox::GetValueCallback( n, col, value ); } @@ -117,7 +117,7 @@ void wxCheckListBox::SetValueCallback( unsigned int n, wxListWidgetColumn* col , { if ( col == m_checkColumn ) { - Check( n, value.GetIntValue() != 0 ); + Check( n, value.IsChecked() ); wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId() ); event.SetInt( n ); diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index fc3251897f..1c3e28a5bf 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -388,4 +388,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