Changed several places using hard-coded size values to use FromDIP instead.
This commit is contained in:
@@ -39,7 +39,7 @@ public:
|
||||
// borderOther is the margin on all other sides
|
||||
virtual void GetBordersForSizer(int *borderTop, int *borderOther) const
|
||||
{
|
||||
const int BORDER = 5; // FIXME: hardcoded value
|
||||
const int BORDER = FromDIP(5); // FIXME: hardcoded value
|
||||
|
||||
*borderTop = GetLabel().empty() ? BORDER : GetCharHeight();
|
||||
*borderOther = BORDER;
|
||||
|
@@ -1223,7 +1223,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth )
|
||||
// Make very small buttons square, as it makes
|
||||
// them accommodate arrow image better and still
|
||||
// looks decent.
|
||||
if ( height > 18 )
|
||||
if ( height > FromDIP(18) )
|
||||
butWidth = (height*butWidth)/bestHeight;
|
||||
else
|
||||
butWidth = butHeight;
|
||||
|
@@ -358,8 +358,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win,
|
||||
wxRect ar = rect;
|
||||
|
||||
// make a rect for the arrow
|
||||
ar.height = 4;
|
||||
ar.width = 8;
|
||||
ar.SetSize(wxWindow::FromDIP(wxSize(8, 4), win));
|
||||
ar.y += (rect.height - ar.height)/2;
|
||||
ar.x = ar.x + rect.width - 3*ar.width/2;
|
||||
arrowSpace = 3*ar.width/2; // space to preserve when drawing the label
|
||||
|
@@ -227,7 +227,7 @@ void wxComboCtrl::OnResize()
|
||||
|
||||
// Technically Classic Windows style combo has more narrow button,
|
||||
// but the native renderer doesn't paint it well like that.
|
||||
int btnWidth = 17;
|
||||
int btnWidth = FromDIP(17);
|
||||
CalculateAreas(btnWidth);
|
||||
|
||||
// Position textctrl using standard routine
|
||||
|
@@ -253,7 +253,7 @@ wxSize wxControl::DoGetBestSize() const
|
||||
if (m_windowSizer)
|
||||
return wxControlBase::DoGetBestSize();
|
||||
|
||||
return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT);
|
||||
return FromDIP(wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT));
|
||||
}
|
||||
|
||||
wxBorder wxControl::GetDefaultBorder() const
|
||||
|
@@ -589,11 +589,11 @@ wxSize wxRendererMSW::GetCheckBoxSize(wxWindow * WXUNUSED(win))
|
||||
::GetSystemMetrics(SM_CYMENUCHECK));
|
||||
}
|
||||
|
||||
int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win))
|
||||
int wxRendererMSW::GetHeaderButtonHeight(wxWindow * win)
|
||||
{
|
||||
// some "reasonable" value returned in case of error, it doesn't really
|
||||
// correspond to anything but it's better than returning 0
|
||||
static const int DEFAULT_HEIGHT = 20;
|
||||
static const int DEFAULT_HEIGHT = wxWindow::FromDIP(20, win);
|
||||
|
||||
|
||||
// create a temporary header window just to get its geometry
|
||||
@@ -604,6 +604,11 @@ int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win))
|
||||
|
||||
wxON_BLOCK_EXIT1( ::DestroyWindow, hwndHeader );
|
||||
|
||||
// Must ensure the proper font is set or the wrong value will be returned
|
||||
// At 200% scaling it was returning a height of 28 when it should have been 40
|
||||
WXHANDLE hFont = (win && win->GetFont().IsOk() ? win->GetFont() : wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)).GetResourceHandle();
|
||||
::SendMessage(hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
|
||||
// initialize the struct filled with the values by Header_Layout()
|
||||
RECT parentRect = { 0, 0, 100, 100 };
|
||||
WINDOWPOS wp = { 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
@@ -308,7 +308,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
||||
if ( sizeText.x <= 0 )
|
||||
{
|
||||
// DEFAULT_ITEM_WIDTH is the default width for the text control
|
||||
sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x;
|
||||
sizeText.x = FromDIP(DEFAULT_ITEM_WIDTH) + MARGIN_BETWEEN + sizeBtn.x;
|
||||
}
|
||||
|
||||
sizeText.x -= sizeBtn.x + MARGIN_BETWEEN;
|
||||
|
@@ -2259,7 +2259,7 @@ bool wxTextCtrl::AcceptsFocusFromKeyboard() const
|
||||
|
||||
wxSize wxTextCtrl::DoGetBestSize() const
|
||||
{
|
||||
return DoGetSizeFromTextSize( DEFAULT_ITEM_WIDTH );
|
||||
return DoGetSizeFromTextSize( FromDIP(DEFAULT_ITEM_WIDTH) );
|
||||
}
|
||||
|
||||
wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const
|
||||
|
Reference in New Issue
Block a user