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:
@@ -872,14 +872,25 @@ wxDataViewRendererBase::PrepareForItem(const wxDataViewModel *model,
|
||||
|
||||
|
||||
int wxDataViewRendererBase::GetEffectiveAlignment() const
|
||||
{
|
||||
int alignment = GetEffectiveAlignmentIfKnown();
|
||||
wxASSERT( alignment != wxDVR_DEFAULT_ALIGNMENT );
|
||||
return alignment;
|
||||
}
|
||||
|
||||
|
||||
int wxDataViewRendererBase::GetEffectiveAlignmentIfKnown() const
|
||||
{
|
||||
int alignment = GetAlignment();
|
||||
|
||||
if ( alignment == wxDVR_DEFAULT_ALIGNMENT )
|
||||
{
|
||||
// if we don't have an explicit alignment ourselves, use that of the
|
||||
// column in horizontal direction and default vertical alignment
|
||||
alignment = GetOwner()->GetAlignment() | wxALIGN_CENTRE_VERTICAL;
|
||||
if ( GetOwner() != NULL )
|
||||
{
|
||||
// if we don't have an explicit alignment ourselves, use that of the
|
||||
// column in horizontal direction and default vertical alignment
|
||||
alignment = GetOwner()->GetAlignment() | wxALIGN_CENTRE_VERTICAL;
|
||||
}
|
||||
}
|
||||
|
||||
return alignment;
|
||||
|
||||
Reference in New Issue
Block a user