2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUiCtrl_ColorPickerPresenter.h
19 * @brief This is the header file for the _ColorPicker class.
21 * This header file contains the declarations of the %_ColorPicker class.
24 #ifndef _FUI_CTRL_INTERNAL_COLORPICKER_PRESENTER_H_
25 #define _FUI_CTRL_INTERNAL_COLORPICKER_PRESENTER_H_
27 #include <FBaseObject.h>
28 #include "FUiCtrl_ColorPicker.h"
30 namespace Tizen { namespace Graphics
38 namespace Tizen {namespace Ui
43 namespace Tizen { namespace Ui { namespace Animations
46 }}} // Tizen::Ui::Animations
48 namespace Tizen {namespace Ui { namespace Controls
51 enum _ColorPickerComponentType
69 class _ColorPickerModel;
71 class _ColorPickerPresenter
72 : public Tizen::Base::Object
73 , public Tizen::Base::Runtime::ITimerEventListener
74 , virtual public Tizen::Base::Runtime::IEventListener
79 Tizen::Graphics::Color GetColor(void) const;
81 int GetHue(void) const;
83 int GetSaturation(void) const;
85 int GetLuminance(void) const;
87 void SetColor(const Tizen::Graphics::Color& color);
89 result SetHue(int hue);
91 result SetSaturation(int saturation);
93 result SetLuminance(int luminance);
95 void LoadDrawingProperties(const Tizen::Graphics::Rectangle& controlBounds);
97 void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
99 bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
101 bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
103 bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
105 bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
107 virtual ~_ColorPickerPresenter(void);
109 virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
111 static _ColorPickerPresenter* CreateInstanceN(_ColorPicker& colorPicker);
113 Tizen::Ui::Animations::_VisualElement* CreateHandlerN(Tizen::Ui::Animations::_VisualElement& rootElement, _ColorPickerComponentType handlerType);
117 result LoadResource(void);
119 result DrawHueSlider(Tizen::Graphics::Canvas& canvas);
121 result DrawLuminanceSlider(Tizen::Graphics::Canvas& canvas);
123 result DrawSaturationSlider(Tizen::Graphics::Canvas& canvas);
125 result DrawLine(Tizen::Graphics::Canvas& canvas);
127 result DrawArrowButton(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::Rectangle& rcButton, bool isSelected, bool drawLeftButton);
129 result DrawArrowButtons(Tizen::Graphics::Canvas& canvas);
131 result MoveHandler(_ColorPickerComponentType handlerType);
133 result TouchButton(void);
135 result TouchHandler(int x);
137 result SetHandlerPosition(_ColorPickerComponentType handlerType, int position);
139 result SetHandlerPositionByRatio(_ColorPickerComponentType handlerType, double ratio);
141 result ChangeColorFromCurrentHandlerPosition(_ColorPickerComponentType handlerType);
143 bool IsLeftButton(_ColorPickerComponentType buttonType);
145 Tizen::Graphics::Rectangle& GetBarBoundsFromHandler(_ColorPickerComponentType handlerType);
147 _ColorPickerComponentType GetTouchActionType(const Tizen::Graphics::Point& position) const;
149 result DrawResourceBitmap(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::Rectangle& bounds, Tizen::Graphics::Bitmap* pBitmap);
151 _ColorPickerPresenter(_ColorPicker& colorPicker);
153 _ColorPickerPresenter(const _ColorPickerPresenter&);
155 _ColorPickerPresenter& operator =(const _ColorPickerPresenter&);
159 static const double _MAX_COLOR_VALUE = 255.0;
160 static const double _MIN_COLOR_VALUE = 0.0;
161 static const double _HUE_SPACE_RANGE = 6.0;
162 static const byte _ZERO_SATURATION_RGB_VALUE = 127;
164 _ColorPicker* __pColorPicker;
166 _ColorPickerModel* __pColorPickerModel;
168 _ColorPickerComponentType __eventType;
178 Tizen::Graphics::Rectangle __componentBounds[COMPONENT_TYPE_MAX];
180 Tizen::Graphics::Color __hueColor;
182 Tizen::Graphics::Color __saturationColor;
184 Tizen::Base::Runtime::Timer* __pSlideTimer;
185 Tizen::Graphics::Bitmap* __pHueSliderBgBitmap;
186 Tizen::Graphics::Bitmap* __pCustomBitmap;
187 Tizen::Graphics::Bitmap* __pLuminanceSliderBgBitmap;
188 Tizen::Graphics::Bitmap* __pSaturationSliderBgBitmap;
189 Tizen::Graphics::Bitmap* __pColorNormalReplacementBgBitmap;
190 Tizen::Graphics::Bitmap* __pColorPressedReplacementBgBitmap;
191 Tizen::Graphics::Bitmap* __pColorDisabledReplacementBgBitmap;
192 Tizen::Graphics::Bitmap* __pColorNormalEffectReplacementBgBitmap;
193 Tizen::Graphics::Bitmap* __pColorPressedEffectReplacementBgBitmap;
194 Tizen::Graphics::Bitmap* __pColorDisabledEffectReplacementBgBitmap;
195 Tizen::Graphics::Bitmap* __pLeftArrowNormalBitmap;
196 Tizen::Graphics::Bitmap* __pLeftArrowPressedBitmap;
197 Tizen::Graphics::Bitmap* __pLeftArrowDisabledBitmap;
198 Tizen::Graphics::Bitmap* __pRightArrowNormalBitmap;
199 Tizen::Graphics::Bitmap* __pRightArrowPressedBitmap;
200 Tizen::Graphics::Bitmap* __pRightArrowDisabledBitmap;
201 Tizen::Graphics::Bitmap* __pHandlerBitmap;
202 Tizen::Graphics::Bitmap* __pLandscapeHueSliderBgBitmap;
203 Tizen::Graphics::Bitmap* __pLandscapeCustomBitmap;
204 Tizen::Graphics::Bitmap* __pLandscapeLuminanceSliderBgBitmap;
205 Tizen::Graphics::Bitmap* __pLandscapeSaturationSliderBgBitmap;
206 }; // _ColorPickerPresenter
208 }}} // Tizen::Ui::Controls
210 #endif // _FUI_CTRL_INTERNAL_COLORPICKER_PRESENTER_H_