2006-02-21 12:35:19 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/gtk/dataview.h
|
|
|
|
// Purpose: wxDataViewCtrl GTK+2 implementation header
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-12-20 01:08:00 -05:00
|
|
|
#ifndef _WX_GTKDATAVIEWCTRL_H_
|
|
|
|
#define _WX_GTKDATAVIEWCTRL_H_
|
2006-02-21 12:35:19 -05:00
|
|
|
|
|
|
|
#include "wx/list.h"
|
|
|
|
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-21 12:35:19 -05:00
|
|
|
// classes
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-21 12:35:19 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl;
|
|
|
|
class WXDLLIMPEXP_FWD_ADV wxDataViewCtrlInternal;
|
2006-02-21 12:35:19 -05:00
|
|
|
|
2007-02-17 07:32:38 -05:00
|
|
|
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-10-03 11:24:03 -04:00
|
|
|
// wxDataViewRenderer
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-22 21:04:46 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
|
2006-02-22 21:04:46 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewRenderer( const wxString &varianttype,
|
2007-02-23 02:57:46 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
2006-02-22 21:04:46 -05:00
|
|
|
|
2007-02-23 02:57:46 -05:00
|
|
|
virtual void SetMode( wxDataViewCellMode mode );
|
|
|
|
virtual wxDataViewCellMode GetMode() const;
|
|
|
|
|
|
|
|
virtual void SetAlignment( int align );
|
|
|
|
virtual int GetAlignment() const;
|
2006-02-22 21:04:46 -05:00
|
|
|
|
2007-08-25 17:05:51 -04:00
|
|
|
// implementation
|
|
|
|
GtkCellRenderer* GetGtkHandle() { return m_renderer; }
|
|
|
|
void GtkInitHandlers();
|
2007-11-08 17:51:58 -05:00
|
|
|
virtual bool GtkHasAttributes() { return false; }
|
2008-04-08 06:39:57 -04:00
|
|
|
void GtkUpdateAlignment();
|
2007-08-25 17:05:51 -04:00
|
|
|
|
2006-02-22 21:04:46 -05:00
|
|
|
protected:
|
2007-05-09 06:38:15 -04:00
|
|
|
GtkCellRenderer *m_renderer;
|
2008-04-08 06:39:57 -04:00
|
|
|
int m_alignment;
|
2006-02-22 21:04:46 -05:00
|
|
|
|
|
|
|
protected:
|
2006-10-03 11:24:03 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
|
2006-02-22 21:04:46 -05:00
|
|
|
};
|
2007-02-23 02:57:46 -05:00
|
|
|
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-10-03 11:24:03 -04:00
|
|
|
// wxDataViewTextRenderer
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-22 21:04:46 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
|
2006-02-22 21:04:46 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewTextRenderer( const wxString &varianttype = wxT("string"),
|
2007-02-23 02:57:46 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
2006-02-22 21:04:46 -05:00
|
|
|
|
2006-02-22 22:04:15 -05:00
|
|
|
bool SetValue( const wxVariant &value );
|
2007-02-23 02:57:46 -05:00
|
|
|
bool GetValue( wxVariant &value ) const;
|
|
|
|
|
|
|
|
void SetAlignment( int align );
|
|
|
|
|
2006-02-22 21:04:46 -05:00
|
|
|
protected:
|
2006-10-03 11:24:03 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
|
2006-02-22 21:04:46 -05:00
|
|
|
};
|
2008-12-07 09:19:18 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2007-11-08 17:51:58 -05:00
|
|
|
// wxDataViewTextRendererAttr
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2007-11-08 17:51:58 -05:00
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewTextRendererAttr: public wxDataViewTextRenderer
|
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewTextRendererAttr( const wxString &varianttype = wxT("string"),
|
2007-11-08 17:51:58 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
|
|
|
|
// implementation
|
|
|
|
bool GtkHasAttributes() { return true; }
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-11-08 17:51:58 -05:00
|
|
|
protected:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRendererAttr)
|
|
|
|
};
|
2008-12-07 09:19:18 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-10-03 11:24:03 -04:00
|
|
|
// wxDataViewBitmapRenderer
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-09-26 18:17:00 -04:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
|
2006-09-26 18:17:00 -04:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"),
|
2007-02-23 02:57:46 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
2006-09-26 18:17:00 -04:00
|
|
|
|
|
|
|
bool SetValue( const wxVariant &value );
|
2007-02-23 02:57:46 -05:00
|
|
|
bool GetValue( wxVariant &value ) const;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-09-26 18:17:00 -04:00
|
|
|
protected:
|
2006-10-03 11:24:03 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
|
2006-09-26 18:17:00 -04:00
|
|
|
};
|
2008-12-07 09:19:18 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-10-03 11:24:03 -04:00
|
|
|
// wxDataViewToggleRenderer
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-24 08:19:23 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
|
2006-02-24 08:19:23 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"),
|
2007-02-23 02:57:46 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
2006-02-24 08:19:23 -05:00
|
|
|
|
|
|
|
bool SetValue( const wxVariant &value );
|
2007-02-23 02:57:46 -05:00
|
|
|
bool GetValue( wxVariant &value ) const;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-24 08:19:23 -05:00
|
|
|
protected:
|
2006-10-03 11:24:03 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
|
2006-02-24 08:19:23 -05:00
|
|
|
};
|
2008-12-07 09:19:18 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-10-03 11:24:03 -04:00
|
|
|
// wxDataViewCustomRenderer
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-24 13:19:55 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
|
2006-02-24 13:19:55 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"),
|
2006-10-03 11:24:03 -04:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
2007-02-23 02:57:46 -05:00
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT,
|
2006-10-03 11:24:03 -04:00
|
|
|
bool no_init = false );
|
|
|
|
virtual ~wxDataViewCustomRenderer();
|
2007-02-23 02:57:46 -05:00
|
|
|
|
|
|
|
|
2006-02-24 13:19:55 -05:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-10-20 16:09:10 -04:00
|
|
|
void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state );
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-02-23 02:57:46 -05:00
|
|
|
virtual wxSize GetSize() const = 0;
|
|
|
|
|
2007-11-15 15:11:30 -05:00
|
|
|
virtual bool Activate( wxRect WXUNUSED(cell),
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
|
2006-02-26 10:48:42 -05:00
|
|
|
{ return false; }
|
2007-02-23 02:57:46 -05:00
|
|
|
|
2008-12-07 09:19:18 -05:00
|
|
|
virtual bool LeftClick( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell),
|
|
|
|
wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
|
2006-02-26 10:48:42 -05:00
|
|
|
{ return false; }
|
2008-12-07 09:19:18 -05:00
|
|
|
virtual bool StartDrag( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell),
|
|
|
|
wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
|
2006-02-26 10:48:42 -05:00
|
|
|
{ return false; }
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-24 13:19:55 -05:00
|
|
|
// Create DC on request
|
|
|
|
virtual wxDC *GetDC();
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-02-23 02:57:46 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool Init(wxDataViewCellMode mode, int align);
|
|
|
|
|
2006-02-24 13:19:55 -05:00
|
|
|
private:
|
|
|
|
wxDC *m_dc;
|
2007-10-22 07:26:04 -04:00
|
|
|
|
2008-12-07 09:19:18 -05:00
|
|
|
public:
|
2007-10-22 07:26:04 -04:00
|
|
|
// Internal, temporay for RenderText.
|
|
|
|
GtkCellRenderer *m_text_renderer;
|
|
|
|
GdkWindow *window;
|
|
|
|
GtkWidget *widget;
|
|
|
|
void *background_area;
|
|
|
|
void *cell_area;
|
|
|
|
void *expose_area;
|
|
|
|
int flags;
|
|
|
|
|
2006-02-24 13:19:55 -05:00
|
|
|
protected:
|
2006-10-03 11:24:03 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
|
2006-02-24 13:19:55 -05:00
|
|
|
};
|
2008-12-07 09:19:18 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-10-03 11:24:03 -04:00
|
|
|
// wxDataViewProgressRenderer
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-25 08:13:05 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer
|
2006-02-25 08:13:05 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
|
|
|
|
const wxString &varianttype = wxT("long"),
|
2007-02-23 02:57:46 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
2006-10-03 11:24:03 -04:00
|
|
|
virtual ~wxDataViewProgressRenderer();
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-25 08:13:05 -05:00
|
|
|
bool SetValue( const wxVariant &value );
|
2007-02-23 02:57:46 -05:00
|
|
|
bool GetValue( wxVariant &value ) const;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-25 08:13:05 -05:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
2007-02-23 02:57:46 -05:00
|
|
|
virtual wxSize GetSize() const;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-25 08:13:05 -05:00
|
|
|
private:
|
|
|
|
wxString m_label;
|
|
|
|
int m_value;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-25 08:13:05 -05:00
|
|
|
protected:
|
2006-10-03 11:24:03 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
|
2006-02-25 08:13:05 -05:00
|
|
|
};
|
2008-12-07 09:19:18 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2007-08-29 07:48:12 -04:00
|
|
|
// wxDataViewIconTextRenderer
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2007-08-29 07:48:12 -04:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewCustomRenderer
|
2007-08-29 07:48:12 -04:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
|
2007-08-29 07:48:12 -04:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
virtual ~wxDataViewIconTextRenderer();
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-08-29 07:48:12 -04:00
|
|
|
bool SetValue( const wxVariant &value );
|
|
|
|
bool GetValue( wxVariant &value ) const;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-08-29 07:48:12 -04:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
|
|
|
virtual wxSize GetSize() const;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2009-03-06 14:07:40 -05:00
|
|
|
virtual bool HasEditorCtrl() const { return true; }
|
2007-08-29 07:48:12 -04:00
|
|
|
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
|
|
|
|
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-08-29 07:48:12 -04:00
|
|
|
private:
|
|
|
|
wxDataViewIconText m_value;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-08-29 07:48:12 -04:00
|
|
|
protected:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
|
|
|
|
};
|
2008-12-07 09:19:18 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
2006-10-03 11:24:03 -04:00
|
|
|
// wxDataViewDateRenderer
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-26 10:48:42 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer
|
2006-02-26 10:48:42 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"),
|
2007-02-23 02:57:46 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-26 10:48:42 -05:00
|
|
|
bool SetValue( const wxVariant &value );
|
2007-02-23 02:57:46 -05:00
|
|
|
bool GetValue( wxVariant &value ) const;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-26 10:48:42 -05:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
2007-02-23 02:57:46 -05:00
|
|
|
virtual wxSize GetSize() const;
|
2006-02-26 10:48:42 -05:00
|
|
|
virtual bool Activate( wxRect cell,
|
2007-07-04 20:13:28 -04:00
|
|
|
wxDataViewModel *model, const wxDataViewItem &item, unsigned int col );
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-26 10:48:42 -05:00
|
|
|
private:
|
|
|
|
wxDateTime m_date;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-26 10:48:42 -05:00
|
|
|
protected:
|
2006-10-03 11:24:03 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
|
2006-02-26 10:48:42 -05:00
|
|
|
};
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2008-11-10 09:08:38 -05:00
|
|
|
// -------------------------------------
|
|
|
|
// wxDataViewChoiceRenderer
|
|
|
|
// -------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxDataViewChoiceRenderer( const wxArrayString &choices,
|
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
|
|
|
|
int alignment = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
virtual bool Render( wxRect rect, wxDC *dc, int state );
|
|
|
|
virtual wxSize GetSize() const;
|
|
|
|
virtual bool SetValue( const wxVariant &value );
|
|
|
|
virtual bool GetValue( wxVariant &value ) const;
|
|
|
|
|
|
|
|
void SetAlignment( int align );
|
|
|
|
private:
|
|
|
|
wxArrayString m_choices;
|
|
|
|
wxString m_data;
|
|
|
|
};
|
|
|
|
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-21 19:19:04 -05:00
|
|
|
// wxDataViewColumn
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-21 19:19:04 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase
|
2006-02-21 19:19:04 -05:00
|
|
|
{
|
|
|
|
public:
|
2007-02-17 07:32:38 -05:00
|
|
|
wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer,
|
|
|
|
unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
|
|
|
|
wxAlignment align = wxALIGN_CENTER,
|
|
|
|
int flags = wxDATAVIEW_COL_RESIZABLE );
|
|
|
|
wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *renderer,
|
|
|
|
unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
|
|
|
|
wxAlignment align = wxALIGN_CENTER,
|
|
|
|
int flags = wxDATAVIEW_COL_RESIZABLE );
|
|
|
|
|
2007-02-23 02:57:46 -05:00
|
|
|
|
|
|
|
// setters:
|
|
|
|
|
2006-02-21 19:19:04 -05:00
|
|
|
virtual void SetTitle( const wxString &title );
|
2006-10-05 15:06:21 -04:00
|
|
|
virtual void SetBitmap( const wxBitmap &bitmap );
|
2006-10-05 15:35:23 -04:00
|
|
|
|
2006-11-01 10:24:48 -05:00
|
|
|
virtual void SetOwner( wxDataViewCtrl *owner );
|
|
|
|
|
2006-10-05 15:35:23 -04:00
|
|
|
virtual void SetAlignment( wxAlignment align );
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-10-06 05:50:45 -04:00
|
|
|
virtual void SetSortable( bool sortable );
|
2006-10-05 15:35:23 -04:00
|
|
|
virtual void SetSortOrder( bool ascending );
|
2008-12-07 09:47:55 -05:00
|
|
|
virtual void SetAsSortKey(bool sort = true);
|
2006-10-05 15:35:23 -04:00
|
|
|
|
2007-02-23 02:57:46 -05:00
|
|
|
virtual void SetResizeable( bool resizeable );
|
|
|
|
virtual void SetHidden( bool hidden );
|
|
|
|
|
|
|
|
virtual void SetMinWidth( int minWidth );
|
|
|
|
virtual void SetWidth( int width );
|
|
|
|
|
2007-12-26 13:30:56 -05:00
|
|
|
virtual void SetReorderable( bool reorderable );
|
2007-02-23 02:57:46 -05:00
|
|
|
|
2008-12-03 16:53:10 -05:00
|
|
|
virtual void SetFlags(int flags) { SetIndividualFlags(flags); }
|
|
|
|
|
2007-02-23 02:57:46 -05:00
|
|
|
// getters:
|
|
|
|
|
|
|
|
virtual wxString GetTitle() const;
|
|
|
|
virtual wxAlignment GetAlignment() const;
|
|
|
|
|
2007-02-17 07:32:38 -05:00
|
|
|
virtual bool IsSortable() const;
|
|
|
|
virtual bool IsSortOrderAscending() const;
|
2008-12-07 11:04:48 -05:00
|
|
|
virtual bool IsSortKey() const;
|
2008-12-07 09:47:55 -05:00
|
|
|
|
2007-02-23 02:57:46 -05:00
|
|
|
virtual bool IsResizeable() const;
|
|
|
|
virtual bool IsHidden() const;
|
2007-02-17 07:32:38 -05:00
|
|
|
|
|
|
|
virtual int GetWidth() const;
|
2007-02-23 02:57:46 -05:00
|
|
|
virtual int GetMinWidth() const;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-12-26 13:30:56 -05:00
|
|
|
virtual bool IsReorderable() const;
|
2007-02-23 02:57:46 -05:00
|
|
|
|
2008-12-03 16:53:10 -05:00
|
|
|
virtual int GetFlags() const { return GetFromIndividualFlags(); }
|
|
|
|
|
2006-02-21 19:19:04 -05:00
|
|
|
// implementation
|
2007-02-23 02:57:46 -05:00
|
|
|
GtkWidget* GetGtkHandle() { return m_column; }
|
2007-09-14 16:30:05 -04:00
|
|
|
GtkWidget* GetConstGtkHandle() const { return m_column; }
|
2006-02-21 19:19:04 -05:00
|
|
|
|
|
|
|
private:
|
2006-02-22 21:04:46 -05:00
|
|
|
// holds the GTK handle
|
2007-02-23 02:57:46 -05:00
|
|
|
GtkWidget *m_column;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2008-04-12 16:07:53 -04:00
|
|
|
// holds GTK handles for title/bitmap in the header
|
|
|
|
GtkWidget *m_image;
|
|
|
|
GtkWidget *m_label;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-10-06 05:50:45 -04:00
|
|
|
// delayed connection to mouse events
|
|
|
|
friend class wxDataViewCtrl;
|
|
|
|
void OnInternalIdle();
|
2007-02-23 02:57:46 -05:00
|
|
|
bool m_isConnected;
|
|
|
|
|
|
|
|
void Init(wxAlignment align, int flags, int width);
|
2006-02-21 19:19:04 -05:00
|
|
|
};
|
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
WX_DECLARE_LIST_WITH_DECL(wxDataViewColumn, wxDataViewColumnList,
|
|
|
|
class WXDLLIMPEXP_ADV);
|
2007-08-26 06:05:16 -04:00
|
|
|
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-21 12:35:19 -05:00
|
|
|
// wxDataViewCtrl
|
2008-12-07 09:19:18 -05:00
|
|
|
// ---------------------------------------------------------
|
2006-02-21 12:35:19 -05:00
|
|
|
|
2007-10-10 15:44:26 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase
|
2006-02-21 12:35:19 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-12-07 09:19:18 -05:00
|
|
|
wxDataViewCtrl()
|
2006-02-21 12:35:19 -05:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-21 12:35:19 -05:00
|
|
|
wxDataViewCtrl( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator )
|
|
|
|
{
|
|
|
|
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 );
|
|
|
|
|
2007-07-04 20:13:28 -04:00
|
|
|
virtual bool AssociateModel( wxDataViewModel *model );
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-10-18 16:56:38 -04:00
|
|
|
virtual bool PrependColumn( wxDataViewColumn *col );
|
2006-02-25 09:07:06 -05:00
|
|
|
virtual bool AppendColumn( wxDataViewColumn *col );
|
2008-05-21 04:47:21 -04:00
|
|
|
virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-08-26 06:05:16 -04:00
|
|
|
virtual unsigned int GetColumnCount() const;
|
|
|
|
virtual wxDataViewColumn* GetColumn( unsigned int pos ) const;
|
|
|
|
virtual bool DeleteColumn( wxDataViewColumn *column );
|
|
|
|
virtual bool ClearColumns();
|
2007-09-13 09:29:19 -04:00
|
|
|
virtual int GetColumnPosition( const wxDataViewColumn *column ) const;
|
2007-07-14 09:54:14 -04:00
|
|
|
|
2007-09-13 08:57:40 -04:00
|
|
|
virtual wxDataViewColumn *GetSortingColumn() const;
|
|
|
|
|
2007-08-24 07:21:52 -04:00
|
|
|
virtual wxDataViewItem GetSelection() const;
|
2007-08-19 16:11:34 -04:00
|
|
|
virtual int GetSelections( wxDataViewItemArray & sel ) const;
|
|
|
|
virtual void SetSelections( const wxDataViewItemArray & sel );
|
|
|
|
virtual void Select( const wxDataViewItem & item );
|
|
|
|
virtual void Unselect( const wxDataViewItem & item );
|
|
|
|
virtual bool IsSelected( const wxDataViewItem & item ) const;
|
|
|
|
virtual void SelectAll();
|
|
|
|
virtual void UnselectAll();
|
|
|
|
|
2008-12-07 09:19:18 -05:00
|
|
|
virtual void EnsureVisible( const wxDataViewItem& item,
|
2007-08-24 07:21:52 -04:00
|
|
|
const wxDataViewColumn *column = NULL );
|
2008-12-07 09:19:18 -05:00
|
|
|
virtual void HitTest( const wxPoint &point,
|
|
|
|
wxDataViewItem &item,
|
2007-08-24 16:00:32 -04:00
|
|
|
wxDataViewColumn *&column ) const;
|
2008-12-07 09:19:18 -05:00
|
|
|
virtual wxRect GetItemRect( const wxDataViewItem &item,
|
2007-08-24 07:21:52 -04:00
|
|
|
const wxDataViewColumn *column = NULL ) const;
|
2007-08-20 13:26:11 -04:00
|
|
|
|
2007-08-25 17:05:51 -04:00
|
|
|
virtual void Expand( const wxDataViewItem & item );
|
|
|
|
virtual void Collapse( const wxDataViewItem & item );
|
2008-12-16 16:23:55 -05:00
|
|
|
virtual bool IsExpanded( const wxDataViewItem & item ) const;
|
|
|
|
|
2009-01-19 17:27:06 -05:00
|
|
|
virtual bool EnableDragSource( const wxDataFormat &format );
|
2009-01-20 12:50:51 -05:00
|
|
|
virtual bool EnableDropTarget( const wxDataFormat &format );
|
2009-01-19 17:27:06 -05:00
|
|
|
|
2006-11-01 10:24:48 -05:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-04-17 08:08:10 -04:00
|
|
|
wxWindow *GetMainWindow() { return (wxWindow*) this; }
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-07-17 18:01:47 -04:00
|
|
|
GtkWidget *GtkGetTreeView() { return m_treeview; }
|
|
|
|
wxDataViewCtrlInternal* GtkGetInternal() { return m_internal; }
|
2007-07-12 08:58:28 -04:00
|
|
|
|
2007-12-20 01:08:00 -05:00
|
|
|
virtual void OnInternalIdle();
|
|
|
|
|
2007-07-12 08:58:28 -04:00
|
|
|
protected:
|
|
|
|
virtual void DoSetExpanderColumn();
|
|
|
|
virtual void DoSetIndent();
|
|
|
|
|
2009-09-26 12:43:30 -04:00
|
|
|
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
|
|
|
|
2006-02-25 09:07:06 -05:00
|
|
|
private:
|
2007-11-30 08:48:22 -05:00
|
|
|
friend class wxDataViewCtrlDCImpl;
|
2006-10-06 05:50:45 -04:00
|
|
|
friend class wxDataViewColumn;
|
2007-07-04 20:13:28 -04:00
|
|
|
friend class wxGtkDataViewModelNotifier;
|
2007-12-17 08:56:28 -05:00
|
|
|
friend class wxDataViewCtrlInternal;
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2007-07-04 20:13:28 -04:00
|
|
|
GtkWidget *m_treeview;
|
|
|
|
wxDataViewModelNotifier *m_notifier;
|
2007-07-17 18:01:47 -04:00
|
|
|
wxDataViewCtrlInternal *m_internal;
|
2007-08-26 06:05:16 -04:00
|
|
|
wxDataViewColumnList m_cols;
|
2007-07-12 08:58:28 -04:00
|
|
|
|
2008-08-29 11:46:48 -04:00
|
|
|
virtual void AddChildGTK(wxWindowGTK* child);
|
2007-05-30 16:31:53 -04:00
|
|
|
void GtkEnableSelectionEvents();
|
|
|
|
void GtkDisableSelectionEvents();
|
2008-12-07 09:19:18 -05:00
|
|
|
|
2006-02-21 12:35:19 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl);
|
2006-02-21 12:35:19 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-12-20 01:08:00 -05:00
|
|
|
#endif // _WX_GTKDATAVIEWCTRL_H_
|