CCControlColourPicker.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_COLOUR_PICKER_H__
  32. #define __CCCONTROL_COLOUR_PICKER_H__
  33. #include "CCControl.h"
  34. #include "CCControlUtils.h"
  35. #include "CCControlHuePicker.h"
  36. #include "CCControlSaturationBrightnessPicker.h"
  37. #include "extensions/ExtensionExport.h"
  38. NS_CC_EXT_BEGIN
  39. /**
  40. * @addtogroup GUI
  41. * @{
  42. * @addtogroup control_extension
  43. * @{
  44. */
  45. class CC_EX_DLL ControlColourPicker: public Control
  46. {
  47. public:
  48. static ControlColourPicker* create();
  49. /**
  50. * @js ctor
  51. * @lua new
  52. */
  53. ControlColourPicker();
  54. /**
  55. * @js NA
  56. * @lua NA
  57. */
  58. virtual ~ControlColourPicker();
  59. virtual bool init() override;
  60. virtual void setColor(const Color3B& colorValue) override;
  61. virtual void setEnabled(bool bEnabled) override;
  62. //virtual ~ControlColourPicker();
  63. void hueSliderValueChanged(Ref * sender, Control::EventType controlEvent);
  64. void colourSliderValueChanged(Ref * sender, Control::EventType controlEvent);
  65. protected:
  66. void updateControlPicker();
  67. void updateHueAndControlPicker();
  68. virtual bool onTouchBegan(Touch* touch, Event* pEvent) override;
  69. HSV _hsv;
  70. CC_SYNTHESIZE_RETAIN(ControlSaturationBrightnessPicker*, _colourPicker, colourPicker)
  71. CC_SYNTHESIZE_RETAIN(ControlHuePicker*, _huePicker, HuePicker)
  72. CC_SYNTHESIZE_RETAIN(Sprite*, _background, Background)
  73. };
  74. // end of GUI group
  75. /// @}
  76. /// @}
  77. NS_CC_EXT_END
  78. #endif