COND_TOOLKIT_OSX_CARBON_ADVANCED_PLATFORM_HDR = \
wx/generic/animate.h \
wx/osx/dataview.h \
+ wx/osx/dvrenderer.h \
+ wx/osx/dvrenderers.h \
wx/osx/joystick.h \
wx/osx/sound.h \
wx/osx/taskbarosx.h \
COND_TOOLKIT_OSX_COCOA_ADVANCED_PLATFORM_HDR = \
wx/generic/animate.h \
wx/osx/dataview.h \
+ wx/osx/dvrenderer.h \
+ wx/osx/dvrenderers.h \
wx/osx/joystick.h \
wx/osx/sound.h \
wx/osx/taskbarosx.h \
wx/gtk/bmpcbox.h \
wx/gtk/calctrl.h \
wx/gtk/dataview.h \
+ wx/gtk/dvrenderer.h \
+ wx/gtk/dvrenderers.h \
wx/gtk/hyperlink.h \
wx/gtk/infobar.h
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ADVANCED_PLATFORM_NATIVE_HDR = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_ADVANCED_PLATFORM_NATIVE_HDR)
wx/datectrl.h \
wx/dateevt.h \
wx/dcbuffer.h \
+ wx/dvrenderers.h \
wx/editlbox.h \
wx/generic/aboutdlgg.h \
wx/generic/bmpcbox.h \
wx/generic/calctrlg.h \
wx/generic/datectrl.h \
wx/generic/dataview.h \
+ wx/generic/dvrenderer.h \
+ wx/generic/dvrenderers.h \
wx/generic/grid.h \
wx/generic/gridctrl.h \
wx/generic/grideditors.h \
wx/datectrl.h \
wx/dateevt.h \
wx/dcbuffer.h \
+ wx/dvrenderers.h \
wx/editlbox.h \
wx/generic/aboutdlgg.h \
wx/generic/bmpcbox.h \
wx/generic/calctrlg.h \
wx/generic/datectrl.h \
wx/generic/dataview.h \
+ wx/generic/dvrenderer.h \
+ wx/generic/dvrenderers.h \
wx/generic/grid.h \
wx/generic/gridctrl.h \
wx/generic/grideditors.h \
wx/datectrl.h
wx/dateevt.h
wx/dcbuffer.h
+ wx/dvrenderers.h
wx/editlbox.h
wx/generic/aboutdlgg.h
wx/generic/bmpcbox.h
wx/generic/calctrlg.h
wx/generic/datectrl.h
wx/generic/dataview.h
+ wx/generic/dvrenderer.h
+ wx/generic/dvrenderers.h
wx/generic/grid.h
wx/generic/gridctrl.h
wx/generic/grideditors.h
<set var="ADVANCED_OSX_CARBON_HDR" hints="files">
wx/generic/animate.h
wx/osx/dataview.h
+ wx/osx/dvrenderer.h
+ wx/osx/dvrenderers.h
wx/osx/joystick.h
wx/osx/sound.h
wx/osx/taskbarosx.h
<set var="ADVANCED_OSX_COCOA_HDR" hints="files">
wx/generic/animate.h
wx/osx/dataview.h
+ wx/osx/dvrenderer.h
+ wx/osx/dvrenderers.h
wx/osx/joystick.h
wx/osx/sound.h
wx/osx/taskbarosx.h
wx/gtk/bmpcbox.h
wx/gtk/calctrl.h
wx/gtk/dataview.h
+ wx/gtk/dvrenderer.h
+ wx/gtk/dvrenderers.h
wx/gtk/hyperlink.h
wx/gtk/infobar.h
</set>
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\include\wx\generic\dvrenderer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\wx\generic\dvrenderers.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\wx\generic\grid.h\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\include\wx\dvrenderers.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\wx\editlbox.h\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\include\wx\generic\dvrenderer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\wx\generic\dvrenderers.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\wx\generic\fdrepdlg.h\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\include\wx\dvrenderers.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\wx\editlbox.h\r
# End Source File\r
# Begin Source File\r
RelativePath="..\..\include\wx\generic\datectrl.h">\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\generic\dvrenderer.h">
+ </File>
+ <File
+ RelativePath="..\..\include\wx\generic\dvrenderers.h">
+ </File>
+ <File
RelativePath="..\..\include\wx\generic\grid.h">\r
</File>\r
<File\r
RelativePath="..\..\include\wx\dcbuffer.h">\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\dvrenderers.h">
+ </File>
+ <File
RelativePath="..\..\include\wx\editlbox.h">\r
</File>\r
<File\r
RelativePath="..\..\include\wx\generic\dragimgg.h">\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\generic\dvrenderer.h">
+ </File>
+ <File
+ RelativePath="..\..\include\wx\generic\dvrenderers.h">
+ </File>
+ <File
RelativePath="..\..\include\wx\generic\fdrepdlg.h">\r
</File>\r
<File\r
RelativePath="..\..\include\wx\dragimag.h">\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\dvrenderers.h">
+ </File>
+ <File
RelativePath="..\..\include\wx\editlbox.h">\r
</File>\r
<File\r
>\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\generic\dvrenderer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\wx\generic\dvrenderers.h"
+ >
+ </File>
+ <File
RelativePath="..\..\include\wx\generic\grid.h"\r
>\r
</File>\r
>\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\dvrenderers.h"
+ >
+ </File>
+ <File
RelativePath="..\..\include\wx\editlbox.h"\r
>\r
</File>\r
>\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\generic\dvrenderer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\wx\generic\dvrenderers.h"
+ >
+ </File>
+ <File
RelativePath="..\..\include\wx\generic\fdrepdlg.h"\r
>\r
</File>\r
>\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\dvrenderers.h"
+ >
+ </File>
+ <File
RelativePath="..\..\include\wx\editlbox.h"\r
>\r
</File>\r
>\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\generic\dvrenderer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\wx\generic\dvrenderers.h"
+ >
+ </File>
+ <File
RelativePath="..\..\include\wx\generic\grid.h"\r
>\r
</File>\r
>\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\dvrenderers.h"
+ >
+ </File>
+ <File
RelativePath="..\..\include\wx\editlbox.h"\r
>\r
</File>\r
>\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\generic\dvrenderer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\include\wx\generic\dvrenderers.h"
+ >
+ </File>
+ <File
RelativePath="..\..\include\wx\generic\fdrepdlg.h"\r
>\r
</File>\r
>\r
</File>\r
<File\r
+ RelativePath="..\..\include\wx\dvrenderers.h"
+ >
+ </File>
+ <File
RelativePath="..\..\include\wx\editlbox.h"\r
>\r
</File>\r
#define wxHAS_GENERIC_DATAVIEWCTRL
#endif
+#ifdef wxHAS_GENERIC_DATAVIEWCTRL
+ // this symbol doesn't follow the convention for wxUSE_XXX symbols which
+ // are normally always defined as either 0 or 1, so its use is deprecated
+ // and it only exists for backwards compatibility, don't use it any more
+ // and use wxHAS_GENERIC_DATAVIEWCTRL instead
+ #define wxUSE_GENERICDATAVIEWCTRL
+#endif
+
// ----------------------------------------------------------------------------
// wxDataViewCtrl globals
// ----------------------------------------------------------------------------
DECLARE_EVENT_TABLE()
};
-// ---------------------------------------------------------
-// wxDataViewRendererBase
-// ---------------------------------------------------------
-
-enum wxDataViewCellMode
-{
- wxDATAVIEW_CELL_INERT,
- wxDATAVIEW_CELL_ACTIVATABLE,
- wxDATAVIEW_CELL_EDITABLE
-};
-
-enum wxDataViewCellRenderState
-{
- wxDATAVIEW_CELL_SELECTED = 1,
- wxDATAVIEW_CELL_PRELIT = 2,
- wxDATAVIEW_CELL_INSENSITIVE = 4,
- wxDATAVIEW_CELL_FOCUSED = 8
-};
-
-class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject
-{
-public:
- wxDataViewRendererBase( const wxString &varianttype,
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int alignment = wxDVR_DEFAULT_ALIGNMENT );
- virtual ~wxDataViewRendererBase();
-
- virtual bool Validate( wxVariant& WXUNUSED(value) )
- { return true; }
-
- void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
- wxDataViewColumn* GetOwner() const { return m_owner; }
-
- // renderer properties:
-
- virtual bool SetValue( const wxVariant& WXUNUSED(value) ) = 0;
- virtual bool GetValue( wxVariant& WXUNUSED(value) ) const = 0;
-
- wxString GetVariantType() const { return m_variantType; }
-
- virtual void SetMode( wxDataViewCellMode mode ) = 0;
- virtual wxDataViewCellMode GetMode() const = 0;
-
- // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
- // rather an "int"; that's because for rendering cells it's allowed
- // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
- virtual void SetAlignment( int align ) = 0;
- virtual int GetAlignment() const = 0;
-
- // enable or disable (if called with wxELLIPSIZE_NONE) replacing parts of
- // the item text (hence this only makes sense for renderers showing
- // text...) with ellipsis in order to make it fit the column width
- virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) = 0;
- void DisableEllipsize() { EnableEllipsize(wxELLIPSIZE_NONE); }
-
- virtual wxEllipsizeMode GetEllipsizeMode() const = 0;
-
- // in-place editing
- virtual bool HasEditorCtrl() const
- { return false; }
- virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
- wxRect WXUNUSED(labelRect),
- const wxVariant& WXUNUSED(value))
- { return NULL; }
- virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor),
- wxVariant& WXUNUSED(value))
- { return false; }
-
- virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect );
- virtual void CancelEditing();
- virtual bool FinishEditing();
-
- wxControl *GetEditorCtrl() { return m_editorCtrl; }
-
-protected:
- wxString m_variantType;
- wxDataViewColumn *m_owner;
- wxWeakRef<wxControl> m_editorCtrl;
- wxDataViewItem m_item; // for m_editorCtrl
-
- // internal utility:
- const wxDataViewCtrl* GetView() const;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase)
-};
-
-//-----------------------------------------------------------------------------
-// wxDataViewIconText
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewIconText: public wxObject
-{
-public:
- wxDataViewIconText( const wxString &text = wxEmptyString, const wxIcon& icon = wxNullIcon )
- : m_text(text), m_icon(icon)
- { }
- wxDataViewIconText( const wxDataViewIconText &other )
- : wxObject()
- { m_icon = other.m_icon; m_text = other.m_text; }
-
- void SetText( const wxString &text ) { m_text = text; }
- wxString GetText() const { return m_text; }
- void SetIcon( const wxIcon &icon ) { m_icon = icon; }
- const wxIcon &GetIcon() const { return m_icon; }
-
-private:
- wxString m_text;
- wxIcon m_icon;
-
-private:
- DECLARE_DYNAMIC_CLASS(wxDataViewIconText)
-};
-
-inline
-bool operator==(const wxDataViewIconText& left, const wxDataViewIconText& right)
-{
- return left.GetText() == right.GetText() &&
- left.GetIcon().IsSameAs(right.GetIcon());
-}
-
-inline
-bool operator!=(const wxDataViewIconText& left, const wxDataViewIconText& right)
-{
- return !(left == right);
-}
+// ----------------------------------------------------------------------------
+// wxDataViewRenderer and related classes
+// ----------------------------------------------------------------------------
-DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV)
+#include "wx/dvrenderers.h"
// ---------------------------------------------------------
// wxDataViewColumnBase
#define EVT_DATAVIEW_ITEM_DROP(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP, id, fn)
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
- // this symbol doesn't follow the convention for wxUSE_XXX symbols which
- // are normally always defined as either 0 or 1, so its use is deprecated
- // and it only exists for backwards compatibility, don't use it any more
- // and use wxHAS_GENERIC_DATAVIEWCTRL instead
- #define wxUSE_GENERICDATAVIEWCTRL
-
#include "wx/generic/dataview.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/dataview.h"
#error "unknown native wxDataViewCtrl implementation"
#endif
-// -------------------------------------
-// wxDataViewSpinRenderer
-// -------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewSpinRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewSpinRenderer( int min, int max,
- wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
- int alignment = wxDVR_DEFAULT_ALIGNMENT );
- virtual bool HasEditorCtrl() const { return true; }
- virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
- virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
- 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;
-
-private:
- long m_data;
- long m_min,m_max;
-};
-
-#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXOSX_CARBON__)
-
-// -------------------------------------
-// wxDataViewChoiceRenderer
-// -------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewChoiceRenderer( const wxArrayString &choices,
- wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
- int alignment = wxDVR_DEFAULT_ALIGNMENT );
- virtual bool HasEditorCtrl() const { return true; }
- virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
- virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
- 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;
-
-private:
- wxArrayString m_choices;
- wxString m_data;
-};
-
-#endif
-
-// this class is obsolete, its functionality was merged in
-// wxDataViewTextRenderer itself now, don't use it any more
-#define wxDataViewTextRendererAttr wxDataViewTextRenderer
-
//-----------------------------------------------------------------------------
// wxDataViewListStore
//-----------------------------------------------------------------------------
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/dvrenderers.h
+// Purpose: Declare all wxDataViewCtrl classes
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-08 (extracted from wx/dataview.h)
+// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_DVRENDERERS_H_
+#define _WX_DVRENDERERS_H_
+
+/*
+ Note about the structure of various headers: they're organized in a more
+ complicated way than usual because of the various dependencies which are
+ different for different ports. In any case the only public header, i.e. the
+ one which can be included directly is wx/dataview.h. It, in turn, includes
+ this one to define all the renderer classes.
+
+ We define the base wxDataViewRendererBase class first and then include a
+ port-dependent wx/xxx/dvrenderer.h which defines wxDataViewRenderer itself.
+ After this we can define wxDataViewRendererCustomBase (and maybe in the
+ future base classes for other renderers if the need arises, i.e. if there
+ is any non-trivial code or API which it makes sense to keep in common code)
+ and include wx/xxx/dvrenderers.h (notice the plural) which defines all the
+ rest of the renderer classes.
+ */
+
+class WXDLLIMPEXP_FWD_ADV wxDataViewCustomRenderer;
+
+// ----------------------------------------------------------------------------
+// wxDataViewIconText: helper class used by wxDataViewIconTextRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewIconText : public wxObject
+{
+public:
+ wxDataViewIconText( const wxString &text = wxEmptyString,
+ const wxIcon& icon = wxNullIcon )
+ : m_text(text),
+ m_icon(icon)
+ { }
+
+ wxDataViewIconText( const wxDataViewIconText &other )
+ : wxObject(),
+ m_text(other.m_text),
+ m_icon(other.m_icon)
+ { }
+
+ void SetText( const wxString &text ) { m_text = text; }
+ wxString GetText() const { return m_text; }
+ void SetIcon( const wxIcon &icon ) { m_icon = icon; }
+ const wxIcon &GetIcon() const { return m_icon; }
+
+private:
+ wxString m_text;
+ wxIcon m_icon;
+
+ DECLARE_DYNAMIC_CLASS(wxDataViewIconText)
+};
+
+inline
+bool operator==(const wxDataViewIconText& left, const wxDataViewIconText& right)
+{
+ return left.GetText() == right.GetText() &&
+ left.GetIcon().IsSameAs(right.GetIcon());
+}
+
+inline
+bool operator!=(const wxDataViewIconText& left, const wxDataViewIconText& right)
+{
+ return !(left == right);
+}
+
+DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV)
+
+// ----------------------------------------------------------------------------
+// wxDataViewRendererBase
+// ----------------------------------------------------------------------------
+
+enum wxDataViewCellMode
+{
+ wxDATAVIEW_CELL_INERT,
+ wxDATAVIEW_CELL_ACTIVATABLE,
+ wxDATAVIEW_CELL_EDITABLE
+};
+
+enum wxDataViewCellRenderState
+{
+ wxDATAVIEW_CELL_SELECTED = 1,
+ wxDATAVIEW_CELL_PRELIT = 2,
+ wxDATAVIEW_CELL_INSENSITIVE = 4,
+ wxDATAVIEW_CELL_FOCUSED = 8
+};
+
+class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject
+{
+public:
+ wxDataViewRendererBase( const wxString &varianttype,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+ virtual ~wxDataViewRendererBase();
+
+ virtual bool Validate( wxVariant& WXUNUSED(value) )
+ { return true; }
+
+ void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
+ wxDataViewColumn* GetOwner() const { return m_owner; }
+
+ // renderer properties:
+
+ virtual bool SetValue( const wxVariant& WXUNUSED(value) ) = 0;
+ virtual bool GetValue( wxVariant& WXUNUSED(value) ) const = 0;
+
+ wxString GetVariantType() const { return m_variantType; }
+
+ virtual void SetMode( wxDataViewCellMode mode ) = 0;
+ virtual wxDataViewCellMode GetMode() const = 0;
+
+ // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
+ // rather an "int"; that's because for rendering cells it's allowed
+ // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
+ virtual void SetAlignment( int align ) = 0;
+ virtual int GetAlignment() const = 0;
+
+ // enable or disable (if called with wxELLIPSIZE_NONE) replacing parts of
+ // the item text (hence this only makes sense for renderers showing
+ // text...) with ellipsis in order to make it fit the column width
+ virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) = 0;
+ void DisableEllipsize() { EnableEllipsize(wxELLIPSIZE_NONE); }
+
+ virtual wxEllipsizeMode GetEllipsizeMode() const = 0;
+
+ // in-place editing
+ virtual bool HasEditorCtrl() const
+ { return false; }
+ virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
+ wxRect WXUNUSED(labelRect),
+ const wxVariant& WXUNUSED(value))
+ { return NULL; }
+ virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor),
+ wxVariant& WXUNUSED(value))
+ { return false; }
+
+ virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect );
+ virtual void CancelEditing();
+ virtual bool FinishEditing();
+
+ wxControl *GetEditorCtrl() { return m_editorCtrl; }
+
+protected:
+ wxString m_variantType;
+ wxDataViewColumn *m_owner;
+ wxWeakRef<wxControl> m_editorCtrl;
+ wxDataViewItem m_item; // for m_editorCtrl
+
+ // internal utility:
+ const wxDataViewCtrl* GetView() const;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase)
+};
+
+// include the real wxDataViewRenderer declaration for the native ports
+#ifdef wxHAS_GENERIC_DATAVIEWCTRL
+ // in the generic implementation there is no real wxDataViewRenderer, all
+ // renderers are custom so it's the same as wxDataViewCustomRenderer and
+ // wxDataViewCustomRendererBase derives from wxDataViewRendererBase directly
+ //
+ // this is a rather ugly hack but unfortunately it just doesn't seem to be
+ // possible to have the same class hierarchy in all ports and avoid
+ // duplicating the entire wxDataViewCustomRendererBase in the generic
+ // wxDataViewRenderer class (well, we could use a mix-in but this would
+ // make classes hierarchy non linear and arguably even more complex)
+ #define wxDataViewCustomRendererRealBase wxDataViewRendererBase
+#else
+ #if defined(__WXGTK20__)
+ #include "wx/gtk/dvrenderer.h"
+ #elif defined(__WXMAC__)
+ #include "wx/osx/dvrenderer.h"
+ #else
+ #error "unknown native wxDataViewCtrl implementation"
+ #endif
+ #define wxDataViewCustomRendererRealBase wxDataViewRenderer
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDataViewCustomRendererBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCustomRendererBase
+ : public wxDataViewCustomRendererRealBase
+{
+public:
+ // Constructor must specify the usual renderer parameters which we simply
+ // pass to the base class
+ wxDataViewCustomRendererBase(const wxString& varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT)
+ : wxDataViewCustomRendererRealBase(varianttype, mode, align)
+ {
+ }
+
+
+ // Define virtual function which are called when the item is activated
+ // (double-clicked or Enter is pressed on it), clicked or the user starts
+ // to drag it: by default they all simply return false indicating that the
+ // events are not handled
+
+ virtual bool Activate(wxRect WXUNUSED(cell),
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col))
+ { return false; }
+
+ virtual bool LeftClick(wxPoint WXUNUSED(cursor),
+ wxRect WXUNUSED(cell),
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col) )
+ { return false; }
+
+ virtual bool StartDrag(wxPoint WXUNUSED(cursor),
+ wxRect WXUNUSED(cell),
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col) )
+ { return false; }
+
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxDataViewCustomRendererBase);
+};
+
+// include the declaration of all the other renderers to get the real
+// wxDataViewCustomRenderer from which we need to inherit below
+#ifdef wxHAS_GENERIC_DATAVIEWCTRL
+ // because of the different renderer classes hierarchy in the generic
+ // version, as explained above, we can include the header defining
+ // wxDataViewRenderer only here and not before wxDataViewCustomRendererBase
+ // declaration as for the native ports
+ #include "wx/generic/dvrenderer.h"
+ #include "wx/generic/dvrenderers.h"
+#elif defined(__WXGTK20__)
+ #include "wx/gtk/dvrenderers.h"
+#elif defined(__WXMAC__)
+ #include "wx/osx/dvrenderers.h"
+#else
+ #error "unknown native wxDataViewCtrl implementation"
+#endif
+
+// ----------------------------------------------------------------------------
+// wxDataViewSpinRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewSpinRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewSpinRenderer( int min, int max,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+ virtual bool HasEditorCtrl() const { return true; }
+ virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
+ 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;
+
+private:
+ long m_data;
+ long m_min,m_max;
+};
+
+#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXOSX_CARBON__)
+
+// ----------------------------------------------------------------------------
+// wxDataViewChoiceRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewChoiceRenderer( const wxArrayString &choices,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+ virtual bool HasEditorCtrl() const { return true; }
+ virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
+ 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;
+
+private:
+ wxArrayString m_choices;
+ wxString m_data;
+};
+
+#endif // generic or Carbon versions
+
+// this class is obsolete, its functionality was merged in
+// wxDataViewTextRenderer itself now, don't use it any more
+#define wxDataViewTextRendererAttr wxDataViewTextRenderer
+
+#endif // _WX_DVRENDERERS_H_
+
#include "wx/scrolwin.h"
#include "wx/icon.h"
-// ---------------------------------------------------------
-// classes
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl;
class WXDLLIMPEXP_FWD_ADV wxDataViewMainWindow;
class WXDLLIMPEXP_FWD_ADV wxDataViewHeaderWindow;
-// ---------------------------------------------------------
-// wxDataViewRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
-{
-public:
- wxDataViewRenderer( const wxString &varianttype,
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
- virtual ~wxDataViewRenderer();
-
- // these methods are used to draw the cell contents, Render() doesn't care
- // about the attributes while RenderWithAttr() does -- override it if you
- // want to take the attributes defined for this cell into account, otherwise
- // overriding Render() is enough
- virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
-
- // NB: RenderWithAttr() also has more standard parameter order and types
- virtual bool
- RenderWithAttr(wxDC& dc,
- const wxRect& rect,
- int align, // combination of horizontal and vertical
- const wxDataViewItemAttr *attr, // may be NULL if none
- int state);
-
- virtual wxSize GetSize() const = 0;
-
- virtual void SetAlignment( int align );
- virtual int GetAlignment() const;
-
- virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE)
- { m_ellipsizeMode = mode; }
- virtual wxEllipsizeMode GetEllipsizeMode() const
- { return m_ellipsizeMode; }
-
- virtual void SetMode( wxDataViewCellMode mode )
- { m_mode=mode; }
- virtual wxDataViewCellMode GetMode() const
- { return m_mode; }
-
- virtual bool Activate( wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model),
- const wxDataViewItem & WXUNUSED(item),
- unsigned int WXUNUSED(col) )
- { return false; }
-
- virtual bool LeftClick( wxPoint WXUNUSED(cursor),
- wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model),
- const wxDataViewItem & WXUNUSED(item),
- unsigned int WXUNUSED(col) )
- { return false; }
- virtual bool StartDrag( wxPoint WXUNUSED(cursor),
- wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model),
- const wxDataViewItem & WXUNUSED(item),
- unsigned int WXUNUSED(col) )
- { return false; }
-
- // Create DC on request
- virtual wxDC *GetDC();
-
- // implementation
- int CalculateAlignment() const;
-
-protected:
- // This is just a convenience for the derived classes overriding
- // RenderWithAttr() to avoid repeating the same wxFAIL_MSG() in all of them
- bool DummyRender(wxRect WXUNUSED(cell),
- wxDC * WXUNUSED(dc),
- int WXUNUSED(state))
- {
- wxFAIL_MSG("shouldn't be called at all, use RenderWithAttr() instead");
-
- return false;
- }
-
-private:
- wxDC *m_dc;
- int m_align;
- wxDataViewCellMode m_mode;
-
- wxEllipsizeMode m_ellipsizeMode;
-
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewCustomRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- // Draw the text using the provided attributes
- void RenderText(wxDC& dc,
- const wxRect& rect,
- int align,
- const wxString& text,
- const wxDataViewItemAttr *attr, // may be NULL if none
- int state,
- int xoffset = 0);
-
- // Overload using standard attributes
- void RenderText(const wxString& text,
- int xoffset,
- wxRect cell,
- wxDC *dc,
- int state)
- {
- RenderText(*dc, cell, wxALIGN_NOT, text, NULL, state, xoffset);
- }
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
-};
-
-
-// ---------------------------------------------------------
-// wxDataViewTextRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewTextRenderer( const wxString &varianttype = wxT("string"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
- virtual bool RenderWithAttr(wxDC& dc,
- const wxRect& rect,
- int align,
- const wxDataViewItemAttr *attr,
- int state);
- virtual bool Render(wxRect cell, wxDC *dc, int state)
- {
- return DummyRender(cell, dc, state);
- }
-
- wxSize GetSize() const;
-
- // in-place editing
- virtual bool HasEditorCtrl() const;
- virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
- const wxVariant &value );
- virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
-
-protected:
- wxString m_text;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewBitmapRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
- bool Render( wxRect cell, wxDC *dc, int state );
- wxSize GetSize() const;
-
-private:
- wxIcon m_icon;
- wxBitmap m_bitmap;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewToggleRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
- bool Render( wxRect cell, wxDC *dc, int state );
- bool Activate( wxRect cell, wxDataViewModel *model, const wxDataViewItem & item,
- unsigned int col );
- wxSize GetSize() const;
-
-private:
- bool m_toggle;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewProgressRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
- const wxString &varianttype = wxT("long"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant& value ) const;
-
- virtual bool RenderWithAttr(wxDC& dc,
- const wxRect& rect,
- int align,
- const wxDataViewItemAttr *attr,
- int state);
- virtual bool Render(wxRect cell, wxDC *dc, int state)
- {
- return DummyRender(cell, dc, state);
- }
- virtual wxSize GetSize() const;
-
-private:
- wxString m_label;
- int m_value;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewIconTextRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
- virtual bool RenderWithAttr(wxDC& dc,
- const wxRect& rect,
- int align,
- const wxDataViewItemAttr *attr,
- int state);
- virtual bool Render(wxRect cell, wxDC *dc, int state)
- {
- return DummyRender(cell, dc, state);
- }
- virtual wxSize GetSize() const;
-
- virtual bool HasEditorCtrl() const { return true; }
- virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
- const wxVariant &value );
- virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
-
-private:
- wxDataViewIconText m_value;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewDateRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant& value ) const;
-
- virtual bool Render( wxRect cell, wxDC *dc, int state );
- virtual wxSize GetSize() const;
- virtual bool Activate( wxRect cell,
- wxDataViewModel *model,
- const wxDataViewItem& item,
- unsigned int col );
-
-private:
- wxDateTime m_date;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
-};
-
// ---------------------------------------------------------
// wxDataViewColumn
// ---------------------------------------------------------
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/generic/dvrenderer.h
+// Purpose: wxDataViewRenderer for generic wxDataViewCtrl implementation
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-07 (extracted from wx/generic/dataview.h)
+// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_DVRENDERER_H_
+#define _WX_GENERIC_DVRENDERER_H_
+
+// ----------------------------------------------------------------------------
+// wxDataViewRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewCustomRendererBase
+{
+public:
+ wxDataViewRenderer( const wxString &varianttype,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+ virtual ~wxDataViewRenderer();
+
+ // these methods are used to draw the cell contents, Render() doesn't care
+ // about the attributes while RenderWithAttr() does -- override it if you
+ // want to take the attributes defined for this cell into account, otherwise
+ // overriding Render() is enough
+ virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
+
+ // NB: RenderWithAttr() also has more standard parameter order and types
+ virtual bool
+ RenderWithAttr(wxDC& dc,
+ const wxRect& rect,
+ int align, // combination of horizontal and vertical
+ const wxDataViewItemAttr *attr, // may be NULL if none
+ int state);
+
+ virtual wxSize GetSize() const = 0;
+ virtual wxDC *GetDC();
+
+ // Draw the text using the provided attributes
+ void RenderText(wxDC& dc,
+ const wxRect& rect,
+ int align,
+ const wxString& text,
+ const wxDataViewItemAttr *attr, // may be NULL if none
+ int state,
+ int xoffset = 0);
+
+ // Overload using standard attributes
+ void RenderText(const wxString& text,
+ int xoffset,
+ wxRect cell,
+ wxDC *dc,
+ int state)
+ {
+ RenderText(*dc, cell, wxALIGN_NOT, text, NULL, state, xoffset);
+ }
+
+
+ virtual void SetAlignment( int align );
+ virtual int GetAlignment() const;
+
+ virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE)
+ { m_ellipsizeMode = mode; }
+ virtual wxEllipsizeMode GetEllipsizeMode() const
+ { return m_ellipsizeMode; }
+
+ virtual void SetMode( wxDataViewCellMode mode )
+ { m_mode = mode; }
+ virtual wxDataViewCellMode GetMode() const
+ { return m_mode; }
+
+ // implementation
+ int CalculateAlignment() const;
+
+ // this is a replacement for dynamic_cast<wxDataViewCustomRenderer> in the
+ // code checking whether the renderer is interested in mouse events, it's
+ // overridden in wxDataViewCustomRenderer to return the object itself but
+ // intentionally returns NULL for all the other renderer classes as the
+ // user should _not_ be able to override Activate/LeftClick() when deriving
+ // from them for consistency with the other ports and while we can't
+ // prevent this from working at compile-time because all renderer are
+ // custom renderers in the generic implementation, we at least make sure
+ // that it doesn't work at run-time because Activate/LeftClick() would
+ // never be called
+ virtual wxDataViewCustomRenderer *WXGetAsCustom() { return NULL; }
+
+protected:
+ // This is just a convenience for the derived classes overriding
+ // RenderWithAttr() to avoid repeating the same wxFAIL_MSG() in all of them
+ bool DummyRender(wxRect WXUNUSED(cell),
+ wxDC * WXUNUSED(dc),
+ int WXUNUSED(state))
+ {
+ wxFAIL_MSG("shouldn't be called at all, use RenderWithAttr() instead");
+
+ return false;
+ }
+
+private:
+ int m_align;
+ wxDataViewCellMode m_mode;
+
+ wxEllipsizeMode m_ellipsizeMode;
+
+ wxDC *m_dc;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
+};
+
+#endif // _WX_GENERIC_DVRENDERER_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// 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)
+// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
+// 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:
+ wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual wxDataViewCustomRenderer *WXGetAsCustom() { return this; }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
+};
+
+
+// ---------------------------------------------------------
+// wxDataViewTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewTextRenderer( const wxString &varianttype = wxT("string"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual bool RenderWithAttr(wxDC& dc,
+ const wxRect& rect,
+ int align,
+ const wxDataViewItemAttr *attr,
+ int state);
+ virtual bool Render(wxRect cell, wxDC *dc, int state)
+ {
+ return DummyRender(cell, dc, state);
+ }
+
+ wxSize GetSize() const;
+
+ // in-place editing
+ virtual bool HasEditorCtrl() const;
+ virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
+ const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
+
+protected:
+ wxString m_text;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewBitmapRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ bool Render( wxRect cell, wxDC *dc, int state );
+ wxSize GetSize() const;
+
+private:
+ wxIcon m_icon;
+ wxBitmap m_bitmap;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewToggleRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ bool Render( wxRect cell, wxDC *dc, int state );
+ bool Activate( wxRect cell, wxDataViewModel *model, const wxDataViewItem & item,
+ unsigned int col );
+ wxSize GetSize() const;
+
+private:
+ bool m_toggle;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewProgressRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
+ const wxString &varianttype = wxT("long"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant& value ) const;
+
+ virtual bool RenderWithAttr(wxDC& dc,
+ const wxRect& rect,
+ int align,
+ const wxDataViewItemAttr *attr,
+ int state);
+ virtual bool Render(wxRect cell, wxDC *dc, int state)
+ {
+ return DummyRender(cell, dc, state);
+ }
+ virtual wxSize GetSize() const;
+
+private:
+ wxString m_label;
+ int m_value;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewIconTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual bool RenderWithAttr(wxDC& dc,
+ const wxRect& rect,
+ int align,
+ const wxDataViewItemAttr *attr,
+ int state);
+ virtual bool Render(wxRect cell, wxDC *dc, int state)
+ {
+ return DummyRender(cell, dc, state);
+ }
+ virtual wxSize GetSize() const;
+
+ virtual bool HasEditorCtrl() const { return true; }
+ virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
+ const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
+
+private:
+ wxDataViewIconText m_value;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewDateRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"),
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant& value ) const;
+
+ virtual bool Render( wxRect cell, wxDC *dc, int state );
+ virtual wxSize GetSize() const;
+ virtual bool Activate( wxRect cell,
+ wxDataViewModel *model,
+ const wxDataViewItem& item,
+ unsigned int col );
+
+private:
+ wxDateTime m_date;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
+};
+
+
+#endif // _WX_GENERIC_DVRENDERERS_H_
+
#include "wx/list.h"
-// ---------------------------------------------------------
-// classes
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl;
class WXDLLIMPEXP_FWD_ADV wxDataViewCtrlInternal;
-typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
-
-// ---------------------------------------------------------
-// wxDataViewRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
-{
-public:
- wxDataViewRenderer( const wxString &varianttype,
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- virtual void SetMode( wxDataViewCellMode mode );
- virtual wxDataViewCellMode GetMode() const;
-
- virtual void SetAlignment( int align );
- virtual int GetAlignment() const;
-
- virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
- virtual wxEllipsizeMode GetEllipsizeMode() const;
-
- // GTK-specific implementation
- // ---------------------------
-
- // pack the GTK cell renderers used by this renderer to the given column
- //
- // by default only a single m_renderer is used but some renderers use more
- // than one GTK cell renderer
- virtual void GtkPackIntoColumn(GtkTreeViewColumn *column);
-
- // called when the cell value was edited by user with the new value
- //
- // it validates the new value and notifies the model about the change by
- // calling GtkOnCellChanged() if it was accepted
- void GtkOnTextEdited(const gchar *itempath, const wxString& value);
-
- GtkCellRenderer* GetGtkHandle() { return m_renderer; }
- void GtkInitHandlers();
- void GtkUpdateAlignment();
-
- bool GtkIsUsingDefaultAttrs() const { return m_usingDefaultAttrs; }
- void GtkSetUsingDefaultAttrs(bool def) { m_usingDefaultAttrs = def; }
-
-protected:
- virtual void GtkOnCellChanged(const wxVariant& value,
- const wxDataViewItem& item,
- unsigned col);
-
-
- GtkCellRenderer *m_renderer;
- int m_alignment;
-
- // true if we hadn't changed any visual attributes or restored them since
- // doing this
- bool m_usingDefaultAttrs;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewTextRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewTextRenderer( const wxString &varianttype = wxT("string"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- virtual bool SetValue( const wxVariant &value )
- {
- return SetTextValue(value);
- }
-
- virtual bool GetValue( wxVariant &value ) const
- {
- wxString str;
- if ( !GetTextValue(str) )
- return false;
-
- value = str;
-
- return true;
- }
-
- virtual void SetAlignment( int align );
-
-protected:
- // implementation of Set/GetValue()
- bool SetTextValue(const wxString& str);
- bool GetTextValue(wxString& str) const;
-
-
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewBitmapRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewToggleRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewCustomRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT,
- bool no_init = false );
- virtual ~wxDataViewCustomRenderer();
-
-
- virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
-
- void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state );
-
- virtual wxSize GetSize() const = 0;
-
- virtual bool Activate( wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
- { return false; }
-
- virtual bool LeftClick( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
- { return false; }
- virtual bool StartDrag( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
- { return false; }
-
- // Create DC on request
- virtual wxDC *GetDC();
-
-
-protected:
-
- bool Init(wxDataViewCellMode mode, int align);
-
-private:
- wxDC *m_dc;
-
-public:
- // Internal, temporary for RenderText.
- GtkCellRenderer *m_text_renderer;
- GdkWindow *window;
- GtkWidget *widget;
- void *background_area;
- void *cell_area;
- void *expose_area;
- int flags;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewProgressRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
- const wxString &varianttype = wxT("long"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
- virtual ~wxDataViewProgressRenderer();
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
- virtual bool Render( wxRect cell, wxDC *dc, int state );
- virtual wxSize GetSize() const;
-
-private:
- wxString m_label;
- int m_value;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewIconTextRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewTextRenderer
-{
-public:
- wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
- int align = wxDVR_DEFAULT_ALIGNMENT );
- virtual ~wxDataViewIconTextRenderer();
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
- virtual void GtkPackIntoColumn(GtkTreeViewColumn *column);
-
-protected:
- virtual void GtkOnCellChanged(const wxVariant& value,
- const wxDataViewItem& item,
- unsigned col);
-
-private:
- wxDataViewIconText m_value;
-
- // we use the base class m_renderer for the text and this one for the icon
- GtkCellRenderer *m_rendererIcon;
-
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewDateRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer
-{
-public:
- wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"),
- wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
- int align = wxDVR_DEFAULT_ALIGNMENT );
-
- bool SetValue( const wxVariant &value );
- bool GetValue( wxVariant &value ) const;
-
- virtual bool Render( wxRect cell, wxDC *dc, int state );
- virtual wxSize GetSize() const;
- virtual bool Activate( wxRect cell,
- wxDataViewModel *model, const wxDataViewItem &item, unsigned int col );
-
-private:
- wxDateTime m_date;
-
-protected:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
-};
-
-// -------------------------------------
-// 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;
-};
-
// ---------------------------------------------------------
// wxDataViewColumn
// ---------------------------------------------------------
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dvrenderer.h
+// Purpose: wxDataViewRenderer for GTK wxDataViewCtrl implementation
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-07 (extracted from wx/gtk/dataview.h)
+// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_DVRENDERER_H_
+#define _WX_GTK_DVRENDERER_H_
+
+typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
+
+// ----------------------------------------------------------------------------
+// wxDataViewRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
+{
+public:
+ wxDataViewRenderer( const wxString &varianttype,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual void SetMode( wxDataViewCellMode mode );
+ virtual wxDataViewCellMode GetMode() const;
+
+ virtual void SetAlignment( int align );
+ virtual int GetAlignment() const;
+
+ virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
+ virtual wxEllipsizeMode GetEllipsizeMode() const;
+
+ // GTK-specific implementation
+ // ---------------------------
+
+ // pack the GTK cell renderers used by this renderer to the given column
+ //
+ // by default only a single m_renderer is used but some renderers use more
+ // than one GTK cell renderer
+ virtual void GtkPackIntoColumn(GtkTreeViewColumn *column);
+
+ // called when the cell value was edited by user with the new value
+ //
+ // it validates the new value and notifies the model about the change by
+ // calling GtkOnCellChanged() if it was accepted
+ void GtkOnTextEdited(const gchar *itempath, const wxString& value);
+
+ GtkCellRenderer* GetGtkHandle() { return m_renderer; }
+ void GtkInitHandlers();
+ void GtkUpdateAlignment();
+
+ bool GtkIsUsingDefaultAttrs() const { return m_usingDefaultAttrs; }
+ void GtkSetUsingDefaultAttrs(bool def) { m_usingDefaultAttrs = def; }
+
+protected:
+ virtual void GtkOnCellChanged(const wxVariant& value,
+ const wxDataViewItem& item,
+ unsigned col);
+
+
+ GtkCellRenderer *m_renderer;
+ int m_alignment;
+
+ // true if we hadn't changed any visual attributes or restored them since
+ // doing this
+ bool m_usingDefaultAttrs;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
+};
+
+#endif // _WX_GTK_DVRENDERER_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/dvrenderers.h
+// Purpose: All GTK wxDataViewCtrl renderer classes
+// Author: Robert Roebling, Vadim Zeitlin
+// Created: 2009-11-07 (extracted from wx/gtk/dataview.h)
+// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
+// Copyright: (c) 2006 Robert Roebling
+// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_DVRENDERERS_H_
+#define _WX_GTK_DVRENDERERS_H_
+
+// ---------------------------------------------------------
+// wxDataViewTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewTextRenderer( const wxString &varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual bool SetValue( const wxVariant &value )
+ {
+ return SetTextValue(value);
+ }
+
+ virtual bool GetValue( wxVariant &value ) const
+ {
+ wxString str;
+ if ( !GetTextValue(str) )
+ return false;
+
+ value = str;
+
+ return true;
+ }
+
+ virtual void SetAlignment( int align );
+
+protected:
+ // implementation of Set/GetValue()
+ bool SetTextValue(const wxString& str);
+ bool GetTextValue(wxString& str) const;
+
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewBitmapRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewBitmapRenderer( const wxString &varianttype = "wxBitmap",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewToggleRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewToggleRenderer( const wxString &varianttype = "bool",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewCustomRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewCustomRendererBase
+{
+public:
+ wxDataViewCustomRenderer( const wxString &varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT,
+ bool no_init = false );
+ virtual ~wxDataViewCustomRenderer();
+
+
+ virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
+
+ void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state );
+
+ virtual wxSize GetSize() const = 0;
+
+ // Create DC on request
+ virtual wxDC *GetDC();
+
+
+protected:
+
+ bool Init(wxDataViewCellMode mode, int align);
+
+private:
+ wxDC *m_dc;
+
+public:
+ // Internal, temporary for RenderText.
+ GtkCellRenderer *m_text_renderer;
+ GdkWindow *window;
+ GtkWidget *widget;
+ void *background_area;
+ void *cell_area;
+ void *expose_area;
+ int flags;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewProgressRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
+ const wxString &varianttype = "long",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+ virtual ~wxDataViewProgressRenderer();
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual bool Render( wxRect cell, wxDC *dc, int state );
+ virtual wxSize GetSize() const;
+
+private:
+ wxString m_label;
+ int m_value;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewIconTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewTextRenderer
+{
+public:
+ wxDataViewIconTextRenderer( const wxString &varianttype = "wxDataViewIconText",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+ virtual ~wxDataViewIconTextRenderer();
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual void GtkPackIntoColumn(GtkTreeViewColumn *column);
+
+protected:
+ virtual void GtkOnCellChanged(const wxVariant& value,
+ const wxDataViewItem& item,
+ unsigned col);
+
+private:
+ wxDataViewIconText m_value;
+
+ // we use the base class m_renderer for the text and this one for the icon
+ GtkCellRenderer *m_rendererIcon;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewDateRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer
+{
+public:
+ wxDataViewDateRenderer( const wxString &varianttype = "datetime",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
+ int align = wxDVR_DEFAULT_ALIGNMENT );
+
+ bool SetValue( const wxVariant &value );
+ bool GetValue( wxVariant &value ) const;
+
+ virtual bool Render( wxRect cell, wxDC *dc, int state );
+ virtual wxSize GetSize() const;
+ virtual bool Activate( wxRect cell,
+ wxDataViewModel *model,
+ const wxDataViewItem &item,
+ unsigned int col );
+
+private:
+ wxDateTime m_date;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
+};
+
+// -------------------------------------
+// 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;
+};
+
+#endif // _WX_GTK_DVRENDERERS_H_
+
-
/////////////////////////////////////////////////////////////////////////////
// Name: wx/osx/dataview.h
// Purpose: wxDataViewCtrl native implementation header for OSX
// Class declarations to mask native types
// --------------------------------------------------------
class wxDataViewColumnNativeData; // class storing environment dependent data for the native implementation
-class wxDataViewRendererNativeData; // class storing environment dependent data for the native renderer
class wxDataViewWidgetImpl; // class used as a common interface for carbon and cocoa implementation
-// ---------------------------------------------------------
-// wxDataViewRenderer
-// ---------------------------------------------------------
-class WXDLLIMPEXP_ADV wxDataViewRenderer : public wxDataViewRendererBase
-{
-public:
-//
-// constructors / destructor
-//
- wxDataViewRenderer(wxString const& varianttype, wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
-
- virtual ~wxDataViewRenderer();
-
-//
-// inherited methods from wxDataViewRendererBase
-//
- virtual int GetAlignment() const
- {
- return m_alignment;
- }
- virtual wxDataViewCellMode GetMode() const
- {
- return m_mode;
- }
- virtual bool GetValue(wxVariant& value) const
- {
- value = m_value;
- return true;
- }
-
- virtual void SetAlignment(int align); // carbon: is always identical to the header alignment;
- // cocoa: cell alignment is independent from header alignment
- virtual void SetMode(wxDataViewCellMode mode);
- virtual bool SetValue(wxVariant const& newValue)
- {
- m_value = newValue;
- return true;
- }
-
- virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
- virtual wxEllipsizeMode GetEllipsizeMode() const;
-
-//
-// implementation
-//
- wxVariant const& GetValue() const
- {
- return m_value;
- }
-
- wxDataViewRendererNativeData* GetNativeData() const
- {
- return m_NativeDataPtr;
- }
-
- virtual bool MacRender() = 0; // a call to the native data browser function to render the data;
- // returns true if the data value could be rendered, false otherwise
-
- void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr);
-
-
-#if wxOSX_USE_COCOA
- // called when a value was edited by user
- virtual void OSXOnCellChanged(NSObject *value,
- const wxDataViewItem& item,
- unsigned col);
-#endif // Cocoa
-
-private:
-//
-// variables
-//
- int m_alignment; // contains the alignment flags
-
- wxDataViewCellMode m_mode; // storing the mode that determines how the cell is going to be shown
-
- wxDataViewRendererNativeData* m_NativeDataPtr; // data used by implementation of the native renderer
-
- wxVariant m_value; // value that is going to be rendered
-
-//
-// wxWidget internal stuff
-//
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewCustomRenderer
-// ---------------------------------------------------------
-class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
-{
-public:
-//
-// constructors / destructor
-//
- wxDataViewCustomRenderer(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
-
- virtual ~wxDataViewCustomRenderer();
-
- void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state );
-
-//
-// methods handling render space
-//
- virtual wxSize GetSize() const = 0;
-
-//
-// methods handling user actions
-//
- virtual bool Render(wxRect cell, wxDC* dc, int state) = 0;
-
- virtual bool Activate( wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model),
- const wxDataViewItem & WXUNUSED(item),
- unsigned int WXUNUSED(col) )
- { return false; }
-
- virtual bool LeftClick( wxPoint WXUNUSED(cursor),
- wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model),
- const wxDataViewItem & WXUNUSED(item),
- unsigned int WXUNUSED(col) )
- { return false; }
-
- virtual bool StartDrag( wxPoint WXUNUSED(cursor),
- wxRect WXUNUSED(cell),
- wxDataViewModel *WXUNUSED(model),
- const wxDataViewItem & WXUNUSED(item),
- unsigned int WXUNUSED(col) )
- { return false; }
-
-//
-// device context handling
-//
- virtual wxDC* GetDC(); // creates a device context and keeps it
-
-//
-// implementation
-//
- virtual bool MacRender();
-
- void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
-
-protected:
-private:
-//
-// variables
-//
- wxControl* m_editorCtrlPtr; // pointer to an in-place editor control
-
- wxDC* m_DCPtr;
-
-//
-// wxWidget internal stuff
-//
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewTextRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
-{
-public:
-//
-// constructors / destructor
-//
- wxDataViewTextRenderer(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
-
-//
-// inherited functions from wxDataViewRenderer
-//
- virtual bool MacRender();
-
-#if wxOSX_USE_COCOA
- virtual void OSXOnCellChanged(NSObject *value,
- const wxDataViewItem& item,
- unsigned col);
-#endif // Cocoa
-
-private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewBitmapRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
-{
-public:
-//
-// constructors / destructor
-//
- wxDataViewBitmapRenderer(wxString const& varianttype=wxT("wxBitmap"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
-
-//
-// inherited functions from wxDataViewRenderer
-//
- virtual bool MacRender();
-
-protected:
-private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
-};
-
-#if !defined(wxUSE_GENERICDATAVIEWCTRL) && defined(__WXOSX_COCOA__)
-
-// -------------------------------------
-// wxDataViewChoiceRenderer
-// -------------------------------------
-class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewRenderer
-{
-public:
-//
-// constructors / destructor
-//
- wxDataViewChoiceRenderer(wxArrayString const& choices,
- wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
- int alignment = wxDVR_DEFAULT_ALIGNMENT );
-
-//
-// inherited functions from wxDataViewRenderer
-//
- virtual bool MacRender();
-
-//
-// implementation
-//
- wxString GetChoice(size_t index) const
- {
- return m_Choices[index];
- }
- wxArrayString const& GetChoices() const
- {
- return m_Choices;
- }
-
-private:
-//
-// variables
-//
- wxArrayString m_Choices;
-
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer)
-};
-
-#endif
-
-// ---------------------------------------------------------
-// wxDataViewIconTextRenderer
-// ---------------------------------------------------------
-class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewIconTextRenderer(wxString const& varianttype = wxT("wxDataViewIconText"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
-
-//
-// inherited functions from wxDataViewRenderer
-//
- virtual bool MacRender();
-
-#if wxOSX_USE_COCOA
- virtual void OSXOnCellChanged(NSObject *value,
- const wxDataViewItem& item,
- unsigned col);
-#endif // Cocoa
-
-protected:
-private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewToggleRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewToggleRenderer(wxString const& varianttype = wxT("bool"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
-
-//
-// inherited functions from wxDataViewRenderer
-//
- virtual bool MacRender();
-
-#if wxOSX_USE_COCOA
- virtual void OSXOnCellChanged(NSObject *value,
- const wxDataViewItem& item,
- unsigned col);
-#endif // Cocoa
-
-private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewProgressRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewProgressRenderer(wxString const& label = wxEmptyString, wxString const& varianttype=wxT("long"),
- wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
-
-//
-// inherited functions from wxDataViewRenderer
-//
- virtual bool MacRender();
-
-#if wxOSX_USE_COCOA
- virtual void OSXOnCellChanged(NSObject *value,
- const wxDataViewItem& item,
- unsigned col);
-#endif // Cocoa
-
-private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
-};
-
-// ---------------------------------------------------------
-// wxDataViewDateRenderer
-// ---------------------------------------------------------
-
-class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
-{
-public:
- wxDataViewDateRenderer(wxString const& varianttype=wxT("datetime"), wxDataViewCellMode mode=wxDATAVIEW_CELL_ACTIVATABLE, int align=wxDVR_DEFAULT_ALIGNMENT);
-
-//
-// inherited functions from wxDataViewRenderer
-//
- virtual bool MacRender();
-
-#if wxOSX_USE_COCOA
- virtual void OSXOnCellChanged(NSObject *value,
- const wxDataViewItem& item,
- unsigned col);
-#endif // Cocoa
-
-private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
-};
-
// ---------------------------------------------------------
// wxDataViewColumn
// ---------------------------------------------------------
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/osx/dvrenderer.h
+// Purpose: wxDataViewRenderer for OS X wxDataViewCtrl implementations
+// Author: Vadim Zeitlin
+// Created: 2009-11-07 (extracted from wx/osx/dataview.h)
+// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
+// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_OSX_DVRENDERER_H_
+#define _WX_OSX_DVRENDERER_H_
+
+class wxDataViewRendererNativeData;
+
+// ----------------------------------------------------------------------------
+// wxDataViewRenderer
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewRenderer : public wxDataViewRendererBase
+{
+public:
+ // constructors / destructor
+ // -------------------------
+
+ wxDataViewRenderer(const wxString& varianttype,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual ~wxDataViewRenderer();
+
+ // inherited methods from wxDataViewRendererBase
+ // ---------------------------------------------
+
+ virtual int GetAlignment() const
+ {
+ return m_alignment;
+ }
+ virtual wxDataViewCellMode GetMode() const
+ {
+ return m_mode;
+ }
+ virtual bool GetValue(wxVariant& value) const
+ {
+ value = m_value;
+ return true;
+ }
+
+ // NB: in Carbon this is always identical to the header alignment
+ virtual void SetAlignment(int align);
+ virtual void SetMode(wxDataViewCellMode mode);
+ virtual bool SetValue(const wxVariant& newValue)
+ {
+ m_value = newValue;
+ return true;
+ }
+
+ virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
+ virtual wxEllipsizeMode GetEllipsizeMode() const;
+
+ // implementation
+ // --------------
+
+ const wxVariant& GetValue() const
+ {
+ return m_value;
+ }
+
+ wxDataViewRendererNativeData* GetNativeData() const
+ {
+ return m_NativeDataPtr;
+ }
+
+ // a call to the native data browser function to render the data;
+ // returns true if the data value could be rendered, false otherwise
+ virtual bool MacRender() = 0;
+
+ void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr);
+
+
+#if wxOSX_USE_COCOA
+ // called when a value was edited by user
+ virtual void OSXOnCellChanged(NSObject *value,
+ const wxDataViewItem& item,
+ unsigned col);
+#endif // Cocoa
+
+private:
+ // contains the alignment flags
+ int m_alignment;
+
+ // storing the mode that determines how the cell is going to be shown
+ wxDataViewCellMode m_mode;
+
+ // data used by implementation of the native renderer
+ wxDataViewRendererNativeData* m_NativeDataPtr;
+
+ // value that is going to be rendered
+ wxVariant m_value;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
+};
+
+#endif // _WX_OSX_DVRENDERER_H_
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// 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)
+// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
+// 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:
+ wxDataViewCustomRenderer(const wxString& varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual ~wxDataViewCustomRenderer();
+
+ void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state );
+
+ virtual wxSize GetSize() const = 0;
+
+ virtual bool Render(wxRect cell, wxDC* dc, int state) = 0;
+
+
+ // implementation only
+ // -------------------
+
+ virtual bool MacRender();
+
+ virtual wxDC* GetDC(); // creates a device context and keeps it
+ 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;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewTextRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewTextRenderer(const wxString& varianttype = "string",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual bool MacRender();
+
+#if wxOSX_USE_COCOA
+ virtual void OSXOnCellChanged(NSObject *value,
+ const wxDataViewItem& item,
+ unsigned col);
+#endif // Cocoa
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewBitmapRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual bool MacRender();
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
+};
+
+#if wxOSX_USE_COCOA
+
+// -------------------------------------
+// wxDataViewChoiceRenderer
+// -------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewChoiceRenderer(const wxArrayString& choices,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual bool MacRender();
+
+ wxString GetChoice(size_t index) const { return m_choices[index]; }
+ const wxArrayString& GetChoices() const { return m_choices; }
+
+private:
+ wxArrayString m_choices;
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer)
+};
+
+#endif // wxOSX_USE_COCOA
+
+// ---------------------------------------------------------
+// wxDataViewIconTextRenderer
+// ---------------------------------------------------------
+class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual bool MacRender();
+
+#if wxOSX_USE_COCOA
+ virtual void OSXOnCellChanged(NSObject *value,
+ const wxDataViewItem& item,
+ unsigned col);
+#endif // Cocoa
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewToggleRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewToggleRenderer(const wxString& varianttype = "bool",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual bool MacRender();
+
+#if wxOSX_USE_COCOA
+ virtual void OSXOnCellChanged(NSObject *value,
+ const wxDataViewItem& item,
+ unsigned col);
+#endif // Cocoa
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewProgressRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
+ const wxString& varianttype = "long",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual bool MacRender();
+
+#if wxOSX_USE_COCOA
+ virtual void OSXOnCellChanged(NSObject *value,
+ const wxDataViewItem& item,
+ unsigned col);
+#endif // Cocoa
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
+};
+
+// ---------------------------------------------------------
+// wxDataViewDateRenderer
+// ---------------------------------------------------------
+
+class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
+{
+public:
+ wxDataViewDateRenderer(const wxString& varianttype = "datetime",
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
+ int align = wxDVR_DEFAULT_ALIGNMENT);
+
+ virtual bool MacRender();
+
+#if wxOSX_USE_COCOA
+ virtual void OSXOnCellChanged(NSObject *value,
+ const wxDataViewItem& item,
+ unsigned col);
+#endif // Cocoa
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
+};
+
+#endif // _WX_OSX_DVRENDERERS_H_
+
wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype,
wxDataViewCellMode mode,
int align) :
- wxDataViewRendererBase( varianttype, mode, align )
+ wxDataViewCustomRendererBase( varianttype, mode, align )
{
- m_dc = NULL;
m_align = align;
m_mode = mode;
m_ellipsizeMode = wxELLIPSIZE_MIDDLE;
+ m_dc = NULL;
}
wxDataViewRenderer::~wxDataViewRenderer()
{
- if (m_dc)
- delete m_dc;
+ delete m_dc;
+}
+
+wxDC *wxDataViewRenderer::GetDC()
+{
+ if (m_dc == NULL)
+ {
+ if (GetOwner() == NULL)
+ return NULL;
+ if (GetOwner()->GetOwner() == NULL)
+ return NULL;
+ m_dc = new wxClientDC( GetOwner()->GetOwner() );
+ }
+
+ return m_dc;
+}
+
+void wxDataViewRenderer::SetAlignment( int align )
+{
+ m_align=align;
+}
+
+int wxDataViewRenderer::GetAlignment() const
+{
+ return m_align;
+}
+
+int wxDataViewRenderer::CalculateAlignment() const
+{
+ if (m_align == wxDVR_DEFAULT_ALIGNMENT)
+ {
+ if (GetOwner() == NULL)
+ return wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL;
+
+ return GetOwner()->GetAlignment() | wxALIGN_CENTRE_VERTICAL;
+ }
+
+ return m_align;
}
bool
return Render(item_rect, &dc, state);
}
-wxDC *wxDataViewRenderer::GetDC()
-{
- if (m_dc == NULL)
- {
- if (GetOwner() == NULL)
- return NULL;
- if (GetOwner()->GetOwner() == NULL)
- return NULL;
- m_dc = new wxClientDC( GetOwner()->GetOwner() );
- }
-
- return m_dc;
-}
-
-void wxDataViewRenderer::SetAlignment( int align )
-{
- m_align=align;
-}
-
-int wxDataViewRenderer::GetAlignment() const
-{
- return m_align;
-}
-
-int wxDataViewRenderer::CalculateAlignment() const
-{
- if (m_align == wxDVR_DEFAULT_ALIGNMENT)
- {
- if (GetOwner() == NULL)
- return wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL;
-
- return GetOwner()->GetAlignment() | wxALIGN_CENTRE_VERTICAL;
- }
-
- return m_align;
-}
-
-// ---------------------------------------------------------
-// wxDataViewCustomRenderer
-// ---------------------------------------------------------
-
-IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer)
-
-wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype,
- wxDataViewCellMode mode, int align ) :
- wxDataViewRenderer( varianttype, mode, align )
-{
-}
-
void
-wxDataViewCustomRenderer::RenderText(wxDC& dc,
- const wxRect& rect,
- int align,
- const wxString& text,
- const wxDataViewItemAttr *attr,
- int state,
- int xoffset)
+wxDataViewRenderer::RenderText(wxDC& dc,
+ const wxRect& rect,
+ int align,
+ const wxString& text,
+ const wxDataViewItemAttr *attr,
+ int state,
+ int xoffset)
{
// override custom foreground with the standard one for the selected items
// because we currently don't allow changing the selection background and
rectText, align);
}
+// ---------------------------------------------------------
+// wxDataViewCustomRenderer
+// ---------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer)
+
+wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype,
+ wxDataViewCellMode mode, int align ) :
+ wxDataViewRenderer( varianttype, mode, align )
+{
+}
+
// ---------------------------------------------------------
// wxDataViewTextRenderer
// ---------------------------------------------------------
-IMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewCustomRenderer)
+IMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewRenderer)
wxDataViewTextRenderer::wxDataViewTextRenderer( const wxString &varianttype,
wxDataViewCellMode mode, int align ) :
- wxDataViewCustomRenderer( varianttype, mode, align )
+ wxDataViewRenderer( varianttype, mode, align )
{
}
// wxDataViewBitmapRenderer
// ---------------------------------------------------------
-IMPLEMENT_CLASS(wxDataViewBitmapRenderer, wxDataViewCustomRenderer)
+IMPLEMENT_CLASS(wxDataViewBitmapRenderer, wxDataViewRenderer)
wxDataViewBitmapRenderer::wxDataViewBitmapRenderer( const wxString &varianttype,
wxDataViewCellMode mode, int align ) :
- wxDataViewCustomRenderer( varianttype, mode, align )
+ wxDataViewRenderer( varianttype, mode, align )
{
}
// wxDataViewToggleRenderer
// ---------------------------------------------------------
-IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer, wxDataViewCustomRenderer)
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer, wxDataViewRenderer)
wxDataViewToggleRenderer::wxDataViewToggleRenderer( const wxString &varianttype,
wxDataViewCellMode mode, int align ) :
- wxDataViewCustomRenderer( varianttype, mode, align )
+ wxDataViewRenderer( varianttype, mode, align )
{
m_toggle = false;
}
// wxDataViewProgressRenderer
// ---------------------------------------------------------
-IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer, wxDataViewCustomRenderer)
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer, wxDataViewRenderer)
wxDataViewProgressRenderer::wxDataViewProgressRenderer( const wxString &label,
const wxString &varianttype, wxDataViewCellMode mode, int align ) :
- wxDataViewCustomRenderer( varianttype, mode, align )
+ wxDataViewRenderer( varianttype, mode, align )
{
m_label = label;
m_value = 0;
#endif // wxUSE_DATE_RENDERER_POPUP
-IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer, wxDataViewCustomRenderer)
+IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer, wxDataViewRenderer)
wxDataViewDateRenderer::wxDataViewDateRenderer( const wxString &varianttype,
wxDataViewCellMode mode, int align ) :
- wxDataViewCustomRenderer( varianttype, mode, align )
+ wxDataViewRenderer( varianttype, mode, align )
{
}
// wxDataViewIconTextRenderer
// ---------------------------------------------------------
-IMPLEMENT_CLASS(wxDataViewIconTextRenderer, wxDataViewCustomRenderer)
+IMPLEMENT_CLASS(wxDataViewIconTextRenderer, wxDataViewRenderer)
wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(
const wxString &varianttype, wxDataViewCellMode mode, int align ) :
- wxDataViewCustomRenderer( varianttype, mode, align )
+ wxDataViewRenderer( varianttype, mode, align )
{
SetMode(mode);
SetAlignment(align);
{
if ((!ignore_other_columns) && (cell->GetMode() == wxDATAVIEW_CELL_ACTIVATABLE))
{
- wxVariant value;
- model->GetValue( value, item, col->GetModelColumn() );
- cell->SetValue( value );
- wxRect cell_rect( xpos, GetLineStart( current ),
- col->GetWidth(), GetLineHeight( current ) );
- cell->Activate( cell_rect, model, item, col->GetModelColumn() );
+ if ( wxDataViewCustomRenderer *custom = cell->WXGetAsCustom() )
+ {
+ wxVariant value;
+ model->GetValue( value, item, col->GetModelColumn() );
+ custom->SetValue( value );
+ wxRect cell_rect( xpos, GetLineStart( current ),
+ col->GetWidth(), GetLineHeight( current ) );
+ custom->Activate( cell_rect, model, item, col->GetModelColumn() );
+ }
}
else
{
// Call LeftClick after everything else as under GTK+
if (cell->GetMode() & wxDATAVIEW_CELL_ACTIVATABLE)
{
- // notify cell about right click
- wxVariant value;
- model->GetValue( value, item, col->GetModelColumn() );
- cell->SetValue( value );
- wxRect cell_rect( xpos, GetLineStart( current ),
- col->GetWidth(), GetLineHeight( current ) );
- /* ignore ret */ cell->LeftClick( event.GetPosition(), cell_rect,
- model, item, col->GetModelColumn());
+ if ( wxDataViewCustomRenderer *custom = cell->WXGetAsCustom() )
+ {
+ // notify cell about click
+ wxVariant value;
+ model->GetValue( value, item, col->GetModelColumn() );
+ custom->SetValue( value );
+ wxRect cell_rect( xpos, GetLineStart( current ),
+ col->GetWidth(), GetLineHeight( current ) );
+ /* ignore ret */ custom->LeftClick( event.GetPosition(), cell_rect,
+ model, item, col->GetModelColumn());
+ }
}
}
}
IMPLEMENT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer)
wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype,
- wxDataViewCellMode mode, int align,
- bool no_init ) :
- wxDataViewRenderer( varianttype, mode, align )
+ wxDataViewCellMode mode,
+ int align,
+ bool no_init )
+ : wxDataViewCustomRendererBase( varianttype, mode, align )
{
m_dc = NULL;
m_text_renderer = NULL;
// wxDataViewCustomRenderer
// ---------------------------------------------------------
wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align)
- :wxDataViewRenderer(varianttype,mode,align), m_editorCtrlPtr(NULL), m_DCPtr(NULL)
+ :wxDataViewCustomRendererBase(varianttype,mode,align),
+ m_editorCtrlPtr(NULL),
+ m_DCPtr(NULL)
{
SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCustomType));
}
wxDataViewCustomRenderer::wxDataViewCustomRenderer(const wxString& varianttype,
wxDataViewCellMode mode,
int align)
- : wxDataViewRenderer(varianttype, mode, align),
+ : wxDataViewCustomRendererBase(varianttype, mode, align),
m_editorCtrlPtr(NULL),
m_DCPtr(NULL)
{
wxDataViewChoiceRenderer::wxDataViewChoiceRenderer(const wxArrayString& choices,
wxDataViewCellMode mode,
int alignment)
- : wxDataViewRenderer(wxT("string"),mode,alignment), m_Choices(choices)
+ : wxDataViewRenderer(wxT("string"), mode, alignment),
+ m_choices(choices)
{
NSPopUpButtonCell* cell;