#if wxUSE_CHECKLISTBOX
#include "wx/checklst.h"
-#include "wx/arrstr.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/arrstr.h"
+#endif
#include "wx/mac/uma.h"
{
public:
wxMacDataBrowserCheckListControl( wxListBox *peer, const wxPoint& pos, const wxSize& size, long style );
- ~wxMacDataBrowserCheckListControl();
+ wxMacDataBrowserCheckListControl() {}
+ virtual ~wxMacDataBrowserCheckListControl();
+
+ virtual wxMacDataItem* CreateItem();
- virtual wxMacListBoxItem* CreateItem();
-
virtual bool MacIsChecked(unsigned int n) const;
virtual void MacCheck(unsigned int n, bool bCheck = true);
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserCheckListControl)
};
+IMPLEMENT_DYNAMIC_CLASS( wxMacDataBrowserCheckListControl , wxMacDataBrowserListControl )
+
void wxCheckListBox::Init()
{
}
// this will be increased by our Append command
wxMacDataBrowserCheckListControl* control = new wxMacDataBrowserCheckListControl( this, pos, size, style );
- control->SetClientDataType( m_clientDataItemsType );
m_peer = control;
MacPostControlCreate(pos,size);
- InsertItems( n , choices , 0 );
+ InsertItems( n , choices , 0 );
// Needed because it is a wxControlWithItems
- SetBestSize( size );
+ SetInitialSize( size );
return true;
}
}
}
-wxMacCheckListControl* wxCheckListBox::GetPeer() const
-{
- return dynamic_cast<wxMacCheckListControl*>(m_peer);
+wxMacCheckListControl* wxCheckListBox::GetPeer() const
+{
+ wxMacDataBrowserCheckListControl *lb = wxDynamicCast(m_peer,wxMacDataBrowserCheckListControl);
+ return lb ? wx_static_cast(wxMacCheckListControl*,lb) : 0 ;
}
const short kCheckboxColumnId = 1026;
kDataBrowserPropertyIsMutable
| kDataBrowserTableViewSelectionColumn
| kDataBrowserDefaultPropertyFlags;
-
+
err = AddColumn( &columnDesc, 0 );
verify_noerr( err );
}
wxMacDataBrowserCheckListControl::~wxMacDataBrowserCheckListControl()
{
-
+
}
class wxMacCheckListBoxItem : public wxMacListBoxItem
{
m_isChecked = false;
}
-
- ~wxMacCheckListBoxItem()
+
+ virtual ~wxMacCheckListBoxItem()
{
}
-
+
virtual OSStatus GetSetData( wxMacDataItemBrowserControl *owner ,
DataBrowserPropertyID property,
DataBrowserItemDataRef itemData,
- bool changeValue )
+ bool changeValue )
{
OSStatus err = errDataBrowserPropertyNotSupported;
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, checklist->GetId() );
event.SetInt( owner->GetLineFromItem( this ) );
event.SetEventObject( checklist );
- checklist->GetEventHandler()->ProcessEvent( event );
+ checklist->GetEventHandler()->ProcessEvent( event );
}
break;
return err;
}
- void Check( bool check )
+ void Check( bool check )
{
m_isChecked = check;
}
- bool IsChecked() const
+ bool IsChecked() const
{
- return m_isChecked;
+ return m_isChecked;
}
protected :
bool m_isChecked;
};
-wxMacListBoxItem* wxMacDataBrowserCheckListControl::CreateItem()
+wxMacDataItem* wxMacDataBrowserCheckListControl::CreateItem()
{
return new wxMacCheckListBoxItem();
}
-void wxMacDataBrowserCheckListControl::MacCheck( unsigned int n, bool bCheck)
+void wxMacDataBrowserCheckListControl::MacCheck( unsigned int n, bool bCheck)
{
- wxMacCheckListBoxItem* item = dynamic_cast<wxMacCheckListBoxItem*>( GetItemFromLine( n) );
+ wxMacCheckListBoxItem* item = wx_static_cast(wxMacCheckListBoxItem*, GetItemFromLine( n) );
item->Check( bCheck);
UpdateItem(wxMacDataBrowserRootContainer, item , kCheckboxColumnId);
}
-bool wxMacDataBrowserCheckListControl::MacIsChecked( unsigned int n) const
+bool wxMacDataBrowserCheckListControl::MacIsChecked( unsigned int n) const
{
- wxMacCheckListBoxItem * item = dynamic_cast<wxMacCheckListBoxItem*>( GetItemFromLine( n ) );
- return item->IsChecked();
+ wxMacCheckListBoxItem * item = wx_static_cast( wxMacCheckListBoxItem*, GetItemFromLine( n ) );
+ return item->IsChecked();
}