PageRenderTime 24ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llmenubutton.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 93 lines | 47 code | 20 blank | 26 comment | 0 complexity | c5678ff850c60cdc8254e8a308a4a172 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llbutton.h
  3. * @brief Header for buttons
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLMENUBUTTON_H
  27. #define LL_LLMENUBUTTON_H
  28. #include "llbutton.h"
  29. class LLToggleableMenu;
  30. class LLMenuButton
  31. : public LLButton
  32. {
  33. public:
  34. typedef enum e_menu_position
  35. {
  36. MP_TOP_LEFT,
  37. MP_TOP_RIGHT,
  38. MP_BOTTOM_LEFT
  39. } EMenuPosition;
  40. struct MenuPositions
  41. : public LLInitParam::TypeValuesHelper<EMenuPosition, MenuPositions>
  42. {
  43. static void declareValues();
  44. };
  45. struct Params
  46. : public LLInitParam::Block<Params, LLButton::Params>
  47. {
  48. // filename for it's toggleable menu
  49. Optional<std::string> menu_filename;
  50. Optional<EMenuPosition> position;
  51. Params();
  52. };
  53. boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb );
  54. /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  55. /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask );
  56. void hideMenu();
  57. LLToggleableMenu* getMenu();
  58. void setMenu(LLToggleableMenu* menu, EMenuPosition position = MP_TOP_LEFT);
  59. void setMenuPosition(EMenuPosition position) { mMenuPosition = position; }
  60. protected:
  61. friend class LLUICtrlFactory;
  62. LLMenuButton(const Params&);
  63. void toggleMenu();
  64. void updateMenuOrigin();
  65. void onMenuVisibilityChange(const LLSD& param);
  66. private:
  67. LLHandle<LLView> mMenuHandle;
  68. bool mIsMenuShown;
  69. EMenuPosition mMenuPosition;
  70. S32 mX;
  71. S32 mY;
  72. };
  73. #endif // LL_LLMENUBUTTON_H