guiPopupMenuCtrl.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #pragma once
  23. #ifndef GUI_POPUP_MENU_CTRL_H
  24. #define GUI_POPUP_MENU_CTRL_H
  25. #ifndef _GUITEXTLISTCTRL_H_
  26. #include "gui/controls/guiTextListCtrl.h"
  27. #endif
  28. #ifndef _GUIMENUBAR_H_
  29. #include "gui/editor/guiMenuBar.h"
  30. #endif
  31. #ifndef _POPUPMENU_H_
  32. #include "platform/menus/popupMenu.h"
  33. #endif
  34. class GuiPopupMenuBackgroundCtrl;
  35. class GuiPopupMenuTextListCtrl : public GuiTextListCtrl
  36. {
  37. friend class GuiPopupMenuBackgroundCtrl;
  38. private:
  39. typedef GuiTextListCtrl Parent;
  40. GuiPopupMenuBackgroundCtrl* mBackground;
  41. public:
  42. bool isSubMenu; // Indicates that this text list is in a submenu
  43. Point2I maxBitmapSize;
  44. GuiMenuBar::Menu* mMenu;
  45. GuiMenuBar* mMenuBar;
  46. PopupMenu* mPopup;
  47. GuiPopupMenuTextListCtrl();
  48. // GuiControl overloads:
  49. bool onKeyDown(const GuiEvent &event);
  50. void onMouseDown(const GuiEvent &event);
  51. void onMouseUp(const GuiEvent &event);
  52. void onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver);
  53. virtual void onCellHighlighted(Point2I cell); // Added
  54. };
  55. class GuiPopupMenuBackgroundCtrl : public GuiControl
  56. {
  57. typedef GuiControl Parent;
  58. protected:
  59. GuiPopupMenuTextListCtrl *mTextList;
  60. public:
  61. GuiPopupMenuBackgroundCtrl(GuiPopupMenuTextListCtrl* textList);
  62. void onMouseDown(const GuiEvent &event);
  63. void onMouseMove(const GuiEvent &event);
  64. void onMouseDragged(const GuiEvent &event);
  65. void close();
  66. };
  67. #endif