tb_menu_window.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // ================================================================================
  2. // == This file is a part of Turbo Badger. (C) 2011-2014, Emil Segerås ==
  3. // == See tb_core.h for more information. ==
  4. // ================================================================================
  5. #ifndef TB_MENU_WINDOW_H
  6. #define TB_MENU_WINDOW_H
  7. #include "tb_select.h"
  8. #include "tb_popup_window.h"
  9. namespace tb {
  10. /** TBMenuWindow is a popup window that shows a list of items (TBSelectList).
  11. When selected it will invoke a click with the id given to the menu,
  12. and the id of the clicked item as ref_id, and then close itself.
  13. It may open sub items as new windows at the same time as this window is open.*/
  14. class TBMenuWindow : public TBPopupWindow
  15. {
  16. public:
  17. // For safe typecasting
  18. TBOBJECT_SUBCLASS(TBMenuWindow, TBPopupWindow);
  19. TBMenuWindow(TBWidget *target, TBID id);
  20. ~TBMenuWindow();
  21. bool Show(TBSelectItemSource *source, const TBPopupAlignment &alignment, int initial_value = -1);
  22. TBSelectList *GetList() { return &m_select_list; }
  23. virtual bool OnEvent(const TBWidgetEvent &ev);
  24. private:
  25. TBSelectList m_select_list;
  26. };
  27. }; // namespace tb
  28. #endif // TB_MENU_WINDOW_H