Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
wxWidgets-3_0-nostl
0002-spinctrl.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-spinctrl.patch of Package wxWidgets-3_0-nostl
commit 7465237353f795bb9872aca688e9c19000a7a16d Author: Vadim Zeitlin <vadim@wxwidgets.org> Date: Sun Apr 3 18:02:43 2016 +0200 Improve wxSpinCtrl best size computation in wxGTK Don't hardcode completely arbitrary width of 95px for the text part, but compute it from the values this control is actually used for. diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index c7067fd..b33593c 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -355,7 +355,16 @@ GdkWindow *wxSpinCtrlGTKBase::GTKGetWindow(wxArrayGdkWindows& windows) const wxSize wxSpinCtrlGTKBase::DoGetBestSize() const { - return DoGetSizeFromTextSize(95); // TODO: 95 is completely arbitrary + const int minVal = static_cast<int>(DoGetMin()); + const int lenMin = wxString::Format("%d", minVal).length(); + + const int maxVal = static_cast<int>(DoGetMax()); + const int lenMax = wxString::Format("%d", maxVal).length(); + + wxString longestText(wxMax(lenMin, lenMax), '9'); + if ( minVal < 0 ) + longestText.insert(0, "-"); + return DoGetSizeFromTextSize(GetTextExtent(longestText).x, -1); } wxSize wxSpinCtrlGTKBase::DoGetSizeFromTextSize(int xlen, int ylen) const
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor