On OSX don't propogate the alignment setting from column to renderer if it is a custom renderer. This allows the Render function to deal with the alignment itself and brings the behavior into alignment (pun intended!) with the GTK and generic DV classes. Fixes #12883
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4fe83b93a5
commit
f8816e49e4
@ -159,6 +159,9 @@ public:
|
||||
|
||||
wxControl *GetEditorCtrl() { return m_editorCtrl; }
|
||||
|
||||
virtual bool IsCustomRenderer() const { return false; }
|
||||
|
||||
|
||||
protected:
|
||||
// Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
|
||||
void DestroyEditControl();
|
||||
@ -278,6 +281,8 @@ public:
|
||||
// Prepare DC to use attributes and call Render().
|
||||
void WXCallRender(wxRect rect, wxDC *dc, int state);
|
||||
|
||||
virtual bool IsCustomRenderer() const { return true; }
|
||||
|
||||
protected:
|
||||
// helper for GetSize() implementations, respects attributes
|
||||
wxSize GetTextExtent(const wxString& str) const;
|
||||
|
@ -2468,16 +2468,18 @@ wxDataViewColumn::wxDataViewColumn(const wxString& title, wxDataViewRenderer* re
|
||||
:wxDataViewColumnBase(renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData()), m_title(title)
|
||||
{
|
||||
InitCommon(width, align, flags);
|
||||
if ((renderer != NULL) && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
renderer->SetAlignment(align);
|
||||
if ((renderer != NULL) && !renderer->IsCustomRenderer() &&
|
||||
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
renderer->SetAlignment(align);
|
||||
}
|
||||
|
||||
wxDataViewColumn::wxDataViewColumn(const wxBitmap& bitmap, wxDataViewRenderer* renderer, unsigned int model_column, int width, wxAlignment align, int flags)
|
||||
:wxDataViewColumnBase(bitmap, renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData())
|
||||
{
|
||||
InitCommon(width, align, flags);
|
||||
if ((renderer != NULL) && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
renderer->SetAlignment(align);
|
||||
if ((renderer != NULL) && !renderer->IsCustomRenderer() &&
|
||||
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
renderer->SetAlignment(align);
|
||||
}
|
||||
|
||||
wxDataViewColumn::~wxDataViewColumn()
|
||||
|
@ -3015,7 +3015,8 @@ wxDataViewColumn::wxDataViewColumn(const wxString& title,
|
||||
m_title(title)
|
||||
{
|
||||
InitCommon(width, align, flags);
|
||||
if (renderer && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
if (renderer && !renderer->IsCustomRenderer() &&
|
||||
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
renderer->SetAlignment(align);
|
||||
}
|
||||
|
||||
@ -3029,7 +3030,8 @@ wxDataViewColumn::wxDataViewColumn(const wxBitmap& bitmap,
|
||||
m_NativeDataPtr(new wxDataViewColumnNativeData())
|
||||
{
|
||||
InitCommon(width, align, flags);
|
||||
if (renderer && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
if (renderer && !renderer->IsCustomRenderer() &&
|
||||
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
renderer->SetAlignment(align);
|
||||
}
|
||||
|
||||
@ -3053,7 +3055,8 @@ void wxDataViewColumn::SetAlignment(wxAlignment align)
|
||||
{
|
||||
m_alignment = align;
|
||||
[[m_NativeDataPtr->GetNativeColumnPtr() headerCell] setAlignment:ConvertToNativeHorizontalTextAlignment(align)];
|
||||
if (m_renderer && (m_renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
if (m_renderer && !m_renderer->IsCustomRenderer() &&
|
||||
(m_renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||
m_renderer->SetAlignment(align);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user