X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/af905c94b5ff79a63656e0e9ee6dbf0d3b0a758d..f8405d6e6fc2a361d9710dfdaea0b158952803aa:/src/msw/spinctrl.cpp diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index a302bc53bf..a2a61fc04a 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -370,24 +370,22 @@ bool wxSpinCtrl::Create(wxWindow *parent, m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), wxBuddyTextWndProc); - // should have the same font as the other controls - SetFont(GetParent()->GetFont()); + // set up fonts and colours (This is nomally done in MSWCreateControl) + InheritAttributes(); + if (!m_hasFont) + SetFont(GetDefaultAttributes().font); - WXHANDLE hFont = GetFont().GetResourceHandle(); - (void)::SendMessage(GetBuddyHwnd(), WM_SETFONT, (WPARAM)hFont, TRUE); - // set the size of the text window - can do it only now, because we // couldn't call DoGetBestSize() before as font wasn't set if ( sizeText.y <= 0 ) { int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } - DoMoveWindow(pos.x, pos.y, - sizeText.x + sizeBtn.x + MARGIN_BETWEEN, sizeText.y); + SetBestSize(size); (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); @@ -529,7 +527,7 @@ wxSize wxSpinCtrl::DoGetBestSize() const sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN; int y; - wxGetCharSize(GetHWND(), NULL, &y, &GetFont()); + wxGetCharSize(GetHWND(), NULL, &y, GetFont()); y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(y); // JACS: we should always use the height calculated