2009-11-10 12:40:58 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/osx/dvrenderers.h
|
|
|
|
// Purpose: All OS X wxDataViewCtrl renderer classes
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Created: 2009-11-07 (extracted from wx/osx/dataview.h)
|
|
|
|
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_OSX_DVRENDERERS_H_
|
|
|
|
#define _WX_OSX_DVRENDERERS_H_
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewCustomRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewCustomRenderer : public wxDataViewCustomRendererBase
|
|
|
|
{
|
|
|
|
public:
|
2014-12-20 16:51:54 -05:00
|
|
|
static wxString GetDefaultType() { return wxS("string"); }
|
|
|
|
|
|
|
|
wxDataViewCustomRenderer(const wxString& varianttype = GetDefaultType(),
|
2009-11-10 12:40:58 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
|
|
|
|
virtual ~wxDataViewCustomRenderer();
|
|
|
|
|
|
|
|
|
|
|
|
// implementation only
|
|
|
|
// -------------------
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual wxDC* GetDC() wxOVERRIDE; // creates a device context and keeps it
|
2009-11-10 12:40:58 -05:00
|
|
|
void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxControl* m_editorCtrlPtr; // pointer to an in-place editor control
|
|
|
|
|
|
|
|
wxDC* m_DCPtr;
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer);
|
2009-11-10 12:40:58 -05:00
|
|
|
};
|
|
|
|
|
2018-01-30 21:11:07 -05:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// This is a Mac-specific class that should be used as the base class for the
|
|
|
|
// renderers that should be disabled when they're inert, to prevent the user
|
|
|
|
// from editing them.
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxOSXDataViewDisabledInertRenderer : public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
wxOSXDataViewDisabledInertRenderer(const wxString& varianttype,
|
|
|
|
wxDataViewCellMode mode,
|
|
|
|
int alignment)
|
|
|
|
: wxDataViewRenderer(varianttype, mode, alignment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void SetEnabled(bool enabled) wxOVERRIDE
|
|
|
|
{
|
|
|
|
wxDataViewRenderer::SetEnabled(enabled &&
|
|
|
|
GetMode() != wxDATAVIEW_CELL_INERT);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-11-10 12:40:58 -05:00
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewTextRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2014-12-20 16:51:54 -05:00
|
|
|
static wxString GetDefaultType() { return wxS("string"); }
|
|
|
|
|
|
|
|
wxDataViewTextRenderer(const wxString& varianttype = GetDefaultType(),
|
2009-11-10 12:40:58 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
|
2016-06-04 19:30:46 -04:00
|
|
|
#if wxUSE_MARKUP && wxOSX_USE_COCOA
|
|
|
|
void EnableMarkup(bool enable = true);
|
|
|
|
#endif // wxUSE_MARKUP && Cocoa
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
|
|
const wxDataViewItem& item,
|
2019-04-05 14:08:53 -04:00
|
|
|
unsigned col) wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
private:
|
2016-06-04 19:30:46 -04:00
|
|
|
#if wxUSE_MARKUP && wxOSX_USE_COCOA
|
|
|
|
// True if we should interpret markup in our text.
|
|
|
|
bool m_useMarkup;
|
|
|
|
#endif // wxUSE_MARKUP && Cocoa
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer);
|
2009-11-10 12:40:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewBitmapRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2014-12-20 16:51:54 -05:00
|
|
|
static wxString GetDefaultType() { return wxS("wxBitmap"); }
|
|
|
|
|
|
|
|
wxDataViewBitmapRenderer(const wxString& varianttype = GetDefaultType(),
|
2009-11-10 12:40:58 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
private:
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer);
|
2009-11-10 12:40:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// -------------------------------------
|
|
|
|
// wxDataViewChoiceRenderer
|
|
|
|
// -------------------------------------
|
|
|
|
|
2018-01-30 21:11:07 -05:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer
|
|
|
|
: public wxOSXDataViewDisabledInertRenderer
|
2009-11-10 12:40:58 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxDataViewChoiceRenderer(const wxArrayString& choices,
|
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
|
|
|
|
int alignment = wxDVR_DEFAULT_ALIGNMENT );
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
wxString GetChoice(size_t index) const { return m_choices[index]; }
|
|
|
|
const wxArrayString& GetChoices() const { return m_choices; }
|
|
|
|
|
2012-07-02 10:36:56 -04:00
|
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
|
|
const wxDataViewItem& item,
|
2019-04-05 14:08:53 -04:00
|
|
|
unsigned col) wxOVERRIDE;
|
2012-07-02 10:36:56 -04:00
|
|
|
|
2009-11-10 12:40:58 -05:00
|
|
|
private:
|
|
|
|
wxArrayString m_choices;
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer);
|
2009-11-10 12:40:58 -05:00
|
|
|
};
|
|
|
|
|
2016-03-18 19:12:38 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxDataViewChoiceByIndexRenderer
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxDataViewChoiceByIndexRenderer(const wxArrayString& choices,
|
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
|
|
|
|
int alignment = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
|
|
|
|
virtual bool SetValue(const wxVariant& value) wxOVERRIDE;
|
|
|
|
virtual bool GetValue(wxVariant& value) const wxOVERRIDE;
|
|
|
|
|
|
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
|
|
const wxDataViewItem& item,
|
|
|
|
unsigned col) wxOVERRIDE;
|
|
|
|
};
|
|
|
|
|
2009-11-10 12:40:58 -05:00
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewIconTextRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2014-12-20 16:51:54 -05:00
|
|
|
static wxString GetDefaultType() { return wxS("wxDataViewIconText"); }
|
|
|
|
|
|
|
|
wxDataViewIconTextRenderer(const wxString& varianttype = GetDefaultType(),
|
2009-11-10 12:40:58 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
|
|
const wxDataViewItem& item,
|
2019-04-05 14:08:53 -04:00
|
|
|
unsigned col) wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
private:
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer);
|
2009-11-10 12:40:58 -05:00
|
|
|
};
|
|
|
|
|
2019-10-20 20:04:35 -04:00
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewIconTextRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxDataViewCheckIconTextRenderer
|
|
|
|
: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static wxString GetDefaultType() { return wxS("wxDataViewCheckIconText"); }
|
|
|
|
|
|
|
|
explicit wxDataViewCheckIconTextRenderer
|
|
|
|
(
|
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT
|
|
|
|
);
|
|
|
|
|
|
|
|
// This renderer can always display the 3rd ("indeterminate") checkbox
|
|
|
|
// state if the model contains cells with wxCHK_UNDETERMINED value, but it
|
|
|
|
// doesn't allow the user to set it by default. Call this method to allow
|
|
|
|
// this to happen.
|
|
|
|
void Allow3rdStateForUser(bool allow = true);
|
|
|
|
|
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
|
|
|
|
|
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
|
|
const wxDataViewItem& item,
|
|
|
|
unsigned col) wxOVERRIDE;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_allow3rdStateForUser;
|
|
|
|
|
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCheckIconTextRenderer);
|
|
|
|
};
|
|
|
|
|
2009-11-10 12:40:58 -05:00
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewToggleRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
2018-01-30 21:11:07 -05:00
|
|
|
class WXDLLIMPEXP_ADV wxDataViewToggleRenderer
|
|
|
|
: public wxOSXDataViewDisabledInertRenderer
|
2009-11-10 12:40:58 -05:00
|
|
|
{
|
|
|
|
public:
|
2014-12-20 16:51:54 -05:00
|
|
|
static wxString GetDefaultType() { return wxS("bool"); }
|
|
|
|
|
|
|
|
wxDataViewToggleRenderer(const wxString& varianttype = GetDefaultType(),
|
2009-11-10 12:40:58 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
|
2018-07-10 19:13:22 -04:00
|
|
|
void ShowAsRadio();
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
|
|
const wxDataViewItem& item,
|
2019-04-05 14:08:53 -04:00
|
|
|
unsigned col) wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
private:
|
2018-07-13 12:16:16 -04:00
|
|
|
void DoInitButtonCell(int buttonType);
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer);
|
2009-11-10 12:40:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewProgressRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2014-12-20 16:51:54 -05:00
|
|
|
static wxString GetDefaultType() { return wxS("long"); }
|
|
|
|
|
2009-11-10 12:40:58 -05:00
|
|
|
wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
|
2014-12-20 16:51:54 -05:00
|
|
|
const wxString& varianttype = GetDefaultType(),
|
2009-11-10 12:40:58 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
|
|
const wxDataViewItem& item,
|
2019-04-05 14:08:53 -04:00
|
|
|
unsigned col) wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
private:
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer);
|
2009-11-10 12:40:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxDataViewDateRenderer
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
|
|
|
|
{
|
|
|
|
public:
|
2014-12-20 16:51:54 -05:00
|
|
|
static wxString GetDefaultType() { return wxS("datetime"); }
|
|
|
|
|
|
|
|
wxDataViewDateRenderer(const wxString& varianttype = GetDefaultType(),
|
2009-11-10 12:40:58 -05:00
|
|
|
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
|
|
|
|
int align = wxDVR_DEFAULT_ALIGNMENT);
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool MacRender() wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
virtual void OSXOnCellChanged(NSObject *value,
|
|
|
|
const wxDataViewItem& item,
|
2019-04-05 14:08:53 -04:00
|
|
|
unsigned col) wxOVERRIDE;
|
2009-11-10 12:40:58 -05:00
|
|
|
|
|
|
|
private:
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer);
|
2009-11-10 12:40:58 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_OSX_DVRENDERERS_H_
|
|
|
|
|