return 0;
}
+int wxCALLBACK wxDataViewListModelSortedDefaultCompareDescending
+ (unsigned int row1, unsigned int row2, unsigned int col, wxDataViewListModel* model )
+{
+ return wxDataViewListModelSortedDefaultCompare( row2, row1, col, model );
+}
+
static wxDataViewListModelCompare s_CmpFunc;
static wxDataViewListModel *s_CmpModel;
-static unsigned int s_CmpCol;
+static unsigned int s_CmpCol;
int LINKAGEMODE wxDataViewIntermediateCmp( unsigned int row1, unsigned int row2 )
{
m_array( wxDataViewIntermediateCmp )
{
m_child = child;
- s_CmpCol = 0;
- s_CmpModel = child;
- s_CmpFunc = wxDataViewListModelSortedDefaultCompare;
+
+ m_ascending = true;
m_notifierOnChild = new wxDataViewSortedListModelNotifier( this );
m_child->AddNotifier( m_notifierOnChild );
m_child->RemoveNotifier( m_notifierOnChild );
}
+// FIXME
+void wxDataViewSortedListModel::InitStatics()
+{
+ s_CmpCol = 0;
+ s_CmpModel = m_child;
+ if (m_ascending)
+ s_CmpFunc = wxDataViewListModelSortedDefaultCompare;
+ else
+ s_CmpFunc = wxDataViewListModelSortedDefaultCompareDescending;
+}
+
void wxDataViewSortedListModel::Resort()
{
+ InitStatics();
+
m_array.Clear();
unsigned int n = m_child->GetNumberOfRows();
unsigned int i;
}
// ---------------------------------------------------------
-// wxDataViewCellBase
+// wxDataViewRendererBase
// ---------------------------------------------------------
-IMPLEMENT_ABSTRACT_CLASS(wxDataViewCellBase, wxObject)
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewRendererBase, wxObject)
-wxDataViewCellBase::wxDataViewCellBase( const wxString &varianttype, wxDataViewCellMode mode )
+wxDataViewRendererBase::wxDataViewRendererBase( const wxString &varianttype, wxDataViewCellMode mode )
{
m_variantType = varianttype;
m_mode = mode;
IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumnBase, wxObject)
wxDataViewColumnBase::wxDataViewColumnBase(const wxString& title,
- wxDataViewCell *cell,
+ wxDataViewRenderer *renderer,
unsigned int model_column,
int WXUNUSED(width),
int flags )
{
- m_cell = cell;
+ m_renderer = renderer;
m_model_column = model_column;
m_flags = flags;
m_title = title;
m_owner = NULL;
- m_cell->SetOwner( (wxDataViewColumn*) this );
+ m_renderer->SetOwner( (wxDataViewColumn*) this );
+}
+
+wxDataViewColumnBase::wxDataViewColumnBase(const wxBitmap& bitmap,
+ wxDataViewRenderer *renderer,
+ unsigned int model_column,
+ int WXUNUSED(width),
+ int flags )
+{
+ m_renderer = renderer;
+ m_model_column = model_column;
+ m_flags = flags;
+ m_bitmap = bitmap;
+ m_owner = NULL;
+ m_renderer->SetOwner( (wxDataViewColumn*) this );
}
wxDataViewColumnBase::~wxDataViewColumnBase()
{
- if (m_cell)
- delete m_cell;
+ if (m_renderer)
+ delete m_renderer;
if (GetOwner())
{
return m_title;
}
+void wxDataViewColumnBase::SetBitmap( const wxBitmap &bitmap )
+{
+ m_bitmap = bitmap;
+}
+
+const wxBitmap &wxDataViewColumnBase::GetBitmap()
+{
+ return m_bitmap;
+}
+
// ---------------------------------------------------------
// wxDataViewCtrlBase
// ---------------------------------------------------------
return m_model;
}
-bool wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column )
+bool wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
{
- return AppendColumn( new wxDataViewColumn( label, new wxDataViewTextCell(), model_column ) );
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewTextRenderer( wxT("string"), mode ), model_column, width ) );
}
-bool wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column )
+bool wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
{
- return AppendColumn( new wxDataViewColumn( label, new wxDataViewToggleCell(), model_column, 30 ) );
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewToggleRenderer( wxT("bool"), mode ), model_column, width ) );
}
-bool wxDataViewCtrlBase::AppendProgressColumn( const wxString &label, unsigned int model_column )
+bool wxDataViewCtrlBase::AppendProgressColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
{
- return AppendColumn( new wxDataViewColumn( label, new wxDataViewProgressCell(), model_column, 70 ) );
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), model_column, width ) );
}
-bool wxDataViewCtrlBase::AppendDateColumn( const wxString &label, unsigned int model_column )
+bool wxDataViewCtrlBase::AppendDateColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
{
- return AppendColumn( new wxDataViewColumn( label, new wxDataViewDateCell(), model_column ) );
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewDateRenderer( wxT("datetime"), mode), model_column, width ) );
+}
+
+bool wxDataViewCtrlBase::AppendBitmapColumn( const wxString &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
+{
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), model_column, width ) );
+}
+
+bool wxDataViewCtrlBase::AppendTextColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
+{
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewTextRenderer( wxT("string"), mode ), model_column, width ) );
+}
+
+bool wxDataViewCtrlBase::AppendToggleColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
+{
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewToggleRenderer( wxT("bool"), mode ), model_column, width ) );
+}
+
+bool wxDataViewCtrlBase::AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
+{
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), model_column, width ) );
+}
+
+bool wxDataViewCtrlBase::AppendDateColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
+{
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewDateRenderer( wxT("datetime"), mode ), model_column, width ) );
+}
+
+bool wxDataViewCtrlBase::AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
+{
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), model_column, width ) );
}
bool wxDataViewCtrlBase::AppendColumn( wxDataViewColumn *col )
return (wxDataViewColumn*) m_cols[ pos ];
}
+// ---------------------------------------------------------
+// wxDataViewEvent
+// ---------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxDataViewEvent,wxNotifyEvent)
+
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ROW_SELECTED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_ROW_ACTIVATED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK)
+
+
#endif