PageRenderTime 141ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/lltoolpipette.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 70 lines | 30 code | 10 blank | 30 comment | 0 complexity | 0b05f1a65b818e05bf802418c875cc39 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltoolpipette.h
  3. * @brief LLToolPipette class header file
  4. *
  5. * $LicenseInfo:firstyear=2006&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. // A tool to pick texture entry infro from objects in world (color/texture)
  27. // This tool assumes it is transient in the codebase and must be used
  28. // accordingly. We should probably restructure the way tools are
  29. // managed so that this is handled automatically.
  30. #ifndef LL_LLTOOLPIPETTE_H
  31. #define LL_LLTOOLPIPETTE_H
  32. #include "lltool.h"
  33. #include "lltextureentry.h"
  34. #include <boost/function.hpp>
  35. #include <boost/signals2.hpp>
  36. class LLViewerObject;
  37. class LLPickInfo;
  38. class LLToolPipette
  39. : public LLTool, public LLSingleton<LLToolPipette>
  40. {
  41. public:
  42. LLToolPipette();
  43. virtual ~LLToolPipette();
  44. virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  45. virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  46. virtual BOOL handleHover(S32 x, S32 y, MASK mask);
  47. virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
  48. // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots
  49. typedef boost::signals2::signal<void (const LLTextureEntry& te)> signal_t;
  50. void setToolSelectCallback(const signal_t::slot_type& cb) { mSignal.connect(cb); }
  51. void setResult(BOOL success, const std::string& msg);
  52. void setTextureEntry(const LLTextureEntry* entry);
  53. static void pickCallback(const LLPickInfo& pick_info);
  54. protected:
  55. LLTextureEntry mTextureEntry;
  56. signal_t mSignal;
  57. BOOL mSuccess;
  58. std::string mTooltipMsg;
  59. };
  60. #endif //LL_LLTOOLPIPETTE_H