2011-03-20 18:05:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/generic/dvrenderers.h
|
|
|
|
// Purpose: All generic wxDataViewCtrl renderer classes
|
|
|
|
// Author: Robert Roebling, Vadim Zeitlin
|
|
|
|
// Created: 2009-11-07 (extracted from wx/generic/dataview.h)
|
|
|
|
// Copyright: (c) 2006 Robert Roebling
|
|
|
|
// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GENERIC_DVRENDERERS_H_
|
|
|
|
#define _WX_GENERIC_DVRENDERERS_H_
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewCustomRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2016-06-26 05:25:29 +00:00
|
|
|
static wxString GetDefaultType() { return wxS("string"); }
|
|
|
|
|
|
|
|
wxDataViewCustomRenderer( const wxString &varianttype = GetDefaultType(),
|
2011-03-20 18:05:19 +00:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
|
|
|
|
|
|
|
|
// see the explanation of the following WXOnXXX() methods in wx/generic/dvrenderer.h
|
|
|
|
|
2012-03-18 01:12:27 +00:00
|
|
|
virtual bool WXActivateCell(const wxRect& cell,
|
|
|
|
wxDataViewModel *model,
|
|
|
|
const wxDataViewItem& item,
|
|
|
|
unsigned int col,
|
|
|
|
const wxMouseEvent *mouseEvent)
|
2011-03-20 18:05:19 +00:00
|
|
|
{
|
2012-03-18 01:12:27 +00:00
|
|
|
return ActivateCell(cell, model, item, col, mouseEvent);
|
2011-03-20 18:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2016-06-26 05:25:29 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer);
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewTextRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2016-06-26 05:25:29 +00:00
|
|
|
static wxString GetDefaultType() { return wxS("string"); }
|
|
|
|
|
|
|
|
wxDataViewTextRenderer( const wxString &varianttype = GetDefaultType(),
|
2011-03-20 18:05:19 +00:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual bool SetValue( const wxVariant &value );
|
|
|
|
virtual bool GetValue( wxVariant &value ) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
virtual bool Render(wxRect cell, wxDC *dc, int state);
|
|
|
|
virtual wxSize GetSize() const;
|
|
|
|
|
|
|
|
// in-place editing
|
|
|
|
virtual bool HasEditorCtrl() const;
|
2012-03-18 01:12:27 +00:00
|
|
|
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
|
|
|
|
const wxVariant &value );
|
|
|
|
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
wxString m_text;
|
|
|
|
|
|
|
|
protected:
|
2016-06-26 05:25:29 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer);
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewBitmapRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2016-06-26 05:25:29 +00:00
|
|
|
static wxString GetDefaultType() { return wxS("wxBitmap"); }
|
|
|
|
|
|
|
|
wxDataViewBitmapRenderer( const wxString &varianttype = GetDefaultType(),
|
2011-03-20 18:05:19 +00:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual bool SetValue( const wxVariant &value );
|
|
|
|
virtual bool GetValue( wxVariant &value ) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
|
|
|
virtual wxSize GetSize() const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
wxIcon m_icon;
|
|
|
|
wxBitmap m_bitmap;
|
|
|
|
|
|
|
|
protected:
|
2016-06-26 05:25:29 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer);
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewToggleRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2016-06-26 05:25:29 +00:00
|
|
|
static wxString GetDefaultType() { return wxS("bool"); }
|
|
|
|
|
|
|
|
wxDataViewToggleRenderer( const wxString &varianttype = GetDefaultType(),
|
2011-03-20 18:05:19 +00:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual bool SetValue( const wxVariant &value );
|
|
|
|
virtual bool GetValue( wxVariant &value ) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
|
|
|
virtual wxSize GetSize() const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
// Implementation only, don't use nor override
|
2012-03-18 01:12:27 +00:00
|
|
|
virtual bool WXActivateCell(const wxRect& cell,
|
|
|
|
wxDataViewModel *model,
|
|
|
|
const wxDataViewItem& item,
|
|
|
|
unsigned int col,
|
|
|
|
const wxMouseEvent *mouseEvent);
|
2011-03-20 18:05:19 +00:00
|
|
|
private:
|
|
|
|
bool m_toggle;
|
|
|
|
|
|
|
|
protected:
|
2016-06-26 05:25:29 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer);
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewProgressRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2016-06-26 05:25:29 +00:00
|
|
|
static wxString GetDefaultType() { return wxS("long"); }
|
|
|
|
|
2011-03-20 18:05:19 +00:00
|
|
|
wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
|
2016-06-26 05:25:29 +00:00
|
|
|
const wxString &varianttype = GetDefaultType(),
|
2011-03-20 18:05:19 +00:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual bool SetValue( const wxVariant &value );
|
|
|
|
virtual bool GetValue( wxVariant& value ) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
virtual bool Render(wxRect cell, wxDC *dc, int state);
|
|
|
|
virtual wxSize GetSize() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxString m_label;
|
|
|
|
int m_value;
|
|
|
|
|
|
|
|
protected:
|
2016-06-26 05:25:29 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer);
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewIconTextRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2016-06-26 05:25:29 +00:00
|
|
|
static wxString GetDefaultType() { return wxS("wxDataViewIconText"); }
|
|
|
|
|
|
|
|
wxDataViewIconTextRenderer( const wxString &varianttype = GetDefaultType(),
|
2011-03-20 18:05:19 +00:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
|
2016-06-26 05:25:29 +00:00
|
|
|
virtual bool SetValue( const wxVariant &value );
|
|
|
|
virtual bool GetValue( wxVariant &value ) const;
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
virtual bool Render(wxRect cell, wxDC *dc, int state);
|
|
|
|
virtual wxSize GetSize() const;
|
|
|
|
|
|
|
|
virtual bool HasEditorCtrl() const { return true; }
|
2012-03-18 01:12:27 +00:00
|
|
|
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
|
|
|
|
const wxVariant &value );
|
|
|
|
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
|
2011-03-20 18:05:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
wxDataViewIconText m_value;
|
|
|
|
|
|
|
|
protected:
|
2016-06-26 05:25:29 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer);
|
2011-03-20 18:05:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_GENERIC_DVRENDERERS_H_
|
|
|
|
|