Skip to content

Commit

Permalink
Merge pull request #158 from rmpowell77/dev/withWrap
Browse files Browse the repository at this point in the history
Issue #157: Text needs withWrap
  • Loading branch information
rmpowell77 authored Nov 24, 2023
2 parents e9939d1 + c8380e0 commit 66a77bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 3 additions & 3 deletions LATEST_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# wxUI release notes for v0.1.8
# wxUI release notes for v0.1.9

Bugs addressed in this release:

* [#154](../../issues/154) Generic constructor overload takes wxWindow, should have been Window

Other changes:

* [#157](../../issues/157) Text needs withWrap

13 changes: 12 additions & 1 deletion include/wxUI/Text.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ struct Text : public details::WidgetDetails<Text, wxStaticText> {
{
}

auto setWrap(int wrapLength) -> Text&
{
wrap = wrapLength;
return *this;
}

struct Proxy : super::WidgetProxy {
PROXY_BOILERPLATE();

Expand All @@ -78,10 +84,15 @@ struct Text : public details::WidgetDetails<Text, wxStaticText> {

private:
std::string text;
std::optional<int> wrap;

auto createImpl(wxWindow* parent) -> wxWindow* override
{
return setProxy(new underlying_t(parent, getIdentity(), text, getPos(), getSize(), getStyle()));
auto* widget = new underlying_t(parent, getIdentity(), text, getPos(), getSize(), getStyle());
if (wrap) {
widget->Wrap(*wrap);
}
return setProxy(widget);
}
};

Expand Down

0 comments on commit 66a77bc

Please sign in to comment.