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_CheckButtonImpl.cpp
19 * @brief This is the implementation file for the _CheckButtonImpl class.
22 #include <FUiCtrlRadioGroup.h>
23 #include <FBaseInternalTypes.h>
24 #include <FBaseSysLog.h>
25 #include <FUiAccessibilityContainer.h>
26 #include <FUiAccessibilityElement.h>
27 #include <FApp_AppInfo.h>
28 #include "FUi_ResourceSizeInfo.h"
29 #include "FUi_ResourceManager.h"
30 #include "FUi_UiBuilder.h"
31 #include "FUiCtrl_CheckButtonImpl.h"
32 #include "FUiCtrl_CheckButton.h"
35 using namespace Tizen::Base;
36 using namespace Tizen::Graphics;
37 using namespace Tizen::App;
39 namespace Tizen { namespace Ui { namespace Controls
43 _CheckButtonImpl::CheckButtonSizeInfo::GetDefaultMinimumSize(_ControlOrientation orientation) const
46 Dimension dimension(0, 0);
48 r = GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_SIZE, orientation, dimension);
49 SysTryReturn(NID_UI, r == E_SUCCESS, dimension, r, "[%s] A system error occurred.", GetErrorMessage(r));
57 _CheckButtonImpl::CheckButtonSizeInfo::GetDefaultMinimumSizeF(_ControlOrientation orientation) const
60 FloatDimension dimension(0.0f, 0.0f);
62 r = GET_DIMENSION_CONFIG(CHECKBUTTON::MIN_SIZE, orientation, dimension);
63 SysTryReturn(NID_UI, r == E_SUCCESS, dimension, r, "[%s] A system error occurred.", GetErrorMessage(r));
71 _CheckButtonImpl::GetInstance(CheckButton& checkButton)
73 return static_cast<_CheckButtonImpl*> (checkButton._pControlImpl);
76 const _CheckButtonImpl*
77 _CheckButtonImpl::GetInstance(const CheckButton& checkButton)
79 return static_cast<const _CheckButtonImpl*> (checkButton._pControlImpl);
82 _CheckButtonImpl::_CheckButtonImpl(CheckButton* pPublic, _CheckButton* pCore)
83 : _ControlImpl(pPublic, pCore)
84 , __pPublicActionEvent(null)
89 _CheckButtonImpl::~_CheckButtonImpl(void)
91 _CheckButtonImpl::GetCore().RemoveActionEventListener(*this);
93 if (__pPublicActionEvent)
95 delete __pPublicActionEvent;
96 __pPublicActionEvent = null;
103 _CheckButtonImpl::CreateCheckButtonImplN(CheckButton* pControl, const Rectangle& bounds)
105 result r = E_SUCCESS;
106 r = GET_SIZE_INFO(CheckButton).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
107 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG, "[E_INVALID_ARG] The given size is not valid.");
109 _CheckButton* pCore = _CheckButton::CreateCheckButtonN();
110 SysTryReturn(NID_UI_CTRL, pCore, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
112 _CheckButtonImpl* pImpl = new (std::nothrow) _CheckButtonImpl(pControl, pCore);
113 r = _ControlImpl::CheckConstruction(pCore, pImpl);
114 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
116 r = pImpl->InitializeBoundsProperties(GET_SIZE_INFO(CheckButton), bounds, pCore->GetOrientation());
117 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
119 r = pCore->AddActionEventListener(*pImpl);
120 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
132 _CheckButtonImpl::CreateCheckButtonImplN(CheckButton* pControl, const FloatRectangle& bounds)
134 result r = E_SUCCESS;
135 r = GET_SIZE_INFO(CheckButton).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
136 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG, "[E_INVALID_ARG] The given size is not valid.");
138 _CheckButton* pCore = _CheckButton::CreateCheckButtonN();
139 SysTryReturn(NID_UI_CTRL, pCore, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
141 _CheckButtonImpl* pImpl = new (std::nothrow) _CheckButtonImpl(pControl, pCore);
142 r = _ControlImpl::CheckConstruction(pCore, pImpl);
143 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
145 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(CheckButton), bounds, pCore->GetOrientation());
146 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
148 r = pCore->AddActionEventListener(*pImpl);
149 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
161 _CheckButtonImpl::GetColorOnError(void)
163 return Color(0XFFFFFFFF);
167 _CheckButtonImpl::GetPublicClassName(void) const
169 return "Tizen::Ui::Controls::CheckButton";
173 _CheckButtonImpl::GetPublic(void) const
175 return static_cast <const CheckButton&>(_ControlImpl::GetPublic());
179 _CheckButtonImpl::GetPublic(void)
181 return static_cast <CheckButton&>(_ControlImpl::GetPublic());
185 _CheckButtonImpl::GetCore(void) const
187 return static_cast <const _CheckButton&>(_ControlImpl::GetCore());
191 _CheckButtonImpl::GetCore(void)
193 return static_cast <_CheckButton&>(_ControlImpl::GetCore());
197 _CheckButtonImpl::SetSelected(bool select)
199 result r = GetCore().SetSelected(select);
201 SetLastResultReturn(r);
205 _CheckButtonImpl::IsSelected(void) const
209 return GetCore().IsSelected();
213 _CheckButtonImpl::AddActionEventListener(IActionEventListener& listener)
215 if (__pPublicActionEvent == null)
217 __pPublicActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
218 SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.")
221 result r = __pPublicActionEvent->AddListener(listener);
222 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
228 _CheckButtonImpl::RemoveActionEventListener(IActionEventListener& listener)
230 result r = E_OBJ_NOT_FOUND;
232 if (__pPublicActionEvent)
234 r = __pPublicActionEvent->RemoveListener(listener);
237 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
243 _CheckButtonImpl::SetActionId(int checkedActionId, int uncheckedActionId, int selectedActionId)
245 result r = GetCore().SetActionId(checkedActionId, uncheckedActionId, selectedActionId);
247 SetLastResultReturn(r);
251 _CheckButtonImpl::GetCheckedActionId(void) const
255 return GetCore().GetCheckedActionId();
259 _CheckButtonImpl::GetUncheckedActionId(void) const
263 return GetCore().GetUncheckedActionId();
267 _CheckButtonImpl::GetSelectedActionId(void) const
271 return GetCore().GetSelectedActionId();
275 _CheckButtonImpl::SetText(const String& text)
277 int textLength = text.GetLength();
278 int checkButtonTextMaxLength = 0;
279 GET_FIXED_VALUE_CONFIG(CHECKBUTTON::TEXT_MAX_LENGTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonTextMaxLength);
280 String tempText = String(text);
282 if (textLength >= checkButtonTextMaxLength)
284 tempText.Remove(checkButtonTextMaxLength - 1, textLength - checkButtonTextMaxLength + 1);
287 Variant var(tempText);
288 result r = GetCore().SetPropertyText(var);
289 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
295 _CheckButtonImpl::GetText(void) const
299 return GetCore().GetPropertyText().ToString();
303 _CheckButtonImpl::SetTitleText(const String& title)
305 SysTryReturn(NID_UI_CTRL, GetCore().GetShowTitle() == true , E_INVALID_STATE, E_INVALID_STATE,
306 "[E_INVALID_STATE] The CheckButton has no title style.\n");
308 int titleLength = title.GetLength();
309 int checkButtonTitleMaxLength = 0;
310 GET_FIXED_VALUE_CONFIG(CHECKBUTTON::TITLE_TEXT_MAX_LENGTH, _CONTROL_ORIENTATION_PORTRAIT, checkButtonTitleMaxLength);
311 String tempTitle = String(title);
313 if (titleLength >= checkButtonTitleMaxLength)
315 tempTitle.Remove(checkButtonTitleMaxLength - 1, titleLength - checkButtonTitleMaxLength + 1);
318 Variant var(tempTitle);
319 result r = GetCore().SetPropertyTitleText(var);
320 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
326 _CheckButtonImpl::GetTitleText(void) const
328 SysTryReturn(NID_UI_CTRL, GetCore().GetShowTitle() == true, L"", E_INVALID_STATE,
329 "[E_INVALID_STATE] The CheckButton has no title style.\n");
333 return GetCore().GetPropertyTitleText().ToString();
337 _CheckButtonImpl::SetTextHorizontalAlignment(HorizontalAlignment alignment)
339 result r = GetCore().SetTextHorizontalAlignment(alignment);
340 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
346 _CheckButtonImpl::GetTextHorizontalAlignment(void) const
350 return GetCore().GetTextHorizontalAlignment();
354 _CheckButtonImpl::SetTextVerticalAlignment(VerticalAlignment alignment)
356 result r = GetCore().SetTextVerticalAlignment(alignment);
357 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
363 _CheckButtonImpl::GetTextVerticalAlignment(void) const
367 return GetCore().GetTextVerticalAlignment();
371 _CheckButtonImpl::SetTextColor(const Color& color)
373 result r = GetCore().SetTextColor(color);
374 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
380 _CheckButtonImpl::GetTextColor(void) const
384 return GetCore().GetTextColor();
388 _CheckButtonImpl::SetDisabledTextColor(const Color& color)
390 result r = GetCore().SetDisabledTextColor(color);
391 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
397 _CheckButtonImpl::GetDisabledTextColor(void) const
401 return GetCore().GetDisabledTextColor();
405 _CheckButtonImpl::SetPressedTextColor(const Color& color)
407 result r = GetCore().SetPressedTextColor(color);
408 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
414 _CheckButtonImpl::GetPressedTextColor(void) const
418 return GetCore().GetPressedTextColor();
422 _CheckButtonImpl::SetHighlightedTextColor(const Color& color)
424 result r = GetCore().SetHighlightedTextColor(color);
425 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
431 _CheckButtonImpl::GetHighlightedTextColor(void) const
435 return GetCore().GetHighlightedTextColor();
439 _CheckButtonImpl::SetTitleTextColor(const Color& color)
441 result r = GetCore().SetTitleTextColor(color);
442 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
448 _CheckButtonImpl::GetTitleTextColor(void) const
452 return GetCore().GetTitleTextColor();
456 _CheckButtonImpl::SetDisabledTitleTextColor(const Color& color)
458 result r = GetCore().SetDisabledTitleTextColor(color);
459 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
465 _CheckButtonImpl::GetDisabledTitleTextColor(void) const
469 return GetCore().GetDisabledTitleTextColor();
473 _CheckButtonImpl::SetPressedTitleTextColor(const Color& color)
475 result r = GetCore().SetPressedTitleTextColor(color);
476 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
482 _CheckButtonImpl::GetPressedTitleTextColor(void) const
486 return GetCore().GetPressedTitleTextColor();
490 _CheckButtonImpl::SetHighlightedTitleTextColor(const Color& color)
492 result r = GetCore().SetHighlightedTitleTextColor(color);
493 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
499 _CheckButtonImpl::GetHighlightedTitleTextColor(void) const
503 return GetCore().GetHighlightedTitleTextColor();
507 _CheckButtonImpl::SetColor(CheckButtonStatus status, const Color& color)
509 SysTryReturn(NID_UI_CTRL, GetCore().GetBackgroundStyle() != BACKGROUND_STYLE_NONE, E_INVALID_OPERATION, E_INVALID_OPERATION,
510 "[E_INVALID_OPERATION] Unable to set color.\n");
512 _CheckButtonStatus coreStatus = ConvertStatus(status);
514 result r = GetCore().SetColor(coreStatus, color);
515 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
521 _CheckButtonImpl::GetColor(CheckButtonStatus status) const
523 SysTryReturn(NID_UI_CTRL, GetCore().GetBackgroundStyle() != BACKGROUND_STYLE_NONE,
524 _CheckButtonImpl::GetColorOnError(), E_INVALID_OPERATION, "[E_INVALID_OPERATION] Unable to get color.\n");
526 _CheckButtonStatus coreStatus = ConvertStatus(status);
530 return GetCore().GetColor(coreStatus);
534 _CheckButtonImpl::SetStyle(const CheckButtonStyle& checkButtonStyle, const BackgroundStyle& backgroundStyle, bool showTitle, const GroupStyle& groupStyle)
536 result r = GetCore().SetCheckButtonStyle(checkButtonStyle);
537 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
539 r = GetCore().SetBackgroundStyle(backgroundStyle);
540 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
542 r = GetCore().SetShowTitle(showTitle);
543 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
545 r = GetCore().SetGroupStyle(groupStyle);
546 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
552 _CheckButtonImpl::IsLayoutable(void) const
558 _CheckButtonImpl::OnActionPerformed(const _Control& source, int actionId)
560 if (__pPublicActionEvent != null)
562 __pPublicActionEvent->Fire(*_PublicActionEvent::CreateActionEventArgN(actionId));
569 _CheckButtonImpl::ConvertStatus(CheckButtonStatus status) const
571 _CheckButtonStatus coreStatus = _CHECK_BUTTON_STATUS_HIGHLIGHTED;
574 case CHECK_BUTTON_STATUS_NORMAL:
575 coreStatus = _CHECK_BUTTON_STATUS_NORMAL;
577 case CHECK_BUTTON_STATUS_DISABLED:
578 coreStatus = _CHECK_BUTTON_STATUS_DISABLED;
580 case CHECK_BUTTON_STATUS_PRESSED:
581 coreStatus = _CHECK_BUTTON_STATUS_PRESSED;
584 coreStatus = _CHECK_BUTTON_STATUS_HIGHLIGHTED;
590 class _CheckButtonMaker
591 : public _UiBuilderControlMaker
594 _CheckButtonMaker(_UiBuilder* uibuilder)
595 : _UiBuilderControlMaker(uibuilder){};
596 virtual ~_CheckButtonMaker(){};
597 static _UiBuilderControlMaker* GetInstance(_UiBuilder* uibuilder)
599 _CheckButtonMaker* pCheckButtonMaker = new (std::nothrow) _CheckButtonMaker(uibuilder);
600 return static_cast<_UiBuilderControlMaker*>(pCheckButtonMaker);
603 virtual Control* Make(_UiBuilderControl* pControl)
606 bool isRadioStyle = false;
608 _UiBuilderControlLayout* pControlProperty = null;
609 CheckButton* pCheck = null;
610 BackgroundStyle backgroundStyle = BACKGROUND_STYLE_DEFAULT;
613 Tizen::Base::String elementString;
615 HorizontalAlignment horizontalAlignment;
616 VerticalAlignment verticalAlignment;
617 GroupStyle groupStyle = GROUP_STYLE_NONE;
618 bool showTitle = false;
622 GetProperty(pControl, &pControlProperty);
623 if (pControlProperty == null)
628 pCheck = new (std::nothrow) CheckButton();
629 rect = pControlProperty->GetRectF();
631 Tizen::Base::String styleString;
632 styleString = pControlProperty->GetStyle();
635 if (pControl->GetElement("text", elementString))
638 checkText = elementString;
641 if (pControl->GetElement("backgroundStyle", elementString) || pControl->GetElement("BackgroundStyle", elementString))
643 if (elementString.Equals(L"BACKGROUND_STYLE_NONE", false))
645 backgroundStyle = BACKGROUND_STYLE_NONE;
649 if (pControl->GetElement("showtitleText", elementString) || pControl->GetElement("bShowtitleText", elementString))
651 if (elementString.Equals(L"true", false))
657 if (pControl->GetElement("groupStyle", elementString) || pControl->GetElement("GroupStyle", elementString))
659 if (elementString.Equals(L"GROUP_STYLE_NONE", false))
661 groupStyle = GROUP_STYLE_NONE;
664 if (elementString.Equals(L"GROUP_STYLE_SINGLE", false))
666 groupStyle = GROUP_STYLE_SINGLE;
669 if (elementString.Equals(L"GROUP_STYLE_TOP", false))
671 groupStyle = GROUP_STYLE_TOP;
674 if (elementString.Equals(L"GROUP_STYLE_MIDDLE", false))
676 groupStyle = GROUP_STYLE_MIDDLE;
679 if (elementString.Equals(L"GROUP_STYLE_BOTTOM", false))
681 groupStyle = GROUP_STYLE_BOTTOM;
685 if (styleString.Equals(L"CHECK_BUTTON_STYLE_ONOFF", false))
687 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_ONOFF, backgroundStyle, showTitle, checkText, groupStyle);
689 else if (styleString.Equals(L"CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER", false))
691 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER, backgroundStyle, showTitle, checkText, groupStyle);
693 else if (styleString.Equals(L"CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER", false))
695 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_MARK_WITH_DIVIDER, backgroundStyle, showTitle, checkText, groupStyle);
697 else if (styleString.Equals(L"CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER", false))
699 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER, backgroundStyle, showTitle, checkText, groupStyle);
702 else if (styleString.Equals(L"CHECK_BUTTON_STYLE_RADIO", false))
704 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_RADIO, backgroundStyle, showTitle, checkText, groupStyle);
707 else if (styleString.Equals(L"CHECK_BUTTON_STYLE_ONOFF_SLIDING", false))
709 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_ONOFF_SLIDING, backgroundStyle, showTitle, checkText, groupStyle);
711 else if (styleString.Equals(L"CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON", false))
713 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON, backgroundStyle, showTitle, checkText, groupStyle);
715 else if (styleString.Equals(L"CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON", false))
717 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON, backgroundStyle, showTitle, checkText, groupStyle);
720 else if (styleString.Equals(L"CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER", false))
722 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER, backgroundStyle, showTitle, checkText, groupStyle);
726 r = pCheck->Construct(rect, CHECK_BUTTON_STYLE_MARK, backgroundStyle, showTitle, checkText, groupStyle);
737 if (pControl->GetElement("titleText", elementString))
739 pCheck->SetTitleText(elementString);
742 if (pControl->GetElement("colorOfTitleText", elementString))
744 ConvertStringToColor(elementString, color);
745 pCheck->SetTitleTextColor(color);
748 if (pControl->GetElement("pressedTitleTextColor", elementString))
750 ConvertStringToColor(elementString, color);
751 pCheck->SetPressedTitleTextColor(color);
754 if (pControl->GetElement("disabledTitleTextColor", elementString))
756 ConvertStringToColor(elementString, color);
757 pCheck->SetDisabledTitleTextColor(color);
760 if (pControl->GetElement("highlightedTitleTextColor", elementString))
762 ConvertStringToColor(elementString, color);
763 pCheck->SetHighlightedTitleTextColor(color);
769 if (pControl->GetElement("colorOfText", elementString))
771 ConvertStringToColor(elementString, color);
772 pCheck->SetTextColor(color);
775 if (pControl->GetElement("pressedTextColor", elementString))
777 ConvertStringToColor(elementString, color);
778 pCheck->SetPressedTextColor(color);
781 if (pControl->GetElement("disabledTextColor", elementString))
783 ConvertStringToColor(elementString, color);
784 pCheck->SetDisabledTextColor(color);
787 if (pControl->GetElement("highlightedTextColor", elementString))
789 ConvertStringToColor(elementString, color);
790 pCheck->SetHighlightedTextColor(color);
794 if (isRadioStyle && pControl->GetElement("GroupID", elementString))
796 RadioGroup* pGroup = (RadioGroup*) ((GetContainer())->GetControl(elementString, true));
800 pGroup = new (std::nothrow) RadioGroup();
801 r = pGroup->Construct();
805 // SysLogExceptionxception( "[E_SYSTEM] UiBuilder::__MakeCheck: Failed to create Group(%s)",buffer);
810 pGroup->SetName(elementString);
811 GetContainer()->AddControl(*pGroup);
813 r = pGroup->Add(*pCheck);
817 r = pGroup->Add(*pCheck);
821 if (pControl->GetElement("horizontalAlign", elementString) || pControl->GetElement("hAlign", elementString))
823 if (ConvertHAlignToHorizontalAlignment(elementString, horizontalAlignment))
825 pCheck->SetTextHorizontalAlignment(horizontalAlignment);
829 if (pControl->GetElement("verticalAlign", elementString) || pControl->GetElement("vAlign", elementString))
831 if (ConvertVAlignToVerticalAlignment(elementString, verticalAlignment))
833 pCheck->SetTextVerticalAlignment(verticalAlignment);
837 if (pControl->GetElement("normalColorOpacity", elementString))
839 Base::Integer::Parse(elementString, opacity);
842 if (pControl->GetElement("normalColor", elementString))
844 ConvertStringToColor32(elementString, opacity, color);
845 pCheck->SetColor(CHECK_BUTTON_STATUS_NORMAL, color);
848 if (pControl->GetElement("pressedColorOpacity", elementString))
850 Base::Integer::Parse(elementString, opacity);
853 if (pControl->GetElement("pressedColor", elementString))
855 ConvertStringToColor32(elementString, opacity, color);
856 pCheck->SetColor(CHECK_BUTTON_STATUS_PRESSED, color);
859 if (pControl->GetElement("disabledColorOpacity", elementString))
861 Base::Integer::Parse(elementString, opacity);
864 if (pControl->GetElement("disabledColor", elementString))
866 ConvertStringToColor32(elementString, opacity, color);
867 pCheck->SetColor(CHECK_BUTTON_STATUS_DISABLED, color);
870 if (pControl->GetElement("highlightedColorOpacity", elementString))
872 Base::Integer::Parse(elementString, opacity);
875 if (pControl->GetElement("highlightedColor", elementString))
877 ConvertStringToColor32(elementString, opacity, color);
878 pCheck->SetColor(CHECK_BUTTON_STATUS_HIGHLIGHTED, color);
880 if (pControl->GetElement(L"accessibilityHint1", elementString))
882 AccessibilityContainer* pContainer = pCheck->GetAccessibilityContainer();
885 AccessibilityElement* pElement = pContainer->GetElement(L"CheckButtonText");
888 pElement->SetHint(elementString);
892 if (pControl->GetElement(L"accessibilityHint2", elementString))
894 AccessibilityContainer* pContainer = pCheck->GetAccessibilityContainer();
897 AccessibilityElement* pElement = pContainer->GetElement(L"MoreButtonText");
900 pElement->SetHint(elementString);
905 //-------safety for Minimum size-------------------
906 tempRect = (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT))->GetRectF();
907 if ((pStyleString != null) &&
908 ((strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER") == 0)
909 || (strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER") == 0)
910 || (strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER") == 0)))
912 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_DIVIDER))
914 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_DIVIDER);
917 else if ((pStyleString != null) &&
918 ((strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON") == 0)
919 || (strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON") == 0)))
921 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_DETAILED))
923 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_DETAILED);
926 else if ((pStyleString != null) &&
927 (strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_ONOFF_SLIDING") == 0))
929 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_ONOFF_SLIDING))
931 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_ONOFF_SLIDING);
938 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_TITLE))
940 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_TITLE);
945 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH))
947 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH);
954 if (tempRect.h < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_HEIGHT_WITH_TITLE))
956 tempRect.h = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_HEIGHT_WITH_TITLE);
961 if (tempRect.h < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_HEIGHT))
963 tempRect.h = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_HEIGHT);
967 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT))->SetRect(tempRect.x,tempRect.y,tempRect.w,tempRect.h);
969 tempRect = (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE))->GetRectF();
970 if ((pStyleString != null) &&
971 ((strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER") == 0)
972 || (strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_ONOFF_WITH_DIVIDER") == 0)
973 || (strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_RADIO_WITH_DIVIDER") == 0)))
975 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_DIVIDER))
977 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_DIVIDER);
980 else if ((pStyleString != null) &&
981 ((strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_MARK_WITH_DETAILED_BUTTON") == 0)
982 || (strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_RADIO_WITH_DETAILED_BUTTON") == 0)))
984 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_DETAILED))
986 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_DETAILED);
989 else if ((pStyleString != null) &&
990 (strcmp((const char*)pStyleString,"CHECK_BUTTON_STYLE_ONOFF_SLIDING") == 0))
992 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_ONOFF_SLIDING))
994 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_ONOFF_SLIDING);
1001 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_TITLE))
1003 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH_WITH_TITLE);
1008 if (tempRect.w < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH))
1010 tempRect.w = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_WIDTH);
1017 if (tempRect.h < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_HEIGHT_WITH_TITLE))
1019 tempRect.h = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_HEIGHT_WITH_TITLE);
1024 if (tempRect.h < __BaseProperty(PROPERTY_CHECKBUTTON_MIN_HEIGHT))
1026 tempRect.h = __BaseProperty(PROPERTY_CHECKBUTTON_MIN_HEIGHT);
1030 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE))->SetRect(tempRect.x,tempRect.y,tempRect.w,tempRect.h);
1032 //--------end safety code------------------------
1039 }; // _CheckButtonMaker
1041 _CheckButtonRegister::_CheckButtonRegister()
1043 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1044 pUiBuilderControlTableManager->RegisterControl(L"CheckButton", _CheckButtonMaker::GetInstance);
1046 _CheckButtonRegister::~_CheckButtonRegister()
1048 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1049 pUiBuilderControlTableManager->UnregisterControl(L"CheckButton");
1051 static _CheckButtonRegister CheckButtonRegisterToUiBuilder;
1052 }}} // Tizen::Ui::Controls