Merge branch 'dvc-type-check'
Various fixes to make wxDataViewCtrl behaviour more homogeneous across all ports.
This commit is contained in:
@@ -115,15 +115,21 @@ public:
|
||||
virtual bool SetValue(const wxVariant& value) = 0;
|
||||
virtual bool GetValue(wxVariant& value) const = 0;
|
||||
|
||||
virtual void SetAttr(const wxDataViewItemAttr& WXUNUSED(attr)) { }
|
||||
|
||||
virtual void SetEnabled(bool WXUNUSED(enabled)) { }
|
||||
|
||||
wxString GetVariantType() const { return m_variantType; }
|
||||
|
||||
// helper that calls SetValue and SetAttr:
|
||||
void PrepareForItem(const wxDataViewModel *model,
|
||||
const wxDataViewItem& item, unsigned column);
|
||||
// Prepare for rendering the value of the corresponding item in the given
|
||||
// column taken from the provided non-null model.
|
||||
//
|
||||
// Notice that the column must be the same as GetOwner()->GetModelColumn(),
|
||||
// it is only passed to this method because the existing code already has
|
||||
// it and should probably be removed in the future.
|
||||
//
|
||||
// Return true if this cell is non-empty or false otherwise (and also if
|
||||
// the model returned a value of the wrong, i.e. different from our
|
||||
// GetVariantType(), type, in which case a debug error is also logged).
|
||||
bool PrepareForItem(const wxDataViewModel *model,
|
||||
const wxDataViewItem& item,
|
||||
unsigned column);
|
||||
|
||||
// renderer properties:
|
||||
virtual void SetMode( wxDataViewCellMode mode ) = 0;
|
||||
@@ -175,9 +181,21 @@ public:
|
||||
int GetEffectiveAlignment() const;
|
||||
|
||||
protected:
|
||||
// These methods are called from PrepareForItem() and should do whatever is
|
||||
// needed for the current platform to ensure that the item is rendered
|
||||
// using the given attributes and enabled/disabled state.
|
||||
virtual void SetAttr(const wxDataViewItemAttr& attr) = 0;
|
||||
virtual void SetEnabled(bool enabled) = 0;
|
||||
|
||||
// Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
|
||||
void DestroyEditControl();
|
||||
|
||||
// Helper of PrepareForItem() also used in StartEditing(): returns the
|
||||
// value checking that its type matches our GetVariantType().
|
||||
wxVariant CheckedGetValue(const wxDataViewModel* model,
|
||||
const wxDataViewItem& item,
|
||||
unsigned column) const;
|
||||
|
||||
wxString m_variantType;
|
||||
wxDataViewColumn *m_owner;
|
||||
wxWeakRef<wxWindow> m_editorCtrl;
|
||||
@@ -292,7 +310,7 @@ public:
|
||||
|
||||
// Store the enabled state of the item so that it can be accessed from
|
||||
// Render() via GetEnabled() if needed.
|
||||
virtual void SetEnabled(bool enabled) { m_enabled = enabled; }
|
||||
virtual void SetEnabled(bool enabled);
|
||||
bool GetEnabled() const { return m_enabled; }
|
||||
|
||||
|
||||
|
@@ -55,37 +55,21 @@ public:
|
||||
void GtkInitHandlers();
|
||||
void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); }
|
||||
|
||||
// should be overridden to return true if the renderer supports properties
|
||||
// corresponding to wxDataViewItemAttr field, see wxGtkTreeCellDataFunc()
|
||||
// for details
|
||||
virtual bool GtkSupportsAttrs() const { return false; }
|
||||
|
||||
// if GtkSupportsAttrs() returns true, this function will be called to
|
||||
// effectively set the attribute to use for rendering the next item
|
||||
//
|
||||
// it should return true if the attribute had any non-default properties
|
||||
virtual bool GtkSetAttr(const wxDataViewItemAttr& WXUNUSED(attr))
|
||||
{ return false; }
|
||||
|
||||
|
||||
// these functions are only called if GtkSupportsAttrs() returns true and
|
||||
// are used to remember whether the renderer currently uses the default
|
||||
// attributes or if we changed (and not reset them)
|
||||
bool GtkIsUsingDefaultAttrs() const { return m_usingDefaultAttrs; }
|
||||
void GtkSetUsingDefaultAttrs(bool def) { m_usingDefaultAttrs = def; }
|
||||
|
||||
// return the text renderer used by this renderer for setting text cell
|
||||
// specific attributes: can return NULL if this renderer doesn't render any
|
||||
// text
|
||||
virtual GtkCellRendererText *GtkGetTextRenderer() const { return NULL; }
|
||||
|
||||
|
||||
private:
|
||||
// Change the mode at GTK level without touching m_mode, this is useful for
|
||||
// temporarily making the renderer insensitive but does mean that GetMode()
|
||||
// may return a value different from the actual GTK renderer mode.
|
||||
void GtkSetMode(wxDataViewCellMode mode);
|
||||
|
||||
protected:
|
||||
virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE;
|
||||
virtual void SetEnabled(bool enabled) wxOVERRIDE;
|
||||
|
||||
virtual void GtkOnCellChanged(const wxVariant& value,
|
||||
const wxDataViewItem& item,
|
||||
unsigned col);
|
||||
|
@@ -49,12 +49,11 @@ public:
|
||||
|
||||
virtual void SetAlignment( int align );
|
||||
|
||||
virtual bool GtkSupportsAttrs() const { return true; }
|
||||
virtual bool GtkSetAttr(const wxDataViewItemAttr& attr);
|
||||
|
||||
virtual GtkCellRendererText *GtkGetTextRenderer() const;
|
||||
|
||||
protected:
|
||||
virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE;
|
||||
|
||||
// implementation of Set/GetValue()
|
||||
bool SetTextValue(const wxString& str);
|
||||
bool GetTextValue(wxString& str) const;
|
||||
@@ -137,16 +136,6 @@ public:
|
||||
m_renderParams = renderParams;
|
||||
}
|
||||
|
||||
// we may or not support attributes, as we don't know it, return true to
|
||||
// make it possible to use them
|
||||
virtual bool GtkSupportsAttrs() const { return true; }
|
||||
|
||||
virtual bool GtkSetAttr(const wxDataViewItemAttr& attr)
|
||||
{
|
||||
SetAttr(attr);
|
||||
return !attr.IsDefault();
|
||||
}
|
||||
|
||||
virtual GtkCellRendererText *GtkGetTextRenderer() const;
|
||||
|
||||
private:
|
||||
|
@@ -83,12 +83,9 @@ public:
|
||||
const wxDataViewItem& item,
|
||||
unsigned col);
|
||||
|
||||
// called to ensure that the given attribute will be used for rendering the
|
||||
// next cell (which had been already associated with this renderer before)
|
||||
virtual void OSXApplyAttr(const wxDataViewItemAttr& attr);
|
||||
|
||||
// called to set the state of the next cell to be rendered
|
||||
virtual void OSXApplyEnabled(bool enabled);
|
||||
protected:
|
||||
virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE;
|
||||
virtual void SetEnabled(bool enabled) wxOVERRIDE;
|
||||
#endif // Cocoa
|
||||
|
||||
private:
|
||||
|
@@ -31,10 +31,6 @@ public:
|
||||
|
||||
virtual bool MacRender();
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
virtual void OSXApplyAttr(const wxDataViewItemAttr& attr);
|
||||
#endif // Cocoa
|
||||
|
||||
virtual wxDC* GetDC(); // creates a device context and keeps it
|
||||
void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer
|
||||
|
||||
|
Reference in New Issue
Block a user