PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llui/lltoggleablemenu.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 67 lines | 25 code | 10 blank | 32 comment | 0 complexity | 28a171c04b9827e5d46c7f00912991c6 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltoggleablemenu.h
  3. * @brief Menu toggled by a button press
  4. *
  5. * $LicenseInfo:firstyear=2009&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_LLTOGGLEABLEMENU_H
  27. #define LL_LLTOGGLEABLEMENU_H
  28. #include "llmenugl.h"
  29. class LLToggleableMenu : public LLMenuGL
  30. {
  31. public:
  32. //adding blank params to work around registration issue
  33. //where LLToggleableMenu was owning the LLMenuGL param
  34. //and menu.xml was never loaded
  35. struct Params : public LLInitParam::Block<Params, LLMenuGL::Params>
  36. {};
  37. protected:
  38. LLToggleableMenu(const Params&);
  39. friend class LLUICtrlFactory;
  40. public:
  41. ~LLToggleableMenu();
  42. boost::signals2::connection setVisibilityChangeCallback( const commit_signal_t::slot_type& cb );
  43. virtual void handleVisibilityChange (BOOL curVisibilityIn);
  44. const LLRect& getButtonRect() const { return mButtonRect; }
  45. // Converts the given local button rect to a screen rect
  46. void setButtonRect(const LLRect& rect, LLView* current_view);
  47. void setButtonRect(LLView* current_view);
  48. // Returns "true" if menu was not closed by button click
  49. // and is not still visible. If menu is visible toggles
  50. // its visibility off.
  51. bool toggleVisibility();
  52. protected:
  53. bool mClosedByButtonClick;
  54. LLRect mButtonRect;
  55. commit_signal_t* mVisibilityChangeSignal;
  56. };
  57. #endif // LL_LLTOGGLEABLEMENU_H