Use default wxCheckBox size in wxGridCellBoolEditor
Using wxRendererNative::GetCheckBoxSize() as the size of wxCheckBox just doesn't work with GTK 3, as the control has additional padding between its actual contents and the focus rectangle, which means that its actual size must be greater than the size to be passed to DrawCheckBox() in order to draw a checkbox of the same size. However it isn't really necessary to resize wxCheckBox at all, it's enough for DrawCheckBox() to produce a check mark of the same size as that shown in a default-sized wxCheckBox and this does work in wxGTK. So keep the default size of wxCheckBox to make everything work. This means wxGetGridCheckBoxRect() is not useful any more, so replace it with wxGetContentRect() which just positions a rectangle of the given size inside another one (this should probably be moved somewhere else, as it's more general than wxGrid).
This commit is contained in:
@@ -1223,16 +1223,11 @@ void wxGridCellBoolEditor::SetSize(const wxRect& r)
|
||||
if (GetCellAttr())
|
||||
GetCellAttr()->GetNonDefaultAlignment(&hAlign, &vAlign);
|
||||
|
||||
const wxRect
|
||||
checkBoxRect = wxGetGridCheckBoxRect(GetWindow(), r, hAlign, vAlign);
|
||||
const wxRect checkBoxRect =
|
||||
wxGetContentRect(m_control->GetSize(), r, hAlign, vAlign);
|
||||
|
||||
// resize the control if required
|
||||
if ( m_control->GetSize() != checkBoxRect.GetSize() )
|
||||
{
|
||||
m_control->SetSize(checkBoxRect.GetSize());
|
||||
}
|
||||
|
||||
// and move it
|
||||
// Don't resize the checkbox, it should have its default (and fitting)
|
||||
// size, but do move it to the right position.
|
||||
m_control->Move(checkBoxRect.GetPosition());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user