backport of r61356

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_9_0_BRANCH@61359 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-07-09 16:21:13 +00:00
parent bd06c92d5a
commit ed84b3b0ab
5 changed files with 28 additions and 5 deletions

View File

@@ -859,9 +859,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 ;

View File

@@ -480,7 +480,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;
} ;

View File

@@ -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

View File

@@ -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 );

View File

@@ -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