2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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.cpp
19 * @brief This is the implementation file for the _CheckButtonPresenter class.
22 #include <FBaseErrorDefine.h>
23 #include <FBaseSysLog.h>
24 #include <FGrp_BitmapImpl.h>
25 #include <FGrp_CanvasImpl.h>
26 #include <FGrp_FontImpl.h>
27 #include <FGrp_TextTextObject.h>
28 #include <FGrp_TextTextSimple.h>
29 #include "FUi_CoordinateSystemUtils.h"
30 #include "FUi_ResourceManager.h"
31 #include "FUi_UiTouchEvent.h"
32 #include "FUiAnim_VisualElement.h"
33 #include "FUiCtrl_CheckButtonPresenter.h"
34 #include "FUiCtrl_CheckButtonModel.h"
36 using namespace Tizen::Base;
37 using namespace Tizen::Graphics;
38 using namespace Tizen::Graphics::_Text;
39 using namespace Tizen::Base::Runtime;
41 namespace Tizen { namespace Ui { namespace Controls
44 _CheckButtonPresenter::_CheckButtonPresenter(void)
45 : __pCheckButton(null)
46 , __pCheckButtonModel(null)
47 , __previousEnabledState(false)
48 , __touchMoveHandled(false)
50 , __pTitleTextFont(null)
52 , __pTitleTextObject(null)
53 , __titleTextBounds(FloatRectangle())
54 , __textBounds(FloatRectangle())
55 , __defaultButtonBounds(FloatRectangle())
56 , __onOffSlidingButtonBounds(FloatRectangle())
57 , __detailedButtonBounds(FloatRectangle())
60 , __pCheckAnimationTimer(null)
62 , __onOffHandlerPosition(0.0f)
63 , __onOffHandlerPressed(false)
64 , __onOffHandlerMoved(false)
65 , __highlightedIndex(0)
66 , __detailedPressed(false)
71 _CheckButtonPresenter::~_CheckButtonPresenter(void)
73 if (__pCheckButtonModel)
75 delete __pCheckButtonModel;
76 __pCheckButtonModel = null;
85 if (__pTitleTextObject)
87 delete __pTitleTextObject;
88 __pTitleTextObject = null;
91 if (__pCheckAnimationTimer)
93 delete __pCheckAnimationTimer;
94 __pCheckAnimationTimer = null;
99 _CheckButtonPresenter::Construct(const _CheckButton& checkButton)
101 result r = E_SUCCESS;
103 __pCheckButton = const_cast <_CheckButton*>(&checkButton);
105 __fontStyle = FONT_STYLE_PLAIN;
107 __pTextObject = new (std::nothrow) TextObject();
108 SysTryCatch(NID_UI_CTRL, __pTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
110 __pTitleTextObject = new (std::nothrow) TextObject();
111 SysTryCatch(NID_UI_CTRL, __pTitleTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
113 __pTextObject->Construct();
114 __pTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_WORD);
115 __pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
117 __pTitleTextObject->Construct();
118 __pTitleTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_WORD);
119 __pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
121 CalculateTextBounds();
122 CalculateTitleTextBounds();
123 CalculateButtonBounds();
129 delete __pTextObject;
130 __pTextObject = null;
132 delete __pTitleTextObject;
133 __pTitleTextObject = null;
139 _CheckButtonPresenter::Install(void)
141 result r = E_SUCCESS;
143 _CheckButtonModel* pModel = new (std::nothrow) _CheckButtonModel();
144 SysTryReturn(NID_UI_CTRL, pModel, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
146 r = SetModel(*pModel);
147 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
149 r = pModel->Construct();
150 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
160 _CheckButtonPresenter::SetModel(const _CheckButtonModel& checkButtonModel)
162 __pCheckButtonModel = const_cast <_CheckButtonModel*>(&checkButtonModel);
168 _CheckButtonPresenter::OnFontChanged(Font* pFont)
171 __pTitleTextFont = pFont;
177 _CheckButtonPresenter::OnFontInfoRequested(unsigned long& style, int& size)
180 size = _CoordinateSystemUtils::ConvertToInteger(__fontSize);
186 _CheckButtonPresenter::OnFontInfoRequested(unsigned long& style, float& size)
195 _CheckButtonPresenter::SetFontInfo(unsigned long style, float size)
204 _CheckButtonPresenter::Draw(void)
214 _CheckButtonPresenter::DrawBackground(void)
216 Canvas* pCanvas = __pCheckButton->GetCanvasN();
219 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
224 Bitmap* pBgBitmap = null;
225 Bitmap* pReColorBgBitmap = null;
227 Bitmap* pHighlightedBgBitmap = null;
228 Bitmap* pHighlightedReColorBgBitmap = null;
230 FloatDimension minDimension(0.0f, 0.0f);
231 FloatDimension minDimensionWithAnnex(0.0f, 0.0f);
233 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION, __pCheckButton->GetOrientation(), minDimension);
234 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION_WITH_ANNEX, __pCheckButton->GetOrientation(), minDimensionWithAnnex);
236 FloatRectangle bounds(0.0f, 0.0f, __pCheckButton->GetBoundsF().width, __pCheckButton->GetBoundsF().height);
238 _CheckButtonStatus checkStatus = __pCheckButton->GetCheckButtonStatus();
239 BackgroundStyle backgroundStyle = __pCheckButton->GetBackgroundStyle();
240 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
242 if (checkStyle == CHECK_BUTTON_STYLE_MARK || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_ONOFF
243 || checkStyle == CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER)
245 if (bounds.width < minDimension.width)
247 bounds.width = minDimension.width;
250 if (bounds.height < minDimension.height)
252 bounds.height = minDimension.height;
257 if (bounds.width < minDimensionWithAnnex.width)
259 bounds.width = minDimensionWithAnnex.width;
262 if (bounds.height < minDimensionWithAnnex.height)
264 bounds.height = minDimensionWithAnnex.height;
268 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
271 if (checkStatus == _CHECK_BUTTON_STATUS_NORMAL)
273 if (backgroundStyle == BACKGROUND_STYLE_NONE)
275 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
280 pBgBitmap = __pCheckButton->GetBackgroundBitmap(__pCheckButton->GetGroupStyle(), _CHECK_BUTTON_STATUS_NORMAL);
282 if (pBgBitmap && _BitmapImpl::CheckNinePatchedBitmapStrictly(*pBgBitmap))
284 pReColorBgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBgBitmap, Color::GetColor(COLOR_ID_MAGENTA),
285 __pCheckButton->GetColor(_CHECK_BUTTON_STATUS_NORMAL));
286 if (pReColorBgBitmap)
288 pCanvas->DrawNinePatchedBitmap(bounds, *pReColorBgBitmap);
291 bool themeBgBitmap = false;
293 if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_SINGLE)
295 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_SINGLE_BG_NORMAL);
297 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_TOP)
299 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_TOP_BG_NORMAL);
301 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_MIDDLE)
303 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_MIDDLE_BG_NORMAL);
305 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_BOTTOM)
307 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_BOTTOM_BG_NORMAL);
310 if (themeBgBitmap == false)
312 Bitmap* pBgNormalEffectBitmap = __pCheckButton->GetBackgroundNormalEffectBitmap(__pCheckButton->GetGroupStyle());
314 if (pBgNormalEffectBitmap)
316 pCanvas->DrawNinePatchedBitmap(bounds, *pBgNormalEffectBitmap);
324 pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBgBitmap);
329 else if (checkStatus == _CHECK_BUTTON_STATUS_DISABLED)
331 if (backgroundStyle == BACKGROUND_STYLE_NONE)
333 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
338 pBgBitmap = __pCheckButton->GetBackgroundBitmap(__pCheckButton->GetGroupStyle(), _CHECK_BUTTON_STATUS_DISABLED);
340 if (pBgBitmap && _BitmapImpl::CheckNinePatchedBitmapStrictly(*pBgBitmap))
342 pReColorBgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBgBitmap, Color::GetColor(COLOR_ID_MAGENTA),
343 __pCheckButton->GetColor(_CHECK_BUTTON_STATUS_DISABLED));
344 if (pReColorBgBitmap)
346 pCanvas->DrawNinePatchedBitmap(bounds, *pReColorBgBitmap);
349 bool themeBgBitmap = false;
351 if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_SINGLE)
353 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_SINGLE_BG_DISABLED);
355 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_TOP)
357 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_TOP_BG_DISABLED);
359 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_MIDDLE)
361 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_MIDDLE_BG_DISABLED);
363 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_BOTTOM)
365 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_BOTTOM_BG_DISABLED);
368 if (themeBgBitmap == false)
370 Bitmap* pBgNormalEffectBitmap = __pCheckButton->GetBackgroundNormalEffectBitmap(__pCheckButton->GetGroupStyle());
372 if (pBgNormalEffectBitmap)
374 pCanvas->DrawNinePatchedBitmap(bounds, *pBgNormalEffectBitmap);
382 pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBgBitmap);
387 else if (checkStatus == _CHECK_BUTTON_STATUS_PRESSED)
389 if (backgroundStyle == BACKGROUND_STYLE_NONE)
391 pCanvas->SetBackgroundColor(__pCheckButton->GetColor(_CHECK_BUTTON_STATUS_PRESSED));
396 pBgBitmap = __pCheckButton->GetBackgroundBitmap(__pCheckButton->GetGroupStyle(), _CHECK_BUTTON_STATUS_PRESSED);
398 if (pBgBitmap && _BitmapImpl::CheckNinePatchedBitmapStrictly(*pBgBitmap))
400 pReColorBgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBgBitmap, Color::GetColor(COLOR_ID_MAGENTA),
401 __pCheckButton->GetColor(_CHECK_BUTTON_STATUS_PRESSED));
402 if (pReColorBgBitmap)
404 pCanvas->DrawNinePatchedBitmap(bounds, *pReColorBgBitmap);
407 bool themeBgBitmap = false;
409 if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_SINGLE)
411 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_SINGLE_BG_PRESSED);
413 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_TOP)
415 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_TOP_BG_PRESSED);
417 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_MIDDLE)
419 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_MIDDLE_BG_PRESSED);
421 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_BOTTOM)
423 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_BOTTOM_BG_PRESSED);
426 if (themeBgBitmap == false)
428 Bitmap* pBgPressedEffectBitmap = __pCheckButton->GetBackgroundPressedEffectBitmap(__pCheckButton->GetGroupStyle());
430 if (pBgPressedEffectBitmap)
432 pCanvas->DrawNinePatchedBitmap(bounds, *pBgPressedEffectBitmap);
440 pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBgBitmap);
445 else if (checkStatus == _CHECK_BUTTON_STATUS_HIGHLIGHTED)
447 if (backgroundStyle == BACKGROUND_STYLE_NONE)
449 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
452 pHighlightedBgBitmap = __pCheckButton->GetBackgroundBitmap(__pCheckButton->GetGroupStyle(), _CHECK_BUTTON_STATUS_HIGHLIGHTED);
454 pHighlightedReColorBgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pHighlightedBgBitmap,
455 Color::GetColor(COLOR_ID_MAGENTA), __pCheckButton->GetColor(_CHECK_BUTTON_STATUS_HIGHLIGHTED));
457 if (pHighlightedReColorBgBitmap && __highlightedIndex == 0)
459 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pHighlightedReColorBgBitmap))
461 pCanvas->DrawNinePatchedBitmap(bounds, *pHighlightedReColorBgBitmap);
465 pCanvas->DrawBitmap(bounds, *pHighlightedReColorBgBitmap,
466 FloatRectangle(0.0f, 0.0f, pHighlightedReColorBgBitmap->GetWidthF(), pHighlightedReColorBgBitmap->GetHeightF()));
472 pBgBitmap = __pCheckButton->GetBackgroundBitmap(__pCheckButton->GetGroupStyle(), _CHECK_BUTTON_STATUS_NORMAL);
474 if (pBgBitmap && _BitmapImpl::CheckNinePatchedBitmapStrictly(*pBgBitmap))
476 pReColorBgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBgBitmap, Color::GetColor(COLOR_ID_MAGENTA),
477 __pCheckButton->GetColor(_CHECK_BUTTON_STATUS_NORMAL));
478 if (pReColorBgBitmap)
480 pCanvas->DrawNinePatchedBitmap(bounds, *pReColorBgBitmap);
483 bool themeBgBitmap = false;
485 if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_SINGLE)
487 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_SINGLE_BG_HIGHLIGHTED);
489 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_TOP)
491 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_TOP_BG_HIGHLIGHTED);
493 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_MIDDLE)
495 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_MIDDLE_BG_HIGHLIGHTED);
497 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_BOTTOM)
499 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_BOTTOM_BG_HIGHLIGHTED);
502 if (themeBgBitmap == false)
504 Bitmap* pBgPressedEffectBitmap = __pCheckButton->GetBackgroundPressedEffectBitmap(__pCheckButton->GetGroupStyle());
506 if (pBgPressedEffectBitmap)
508 pCanvas->DrawNinePatchedBitmap(bounds, *pBgPressedEffectBitmap);
516 pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBgBitmap);
520 pHighlightedBgBitmap = __pCheckButton->GetBackgroundBitmap(__pCheckButton->GetGroupStyle(), _CHECK_BUTTON_STATUS_HIGHLIGHTED);
522 pHighlightedReColorBgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pHighlightedBgBitmap,
523 Color::GetColor(COLOR_ID_MAGENTA), __pCheckButton->GetColor(_CHECK_BUTTON_STATUS_HIGHLIGHTED));
525 if (pHighlightedReColorBgBitmap && __highlightedIndex == 0)
527 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pHighlightedReColorBgBitmap))
529 pCanvas->DrawNinePatchedBitmap(bounds, *pHighlightedReColorBgBitmap);
533 pCanvas->DrawBitmap(bounds, *pHighlightedReColorBgBitmap,
534 FloatRectangle(0.0f, 0.0f, pHighlightedReColorBgBitmap->GetWidthF(), pHighlightedReColorBgBitmap->GetHeightF()));
541 if (backgroundStyle == BACKGROUND_STYLE_NONE)
543 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
548 pBgBitmap = __pCheckButton->GetBackgroundBitmap(__pCheckButton->GetGroupStyle(), __pCheckButton->GetCheckButtonStatus());
550 if (pBgBitmap && _BitmapImpl::CheckNinePatchedBitmapStrictly(*pBgBitmap))
552 pReColorBgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBgBitmap, Color::GetColor(COLOR_ID_MAGENTA),
553 __pCheckButton->GetColor(_CHECK_BUTTON_STATUS_SELECTED));
554 if (pReColorBgBitmap)
556 pCanvas->DrawNinePatchedBitmap(bounds, *pReColorBgBitmap);
559 bool themeBgBitmap = false;
561 if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_SINGLE)
563 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_SINGLE_BG_SELECTED);
565 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_TOP)
567 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_TOP_BG_SELECTED);
569 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_MIDDLE)
571 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_MIDDLE_BG_SELECTED);
573 else if (__pCheckButton->GetGroupStyle() == GROUP_STYLE_BOTTOM)
575 themeBgBitmap = IS_CUSTOM_BITMAP(PANEL::GROUPED_BOTTOM_BG_SELECTED);
578 if (themeBgBitmap == false)
580 Bitmap* pBgNormalEffectBitmap = __pCheckButton->GetBackgroundNormalEffectBitmap(__pCheckButton->GetGroupStyle());
582 if (pBgNormalEffectBitmap)
584 pCanvas->DrawNinePatchedBitmap(bounds, *pBgNormalEffectBitmap);
592 pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBgBitmap);
599 delete pReColorBgBitmap;
600 delete pHighlightedReColorBgBitmap;
606 _CheckButtonPresenter::DrawCheckBitmap(void)
608 Canvas* pCanvas = __pCheckButton->GetCanvasN();
611 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
616 Color detailedNormalBgColor;
617 Color detailedDisabledBgColor;
618 Color detailedPressedBgColor;
619 Color detailedHighlightedBgColor;
620 Color detailedSelectedBgColor;
622 Color detailedRightNormalColor;
623 Color detailedRightDisabledColor;
624 Color detailedRightPressedColor;
625 Color detailedRightHighlightedColor;
626 Color detailedRightSelectedColor;
628 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_BG_NORMAL, detailedNormalBgColor);
629 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_BG_DISABLED, detailedDisabledBgColor);
630 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_BG_PRESSED, detailedPressedBgColor);
631 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_BG_HIGHLIGHTED, detailedHighlightedBgColor);
632 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_BG_SELECTED, detailedSelectedBgColor);
634 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_TEXT_NORMAL, detailedRightNormalColor);
635 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_TEXT_DISABLED, detailedRightDisabledColor);
636 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_TEXT_PRESSED, detailedRightPressedColor);
637 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_TEXT_HIGHLIGHTED, detailedRightHighlightedColor);
638 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_TEXT_SELECTED, detailedRightSelectedColor);
640 Bitmap* pReColorCircleBitmap = null;
641 Bitmap* pReColorRightBitmap = null;
643 _CheckButtonStatus checkStatus = __pCheckButton->GetCheckButtonStatus();
644 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
646 CalculateButtonBounds();
648 if (checkStyle == CHECK_BUTTON_STYLE_MARK || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
650 if (checkStatus == _CHECK_BUTTON_STATUS_NORMAL)
652 Bitmap* pMarkBgNormalBitmap = __pCheckButton->GetMarkBgBitmap(_CHECK_BUTTON_STATUS_NORMAL);
654 if (pMarkBgNormalBitmap)
656 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pMarkBgNormalBitmap);
659 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
661 Bitmap* pCircleBitmap = null;
662 Bitmap* pDetailedRightBitmap = null;
663 Bitmap* pCircleEffectBitmap = null;
664 Bitmap* pDetailedRightEffectBitmap = null;
666 if (__detailedPressed == true)
668 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_PRESSED);
669 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_PRESSED);
671 pCircleEffectBitmap = __pCheckButton->GetCirclePressedEffectBitmap();
672 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightPressedEffectBitmap();
676 pCircleBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
677 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(checkStatus);
679 pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
680 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
685 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
688 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_NORMAL);
690 if (themeBgBitmap == false)
692 if (pCircleEffectBitmap)
694 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
698 if (pDetailedRightBitmap)
700 float arrowWidth = pDetailedRightBitmap->GetWidthF();
701 float arrowHeight = pDetailedRightBitmap->GetHeightF();
703 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
704 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
707 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_NORMAL);
709 if (themeBgBitmap == false)
711 if (pDetailedRightEffectBitmap)
713 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
714 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
716 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
717 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
722 else if (checkStatus == _CHECK_BUTTON_STATUS_DISABLED)
724 Bitmap* pMarkBgDisabledBitmap = __pCheckButton->GetMarkBgBitmap(_CHECK_BUTTON_STATUS_DISABLED);
726 if (pMarkBgDisabledBitmap)
728 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pMarkBgDisabledBitmap);
731 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
733 Bitmap* pCircleBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
734 Bitmap* pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(checkStatus);
735 Bitmap* pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
736 Bitmap* pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
740 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
743 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_DISABLED);
745 if (themeBgBitmap == false)
747 if (pCircleEffectBitmap)
749 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
753 if (pDetailedRightBitmap)
755 float arrowWidth = pDetailedRightBitmap->GetWidthF();
756 float arrowHeight = pDetailedRightBitmap->GetHeightF();
758 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
759 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
762 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_DISABLED);
764 if (themeBgBitmap == false)
766 if (pDetailedRightEffectBitmap)
768 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
769 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
771 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
772 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
777 else if (checkStatus == _CHECK_BUTTON_STATUS_PRESSED)
779 Bitmap* pMarkBgPressedBitmap = __pCheckButton->GetMarkBgBitmap(_CHECK_BUTTON_STATUS_PRESSED);
781 if (pMarkBgPressedBitmap)
783 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pMarkBgPressedBitmap);
786 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
788 Bitmap* pCircleBitmap = null;
789 Bitmap* pDetailedRightBitmap = null;
790 Bitmap* pCircleEffectBitmap = null;
791 Bitmap* pDetailedRightEffectBitmap = null;
793 if (__detailedPressed == true)
795 pCircleBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
796 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(checkStatus);
798 pCircleEffectBitmap = __pCheckButton->GetCirclePressedEffectBitmap();
799 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightPressedEffectBitmap();
803 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_NORMAL);
804 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_NORMAL);
806 pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
807 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
812 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
815 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_PRESSED);
817 if (themeBgBitmap == false)
819 if (pCircleEffectBitmap)
821 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
825 if (pDetailedRightBitmap)
827 float arrowWidth = pDetailedRightBitmap->GetWidthF();
828 float arrowHeight = pDetailedRightBitmap->GetHeightF();
830 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
831 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
834 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_PRESSED);
836 if (themeBgBitmap == false)
838 if (pDetailedRightEffectBitmap)
840 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
841 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
843 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
844 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
849 else if (checkStatus == _CHECK_BUTTON_STATUS_HIGHLIGHTED)
851 Bitmap* pMarkBgNormalBitmap = __pCheckButton->GetMarkBgBitmap(_CHECK_BUTTON_STATUS_NORMAL);
852 Bitmap* pMarkBgHighlightedBitmap = __pCheckButton->GetMarkBgBitmap(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
854 if (pMarkBgNormalBitmap)
856 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pMarkBgNormalBitmap);
859 if (pMarkBgHighlightedBitmap && __highlightedIndex == 1)
861 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pMarkBgHighlightedBitmap);
864 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
866 Bitmap* pCircleHighlightedBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
868 Bitmap* pCircleBitmap = null;
869 Bitmap* pDetailedRightBitmap = null;
870 Bitmap* pCircleEffectBitmap = null;
871 Bitmap* pDetailedRightEffectBitmap = null;
873 if (__detailedPressed == true)
875 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_PRESSED);
876 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_PRESSED);
878 pCircleEffectBitmap = __pCheckButton->GetCirclePressedEffectBitmap();
879 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightPressedEffectBitmap();
883 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_NORMAL);
884 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_NORMAL);
886 pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
887 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
892 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
895 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_HIGHLIGHTED);
897 if (themeBgBitmap == false)
899 if (pCircleEffectBitmap)
901 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
905 if (pDetailedRightBitmap)
907 float arrowWidth = pDetailedRightBitmap->GetWidthF();
908 float arrowHeight = pDetailedRightBitmap->GetHeightF();
910 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
911 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
914 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_HIGHLIGHTED);
916 if (themeBgBitmap == false)
918 if (pDetailedRightEffectBitmap)
920 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
921 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
923 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
924 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
928 if (pCircleHighlightedBitmap && __highlightedIndex == 2)
930 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleHighlightedBitmap);
934 else if (checkStatus == _CHECK_BUTTON_STATUS_SELECTED)
936 Bitmap* pMarkBgSelectedBitmap = __pCheckButton->GetMarkBgBitmap(_CHECK_BUTTON_STATUS_SELECTED);
938 if (pMarkBgSelectedBitmap)
940 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pMarkBgSelectedBitmap);
943 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
945 Bitmap* pCircleBitmap = null;
946 Bitmap* pDetailedRightBitmap = null;
947 Bitmap* pCircleEffectBitmap = null;
948 Bitmap* pDetailedRightEffectBitmap = null;
950 if (__detailedPressed == true)
952 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_PRESSED);
953 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_PRESSED);
955 pCircleEffectBitmap = __pCheckButton->GetCirclePressedEffectBitmap();
956 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightPressedEffectBitmap();
960 pCircleBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
961 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(checkStatus);
963 pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
964 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
969 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
972 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_SELECTED);
974 if (themeBgBitmap == false)
976 if (pCircleEffectBitmap)
978 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
982 if (pDetailedRightBitmap)
984 float arrowWidth = pDetailedRightBitmap->GetWidthF();
985 float arrowHeight = pDetailedRightBitmap->GetHeightF();
987 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
988 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
991 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_SELECTED);
993 if (themeBgBitmap == false)
995 if (pDetailedRightEffectBitmap)
997 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
998 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
1000 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1001 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
1007 DrawMarkAnimation();
1009 else if (checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1011 if (checkStatus == _CHECK_BUTTON_STATUS_NORMAL)
1013 if (checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1015 Bitmap* pCircleBitmap = null;
1016 Bitmap* pDetailedRightBitmap = null;
1017 Bitmap* pCircleEffectBitmap = null;
1018 Bitmap* pDetailedRightEffectBitmap = null;
1020 if (__detailedPressed == true)
1022 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_PRESSED);
1023 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_PRESSED);
1025 pCircleEffectBitmap = __pCheckButton->GetCirclePressedEffectBitmap();
1026 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightPressedEffectBitmap();
1030 pCircleBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
1031 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(checkStatus);
1033 pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
1034 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
1039 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
1042 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_NORMAL);
1044 if (themeBgBitmap == false)
1046 if (pCircleEffectBitmap)
1048 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
1052 if (pDetailedRightBitmap)
1054 float arrowWidth = pDetailedRightBitmap->GetWidthF();
1055 float arrowHeight = pDetailedRightBitmap->GetHeightF();
1057 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1058 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
1061 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_NORMAL);
1063 if (themeBgBitmap == false)
1065 if (pDetailedRightEffectBitmap)
1067 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
1068 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
1070 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1071 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
1076 else if (checkStatus == _CHECK_BUTTON_STATUS_DISABLED)
1078 if (checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1080 Bitmap* pCircleBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
1081 Bitmap* pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(checkStatus);
1082 Bitmap* pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
1083 Bitmap* pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
1087 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
1090 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_DISABLED);
1092 if (themeBgBitmap == false)
1094 if (pCircleEffectBitmap)
1096 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
1100 if (pDetailedRightBitmap)
1102 float arrowWidth = pDetailedRightBitmap->GetWidthF();
1103 float arrowHeight = pDetailedRightBitmap->GetHeightF();
1105 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1106 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
1109 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_DISABLED);
1111 if (themeBgBitmap == false)
1113 if (pDetailedRightEffectBitmap)
1115 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
1116 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
1118 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1119 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
1124 else if (checkStatus == _CHECK_BUTTON_STATUS_PRESSED)
1126 if (checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1128 Bitmap* pCircleBitmap = null;
1129 Bitmap* pDetailedRightBitmap = null;
1130 Bitmap* pCircleEffectBitmap = null;
1131 Bitmap* pDetailedRightEffectBitmap = null;
1133 if (__detailedPressed == true)
1135 pCircleBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
1136 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(checkStatus);
1138 pCircleEffectBitmap = __pCheckButton->GetCirclePressedEffectBitmap();
1139 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightPressedEffectBitmap();
1143 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_NORMAL);
1144 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_NORMAL);
1146 pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
1147 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
1152 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
1155 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_PRESSED);
1157 if (themeBgBitmap == false)
1159 if (pCircleEffectBitmap)
1161 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
1165 if (pDetailedRightBitmap)
1167 float arrowWidth = pDetailedRightBitmap->GetWidthF();
1168 float arrowHeight = pDetailedRightBitmap->GetHeightF();
1170 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1171 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
1174 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_PRESSED);
1176 if (themeBgBitmap == false)
1178 if (pDetailedRightEffectBitmap)
1180 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
1181 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
1183 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1184 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
1189 else if (checkStatus == _CHECK_BUTTON_STATUS_HIGHLIGHTED)
1191 if (checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1193 Bitmap* pCircleHighlightedBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
1195 Bitmap* pCircleBitmap = null;
1196 Bitmap* pDetailedRightBitmap = null;
1197 Bitmap* pCircleEffectBitmap = null;
1198 Bitmap* pDetailedRightEffectBitmap = null;
1200 if (__detailedPressed == true)
1202 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_PRESSED);
1203 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_PRESSED);
1205 pCircleEffectBitmap = __pCheckButton->GetCirclePressedEffectBitmap();
1206 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightPressedEffectBitmap();
1210 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_NORMAL);
1211 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_NORMAL);
1213 pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
1214 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
1219 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
1222 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_HIGHLIGHTED);
1224 if (themeBgBitmap == false)
1226 if (pCircleEffectBitmap)
1228 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
1232 if (pDetailedRightBitmap)
1234 float arrowWidth = pDetailedRightBitmap->GetWidthF();
1235 float arrowHeight = pDetailedRightBitmap->GetHeightF();
1237 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1238 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
1241 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_HIGHLIGHTED);
1243 if (themeBgBitmap == false)
1245 if (pDetailedRightEffectBitmap)
1247 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
1248 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
1250 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1251 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
1255 if (pCircleHighlightedBitmap && __highlightedIndex == 1)
1257 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleHighlightedBitmap);
1261 else if (checkStatus == _CHECK_BUTTON_STATUS_SELECTED)
1263 if (checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1265 Bitmap* pCircleBitmap = null;
1266 Bitmap* pDetailedRightBitmap = null;
1267 Bitmap* pCircleEffectBitmap = null;
1268 Bitmap* pDetailedRightEffectBitmap = null;
1270 if (__detailedPressed == true)
1272 pCircleBitmap = __pCheckButton->GetCircleBitmap(_CHECK_BUTTON_STATUS_PRESSED);
1273 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(_CHECK_BUTTON_STATUS_PRESSED);
1275 pCircleEffectBitmap = __pCheckButton->GetCirclePressedEffectBitmap();
1276 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightPressedEffectBitmap();
1280 pCircleBitmap = __pCheckButton->GetCircleBitmap(checkStatus);
1281 pDetailedRightBitmap = __pCheckButton->GetDetailedRightBitmap(checkStatus);
1283 pCircleEffectBitmap = __pCheckButton->GetCircleNormalEffectBitmap();
1284 pDetailedRightEffectBitmap = __pCheckButton->GetDetailedRightNormalEffectBitmap();
1289 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleBitmap);
1292 bool themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_BG_SELECTED);
1294 if (themeBgBitmap == false)
1296 if (pCircleEffectBitmap)
1298 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x, __detailedButtonBounds.y), *pCircleEffectBitmap);
1302 if (pDetailedRightBitmap)
1304 float arrowWidth = pDetailedRightBitmap->GetWidthF();
1305 float arrowHeight = pDetailedRightBitmap->GetHeightF();
1307 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1308 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightBitmap);
1311 themeBgBitmap = IS_CUSTOM_BITMAP(CHECKBUTTON::DETAILED_ICON_SELECTED);
1313 if (themeBgBitmap == false)
1315 if (pDetailedRightEffectBitmap)
1317 float arrowWidth = pDetailedRightEffectBitmap->GetWidthF();
1318 float arrowHeight = pDetailedRightEffectBitmap->GetHeightF();
1320 pCanvas->DrawBitmap(FloatPoint(__detailedButtonBounds.x + (__detailedButtonBounds.width - arrowWidth) / 2.0f
1321 , __detailedButtonBounds.y + (__detailedButtonBounds.height - arrowHeight) / 2.0f), *pDetailedRightEffectBitmap);
1327 DrawMarkAnimation();
1329 else if (checkStyle == CHECK_BUTTON_STYLE_ONOFF || checkStyle == CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER)
1331 if (checkStatus == _CHECK_BUTTON_STATUS_NORMAL)
1333 Bitmap* pOnOffBgNormalBitmap = __pCheckButton->GetOnOffBgBitmap(_CHECK_BUTTON_STATUS_NORMAL);
1335 if (pOnOffBgNormalBitmap)
1337 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffBgNormalBitmap);
1340 Bitmap* pOnOffNormalBitmap = __pCheckButton->GetOnOffBitmap(_CHECK_BUTTON_STATUS_NORMAL);
1342 if (__pCheckButton->IsSelected() && pOnOffNormalBitmap)
1344 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffNormalBitmap);
1347 else if (checkStatus == _CHECK_BUTTON_STATUS_DISABLED)
1349 Bitmap* pOnOffBgDisabledBitmap = __pCheckButton->GetOnOffBgBitmap(_CHECK_BUTTON_STATUS_DISABLED);
1351 if (pOnOffBgDisabledBitmap)
1353 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffBgDisabledBitmap);
1356 Bitmap* pOnOffDisabledBitmap = __pCheckButton->GetOnOffBitmap(_CHECK_BUTTON_STATUS_DISABLED);
1358 if (__pCheckButton->IsSelected() && pOnOffDisabledBitmap)
1360 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffDisabledBitmap);
1363 else if (checkStatus == _CHECK_BUTTON_STATUS_PRESSED)
1365 Bitmap* pOnOffBgPressedBitmap = __pCheckButton->GetOnOffBgBitmap(_CHECK_BUTTON_STATUS_PRESSED);
1367 if (pOnOffBgPressedBitmap)
1369 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffBgPressedBitmap);
1372 Bitmap* pOnOffPressedBitmap = __pCheckButton->GetOnOffBitmap(_CHECK_BUTTON_STATUS_PRESSED);
1374 if (__pCheckButton->IsSelected() && pOnOffPressedBitmap)
1376 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffPressedBitmap);
1379 else if (checkStatus == _CHECK_BUTTON_STATUS_HIGHLIGHTED)
1381 Bitmap* pOnOffBgNormalBitmap = __pCheckButton->GetOnOffBgBitmap(_CHECK_BUTTON_STATUS_NORMAL);
1382 Bitmap* pOnOffBgHighlightedBitmap = __pCheckButton->GetOnOffBgBitmap(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
1384 if (pOnOffBgNormalBitmap)
1386 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffBgNormalBitmap);
1389 Bitmap* pOnOffHighlightedBitmap = __pCheckButton->GetOnOffBitmap(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
1391 if (__pCheckButton->IsSelected() && pOnOffHighlightedBitmap)
1393 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffHighlightedBitmap);
1396 if (pOnOffBgHighlightedBitmap && __highlightedIndex == 1)
1398 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffBgHighlightedBitmap);
1401 else if (checkStatus == _CHECK_BUTTON_STATUS_SELECTED)
1403 Bitmap* pOnOffBgSelectedBitmap = __pCheckButton->GetOnOffBgBitmap(_CHECK_BUTTON_STATUS_SELECTED);
1405 if (pOnOffBgSelectedBitmap)
1407 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffBgSelectedBitmap);
1410 Bitmap* pOnOffSelectedBitmap = __pCheckButton->GetOnOffBitmap(_CHECK_BUTTON_STATUS_SELECTED);
1412 if (__pCheckButton->IsSelected() && pOnOffSelectedBitmap)
1414 pCanvas->DrawBitmap(FloatPoint(__defaultButtonBounds.x, __defaultButtonBounds.y), *pOnOffSelectedBitmap);
1418 else if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1420 float handlerWidth = 0.0f;
1421 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_HANDLER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, handlerWidth);
1422 DrawOnOffSlidingHandler(__onOffHandlerPosition - (handlerWidth / 2.0f));
1424 float dividerWidth = 0.0f;
1425 float dividerTopMargin = 0.0f;
1426 float dividerRightMargin = 0.0f;
1428 Color dividerLeftColor;
1429 //Color dividerRightColor;
1430 FloatDimension minDimension(0.0f, 0.0f);
1432 GET_SHAPE_CONFIG(CHECKBUTTON::DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, dividerWidth);
1433 GET_SHAPE_CONFIG(CHECKBUTTON::DIVIDER_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerTopMargin);
1434 GET_SHAPE_CONFIG(CHECKBUTTON::DIVIDER_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerRightMargin);
1435 GET_COLOR_CONFIG(HEADER::DIVIDER_LINE_LEFT_NORMAL, dividerLeftColor);
1436 //GET_COLOR_CONFIG(HEADER::DIVIDER_LINE_RIGHT_NORMAL, dividerRightColor);
1438 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION, __pCheckButton->GetOrientation(), minDimension);
1440 FloatRectangle bounds(0.0f, 0.0f, __pCheckButton->GetBoundsF().width, __pCheckButton->GetBoundsF().height);
1442 if (bounds.height < minDimension.height)
1444 bounds.height = minDimension.height;
1447 if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1449 pCanvas->SetForegroundColor(dividerLeftColor);
1450 pCanvas->SetLineWidth(dividerWidth);
1451 pCanvas->DrawLine(FloatPoint(__onOffSlidingButtonBounds.x - dividerRightMargin + dividerWidth, dividerTopMargin),
1452 FloatPoint(__onOffSlidingButtonBounds.x - dividerRightMargin + dividerWidth, dividerTopMargin + bounds.height - dividerTopMargin * 2));
1454 //pCanvas->SetForegroundColor(dividerRightColor);
1455 //pCanvas->SetLineWidth(dividerWidth/2);
1456 //pCanvas->DrawLine(FloatPoint(__onOffSlidingButtonBounds.x - dividerRightMargin + dividerWidth, dividerTopMargin),
1457 // FloatPoint(__onOffSlidingButtonBounds.x - dividerRightMargin + dividerWidth, dividerTopMargin + bounds.height - dividerTopMargin * 2));
1462 delete pReColorCircleBitmap;
1463 delete pReColorRightBitmap;
1469 _CheckButtonPresenter::DrawText(void)
1471 result r = E_SUCCESS;
1473 TextSimple* pSimpleText = null;
1474 TextSimple* pSimpleTitleText = null;
1475 TextObjectAlignment horizontalAlign = TEXT_OBJECT_ALIGNMENT_CENTER;
1476 TextObjectAlignment verticalAlign = TEXT_OBJECT_ALIGNMENT_MIDDLE;
1478 _CheckButtonStatus checkStatus = __pCheckButton->GetCheckButtonStatus();
1479 bool showTitle = __pCheckButton->GetShowTitle();
1481 Canvas* pCanvas = __pCheckButton->GetCanvasN();
1482 if (pCanvas == null)
1484 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
1489 __pTextObject->RemoveAll(true);
1490 pSimpleText = new (std::nothrow) TextSimple(const_cast<wchar_t*>(__pCheckButton->GetText().GetPointer()), __pCheckButton->GetText().GetLength());
1491 __pTextObject->AppendElement(*pSimpleText);
1493 __pTitleTextObject->RemoveAll(true);
1494 pSimpleTitleText = new (std::nothrow) TextSimple(const_cast<wchar_t*>(__pCheckButton->GetTitleText().GetPointer()), __pCheckButton->GetTitleText().GetLength());
1495 __pTitleTextObject->AppendElement(*pSimpleTitleText);
1497 if (checkStatus == _CHECK_BUTTON_STATUS_NORMAL)
1499 __pTextObject->SetForegroundColor(__pCheckButton->GetTextColor(), 0, __pTextObject->GetTextLength());
1500 __pTitleTextObject->SetForegroundColor(__pCheckButton->GetTitleTextColor(), 0, __pTitleTextObject->GetTextLength());
1502 else if (checkStatus == _CHECK_BUTTON_STATUS_DISABLED)
1504 __pTextObject->SetForegroundColor(__pCheckButton->GetDisabledTextColor(), 0, __pTextObject->GetTextLength());
1505 __pTitleTextObject->SetForegroundColor(__pCheckButton->GetDisabledTitleTextColor(), 0, __pTitleTextObject->GetTextLength());
1507 else if (checkStatus == _CHECK_BUTTON_STATUS_PRESSED)
1509 __pTextObject->SetForegroundColor(__pCheckButton->GetPressedTextColor(), 0, __pTextObject->GetTextLength());
1510 __pTitleTextObject->SetForegroundColor(__pCheckButton->GetPressedTitleTextColor(), 0, __pTitleTextObject->GetTextLength());
1512 else if (checkStatus == _CHECK_BUTTON_STATUS_HIGHLIGHTED)
1514 __pTextObject->SetForegroundColor(__pCheckButton->GetHighlightedTextColor(), 0, __pTextObject->GetTextLength());
1515 __pTitleTextObject->SetForegroundColor(__pCheckButton->GetHighlightedTitleTextColor(), 0, __pTitleTextObject->GetTextLength());
1519 __pTextObject->SetForegroundColor(__pCheckButton->GetSelectedTextColor(), 0, __pTextObject->GetTextLength());
1520 __pTitleTextObject->SetForegroundColor(__pCheckButton->GetSelectedTitleTextColor(), 0, __pTitleTextObject->GetTextLength());
1523 CalculateTextBounds();
1524 CalculateTitleTextBounds();
1526 __pTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
1527 __pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
1528 __pTextObject->SetBounds(GetTextBoundsF());
1529 __pTextObject->Compose();
1531 __pTitleTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
1532 __pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
1533 __pTitleTextObject->SetBounds(GetTitleTextBoundsF());
1534 __pTitleTextObject->Compose();
1536 switch (__pCheckButton->GetTextHorizontalAlignment())
1538 case ALIGNMENT_LEFT:
1539 horizontalAlign = TEXT_OBJECT_ALIGNMENT_LEFT;
1541 case ALIGNMENT_CENTER:
1542 horizontalAlign = TEXT_OBJECT_ALIGNMENT_CENTER;
1545 horizontalAlign = TEXT_OBJECT_ALIGNMENT_RIGHT;
1548 switch (__pCheckButton->GetTextVerticalAlignment())
1551 verticalAlign = TEXT_OBJECT_ALIGNMENT_TOP;
1553 case ALIGNMENT_MIDDLE:
1554 verticalAlign = TEXT_OBJECT_ALIGNMENT_MIDDLE;
1557 verticalAlign = TEXT_OBJECT_ALIGNMENT_BOTTOM;
1560 __fontSize = __pCheckButton->GetTextSizeF();
1561 __pTextFont = __pCheckButton->GetFallbackFont();
1562 r = GetLastResult();
1563 SysTryReturnVoidResult(NID_UI_CTRL, __pTextFont, r, "[%s] Propagating.", GetErrorMessage(r));
1565 __pTextObject->SetAlignment(horizontalAlign | verticalAlign);
1566 __pTextObject->SetFont(__pTextFont, 0, __pTextObject->GetTextLength());
1567 __pTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
1569 __fontSize = __pCheckButton->GetTitleTextSizeF();
1570 __pTitleTextFont = __pCheckButton->GetFallbackFont();
1571 r = GetLastResult();
1572 SysTryReturnVoidResult(NID_UI_CTRL, __pTitleTextFont, r, "[%s] Propagating.", GetErrorMessage(r));
1574 __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
1575 __pTitleTextObject->SetFont(__pTitleTextFont, 0, __pTitleTextObject->GetTextLength());
1579 __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
1588 _CheckButtonPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1590 if (&source != __pCheckButton)
1595 if (!__pCheckButton->IsEnabled())
1600 __touchMoveHandled = false;
1602 FloatPoint touchPoint = touchinfo.GetCurrentPosition();
1604 touchPoint.x += source.GetClientBoundsF().x;
1605 touchPoint.y += source.GetClientBoundsF().y;
1607 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
1609 if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1611 if (__onOffSlidingButtonBounds.Contains(touchPoint))
1613 __onOffHandlerPressed = true;
1617 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
1620 else if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1622 if (__detailedButtonBounds.Contains(touchPoint))
1624 __detailedPressed = true;
1628 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
1633 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
1636 __pCheckButton->Invalidate();
1642 _CheckButtonPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1644 float checkButtonLeftMargin = 0.0f;
1645 float checkButtonDetailedBitmapWidth = 0.0f;
1646 float checkButtonOnOffSlidingBitmapWidth = 0.0f;
1647 float dividerRightMargin = 0.0f;
1649 GET_SHAPE_CONFIG(CHECKBUTTON::LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, checkButtonLeftMargin);
1650 GET_SHAPE_CONFIG(CHECKBUTTON::DETAILED_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonDetailedBitmapWidth);
1651 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonOnOffSlidingBitmapWidth);
1652 GET_SHAPE_CONFIG(CHECKBUTTON::DIVIDER_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerRightMargin);
1654 if (&source != __pCheckButton)
1659 if (!__pCheckButton->IsEnabled())
1664 _CheckButtonStatus status = __pCheckButton->GetCheckButtonStatus();
1665 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
1667 if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1669 if (status == _CHECK_BUTTON_STATUS_NORMAL && __onOffHandlerPressed == false)
1671 __onOffHandlerMoved = false;
1676 else if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1678 if (status == _CHECK_BUTTON_STATUS_NORMAL && __detailedPressed == true)
1680 __detailedPressed = false;
1682 __pCheckButton->Invalidate();
1689 if (status == _CHECK_BUTTON_STATUS_NORMAL)
1695 if (checkStyle == CHECK_BUTTON_STYLE_MARK || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON
1696 || checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1698 StartCheckAnimationTimer();
1702 FloatPoint touchPoint = touchinfo.GetCurrentPosition();
1704 touchPoint.x += source.GetClientBoundsF().x;
1705 touchPoint.y += source.GetClientBoundsF().y;
1707 FloatRectangle bounds = __pCheckButton->GetClientBoundsF();
1708 FloatRectangle detailedBounds = __pCheckButton->GetClientBoundsF();
1710 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
1711 __pCheckButton->Invalidate();
1713 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1715 if (bounds.Contains(touchPoint) && !__detailedButtonBounds.Contains(touchPoint))
1717 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
1719 __pCheckButton->FireActionEvent();
1721 if (__pCheckButton->GetRadioGroup() != null)
1723 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
1727 else if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1729 detailedBounds.width = detailedBounds.width - checkButtonLeftMargin - checkButtonOnOffSlidingBitmapWidth - dividerRightMargin;
1731 if (!detailedBounds.Contains(touchPoint))
1733 if (__onOffHandlerMoved == false)
1735 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
1737 __pCheckButton->FireActionEvent();
1739 if (__pCheckButton->GetRadioGroup() != null)
1741 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
1746 AdjustHandlerPosition();
1748 __onOffHandlerPressed = false;
1749 __onOffHandlerMoved = false;
1751 else if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING)
1753 if (bounds.Contains(touchPoint))
1755 if (__onOffHandlerMoved == false)
1757 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
1759 __pCheckButton->FireActionEvent();
1761 if (__pCheckButton->GetRadioGroup() != null)
1763 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
1768 AdjustHandlerPosition();
1770 __onOffHandlerPressed = false;
1771 __onOffHandlerMoved = false;
1775 if (bounds.Contains(touchPoint))
1777 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
1779 __pCheckButton->FireActionEvent();
1781 if (__pCheckButton->GetRadioGroup() != null)
1783 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
1792 _CheckButtonPresenter::InitOnOffHandlerMoved(void)
1794 __onOffHandlerMoved = false;
1800 _CheckButtonPresenter::AdjustHandlerPosition(void)
1802 float handlerWidth = 0.0f;
1803 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_HANDLER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, handlerWidth);
1805 if (__onOffHandlerMoved == false)
1807 if (!__pCheckButton->IsSelected())
1809 __onOffHandlerPosition = __onOffSlidingButtonBounds.x;
1813 __onOffHandlerPosition = __onOffSlidingButtonBounds.x + __onOffSlidingButtonBounds.width - (handlerWidth / 2.0f);
1818 if (!__pCheckButton->IsSelected())
1820 if (__onOffHandlerPosition < __onOffSlidingButtonBounds.x + (__onOffSlidingButtonBounds.width / 2.0f))
1822 __onOffHandlerPosition = __onOffSlidingButtonBounds.x;
1826 __onOffHandlerPosition = __onOffSlidingButtonBounds.x + __onOffSlidingButtonBounds.width - (handlerWidth / 2.0f);
1828 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
1830 __pCheckButton->FireActionEvent();
1832 if (__pCheckButton->GetRadioGroup() != null)
1834 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
1840 if (__onOffHandlerPosition < __onOffSlidingButtonBounds.x + (__onOffSlidingButtonBounds.width / 2.0f))
1842 __onOffHandlerPosition = __onOffSlidingButtonBounds.x;
1844 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
1846 __pCheckButton->FireActionEvent();
1848 if (__pCheckButton->GetRadioGroup() != null)
1850 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
1855 __onOffHandlerPosition = __onOffSlidingButtonBounds.x + __onOffSlidingButtonBounds.width - (handlerWidth / 2.0f);
1860 __pCheckButton->Invalidate();
1866 _CheckButtonPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1868 if (&source != __pCheckButton)
1873 if (!__pCheckButton->IsEnabled())
1878 FloatPoint touchPoint = touchinfo.GetCurrentPosition();
1880 touchPoint.x += source.GetClientBoundsF().x;
1881 touchPoint.y += source.GetClientBoundsF().y;
1883 FloatRectangle bounds = __pCheckButton->GetClientBoundsF();
1884 bool isInCheckButtonArea = bounds.Contains(touchPoint);
1885 bool isInOnOffHandlerArea = __onOffSlidingButtonBounds.Contains(touchPoint);
1886 bool isDetailedArea = __detailedButtonBounds.Contains(touchPoint);
1888 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
1890 if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1892 if (__onOffHandlerPressed == true)
1894 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
1898 if (isInCheckButtonArea == true && __touchMoveHandled == false && isInOnOffHandlerArea == false)
1900 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
1904 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
1908 else if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
1910 if (isDetailedArea == true && __touchMoveHandled == false)
1912 __detailedPressed = true;
1914 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
1918 __detailedPressed = false;
1920 if (isInCheckButtonArea == true && __touchMoveHandled == false && isDetailedArea == false)
1922 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
1926 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
1932 if (isInCheckButtonArea == true && __touchMoveHandled == false)
1934 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
1938 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
1942 if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
1944 if (isInOnOffHandlerArea == true && __onOffHandlerPressed == true)
1946 __onOffHandlerPosition = touchPoint.x;
1948 __onOffHandlerMoved = true;
1952 __pCheckButton->Invalidate();
1954 if (__onOffHandlerMoved == true)
1965 _CheckButtonPresenter::DrawOnOffSlidingHandler(float handlerPosition)
1967 Canvas* pCanvas = __pCheckButton->GetCanvasN();
1968 if (pCanvas == null)
1970 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
1975 Bitmap* pReColorBgBitmap = null;
1977 Color detailedHighlightedBgColor;
1978 GET_COLOR_CONFIG(CHECKBUTTON::DETAILED_ICON_BG_HIGHLIGHTED, detailedHighlightedBgColor);
1980 float handlerMargin = 0.0f;
1981 float handlerWidth = 0.0f;
1983 _CheckButtonStatus checkStatus = __pCheckButton->GetCheckButtonStatus();
1985 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_HANDLER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, handlerMargin);
1986 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_HANDLER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, handlerWidth);
1988 if (handlerPosition < __onOffSlidingButtonBounds.x)
1990 handlerPosition = __onOffSlidingButtonBounds.x;
1993 if (handlerPosition > __onOffSlidingButtonBounds.x + __onOffSlidingButtonBounds.width - handlerWidth)
1995 handlerPosition = __onOffSlidingButtonBounds.x + __onOffSlidingButtonBounds.width - handlerWidth;
1998 if (!__pCheckButton->IsSelected())
2000 if (checkStatus == _CHECK_BUTTON_STATUS_NORMAL)
2002 Bitmap* pOnOffSlidingNormalBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_NORMAL);
2004 if (pOnOffSlidingNormalBgBitmap)
2006 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingNormalBgBitmap);
2009 Bitmap* pOnOffSlidingOffHandlerNormalBitmap = __pCheckButton->GetOnOffSlidingOffHandlerBitmap(_CHECK_BUTTON_STATUS_NORMAL);
2011 if (pOnOffSlidingOffHandlerNormalBitmap)
2013 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOffHandlerNormalBitmap);
2016 else if (checkStatus == _CHECK_BUTTON_STATUS_DISABLED)
2018 Bitmap* pOnOffSlidingDisabledBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_DISABLED);
2020 if (pOnOffSlidingDisabledBgBitmap)
2022 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingDisabledBgBitmap);
2025 Bitmap* pOnOffSlidingOffHandlerDisabledBitmap = __pCheckButton->GetOnOffSlidingOffHandlerBitmap(_CHECK_BUTTON_STATUS_DISABLED);
2027 if (pOnOffSlidingOffHandlerDisabledBitmap)
2029 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOffHandlerDisabledBitmap);
2032 else if (checkStatus == _CHECK_BUTTON_STATUS_PRESSED)
2034 Bitmap* pOnOffSlidingPressedBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_PRESSED);
2036 if (pOnOffSlidingPressedBgBitmap)
2038 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingPressedBgBitmap);
2041 Bitmap* pOnOffSlidingOffHandlerPressedBitmap = __pCheckButton->GetOnOffSlidingOffHandlerBitmap(_CHECK_BUTTON_STATUS_PRESSED);
2043 if (pOnOffSlidingOffHandlerPressedBitmap)
2045 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOffHandlerPressedBitmap);
2048 else if (checkStatus == _CHECK_BUTTON_STATUS_HIGHLIGHTED)
2050 Bitmap* pOnOffSlidingHighlightedBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
2052 if (pOnOffSlidingHighlightedBgBitmap)
2054 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingHighlightedBgBitmap);
2057 Bitmap* pOnOffSlidingOffHandlerNormalBitmap = __pCheckButton->GetOnOffSlidingOffHandlerBitmap(_CHECK_BUTTON_STATUS_NORMAL);
2059 if (pOnOffSlidingOffHandlerNormalBitmap)
2061 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOffHandlerNormalBitmap);
2064 Bitmap* pOnOffSlidingOffHandlerHighlightedBitmap = __pCheckButton->GetOnOffSlidingOffHandlerBitmap(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
2066 if (pOnOffSlidingOffHandlerHighlightedBitmap && __highlightedIndex == 1)
2068 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOffHandlerHighlightedBitmap);
2071 else if (checkStatus == _CHECK_BUTTON_STATUS_SELECTED)
2073 Bitmap* pOnOffSlidingSelectedBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_SELECTED);
2075 if (pOnOffSlidingSelectedBgBitmap)
2077 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingSelectedBgBitmap);
2080 Bitmap* pOnOffSlidingOffHandlerSelectedBitmap = __pCheckButton->GetOnOffSlidingOffHandlerBitmap(_CHECK_BUTTON_STATUS_SELECTED);
2082 if (pOnOffSlidingOffHandlerSelectedBitmap)
2084 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOffHandlerSelectedBitmap);
2090 if (checkStatus == _CHECK_BUTTON_STATUS_NORMAL)
2092 Bitmap* pOnOffSlidingNormalBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_NORMAL);
2094 if (pOnOffSlidingNormalBgBitmap)
2096 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingNormalBgBitmap);
2099 Bitmap* pOnOffSlidingOnHandlerNormalBitmap = __pCheckButton->GetOnOffSlidingOnHandlerBitmap(_CHECK_BUTTON_STATUS_NORMAL);
2101 if (pOnOffSlidingOnHandlerNormalBitmap)
2103 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOnHandlerNormalBitmap);
2106 else if (checkStatus == _CHECK_BUTTON_STATUS_DISABLED)
2108 Bitmap* pOnOffSlidingDisabledBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_DISABLED);
2110 if (pOnOffSlidingDisabledBgBitmap)
2112 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingDisabledBgBitmap);
2115 Bitmap* pOnOffSlidingOnHandlerDisabledBitmap = __pCheckButton->GetOnOffSlidingOnHandlerBitmap(_CHECK_BUTTON_STATUS_DISABLED);
2117 if (pOnOffSlidingOnHandlerDisabledBitmap)
2119 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOnHandlerDisabledBitmap);
2122 else if (checkStatus == _CHECK_BUTTON_STATUS_PRESSED)
2124 Bitmap* pOnOffSlidingPressedBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_PRESSED);
2126 if (pOnOffSlidingPressedBgBitmap)
2128 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingPressedBgBitmap);
2131 Bitmap* pOnOffSlidingOnHandlerPressedBitmap = __pCheckButton->GetOnOffSlidingOnHandlerBitmap(_CHECK_BUTTON_STATUS_PRESSED);
2133 if (pOnOffSlidingOnHandlerPressedBitmap)
2135 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOnHandlerPressedBitmap);
2138 else if (checkStatus == _CHECK_BUTTON_STATUS_HIGHLIGHTED)
2140 Bitmap* pOnOffSlidingHighlightedBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
2142 if (pOnOffSlidingHighlightedBgBitmap)
2144 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingHighlightedBgBitmap);
2147 Bitmap* pOnOffSlidingOnHandlerNormalBitmap = __pCheckButton->GetOnOffSlidingOnHandlerBitmap(_CHECK_BUTTON_STATUS_NORMAL);
2149 if (pOnOffSlidingOnHandlerNormalBitmap)
2151 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOnHandlerNormalBitmap);
2154 Bitmap* pOnOffSlidingOnHandlerHighlightedBitmap = __pCheckButton->GetOnOffSlidingOnHandlerBitmap(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
2156 if (pOnOffSlidingOnHandlerHighlightedBitmap && __highlightedIndex == 1)
2158 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOnHandlerHighlightedBitmap);
2161 else if (checkStatus == _CHECK_BUTTON_STATUS_SELECTED)
2163 Bitmap* pOnOffSlidingSelectedBgBitmap = __pCheckButton->GetOnOffSlidingBgBitmap(_CHECK_BUTTON_STATUS_SELECTED);
2165 if (pOnOffSlidingSelectedBgBitmap)
2167 pCanvas->DrawBitmap(FloatPoint(__onOffSlidingButtonBounds.x, __onOffSlidingButtonBounds.y), *pOnOffSlidingSelectedBgBitmap);
2170 Bitmap* pOnOffSlidingOnHandlerSelectedBitmap = __pCheckButton->GetOnOffSlidingOnHandlerBitmap(_CHECK_BUTTON_STATUS_SELECTED);
2172 if (pOnOffSlidingOnHandlerSelectedBitmap)
2174 pCanvas->DrawBitmap(FloatPoint(handlerPosition, __onOffSlidingButtonBounds.y - handlerMargin), *pOnOffSlidingOnHandlerSelectedBitmap);
2180 delete pReColorBgBitmap;
2186 _CheckButtonPresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
2188 if (&source != __pCheckButton)
2193 if (!__pCheckButton->IsEnabled())
2198 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
2199 __pCheckButton->Invalidate();
2205 _CheckButtonPresenter::OnTouchMoveHandled(const _Control& control)
2207 __touchMoveHandled = true;
2208 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
2209 __pCheckButton->Invalidate();
2215 _CheckButtonPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
2217 _KeyCode keyCode = keyInfo.GetKeyCode();
2219 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
2221 if (__pCheckButton->IsFocusModeStateEnabled() == true && keyCode == _KEY_ENTER)
2223 if (__pCheckButton->GetCheckButtonStatus() != _CHECK_BUTTON_STATUS_DISABLED)
2225 if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
2227 if (__highlightedIndex == 1)
2229 __onOffHandlerPressed = true;
2233 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
2236 else if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
2238 if (__highlightedIndex == 2)
2240 __detailedPressed = true;
2244 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
2247 else if (checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
2249 if (__highlightedIndex == 1)
2251 __detailedPressed = true;
2255 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
2260 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
2265 __pCheckButton->Invalidate();
2271 _CheckButtonPresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
2273 _KeyCode keyCode = keyInfo.GetKeyCode();
2275 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
2277 if (__pCheckButton->IsFocusModeStateEnabled() == true && keyCode == _KEY_LEFT)
2279 if (checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER)
2281 __highlightedIndex = 0;
2283 else if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
2285 if (__highlightedIndex == 0)
2287 __highlightedIndex = 1;
2289 else if (__highlightedIndex == 1)
2291 __highlightedIndex = 2;
2293 else if (__highlightedIndex == 2)
2295 __highlightedIndex = 0;
2300 if (__highlightedIndex == 0)
2302 __highlightedIndex = 1;
2304 else if (__highlightedIndex == 1)
2306 __highlightedIndex = 0;
2310 __pCheckButton->Invalidate();
2312 else if (__pCheckButton->IsFocusModeStateEnabled() == true && keyCode == _KEY_RIGHT)
2314 if (checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER)
2316 __highlightedIndex = 0;
2318 else if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
2320 if (__highlightedIndex == 0)
2322 __highlightedIndex = 2;
2324 else if (__highlightedIndex == 1)
2326 __highlightedIndex = 0;
2328 else if (__highlightedIndex == 2)
2330 __highlightedIndex = 1;
2335 if (__highlightedIndex == 0)
2337 __highlightedIndex = 1;
2339 else if (__highlightedIndex == 1)
2341 __highlightedIndex = 0;
2345 __pCheckButton->Invalidate();
2347 else if (__pCheckButton->IsFocusModeStateEnabled() == true && keyCode == _KEY_ENTER)
2349 if (checkStyle == CHECK_BUTTON_STYLE_MARK || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON
2350 || checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
2352 if (__detailedPressed == false)
2354 StartCheckAnimationTimer();
2359 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
2360 __pCheckButton->Invalidate();
2362 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
2364 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON)
2366 if (__highlightedIndex != 2)
2368 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
2370 __pCheckButton->FireActionEvent();
2372 if (__pCheckButton->GetRadioGroup() != null)
2374 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
2379 __detailedPressed = false;
2382 else if (checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
2384 if (__highlightedIndex != 1)
2386 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
2388 __pCheckButton->FireActionEvent();
2390 if (__pCheckButton->GetRadioGroup() != null)
2392 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
2397 __detailedPressed = false;
2400 else if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING)
2402 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
2404 __pCheckButton->FireActionEvent();
2406 if (__pCheckButton->GetRadioGroup() != null)
2408 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
2411 AdjustHandlerPosition();
2413 __onOffHandlerPressed = false;
2414 __onOffHandlerMoved = false;
2418 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pCheckButton);
2420 __pCheckButton->FireActionEvent();
2422 if (__pCheckButton->GetRadioGroup() != null)
2424 __pCheckButton->SendTouchReleasedEvent(*__pCheckButton);
2433 _CheckButtonPresenter::IsEnabledStateChanged(void)
2435 bool __currentEnabledState = __pCheckButton->GetEnableState();
2437 if (__currentEnabledState != __previousEnabledState)
2439 __previousEnabledState = __currentEnabledState;
2449 _CheckButtonPresenter::CalculateTitleTextBounds(void)
2451 float checkButtonLeftMargin = 0.0f;
2452 float checkButtonTopMargin = 0.0f;
2453 float checkButtonBitmapWidth = 0.0f;
2454 float checkButtonOnOffSlidingBitmapWidth = 0.0f;
2455 float checkButtonDetailedBitmapWidth = 0.0f;
2456 float checkButtonTitleTextHeight = 0.0f;
2457 float checkButtonTextHeight = 0.0f;
2459 FloatDimension minDimension(0.0f, 0.0f);
2460 FloatDimension minDimensionWithAnnex(0.0f, 0.0f);
2462 GET_SHAPE_CONFIG(CHECKBUTTON::LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, checkButtonLeftMargin);
2463 GET_SHAPE_CONFIG(CHECKBUTTON::TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, checkButtonTopMargin);
2464 GET_SHAPE_CONFIG(CHECKBUTTON::MARK_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonBitmapWidth);
2465 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonOnOffSlidingBitmapWidth);
2466 GET_SHAPE_CONFIG(CHECKBUTTON::DETAILED_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonDetailedBitmapWidth);
2467 GET_SHAPE_CONFIG(CHECKBUTTON::TITLE_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, checkButtonTitleTextHeight);
2468 GET_SHAPE_CONFIG(CHECKBUTTON::TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, checkButtonTextHeight);
2470 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION, __pCheckButton->GetOrientation(), minDimension);
2471 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION_WITH_ANNEX, __pCheckButton->GetOrientation(), minDimensionWithAnnex);
2473 FloatRectangle bounds(0.0f, 0.0f, __pCheckButton->GetBoundsF().width, __pCheckButton->GetBoundsF().height);
2475 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
2477 if (checkStyle == CHECK_BUTTON_STYLE_MARK || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_ONOFF
2478 || checkStyle == CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER)
2480 if (bounds.width < minDimension.width)
2482 bounds.width = minDimension.width;
2485 if (bounds.height < minDimension.height)
2487 bounds.height = minDimension.height;
2492 if (bounds.width < minDimensionWithAnnex.width)
2494 bounds.width = minDimensionWithAnnex.width;
2497 if (bounds.height < minDimensionWithAnnex.height)
2499 bounds.height = minDimensionWithAnnex.height;
2503 if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
2505 __titleTextBounds.x = checkButtonLeftMargin;
2506 __titleTextBounds.y = checkButtonTopMargin;
2507 __titleTextBounds.width = bounds.width - checkButtonLeftMargin * 3 - checkButtonOnOffSlidingBitmapWidth;
2508 __titleTextBounds.height = bounds.height - checkButtonTopMargin * 2 - __textBounds.height;
2512 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
2514 __titleTextBounds.x = checkButtonLeftMargin * 2 + checkButtonBitmapWidth;
2515 __titleTextBounds.y = checkButtonTopMargin;
2516 __titleTextBounds.width = bounds.width - checkButtonLeftMargin * 4 - checkButtonBitmapWidth - checkButtonDetailedBitmapWidth;
2517 __titleTextBounds.height = bounds.height - checkButtonTopMargin * 2 - __textBounds.height;
2521 __titleTextBounds.x = checkButtonLeftMargin * 2 + checkButtonBitmapWidth;
2522 __titleTextBounds.y = checkButtonTopMargin;
2523 __titleTextBounds.width = bounds.width - checkButtonLeftMargin * 3 - checkButtonBitmapWidth;
2524 __titleTextBounds.height = bounds.height - checkButtonTopMargin * 2 - __textBounds.height;
2532 _CheckButtonPresenter::CalculateTextBounds(void)
2534 float checkButtonLeftMargin = 0.0f;
2535 float checkButtonTopMargin = 0.0f;
2536 float checkButtonBitmapWidth = 0.0f;
2537 float checkButtonOnOffSlidingBitmapWidth = 0.0f;
2538 float checkButtonDetailedBitmapWidth = 0.0f;
2539 float checkButtonTitleTextHeight = 0.0f;
2540 float checkButtonTextHeight = 0.0f;
2542 FloatDimension minDimension(0.0f, 0.0f);
2543 FloatDimension minDimensionWithAnnex(0.0f, 0.0f);
2545 GET_SHAPE_CONFIG(CHECKBUTTON::LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, checkButtonLeftMargin);
2546 GET_SHAPE_CONFIG(CHECKBUTTON::TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, checkButtonTopMargin);
2547 GET_SHAPE_CONFIG(CHECKBUTTON::MARK_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonBitmapWidth);
2548 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonOnOffSlidingBitmapWidth);
2549 GET_SHAPE_CONFIG(CHECKBUTTON::DETAILED_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonDetailedBitmapWidth);
2550 GET_SHAPE_CONFIG(CHECKBUTTON::TITLE_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, checkButtonTitleTextHeight);
2551 GET_SHAPE_CONFIG(CHECKBUTTON::TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, checkButtonTextHeight);
2553 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION, __pCheckButton->GetOrientation(), minDimension);
2554 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION_WITH_ANNEX, __pCheckButton->GetOrientation(), minDimensionWithAnnex);
2556 FloatRectangle bounds(0.0f, 0.0f, __pCheckButton->GetBoundsF().width, __pCheckButton->GetBoundsF().height);
2558 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
2559 bool showTitle = __pCheckButton->GetShowTitle();
2561 if (checkStyle == CHECK_BUTTON_STYLE_MARK || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_ONOFF
2562 || checkStyle == CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER)
2564 if (bounds.width < minDimension.width)
2566 bounds.width = minDimension.width;
2569 if (bounds.height < minDimension.height)
2571 bounds.height = minDimension.height;
2576 if (bounds.width < minDimensionWithAnnex.width)
2578 bounds.width = minDimensionWithAnnex.width;
2581 if (bounds.height < minDimensionWithAnnex.height)
2583 bounds.height = minDimensionWithAnnex.height;
2587 if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
2591 __textBounds.x = checkButtonLeftMargin;
2592 __textBounds.y = checkButtonTopMargin + checkButtonTitleTextHeight;
2593 __textBounds.width = bounds.width - checkButtonLeftMargin * 3 - checkButtonOnOffSlidingBitmapWidth;
2594 __textBounds.height = bounds.height - checkButtonTopMargin * 2 - checkButtonTitleTextHeight;
2598 __textBounds.x = checkButtonLeftMargin;
2599 __textBounds.y = checkButtonTopMargin;
2600 __textBounds.width = bounds.width - checkButtonLeftMargin * 3 - checkButtonOnOffSlidingBitmapWidth;
2601 __textBounds.height = bounds.height - checkButtonTopMargin * 2;
2606 if (checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON)
2610 __textBounds.x = checkButtonLeftMargin * 2 + checkButtonBitmapWidth;
2611 __textBounds.y = checkButtonTopMargin + checkButtonTitleTextHeight;
2612 __textBounds.width = bounds.width - checkButtonLeftMargin * 4 - checkButtonBitmapWidth - checkButtonDetailedBitmapWidth;
2613 __textBounds.height = bounds.height - checkButtonTopMargin * 2 - checkButtonTitleTextHeight;
2617 __textBounds.x = checkButtonLeftMargin * 2 + checkButtonBitmapWidth;
2618 __textBounds.y = checkButtonTopMargin;
2619 __textBounds.width = bounds.width - checkButtonLeftMargin * 4 - checkButtonBitmapWidth - checkButtonDetailedBitmapWidth;
2620 __textBounds.height = bounds.height - checkButtonTopMargin * 2;
2627 __textBounds.x = checkButtonLeftMargin * 2 + checkButtonBitmapWidth;
2628 __textBounds.y = checkButtonTopMargin + checkButtonTitleTextHeight;
2629 __textBounds.width = bounds.width - checkButtonLeftMargin * 3 - checkButtonBitmapWidth;
2630 __textBounds.height = bounds.height - checkButtonTopMargin * 2 - checkButtonTitleTextHeight;
2634 __textBounds.x = checkButtonLeftMargin * 2 + checkButtonBitmapWidth;
2635 __textBounds.y = checkButtonTopMargin;
2636 __textBounds.width = bounds.width - checkButtonLeftMargin * 3 - checkButtonBitmapWidth;
2637 __textBounds.height = bounds.height - checkButtonTopMargin * 2;
2646 _CheckButtonPresenter::CalculateButtonBounds(void)
2648 float checkButtonLeftMargin = 0.0f;
2649 float checkButtonBitmapWidth = 0.0f;
2650 float checkButtonBitmapHeight = 0.0f;
2651 float checkButtonOnOffSlidingBitmapWidth = 0.0f;
2652 float checkButtonOnOffSlidingBitmapHeight = 0.0f;
2653 float checkButtonDetaieldBitmapWidth = 0.0f;
2654 float checkButtonDetaieldBitmapHeight = 0.0f;
2656 FloatDimension minDimension(0.0f, 0.0f);
2657 FloatDimension minDimensionWithAnnex(0.0f, 0.0f);
2659 GET_SHAPE_CONFIG(CHECKBUTTON::LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, checkButtonLeftMargin);
2660 GET_SHAPE_CONFIG(CHECKBUTTON::MARK_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonBitmapWidth);
2661 GET_SHAPE_CONFIG(CHECKBUTTON::MARK_BITMAP_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, checkButtonBitmapHeight);
2662 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonOnOffSlidingBitmapWidth);
2663 GET_SHAPE_CONFIG(CHECKBUTTON::ONOFF_SLIDING_BITMAP_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, checkButtonOnOffSlidingBitmapHeight);
2664 GET_SHAPE_CONFIG(CHECKBUTTON::DETAILED_BITMAP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonDetaieldBitmapWidth);
2665 GET_SHAPE_CONFIG(CHECKBUTTON::DETAILED_BITMAP_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, checkButtonDetaieldBitmapHeight);
2667 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION, __pCheckButton->GetOrientation(), minDimension);
2668 GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_DIMENSION_WITH_ANNEX, __pCheckButton->GetOrientation(), minDimensionWithAnnex);
2670 FloatRectangle bounds(0.0f, 0.0f, __pCheckButton->GetBoundsF().width, __pCheckButton->GetBoundsF().height);
2672 CheckButtonStyle checkStyle = __pCheckButton->GetCheckButtonStyle();
2674 if (checkStyle == CHECK_BUTTON_STYLE_MARK || checkStyle == CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_ONOFF
2675 || checkStyle == CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER || checkStyle == CHECK_BUTTON_STYLE_RADIO || checkStyle == CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER)
2677 if (bounds.width < minDimension.width)
2679 bounds.width = minDimension.width;
2682 if (bounds.height < minDimension.height)
2684 bounds.height = minDimension.height;
2689 if (bounds.width < minDimensionWithAnnex.width)
2691 bounds.width = minDimensionWithAnnex.width;
2694 if (bounds.height < minDimensionWithAnnex.height)
2696 bounds.height = minDimensionWithAnnex.height;
2700 __defaultButtonBounds.x = checkButtonLeftMargin;
2701 __defaultButtonBounds.y = (bounds.height - checkButtonBitmapHeight) / 2;
2702 __defaultButtonBounds.width = checkButtonBitmapWidth;
2703 __defaultButtonBounds.height = checkButtonBitmapHeight;
2705 __onOffSlidingButtonBounds.x = bounds.width - checkButtonLeftMargin - checkButtonOnOffSlidingBitmapWidth;
2706 __onOffSlidingButtonBounds.y = (bounds.height - checkButtonOnOffSlidingBitmapHeight) / 2;
2707 __onOffSlidingButtonBounds.width = checkButtonOnOffSlidingBitmapWidth;
2708 __onOffSlidingButtonBounds.height = checkButtonOnOffSlidingBitmapHeight;
2710 __detailedButtonBounds.x = bounds.width - checkButtonLeftMargin - checkButtonDetaieldBitmapWidth;
2711 __detailedButtonBounds.y = (bounds.height - checkButtonDetaieldBitmapHeight) / 2;
2712 __detailedButtonBounds.width = checkButtonDetaieldBitmapWidth;
2713 __detailedButtonBounds.height = checkButtonDetaieldBitmapHeight;
2719 _CheckButtonPresenter::GetTitleTextBoundsF(void) const
2721 return __titleTextBounds;
2725 _CheckButtonPresenter::GetTextBoundsF(void) const
2727 return __textBounds;
2731 _CheckButtonPresenter::GetDefaultButtonBoundsF(void) const
2733 return __defaultButtonBounds;
2737 _CheckButtonPresenter::GetOnOffSlidingButtonBoundsF(void) const
2739 return __onOffSlidingButtonBounds;
2743 _CheckButtonPresenter::GetDetailedButtonBoundsF(void) const
2745 return __detailedButtonBounds;
2749 _CheckButtonPresenter::StartCheckAnimationTimer(void)
2751 result r = E_SUCCESS;
2752 if (__pCheckAnimationTimer == null)
2754 __pCheckAnimationTimer = new (std::nothrow) Timer;
2755 SysTryReturn(NID_UI_CTRL, (__pCheckAnimationTimer != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memroy allocation failed.");
2757 r = __pCheckAnimationTimer->Construct(*this);
2758 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2762 __pCheckAnimationTimer->Cancel();
2765 __pCheckAnimationTimer->Start(CHECK_ACTION_TIMER_PERIOD);
2766 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2770 ResetCheckAnimationTimer();
2775 _CheckButtonPresenter::ResetCheckAnimationTimer(void)
2777 delete __pCheckAnimationTimer;
2778 __pCheckAnimationTimer = null;
2784 _CheckButtonPresenter::OnTimerExpired(Timer& timer)
2788 if (__ratio <= RATIO_MAX)
2790 StartCheckAnimationTimer();
2791 DrawMarkAnimation();
2795 ResetCheckAnimationTimer();
2803 _CheckButtonPresenter::OnDrawFocus(void)
2805 if (__pCheckButton->GetCheckButtonStatus() != _CHECK_BUTTON_STATUS_DISABLED)
2807 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
2808 __pCheckButton->Invalidate();
2815 _CheckButtonPresenter::OnChildControlFocusMoved(const _Control& control)
2821 _CheckButtonPresenter::IsChildControlFocusManage(void) const
2827 _CheckButtonPresenter::OnFocusableStateChanged(bool focusalbeState)
2833 _CheckButtonPresenter::OnFocusModeStateChanged(void)
2835 if (__pCheckButton->GetCheckButtonStatus() != _CHECK_BUTTON_STATUS_DISABLED)
2837 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
2838 __pCheckButton->Invalidate();
2845 _CheckButtonPresenter::OnFocusGained(const _Control& source)
2847 __highlightedIndex = 0;
2849 if (__pCheckButton->IsFocusModeStateEnabled() == true)
2851 if (__pCheckButton->GetCheckButtonStatus() != _CHECK_BUTTON_STATUS_DISABLED)
2853 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
2854 __pCheckButton->Invalidate();
2862 _CheckButtonPresenter::OnFocusLost(const _Control& source)
2864 if (__pCheckButton->GetCheckButtonStatus() != _CHECK_BUTTON_STATUS_DISABLED)
2866 __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_NORMAL);
2867 __pCheckButton->Invalidate();
2873 _CheckButtonPresenter::DrawMarkAnimation(void)
2875 Canvas* pCanvas = __pCheckButton->GetCanvasN();
2876 if (pCanvas == null)
2878 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
2883 _CheckButtonStatus checkStatus = __pCheckButton->GetCheckButtonStatus();
2885 if (checkStatus == _CHECK_BUTTON_STATUS_NORMAL)
2887 Bitmap* pMarkNormalBitmap = __pCheckButton->GetMarkBitmap(_CHECK_BUTTON_STATUS_NORMAL);
2889 if (__pCheckButton->IsSelected() && pMarkNormalBitmap)
2891 FloatRectangle sourceRect(0.0f, 0.0f, pMarkNormalBitmap->GetWidthF() * __ratio * 0.1, pMarkNormalBitmap->GetHeightF());
2892 FloatRectangle destRect(__defaultButtonBounds.x, __defaultButtonBounds.y, pMarkNormalBitmap->GetWidthF() * __ratio * 0.1, pMarkNormalBitmap->GetHeightF());
2894 pCanvas->DrawBitmap(destRect, *pMarkNormalBitmap, sourceRect);
2897 else if (checkStatus == _CHECK_BUTTON_STATUS_DISABLED)
2899 Bitmap* pMarkDisabledBitmap = __pCheckButton->GetMarkBitmap(_CHECK_BUTTON_STATUS_DISABLED);
2901 if (__pCheckButton->IsSelected() && pMarkDisabledBitmap)
2903 FloatRectangle sourceRect(0.0f, 0.0f, pMarkDisabledBitmap->GetWidthF() * __ratio * 0.1, pMarkDisabledBitmap->GetHeightF());
2904 FloatRectangle destRect(__defaultButtonBounds.x, __defaultButtonBounds.y, pMarkDisabledBitmap->GetWidthF() * __ratio * 0.1, pMarkDisabledBitmap->GetHeightF());
2906 pCanvas->DrawBitmap(destRect, *pMarkDisabledBitmap, sourceRect);
2909 else if (checkStatus == _CHECK_BUTTON_STATUS_PRESSED)
2911 Bitmap* pMarkPressedBitmap = __pCheckButton->GetMarkBitmap(_CHECK_BUTTON_STATUS_PRESSED);
2913 if (__pCheckButton->IsSelected() && pMarkPressedBitmap)
2915 FloatRectangle sourceRect(0.0f, 0.0f, pMarkPressedBitmap->GetWidthF() * __ratio * 0.1, pMarkPressedBitmap->GetHeightF());
2916 FloatRectangle destRect(__defaultButtonBounds.x, __defaultButtonBounds.y, pMarkPressedBitmap->GetWidthF() * __ratio * 0.1, pMarkPressedBitmap->GetHeightF());
2918 pCanvas->DrawBitmap(destRect, *pMarkPressedBitmap, sourceRect);
2921 else if (checkStatus == _CHECK_BUTTON_STATUS_HIGHLIGHTED)
2923 Bitmap* pMarkHighlightedBitmap = __pCheckButton->GetMarkBitmap(_CHECK_BUTTON_STATUS_HIGHLIGHTED);
2925 if (__pCheckButton->IsSelected() && pMarkHighlightedBitmap)
2927 FloatRectangle sourceRect(0.0f, 0.0f, pMarkHighlightedBitmap->GetWidthF() * __ratio * 0.1, pMarkHighlightedBitmap->GetHeightF());
2928 FloatRectangle destRect(__defaultButtonBounds.x, __defaultButtonBounds.y, pMarkHighlightedBitmap->GetWidthF() * __ratio * 0.1, pMarkHighlightedBitmap->GetHeightF());
2930 pCanvas->DrawBitmap(destRect, *pMarkHighlightedBitmap, sourceRect);
2933 else if (checkStatus == _CHECK_BUTTON_STATUS_SELECTED)
2935 Bitmap* pMarkSelectedBitmap = __pCheckButton->GetMarkBitmap(_CHECK_BUTTON_STATUS_SELECTED);
2937 if (__pCheckButton->IsSelected() && pMarkSelectedBitmap)
2939 FloatRectangle sourceRect(0.0f, 0.0f, pMarkSelectedBitmap->GetWidthF() * __ratio * 0.1, pMarkSelectedBitmap->GetHeightF());
2940 FloatRectangle destRect(__defaultButtonBounds.x, __defaultButtonBounds.y, pMarkSelectedBitmap->GetWidthF() * __ratio * 0.1, pMarkSelectedBitmap->GetHeightF());
2942 pCanvas->DrawBitmap(destRect, *pMarkSelectedBitmap, sourceRect);
2951 }}} // Tizen::Ui::Controls