lltoolpipette.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * @file lltoolpipette.h
  3. * @brief LLToolPipette class header file
  4. *
  5. * $LicenseInfo:firstyear=2006&license=viewergpl$
  6. *
  7. * Copyright (c) 2006-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. // A tool to pick texture entry infro from objects in world (color/texture)
  33. // This tool assumes it is transient in the codebase and must be used
  34. // accordingly. We should probably restructure the way tools are
  35. // managed so that this is handled automatically.
  36. #ifndef LL_LLTOOLPIPETTE_H
  37. #define LL_LLTOOLPIPETTE_H
  38. #include "lltextureentry.h"
  39. #include "lltool.h"
  40. class LLViewerObject;
  41. class LLPickInfo;
  42. class LLToolPipette final : public LLTool
  43. {
  44. protected:
  45. LOG_CLASS(LLToolPipette);
  46. public:
  47. LLToolPipette();
  48. // This is an object edit tool
  49. LL_INLINE bool isObjectEditTool() const override { return true; }
  50. bool handleMouseDown(S32 x, S32 y, MASK mask) override;
  51. bool handleMouseUp(S32 x, S32 y, MASK mask) override;
  52. bool handleHover(S32 x, S32 y, MASK mask) override;
  53. bool handleToolTip(S32 x, S32 y, std::string& msg, LLRect* rect) override;
  54. typedef void (*select_callback)(const LLTextureEntry& te, void *data);
  55. void setSelectCallback(select_callback callback, void* user_data);
  56. void setResult(bool success, const std::string& msg);
  57. static void pickCallback(const LLPickInfo& pick_info);
  58. protected:
  59. LLTextureEntry mTextureEntry;
  60. select_callback mSelectCallback;
  61. std::string mTooltipMsg;
  62. void* mUserData;
  63. bool mSuccess;
  64. };
  65. extern LLToolPipette gToolPipette;
  66. #endif //LL_LLTOOLPIPETTE_H