Skip to content

Commit

Permalink
Merge pull request #97 from rmpowell77/dev/font
Browse files Browse the repository at this point in the history
Issue #95: Text needs to customize font
  • Loading branch information
rmpowell77 authored Mar 10, 2023
2 parents 4b9c806 + 0d07315 commit 728ec67
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions LATEST_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Other changes:
* [#82](../../issues/82) wxCheckBox needs a setValue
* [#89](../../issues/89) Change stack to sizer
* [#92](../../issues/92) Need a Bitmap
* [#95](../../issues/95) Text needs to customize font

10 changes: 10 additions & 0 deletions include/wxUI/Widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ struct WidgetDetails {
return static_cast<ConcreteWidget&>(*this);
}

auto withFont(wxFontInfo const& fontInfo_) -> ConcreteWidget&
{
fontInfo = fontInfo_;
return static_cast<ConcreteWidget&>(*this);
}

auto getHandle(Underlying** handle) -> ConcreteWidget&
{
windowHandle = handle;
Expand All @@ -166,6 +172,9 @@ struct WidgetDetails {
auto createAndAdd(wxWindow* parent, wxSizer* sizer, wxSizerFlags const& parentFlags)
{
auto widget = dynamic_cast<Underlying*>(create(parent));
if (fontInfo) {
widget->SetFont(wxFont(*fontInfo));
}
sizer->Add(widget, flags ? *flags : parentFlags);
if (windowHandle) {
*windowHandle = widget;
Expand All @@ -189,6 +198,7 @@ struct WidgetDetails {
wxPoint pos = wxDefaultPosition;
wxSize size = wxDefaultSize;
int64_t style {};
std::optional<wxFontInfo> fontInfo {};
Underlying** windowHandle {};
};

Expand Down

0 comments on commit 728ec67

Please sign in to comment.