Menu.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <ewol/debug.hpp>
10 #include <ewol/widget/Widget.hpp>
11 #include <ewol/widget/Button.hpp>
12 #include <ewol/widget/Sizer.hpp>
14 
15 namespace ewol {
16  namespace widget {
17  class MenuElement {
18  public :
19  MenuElement() { };
20  int32_t m_localId;
21  int32_t m_parentId;
22  ewol::WidgetWeak m_widgetPointer;
23  std::string m_label;
24  std::string m_image;
25  std::string m_message;
26  };
27  class Menu;
33  class Menu :public ewol::widget::Sizer {
34  public:
35  esignal::Signal<std::string> signalSelect; // event on a menu button or ...
36  protected:
37  Menu();
38  public:
39  DECLARE_WIDGET_FACTORY(Menu, "Menu");
40  virtual ~Menu();
41  private:
42  void subWidgetRemoveAll() override;
43  int32_t subWidgetAdd(ewol::WidgetShared _newWidget) override;
44  void subWidgetRemove(ewol::WidgetShared _newWidget) override;
45  void subWidgetUnLink(ewol::WidgetShared _newWidget) override;
46  private:
47  std::vector<ewol::widget::MenuElement> m_listElement;
48  int32_t m_staticId; // unique ID for every element of the menu ...
49  ewol::widget::ContextMenuWeak m_widgetContextMenu;
50  int32_t get(const std::string& _label);
51  public:
52  void clear();
53  int32_t addTitle(const std::string& _label, const std::string& _image="", const std::string& _message = "");
54  int32_t add(int32_t _parent, const std::string& _label, const std::string& _image="", const std::string& _message = "");
55  int32_t addSpacer();
56  void remove(int32_t _id);
57  private:
58  void onButtonPressed(ewol::widget::ButtonWeak _button);
59  };
60  };
61 };
62 
Definition: Menu.hpp:33
Definition: Area.hpp:16
void clear()
Definition: Menu.hpp:17
Definition: Sizer.hpp:23