Make wxBU_EXACTFIT fir the button text more exactly.
Too big margins were added for the buttons with wxBU_EXACTFIT style making them larger than strictly necessary. Reduce the margins to make them really as small as possible. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68922 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,7 +44,8 @@ void UpdateMultilineStyle(HWND hwnd, const wxString& label);
|
|||||||
// flags for ComputeBestSize() and GetFittingSize()
|
// flags for ComputeBestSize() and GetFittingSize()
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
Size_AuthNeeded = 1
|
Size_AuthNeeded = 1,
|
||||||
|
Size_ExactFit = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
// NB: All the functions below are implemented in src/msw/button.cpp
|
// NB: All the functions below are implemented in src/msw/button.cpp
|
||||||
|
@@ -387,11 +387,21 @@ wxSize wxMSWButton::GetFittingSize(wxWindow *win,
|
|||||||
const wxSize& sizeLabel,
|
const wxSize& sizeLabel,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
// FIXME: this is pure guesswork, need to retrieve the real button margins
|
|
||||||
wxSize sizeBtn = sizeLabel;
|
wxSize sizeBtn = sizeLabel;
|
||||||
|
|
||||||
|
// FIXME: The numbers here are pure guesswork, no idea how should the
|
||||||
|
// button margins be really calculated.
|
||||||
|
if ( flags & Size_ExactFit )
|
||||||
|
{
|
||||||
|
// We still need some margin or the text would be overwritten, just
|
||||||
|
// make it as small as possible.
|
||||||
|
sizeBtn.x += (3*win->GetCharWidth())/2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sizeBtn.x += 3*win->GetCharWidth();
|
sizeBtn.x += 3*win->GetCharWidth();
|
||||||
sizeBtn.y += win->GetCharHeight()/2;
|
sizeBtn.y += win->GetCharHeight()/2;
|
||||||
|
}
|
||||||
|
|
||||||
// account for the shield UAC icon if we have it
|
// account for the shield UAC icon if we have it
|
||||||
if ( flags & Size_AuthNeeded )
|
if ( flags & Size_AuthNeeded )
|
||||||
@@ -555,6 +565,8 @@ wxSize wxAnyButton::DoGetBestSize() const
|
|||||||
if ( ShowsLabel() )
|
if ( ShowsLabel() )
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
if ( HasFlag(wxBU_EXACTFIT) )
|
||||||
|
flags |= wxMSWButton::Size_ExactFit;
|
||||||
if ( DoGetAuthNeeded() )
|
if ( DoGetAuthNeeded() )
|
||||||
flags |= wxMSWButton::Size_AuthNeeded;
|
flags |= wxMSWButton::Size_AuthNeeded;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user