Make wxDataViewCheckIconTextRenderer class public
Export this class, which was only used internally by wxTreeListCtrl before, so that user code can use it for its own columns with custom wxDataViewCtrl models.
This commit is contained in:
@@ -77,6 +77,32 @@ private:
|
||||
|
||||
DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewCheckIconText: value class used by wxDataViewCheckIconTextRenderer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxDataViewCheckIconText : public wxDataViewIconText
|
||||
{
|
||||
public:
|
||||
wxDataViewCheckIconText(const wxString& text = wxString(),
|
||||
const wxIcon& icon = wxNullIcon,
|
||||
wxCheckBoxState checkedState = wxCHK_UNDETERMINED)
|
||||
: wxDataViewIconText(text, icon),
|
||||
m_checkedState(checkedState)
|
||||
{
|
||||
}
|
||||
|
||||
wxCheckBoxState GetCheckedState() const { return m_checkedState; }
|
||||
void SetCheckedState(wxCheckBoxState state) { m_checkedState = state; }
|
||||
|
||||
private:
|
||||
wxCheckBoxState m_checkedState;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxDataViewCheckIconText);
|
||||
};
|
||||
|
||||
DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewCheckIconText, WXDLLIMPEXP_ADV)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewRendererBase
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -509,6 +535,61 @@ typedef wxDataViewTextRenderer wxDataViewDateRenderer;
|
||||
|
||||
#endif // generic or GTK+ versions
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewCheckIconTextRenderer: 3-state checkbox + text + optional icon
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewCheckIconTextRenderer
|
||||
: public wxDataViewCustomRenderer
|
||||
{
|
||||
public:
|
||||
static wxString GetDefaultType() { return wxS("wxDataViewCheckIconText"); }
|
||||
|
||||
explicit wxDataViewCheckIconTextRenderer
|
||||
(
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
|
||||
int align = wxDVR_DEFAULT_ALIGNMENT
|
||||
);
|
||||
|
||||
// This renderer can always display the 3rd ("indeterminate") checkbox
|
||||
// state if the model contains cells with wxCHK_UNDETERMINED value, but it
|
||||
// doesn't allow the user to set it by default. Call this method to allow
|
||||
// this to happen.
|
||||
void Allow3rdStateForUser(bool allow = true);
|
||||
|
||||
virtual bool SetValue(const wxVariant& value) wxOVERRIDE;
|
||||
virtual bool GetValue(wxVariant& value) const wxOVERRIDE;
|
||||
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
virtual bool Render(wxRect cell, wxDC* dc, int state) wxOVERRIDE;
|
||||
virtual bool ActivateCell(const wxRect& cell,
|
||||
wxDataViewModel *model,
|
||||
const wxDataViewItem & item,
|
||||
unsigned int col,
|
||||
const wxMouseEvent *mouseEvent) wxOVERRIDE;
|
||||
|
||||
private:
|
||||
wxSize GetCheckSize() const;
|
||||
|
||||
// Just some arbitrary constants defining margins, in pixels.
|
||||
enum
|
||||
{
|
||||
MARGIN_CHECK_ICON = 3,
|
||||
MARGIN_ICON_TEXT = 4
|
||||
};
|
||||
|
||||
wxDataViewCheckIconText m_value;
|
||||
|
||||
bool m_allow3rdStateForUser;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCheckIconTextRenderer);
|
||||
};
|
||||
|
||||
|
||||
// this class is obsolete, its functionality was merged in
|
||||
// wxDataViewTextRenderer itself now, don't use it any more
|
||||
#define wxDataViewTextRendererAttr wxDataViewTextRenderer
|
||||
|
Reference in New Issue
Block a user