dvrenderers.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/dvrenderers.h
  3. // Purpose: All OS X wxDataViewCtrl renderer classes
  4. // Author: Vadim Zeitlin
  5. // Created: 2009-11-07 (extracted from wx/osx/dataview.h)
  6. // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_OSX_DVRENDERERS_H_
  10. #define _WX_OSX_DVRENDERERS_H_
  11. // ---------------------------------------------------------
  12. // wxDataViewCustomRenderer
  13. // ---------------------------------------------------------
  14. class WXDLLIMPEXP_ADV wxDataViewCustomRenderer : public wxDataViewCustomRendererBase
  15. {
  16. public:
  17. wxDataViewCustomRenderer(const wxString& varianttype = "string",
  18. wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
  19. int align = wxDVR_DEFAULT_ALIGNMENT);
  20. virtual ~wxDataViewCustomRenderer();
  21. // implementation only
  22. // -------------------
  23. virtual bool MacRender();
  24. #if wxOSX_USE_COCOA
  25. virtual void OSXApplyAttr(const wxDataViewItemAttr& attr);
  26. #endif // Cocoa
  27. virtual wxDC* GetDC(); // creates a device context and keeps it
  28. void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
  29. private:
  30. wxControl* m_editorCtrlPtr; // pointer to an in-place editor control
  31. wxDC* m_DCPtr;
  32. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
  33. };
  34. // ---------------------------------------------------------
  35. // wxDataViewTextRenderer
  36. // ---------------------------------------------------------
  37. class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
  38. {
  39. public:
  40. wxDataViewTextRenderer(const wxString& varianttype = "string",
  41. wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
  42. int align = wxDVR_DEFAULT_ALIGNMENT);
  43. virtual bool MacRender();
  44. #if wxOSX_USE_COCOA
  45. virtual void OSXOnCellChanged(NSObject *value,
  46. const wxDataViewItem& item,
  47. unsigned col);
  48. #endif // Cocoa
  49. private:
  50. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
  51. };
  52. // ---------------------------------------------------------
  53. // wxDataViewBitmapRenderer
  54. // ---------------------------------------------------------
  55. class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
  56. {
  57. public:
  58. wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap",
  59. wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
  60. int align = wxDVR_DEFAULT_ALIGNMENT);
  61. virtual bool MacRender();
  62. private:
  63. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer)
  64. };
  65. #if wxOSX_USE_COCOA
  66. // -------------------------------------
  67. // wxDataViewChoiceRenderer
  68. // -------------------------------------
  69. class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewRenderer
  70. {
  71. public:
  72. wxDataViewChoiceRenderer(const wxArrayString& choices,
  73. wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
  74. int alignment = wxDVR_DEFAULT_ALIGNMENT );
  75. virtual bool MacRender();
  76. wxString GetChoice(size_t index) const { return m_choices[index]; }
  77. const wxArrayString& GetChoices() const { return m_choices; }
  78. #if wxOSX_USE_COCOA
  79. virtual void OSXOnCellChanged(NSObject *value,
  80. const wxDataViewItem& item,
  81. unsigned col);
  82. #endif // Cocoa
  83. private:
  84. wxArrayString m_choices;
  85. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer)
  86. };
  87. #endif // wxOSX_USE_COCOA
  88. // ---------------------------------------------------------
  89. // wxDataViewIconTextRenderer
  90. // ---------------------------------------------------------
  91. class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer
  92. {
  93. public:
  94. wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText",
  95. wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
  96. int align = wxDVR_DEFAULT_ALIGNMENT);
  97. virtual bool MacRender();
  98. #if wxOSX_USE_COCOA
  99. virtual void OSXOnCellChanged(NSObject *value,
  100. const wxDataViewItem& item,
  101. unsigned col);
  102. #endif // Cocoa
  103. private:
  104. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
  105. };
  106. // ---------------------------------------------------------
  107. // wxDataViewToggleRenderer
  108. // ---------------------------------------------------------
  109. class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
  110. {
  111. public:
  112. wxDataViewToggleRenderer(const wxString& varianttype = "bool",
  113. wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
  114. int align = wxDVR_DEFAULT_ALIGNMENT);
  115. virtual bool MacRender();
  116. #if wxOSX_USE_COCOA
  117. virtual void OSXOnCellChanged(NSObject *value,
  118. const wxDataViewItem& item,
  119. unsigned col);
  120. #endif // Cocoa
  121. private:
  122. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer)
  123. };
  124. // ---------------------------------------------------------
  125. // wxDataViewProgressRenderer
  126. // ---------------------------------------------------------
  127. class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer
  128. {
  129. public:
  130. wxDataViewProgressRenderer(const wxString& label = wxEmptyString,
  131. const wxString& varianttype = "long",
  132. wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
  133. int align = wxDVR_DEFAULT_ALIGNMENT);
  134. virtual bool MacRender();
  135. #if wxOSX_USE_COCOA
  136. virtual void OSXOnCellChanged(NSObject *value,
  137. const wxDataViewItem& item,
  138. unsigned col);
  139. #endif // Cocoa
  140. private:
  141. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer)
  142. };
  143. // ---------------------------------------------------------
  144. // wxDataViewDateRenderer
  145. // ---------------------------------------------------------
  146. class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
  147. {
  148. public:
  149. wxDataViewDateRenderer(const wxString& varianttype = "datetime",
  150. wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
  151. int align = wxDVR_DEFAULT_ALIGNMENT);
  152. virtual bool MacRender();
  153. #if wxOSX_USE_COCOA
  154. virtual void OSXOnCellChanged(NSObject *value,
  155. const wxDataViewItem& item,
  156. unsigned col);
  157. #endif // Cocoa
  158. private:
  159. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
  160. };
  161. #endif // _WX_OSX_DVRENDERERS_H_