2006-03-20 11:37:24 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/generic/dataview.h
|
|
|
|
// Purpose: wxDataViewCtrl generic implementation header
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GENERICDATAVIEWCTRLH__
|
|
|
|
#define __GENERICDATAVIEWCTRLH__
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/list.h"
|
|
|
|
#include "wx/control.h"
|
2006-03-20 11:41:41 -05:00
|
|
|
#include "wx/scrolwin.h"
|
2006-09-30 17:21:19 -04:00
|
|
|
#include "wx/icon.h"
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
// classes
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewCtrl;
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewMainWindow;
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewHeaderWindow;
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
// wxDataViewCell
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewCell: public wxDataViewCellBase
|
2006-03-20 11:37:24 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxDataViewCell();
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-03-22 05:01:57 -05:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
|
|
|
|
virtual wxSize GetSize() = 0;
|
2006-03-27 09:01:33 -05:00
|
|
|
|
|
|
|
virtual bool Activate( wxRect WXUNUSED(cell),
|
|
|
|
wxDataViewListModel *WXUNUSED(model),
|
2006-10-03 07:09:06 -04:00
|
|
|
unsigned int WXUNUSED(col),
|
|
|
|
unsigned int WXUNUSED(row) )
|
2006-03-22 05:01:57 -05:00
|
|
|
{ return false; }
|
2006-03-27 09:01:33 -05:00
|
|
|
|
|
|
|
virtual bool LeftClick( wxPoint WXUNUSED(cursor),
|
|
|
|
wxRect WXUNUSED(cell),
|
|
|
|
wxDataViewListModel *WXUNUSED(model),
|
2006-10-03 07:09:06 -04:00
|
|
|
unsigned int WXUNUSED(col),
|
|
|
|
unsigned int WXUNUSED(row) )
|
2006-03-27 09:01:33 -05:00
|
|
|
{ return false; }
|
|
|
|
virtual bool RightClick( wxPoint WXUNUSED(cursor),
|
|
|
|
wxRect WXUNUSED(cell),
|
|
|
|
wxDataViewListModel *WXUNUSED(model),
|
2006-10-03 07:09:06 -04:00
|
|
|
unsigned int WXUNUSED(col),
|
|
|
|
unsigned int WXUNUSED(row) )
|
2006-03-27 09:01:33 -05:00
|
|
|
{ return false; }
|
|
|
|
virtual bool StartDrag( wxPoint WXUNUSED(cursor),
|
|
|
|
wxRect WXUNUSED(cell),
|
|
|
|
wxDataViewListModel *WXUNUSED(model),
|
2006-10-03 07:09:06 -04:00
|
|
|
unsigned int WXUNUSED(col),
|
|
|
|
unsigned int WXUNUSED(row) )
|
2006-03-27 09:01:33 -05:00
|
|
|
{ return false; }
|
|
|
|
|
2006-03-22 05:01:57 -05:00
|
|
|
// Create DC on request
|
|
|
|
virtual wxDC *GetDC();
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-22 05:01:57 -05:00
|
|
|
private:
|
|
|
|
wxDC *m_dc;
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
protected:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
|
|
|
|
};
|
2006-03-27 09:01:33 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-03-22 05:01:57 -05:00
|
|
|
// wxDataViewCustomCell
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewCustomCell: public wxDataViewCell
|
2006-03-20 11:37:24 -05:00
|
|
|
{
|
|
|
|
public:
|
2006-03-27 09:01:33 -05:00
|
|
|
wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
|
2006-03-22 05:01:57 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
protected:
|
2006-03-22 05:01:57 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
|
2006-03-20 11:37:24 -05:00
|
|
|
};
|
2006-03-27 09:01:33 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-03-22 05:01:57 -05:00
|
|
|
// wxDataViewTextCell
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewTextCell: public wxDataViewCustomCell
|
2006-03-20 11:37:24 -05:00
|
|
|
{
|
|
|
|
public:
|
2006-03-27 09:01:33 -05:00
|
|
|
wxDataViewTextCell( const wxString &varianttype = wxT("string"),
|
2006-03-20 11:37:24 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
|
|
|
|
|
|
|
bool SetValue( const wxVariant &value );
|
|
|
|
bool GetValue( wxVariant &value );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-22 05:01:57 -05:00
|
|
|
bool Render( wxRect cell, wxDC *dc, int state );
|
|
|
|
wxSize GetSize();
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-23 06:02:20 -05:00
|
|
|
private:
|
|
|
|
wxString m_text;
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
protected:
|
2006-03-22 05:01:57 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
|
2006-03-20 11:37:24 -05:00
|
|
|
};
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-09-30 17:21:19 -04:00
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewBitmapCell
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewBitmapCell: public wxDataViewCustomCell
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxDataViewBitmapCell( const wxString &varianttype = wxT("wxBitmap"),
|
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
|
|
|
|
|
|
|
bool SetValue( const wxVariant &value );
|
|
|
|
bool GetValue( wxVariant &value );
|
|
|
|
|
|
|
|
bool Render( wxRect cell, wxDC *dc, int state );
|
|
|
|
wxSize GetSize();
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxIcon m_icon;
|
|
|
|
wxBitmap m_bitmap;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapCell)
|
|
|
|
};
|
|
|
|
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-22 05:01:57 -05:00
|
|
|
// wxDataViewToggleCell
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewToggleCell: public wxDataViewCustomCell
|
2006-03-20 11:37:24 -05:00
|
|
|
{
|
|
|
|
public:
|
2006-03-27 09:01:33 -05:00
|
|
|
wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
|
2006-03-22 05:01:57 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
|
|
|
|
|
|
|
bool SetValue( const wxVariant &value );
|
|
|
|
bool GetValue( wxVariant &value );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-22 05:01:57 -05:00
|
|
|
bool Render( wxRect cell, wxDC *dc, int state );
|
2006-10-03 07:09:06 -04:00
|
|
|
bool Activate( wxRect cell, wxDataViewListModel *model, unsigned int col, unsigned int row );
|
2006-03-22 05:01:57 -05:00
|
|
|
wxSize GetSize();
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-23 06:02:20 -05:00
|
|
|
private:
|
|
|
|
bool m_toggle;
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
protected:
|
2006-03-22 05:01:57 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
|
2006-03-20 11:37:24 -05:00
|
|
|
};
|
2006-03-27 09:01:33 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
// wxDataViewProgressCell
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewProgressCell: public wxDataViewCustomCell
|
2006-03-20 11:37:24 -05:00
|
|
|
{
|
|
|
|
public:
|
2006-03-27 09:01:33 -05:00
|
|
|
wxDataViewProgressCell( const wxString &label = wxEmptyString,
|
|
|
|
const wxString &varianttype = wxT("long"),
|
2006-03-20 11:37:24 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxDataViewProgressCell();
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
bool SetValue( const wxVariant &value );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
|
|
|
virtual wxSize GetSize();
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
private:
|
|
|
|
wxString m_label;
|
|
|
|
int m_value;
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
protected:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell)
|
|
|
|
};
|
2006-03-27 09:01:33 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
// wxDataViewDateCell
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewDateCell: public wxDataViewCustomCell
|
2006-03-20 11:37:24 -05:00
|
|
|
{
|
|
|
|
public:
|
2006-03-27 09:01:33 -05:00
|
|
|
wxDataViewDateCell( const wxString &varianttype = wxT("datetime"),
|
2006-03-20 11:37:24 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
bool SetValue( const wxVariant &value );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
|
|
|
virtual wxSize GetSize();
|
|
|
|
virtual bool Activate( wxRect cell,
|
2006-10-03 07:09:06 -04:00
|
|
|
wxDataViewListModel *model, unsigned int col, unsigned int row );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
private:
|
|
|
|
wxDateTime m_date;
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
protected:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell)
|
|
|
|
};
|
2006-03-27 09:01:33 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
// wxDataViewColumn
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase
|
2006-03-20 11:37:24 -05:00
|
|
|
{
|
|
|
|
public:
|
2006-10-03 07:09:06 -04:00
|
|
|
wxDataViewColumn( const wxString &title, wxDataViewCell *cell, unsigned int model_column,
|
2006-10-01 17:09:56 -04:00
|
|
|
int width = 80, int flags = wxDATAVIEW_COL_RESIZABLE );
|
2006-03-20 11:37:24 -05:00
|
|
|
virtual ~wxDataViewColumn();
|
|
|
|
|
|
|
|
virtual void SetTitle( const wxString &title );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-04-18 19:14:36 -04:00
|
|
|
virtual int GetWidth();
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
private:
|
2006-04-18 19:14:36 -04:00
|
|
|
int m_width;
|
|
|
|
int m_fixedWidth;
|
2006-03-20 11:37:24 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
|
|
|
|
};
|
|
|
|
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
// wxDataViewCtrl
|
2006-03-27 09:01:33 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-03-20 11:37:24 -05:00
|
|
|
|
2006-05-17 21:22:06 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase,
|
2006-03-20 11:37:24 -05:00
|
|
|
public wxScrollHelperNative
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxDataViewCtrl() : wxScrollHelperNative(this)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
wxDataViewCtrl( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
2006-03-27 09:01:33 -05:00
|
|
|
const wxValidator& validator = wxDefaultValidator )
|
2006-03-21 07:30:06 -05:00
|
|
|
: wxScrollHelperNative(this)
|
2006-03-20 11:37:24 -05:00
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, style, validator );
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~wxDataViewCtrl();
|
|
|
|
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator );
|
|
|
|
|
|
|
|
virtual bool AssociateModel( wxDataViewListModel *model );
|
|
|
|
virtual bool AppendColumn( wxDataViewColumn *col );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-10-03 07:39:08 -04:00
|
|
|
virtual void SetSelection( int row ); // -1 for unselect
|
|
|
|
virtual void SetSelectionRange( unsigned int from, unsigned int to );
|
|
|
|
virtual void SetSelections( const wxArrayInt& aSelections);
|
|
|
|
|
|
|
|
virtual bool IsSelected( unsigned int row ) const;
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
private:
|
2006-03-21 07:30:06 -05:00
|
|
|
friend class wxDataViewMainWindow;
|
2006-03-22 05:01:57 -05:00
|
|
|
friend class wxDataViewHeaderWindow;
|
2006-03-20 11:37:24 -05:00
|
|
|
wxDataViewListModelNotifier *m_notifier;
|
2006-03-21 07:30:06 -05:00
|
|
|
wxDataViewMainWindow *m_clientArea;
|
|
|
|
wxDataViewHeaderWindow *m_headerArea;
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
private:
|
2006-03-21 07:30:06 -05:00
|
|
|
void OnSize( wxSizeEvent &event );
|
2006-03-27 09:01:33 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
// we need to return a special WM_GETDLGCODE value to process just the
|
|
|
|
// arrows but let the other navigation characters through
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
#endif // __WXMSW__
|
|
|
|
|
|
|
|
WX_FORWARD_TO_SCROLL_HELPER()
|
2006-03-21 07:30:06 -05:00
|
|
|
|
2006-03-20 11:37:24 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
|
|
|
|
DECLARE_NO_COPY_CLASS(wxDataViewCtrl)
|
2006-03-21 07:30:06 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2006-03-20 11:37:24 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // __GENERICDATAVIEWCTRLH__
|