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:
@@ -159,6 +159,9 @@ public:
|
|||||||
|
|
||||||
wxControl *GetEditorCtrl() { return m_editorCtrl; }
|
wxControl *GetEditorCtrl() { return m_editorCtrl; }
|
||||||
|
|
||||||
|
virtual bool IsCustomRenderer() const { return false; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
|
// Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
|
||||||
void DestroyEditControl();
|
void DestroyEditControl();
|
||||||
@@ -278,6 +281,8 @@ public:
|
|||||||
// Prepare DC to use attributes and call Render().
|
// Prepare DC to use attributes and call Render().
|
||||||
void WXCallRender(wxRect rect, wxDC *dc, int state);
|
void WXCallRender(wxRect rect, wxDC *dc, int state);
|
||||||
|
|
||||||
|
virtual bool IsCustomRenderer() const { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// helper for GetSize() implementations, respects attributes
|
// helper for GetSize() implementations, respects attributes
|
||||||
wxSize GetTextExtent(const wxString& str) const;
|
wxSize GetTextExtent(const wxString& str) const;
|
||||||
|
@@ -2468,7 +2468,8 @@ wxDataViewColumn::wxDataViewColumn(const wxString& title, wxDataViewRenderer* re
|
|||||||
:wxDataViewColumnBase(renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData()), m_title(title)
|
:wxDataViewColumnBase(renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData()), m_title(title)
|
||||||
{
|
{
|
||||||
InitCommon(width, align, flags);
|
InitCommon(width, align, flags);
|
||||||
if ((renderer != NULL) && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
if ((renderer != NULL) && !renderer->IsCustomRenderer() &&
|
||||||
|
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||||
renderer->SetAlignment(align);
|
renderer->SetAlignment(align);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2476,7 +2477,8 @@ wxDataViewColumn::wxDataViewColumn(const wxBitmap& bitmap, wxDataViewRenderer* r
|
|||||||
:wxDataViewColumnBase(bitmap, renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData())
|
:wxDataViewColumnBase(bitmap, renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData())
|
||||||
{
|
{
|
||||||
InitCommon(width, align, flags);
|
InitCommon(width, align, flags);
|
||||||
if ((renderer != NULL) && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
if ((renderer != NULL) && !renderer->IsCustomRenderer() &&
|
||||||
|
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||||
renderer->SetAlignment(align);
|
renderer->SetAlignment(align);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3015,7 +3015,8 @@ wxDataViewColumn::wxDataViewColumn(const wxString& title,
|
|||||||
m_title(title)
|
m_title(title)
|
||||||
{
|
{
|
||||||
InitCommon(width, align, flags);
|
InitCommon(width, align, flags);
|
||||||
if (renderer && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
if (renderer && !renderer->IsCustomRenderer() &&
|
||||||
|
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||||
renderer->SetAlignment(align);
|
renderer->SetAlignment(align);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3029,7 +3030,8 @@ wxDataViewColumn::wxDataViewColumn(const wxBitmap& bitmap,
|
|||||||
m_NativeDataPtr(new wxDataViewColumnNativeData())
|
m_NativeDataPtr(new wxDataViewColumnNativeData())
|
||||||
{
|
{
|
||||||
InitCommon(width, align, flags);
|
InitCommon(width, align, flags);
|
||||||
if (renderer && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
if (renderer && !renderer->IsCustomRenderer() &&
|
||||||
|
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
|
||||||
renderer->SetAlignment(align);
|
renderer->SetAlignment(align);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3053,7 +3055,8 @@ void wxDataViewColumn::SetAlignment(wxAlignment align)
|
|||||||
{
|
{
|
||||||
m_alignment = align;
|
m_alignment = align;
|
||||||
[[m_NativeDataPtr->GetNativeColumnPtr() headerCell] setAlignment:ConvertToNativeHorizontalTextAlignment(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);
|
m_renderer->SetAlignment(align);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user