15 std::unordered_map<Action *, ScopedConnection> actions_;
16 FCITX_DEFINE_SIGNAL_PRIVATE(
Menu, Update);
19 Menu::Menu() : d_ptr(std::make_unique<MenuPrivate>(
this)) {}
21 Menu::~Menu() { destroy(); }
23 void Menu::addAction(
Action *action) {
return insertAction(
nullptr, action); }
25 void Menu::insertAction(
Action *before,
Action *action) {
27 insertChild(before, action);
29 auto *action =
static_cast<Action *
>(p);
32 d->actions_.emplace(std::make_pair(action, std::move(conn)));
36 void Menu::removeAction(
Action *action) {
39 d->actions_.erase(action);
43 std::vector<Action *> Menu::actions() {
44 std::vector<Action *> result;
45 for (
const auto &p : childs()) {
46 result.push_back(static_cast<Action *>(p));
The Action class provides an abstraction for user commands that can be added to user interfaces...
Connection that will disconnection when it goes out of scope.