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;
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_renderer)
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 wxDataViewTextRenderer( wxT("string"), mode ), model_column, width ) );
+}
+
+bool wxDataViewCtrlBase::AppendToggleColumn( const wxString &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 wxString &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 wxString &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 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 wxDataViewTextRenderer(), model_column ) );
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewToggleRenderer( wxT("bool"), mode ), model_column, width ) );
}
-bool wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column )
+bool wxDataViewCtrlBase::AppendProgressColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
{
- return AppendColumn( new wxDataViewColumn( label, new wxDataViewToggleRenderer(), model_column, 30 ) );
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), model_column, width ) );
}
-bool wxDataViewCtrlBase::AppendProgressColumn( const wxString &label, unsigned int model_column )
+bool wxDataViewCtrlBase::AppendDateColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
{
- return AppendColumn( new wxDataViewColumn( label, new wxDataViewProgressRenderer(), model_column, 70 ) );
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewDateRenderer( wxT("datetime"), mode ), model_column, width ) );
}
-bool wxDataViewCtrlBase::AppendDateColumn( const wxString &label, unsigned int model_column )
+bool wxDataViewCtrlBase::AppendBitmapColumn( const wxBitmap &label, unsigned int model_column,
+ wxDataViewCellMode mode, int width )
{
- return AppendColumn( new wxDataViewColumn( label, new wxDataViewDateRenderer(), model_column ) );
+ return AppendColumn( new wxDataViewColumn( label,
+ new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), model_column, width ) );
}
bool wxDataViewCtrlBase::AppendColumn( wxDataViewColumn *col )
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