Skip to content

Commit

Permalink
Issue #132: Menu not able to build simple item that is { ID, string, …
Browse files Browse the repository at this point in the history
…string }
  • Loading branch information
rmpowell77 committed Jul 4, 2023
1 parent e87e291 commit c67b097
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 45 deletions.
2 changes: 2 additions & 0 deletions LATEST_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Bugs addressed in this release:

* [#132](../../issues/132) Menu not able to build simple item that is { ID, string, string }

Other changes:

* [#123](../../issues/123) Allow binding to multiple events
Expand Down
1 change: 1 addition & 0 deletions examples/HelloWorld/HelloWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ HelloWorldFrame::HelloWorldFrame()
wxUI::Menu {
"&File",
// endsnippet wxUIMenu
wxUI::Item { wxID_FIND, "&Find\tCTRL-F", "No-op Find" },
wxUI::Item { "&Hello...\tCtrl-H", "Help string shown in status bar for this menu item", [] {
wxLogMessage("Hello world from wxWidgets!");
} },
Expand Down
75 changes: 30 additions & 45 deletions include/wxUI/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,33 +126,28 @@ struct Item {
{
}

template <typename F>
Item(wxStandardID identity, F function)
: Item(identity, "", "", function)
Item(wxStandardID identity, details::function_t function)
: Item(identity, "", "", std::move(function))
{
}

template <typename F>
Item(wxStandardID identity, std::string const& name, F function)
: Item(identity, name, "", function)
Item(wxStandardID identity, std::string const& name, details::function_t function)
: Item(identity, name, "", std::move(function))
{
}

template <typename F>
Item(wxStandardID identity, std::string const& name, std::string const& helpString, F function)
: menuDetails(details::IDMenuDetailsWFunc_t(identity, name, helpString, function))
Item(wxStandardID identity, std::string const& name, std::string const& helpString, details::function_t function)
: menuDetails(details::IDMenuDetailsWFunc_t(identity, name, helpString, std::move(function)))
{
}

template <typename F>
Item(std::string const& name, F function)
: Item(name, "", function)
Item(std::string const& name, details::function_t function)
: Item(name, "", std::move(function))
{
}

template <typename F>
Item(std::string const& name, std::string const& help, F function)
: menuDetails(details::NamedMenuDetails_t(name, help, function))
Item(std::string const& name, std::string const& help, details::function_t function)
: menuDetails(details::NamedMenuDetails_t(name, help, std::move(function)))
{
}

Expand All @@ -171,33 +166,28 @@ struct CheckItem {
{
}

template <typename F>
CheckItem(wxStandardID identity, F function)
: CheckItem(identity, "", "", function)
CheckItem(wxStandardID identity, details::function_t function)
: CheckItem(identity, "", "", std::move(function))
{
}

template <typename F>
CheckItem(wxStandardID identity, std::string const& name, F function)
: CheckItem(identity, name, "", function)
CheckItem(wxStandardID identity, std::string const& name, details::function_t function)
: CheckItem(identity, name, "", std::move(function))
{
}

template <typename F>
CheckItem(wxStandardID identity, std::string const& name, std::string const& helpString, F function)
: menuDetails(details::IDMenuDetailsWFunc_t(identity, name, helpString, function))
CheckItem(wxStandardID identity, std::string const& name, std::string const& helpString, details::function_t function)
: menuDetails(details::IDMenuDetailsWFunc_t(identity, name, helpString, std::move(function)))
{
}

template <typename F>
CheckItem(std::string const& name, F function)
: CheckItem(name, "", function)
CheckItem(std::string const& name, details::function_t function)
: CheckItem(name, "", std::move(function))
{
}

template <typename F>
CheckItem(std::string const& name, std::string const& help, F function)
: menuDetails(details::NamedMenuDetails_t(name, help, function))
CheckItem(std::string const& name, std::string const& help, details::function_t function)
: menuDetails(details::NamedMenuDetails_t(name, help, std::move(function)))
{
}

Expand All @@ -216,33 +206,28 @@ struct RadioItem {
{
}

template <typename F>
RadioItem(wxStandardID identity, F function)
: RadioItem(identity, "", "", function)
RadioItem(wxStandardID identity, details::function_t function)
: RadioItem(identity, "", "", std::move(function))
{
}

template <typename F>
RadioItem(wxStandardID identity, std::string const& name, F function)
: RadioItem(identity, name, "", function)
RadioItem(wxStandardID identity, std::string const& name, details::function_t function)
: RadioItem(identity, name, "", std::move(function))
{
}

template <typename F>
RadioItem(wxStandardID identity, std::string const& name, std::string const& helpString, F function)
: menuDetails(details::IDMenuDetailsWFunc_t(identity, name, helpString, function))
RadioItem(wxStandardID identity, std::string const& name, std::string const& helpString, details::function_t function)
: menuDetails(details::IDMenuDetailsWFunc_t(identity, name, helpString, std::move(function)))
{
}

template <typename F>
RadioItem(std::string const& name, F function)
: RadioItem(name, "", function)
RadioItem(std::string const& name, details::function_t function)
: RadioItem(name, "", std::move(function))
{
}

template <typename F>
RadioItem(std::string const& name, std::string const& help, F function)
: menuDetails(details::NamedMenuDetails_t(name, help, function))
RadioItem(std::string const& name, std::string const& help, details::function_t function)
: menuDetails(details::NamedMenuDetails_t(name, help, std::move(function)))
{
}

Expand Down

0 comments on commit c67b097

Please sign in to comment.