Centre text vertically in wxDataViewCtrl by default in generic version.
This was already the case in the native GTK (possibly unintentionally) and OS X (because vertical alignment is not supported at all there) versions, but in the generic version using the default wxALIGN_NOT alignment when calling wxDataViewCtrl::AppendXXXColumn() methods resulted in top-aligned text which looked ugly (this could be seen on the second page of the dataview sample for example). Fix this by handling wxALIGN_NOT as wxDVR_DEFAULT_ALIGNMENT in these functions to do the right thing by default. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4e86ffbe1b
commit
25b46080cc
@ -1162,9 +1162,27 @@ CreateColumnWithRenderer(const LabelType& label,
|
||||
wxAlignment align,
|
||||
int flags)
|
||||
{
|
||||
// For compatibility reason, handle wxALIGN_NOT as wxDVR_DEFAULT_ALIGNMENT
|
||||
// when creating the renderer here because a lot of existing code,
|
||||
// including our own dataview sample, uses wxALIGN_NOT just because it's
|
||||
// the default value of the alignment argument in AppendXXXColumn()
|
||||
// methods, but this doesn't mean that it actually wants to top-align the
|
||||
// column text.
|
||||
//
|
||||
// This does make it impossible to create top-aligned text using these
|
||||
// functions, but it can always be done by creating the renderer with the
|
||||
// desired alignment explicitly and should be so rarely needed in practice
|
||||
// (without speaking that vertical alignment is completely unsupported in
|
||||
// native OS X version), that it's preferable to do the right thing by
|
||||
// default here rather than account for it.
|
||||
return new wxDataViewColumn(
|
||||
label,
|
||||
RendererFactory<Renderer>::New(mode, align),
|
||||
RendererFactory<Renderer>::New(
|
||||
mode,
|
||||
align & wxALIGN_BOTTOM
|
||||
? align
|
||||
: align | wxALIGN_CENTRE_VERTICAL
|
||||
),
|
||||
model_column,
|
||||
width,
|
||||
align,
|
||||
|
Loading…
Reference in New Issue
Block a user