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_CheckButtonPresenter.h
19 * @brief This is the header file for the _CheckButtonPresenter class.
21 * This header file contains the declarations of the %_CheckButtonPresenter class.
23 #ifndef _FUI_CTRL_INTERNAL_CHECK_BUTTON_PRESENTER_H_
24 #define _FUI_CTRL_INTERNAL_CHECK_BUTTON_PRESENTER_H_
26 #include <FBaseObject.h>
27 #include <FGrp_TextTextObject.h>
28 #include "FUi_Control.h"
30 namespace Tizen { namespace Ui { namespace Animations
33 }}} // Tizen::Ui::Animations
35 namespace Tizen { namespace Ui { namespace Controls
38 class _CheckButtonModel;
41 * @class _CHeckButtonPresenter
49 class _CheckButtonPresenter
50 : public Tizen::Base::Object
51 , public Tizen::Base::Runtime::ITimerEventListener
54 _CheckButtonPresenter(void);
55 virtual ~_CheckButtonPresenter(void);
58 virtual result Construct(const _CheckButton& checkButton);
59 virtual result Install(void);
61 virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
62 virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
63 virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
64 virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
65 virtual void OnTouchMoveHandled(const _Control& control);
67 virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
71 void OnFontChanged(Tizen::Graphics::Font* pFont);
72 void OnFontInfoRequested(unsigned long& style, int& size);
73 void SetFontInfo(unsigned long style, int size);
75 Tizen::Graphics::Rectangle GetTitleTextBounds(void) const;
76 Tizen::Graphics::Rectangle GetTextBounds(void) const;
77 Tizen::Graphics::Rectangle GetDefaultButtonBounds(void) const;
78 Tizen::Graphics::Rectangle GetOnOffSlidingButtonBounds(void) const;
79 Tizen::Graphics::Rectangle GetDetailedButtonBounds(void) const;
81 result StartCheckAnimationTimer(void);
82 result ResetCheckAnimationTimer(void);
85 result SetModel(const _CheckButtonModel& checkButtonModel);
88 _CheckButtonPresenter(const _CheckButtonPresenter& rhs);
89 _CheckButtonPresenter& operator =(const _CheckButtonPresenter& rhs);
91 void DrawBackground(void);
92 void DrawCheckBitmap(void);
95 bool IsEnabledStateChanged(void);
96 result CalculateTitleTextBounds(void);
97 result CalculateTextBounds(void);
98 result CalculateButtonBounds(void);
100 void DrawMarkAnimation(void);
103 _CheckButton* __pCheckButton;
104 _CheckButtonModel* __pCheckButtonModel;
105 bool __previousEnabledState;
106 bool __touchMoveHandled;
108 Tizen::Graphics::Font* __pTextFont;
109 Tizen::Graphics::Font* __pTitleTextFont;
110 Tizen::Graphics::_Text::TextObject* __pTextObject;
111 Tizen::Graphics::_Text::TextObject* __pTitleTextObject;
113 Tizen::Graphics::Rectangle __titleTextBounds;
114 Tizen::Graphics::Rectangle __textBounds;
115 Tizen::Graphics::Rectangle __defaultButtonBounds;
116 Tizen::Graphics::Rectangle __onOffSlidingButtonBounds;
117 Tizen::Graphics::Rectangle __detailedButtonBounds;
119 unsigned long __fontStyle;
122 static const int CHECK_ACTION_TIMER_PERIOD = 10;
123 static const int RATIO_MAX = 10;
124 Tizen::Base::Runtime::Timer* __pCheckAnimationTimer;
127 }; // _CheckButtonPresenter
129 }}} // Tizen::Ui::Controls
131 #endif // _FUI_CTRL_INTERNAL_CHECK_BUTTON_PRESENTER_H_