mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
CppKore: try parent font if current is absent
This allows for setting uniform fonts on all controls, by only assigning the font once to the parent control. Else each control needs to have its own set.
This commit is contained in:
parent
29ff073ae3
commit
4c99efa889
7
r5dev/thirdparty/cppnet/cppkore/Control.cpp
vendored
7
r5dev/thirdparty/cppnet/cppkore/Control.cpp
vendored
@ -231,8 +231,13 @@ namespace Forms
|
||||
SetWindowLongPtrA(this->_Handle, GWLP_USERDATA, (intptr_t)this);
|
||||
|
||||
// Setup the default font if none was previously set
|
||||
|
||||
if (this->_Font == nullptr)
|
||||
this->_Font = std::make_unique<Drawing::Font>(this->_Handle, (HFONT)GetStockObject(DEFAULT_GUI_FONT));
|
||||
if (this->_Parent && this->_Parent->_Font)
|
||||
this->_Font = std::make_unique<Drawing::Font>(this->_Handle, this->_Parent->_Font.get()->GetFontHandle());
|
||||
else
|
||||
this->_Font = std::make_unique<Drawing::Font>(this->_Handle, (HFONT)GetStockObject(DEFAULT_GUI_FONT));
|
||||
|
||||
// Notify the window of the font selection
|
||||
SendMessageA(this->_Handle, WM_SETFONT, (WPARAM)this->_Font->GetFontHandle(), NULL);
|
||||
|
||||
|
2
r5dev/thirdparty/cppnet/cppkore/Control.h
vendored
2
r5dev/thirdparty/cppnet/cppkore/Control.h
vendored
@ -146,7 +146,7 @@ namespace Forms
|
||||
|
||||
// Retrieves the current font for this control.
|
||||
Drawing::Font* GetFont();
|
||||
// Retrieves the current font for this control.
|
||||
// Sets the current font for this control.
|
||||
void SetFont(Drawing::Font* Font);
|
||||
|
||||
// The parent of this control.
|
||||
|
Loading…
x
Reference in New Issue
Block a user