Fcitx
menu.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016-2016 CSSlayer <wengxt@gmail.com>
3  *
4  * SPDX-License-Identifier: LGPL-2.1-or-later
5  *
6  */
7 #ifndef _FCITX_MENU_H_
8 #define _FCITX_MENU_H_
9 
10 #include <memory>
11 #include <fcitx-utils/element.h>
12 #include <fcitx-utils/macros.h>
13 #include <fcitx/action.h>
14 #include <fcitx/fcitxcore_export.h>
15 
16 /// \addtogroup FcitxCore
17 /// \{
18 /// \file
19 /// \brief Class for menu in UI.
20 
21 namespace fcitx {
22 
23 class MenuPrivate;
24 
25 /**
26  * Menu that contains a list of actions.
27  *
28  * The user interface may only support one-level of menu, so you
29  * may want to avoid multiple level of menu if possible.
30  */
31 class FCITXCORE_EXPORT Menu : public Element {
32 public:
33  friend class Action;
34  Menu();
35  virtual ~Menu();
36 
37  void addAction(Action *action);
38  void removeAction(Action *action);
39  void insertAction(Action *before, Action *action);
40  std::vector<Action *> actions();
41 
42  FCITX_DECLARE_SIGNAL(Menu, Update, void());
43 
44 private:
45  std::unique_ptr<MenuPrivate> d_ptr;
46  FCITX_DECLARE_PRIVATE(Menu);
47 };
48 } // namespace fcitx
49 
50 #endif // _FCITX_MENU_H_
Utility class that provides a hierarchy between multiple objects.
#define FCITX_DECLARE_SIGNAL(CLASS_NAME, NAME,...)
Declare signal by type.
Definition: action.cpp:17
The Action class provides an abstraction for user commands that can be added to user interfaces...
Definition: action.h:34
Action class.
Menu that contains a list of actions.
Definition: menu.h:31
Base class that can be used for UI composition or graph.
Definition: element.h:26