CCControlHuePicker.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) 2012 cocos2d-x.org
  3. * http://www.cocos2d-x.org
  4. *
  5. * Copyright 2012 Stewart Hamilton-Arrandale.
  6. * http://creativewax.co.uk
  7. *
  8. * Modified by Yannick Loriot.
  9. * http://yannickloriot.com
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12. * of this software and associated documentation files (the "Software"), to deal
  13. * in the Software without restriction, including without limitation the rights
  14. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. * copies of the Software, and to permit persons to whom the Software is
  16. * furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be included in
  19. * all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27. * THE SOFTWARE.
  28. *
  29. * Converted to c++ / cocos2d-x by Angus C
  30. */
  31. #ifndef __CCCONTROL_HUE_PICKER_H__
  32. #define __CCCONTROL_HUE_PICKER_H__
  33. #include "CCControl.h"
  34. #include "CCInvocation.h"
  35. #include "extensions/ExtensionExport.h"
  36. NS_CC_EXT_BEGIN
  37. /**
  38. * @addtogroup GUI
  39. * @{
  40. * @addtogroup control_extension
  41. * @{
  42. */
  43. class CC_EX_DLL ControlHuePicker : public Control
  44. {
  45. public:
  46. static ControlHuePicker* create(Node* target, Vec2 pos);
  47. /**
  48. * @js ctor
  49. */
  50. ControlHuePicker();
  51. /**
  52. * @js NA
  53. * @lua NA
  54. */
  55. virtual ~ControlHuePicker();
  56. virtual bool initWithTargetAndPos(Node* target, Vec2 pos);
  57. virtual void setEnabled(bool enabled) override;
  58. // overrides
  59. virtual bool onTouchBegan(Touch* touch, Event* pEvent) override;
  60. virtual void onTouchMoved(Touch *pTouch, Event *pEvent) override;
  61. protected:
  62. void updateSliderPosition(Vec2 location);
  63. bool checkSliderPosition(Vec2 location);
  64. //manually put in the setters
  65. CC_SYNTHESIZE_READONLY(float, _hue, Hue);
  66. virtual void setHue(float val);
  67. CC_SYNTHESIZE_READONLY(float, _huePercentage, HuePercentage);
  68. virtual void setHuePercentage(float val);
  69. //not sure if these need to be there actually. I suppose someone might want to access the sprite?
  70. CC_SYNTHESIZE_RETAIN(Sprite*, _background, Background);
  71. CC_SYNTHESIZE_RETAIN(Sprite*, _slider, Slider);
  72. CC_SYNTHESIZE_READONLY(Vec2, _startPos, StartPos);
  73. };
  74. // end of GUI group
  75. /// @}
  76. /// @}
  77. NS_CC_EXT_END
  78. #endif