Fix wxGTK wxDataViewRenderers' alignment handling

Don't apply alignment to native controls in SetAlignment() method, where
it may not be known yet due to column-to-renderer inheritance if
wxDVR_DEFAULT_ALIGNMENT is used (the default). Move such code to
GtkUpdateAlignment() (which was made virtual) in all renderers.

This fixes unintended right-aligning of columns with GTK+ 2 when default
alignment was used.
This commit is contained in:
Václav Slavík
2016-10-21 17:50:34 +02:00
parent 552940b547
commit a6be5bdae3
5 changed files with 46 additions and 22 deletions

View File

@@ -51,7 +51,7 @@ public:
return true;
}
virtual void SetAlignment( int align ) wxOVERRIDE;
virtual void GtkUpdateAlignment() wxOVERRIDE;
virtual GtkCellRendererText *GtkGetTextRenderer() const wxOVERRIDE;
@@ -151,6 +151,8 @@ public:
virtual GtkCellRendererText *GtkGetTextRenderer() const wxOVERRIDE;
virtual GtkWidget* GtkGetEditorWidget() const wxOVERRIDE;
virtual void GtkUpdateAlignment() wxOVERRIDE;
private:
bool Init(wxDataViewCellMode mode, int align);
@@ -254,7 +256,7 @@ public:
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
void SetAlignment( int align ) wxOVERRIDE;
virtual void GtkUpdateAlignment() wxOVERRIDE;
wxString GetChoice(size_t index) const { return m_choices[index]; }
const wxArrayString& GetChoices() const { return m_choices; }