Add a simple wxSetWindowFont() helper
This function is a just a very thin wrapper for WM_SETFONT, but it's still better to have it rather than write casts to WPARAM and MAKELPARAM() in several different places. Note that this removes the assert for font validity from wxWindow::SetFont() which really doesn't make much sense (and if we wanted to have it, it would be better to have it for all ports in wxWindowBase instead) and was never triggered since more than 20 years of its existence.
This commit is contained in:
committed by
Maarten Bent
parent
8e15849706
commit
b24d7e3ae4
@@ -827,11 +827,7 @@ bool wxWindowMSW::SetFont(const wxFont& font)
|
||||
// just been reset and in this case we need to change the font used by
|
||||
// the native window to the default for this class, i.e. exactly what
|
||||
// GetFont() returns
|
||||
WXHANDLE hFont = GetFont().GetResourceHandle();
|
||||
|
||||
wxASSERT_MSG( hFont, wxT("should have valid font") );
|
||||
|
||||
::SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
||||
wxSetWindowFont(hWnd, GetFont());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user