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.
19 * @file FUiCtrl_CustomListElements.cpp
20 * @brief This is the header file for the classes related to implementing elements in CustomListItem.
23 #include <FBaseSysLog.h>
24 #include <FGrp_BitmapImpl.h>
25 #include <FGrp_TextTextObject.h>
26 #include <FGrp_TextTextSimple.h>
27 #include "FUiCtrl_CustomListItemImpl.h"
28 #include "FUiCtrl_CustomListItemFormatImpl.h"
29 #include "FUiCtrl_PanelImpl.h"
30 #include "FUi_ResourceManager.h"
31 #include "FUi_CoordinateSystemUtils.h"
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Graphics::_Text;
38 namespace Tizen { namespace Ui { namespace Controls
41 _ElementBaseModel::_ElementBaseModel(void)
43 , _itemStatus(CUSTOM_LIST_ITEM_STATUS_NORMAL)
47 _ElementBaseModel::~_ElementBaseModel(void)
52 _ElementBaseModel::GetElementId(void)
58 _ElementBaseModel::GetItemStatus(void)
64 _ElementBaseModel::HandleElementEvent(CustomListItemStatus itemStatus)
66 _itemStatus = itemStatus;
69 _TextElementModel::_TextElementModel(const String& text)
72 , __slidingEnabled(false)
76 _TextElementModel::~_TextElementModel(void)
81 _TextElementModel::SetTextSliding(bool enable)
83 __slidingEnabled = enable;
87 _TextElementModel::GetTextSliding(void)
89 return __slidingEnabled;
93 _TextElementModel::GetData(String& text, Color& textColor, int& textSize) const
96 textColor = __textColor[_itemStatus];
97 textSize = __textSize;
103 _TextElementModel::GetTextSize(void) const
109 _TextElementModel::CreateElementView(_ElementViewParams& elementParams)
111 _TextElementModel* pTextElementModel = dynamic_cast<_TextElementModel*>(elementParams.pElementModel);
112 SysTryReturn(NID_UI_CTRL, (pTextElementModel != null), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get element model");
114 SysTryReturn(NID_UI_CTRL, (elementParams.pElementFormatData != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pElementFormatData must not be null");
115 SysTryReturn(NID_UI_CTRL, (elementParams.pTableViewItemBase != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pTableViewItemBase must not be null");
116 SysTryReturn(NID_UI_CTRL, (elementParams.pCustomListItemImpl != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pCustomListItemImpl must not be null");
118 pTextElementModel->__textSize = elementParams.pElementFormatData->textSize;
119 pTextElementModel->__textColor[CUSTOM_LIST_ITEM_STATUS_NORMAL] = elementParams.pElementFormatData->normalTextColor;
120 pTextElementModel->__textColor[CUSTOM_LIST_ITEM_STATUS_FOCUSED] = elementParams.pElementFormatData->focusedTextColor;
121 pTextElementModel->__textColor[CUSTOM_LIST_ITEM_STATUS_SELECTED] = elementParams.pElementFormatData->highlightedTextColor;
123 TextObject* pText = new (std::nothrow) TextObject();
124 SysTryReturn(NID_UI_CTRL, pText, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
128 TextSimple* pSimpleText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(pTextElementModel->__text.GetPointer()), pTextElementModel->__text.GetLength());
129 SysTryReturn(NID_UI_CTRL, pSimpleText, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
131 pText->AppendElement(*pSimpleText);
133 pText->SetAction(TEXT_OBJECT_ACTION_TYPE_NONE);
134 pText->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
135 pText->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
138 _TextElementView* pTextElementView = new (std::nothrow) _TextElementView(pText);
139 SysTryReturn(NID_UI_CTRL, (pTextElementView != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
141 pTextElementView->Construct(_CoordinateSystemUtils::ConvertToFloat(elementParams.pElementFormatData->rect));
142 pTextElementView->AddTouchEventListener(*elementParams.pCustomListItemImpl);
143 elementParams.pTableViewItemBase->AddControl(*pTextElementView);
144 pTextElementView->SetModel(pTextElementModel);
145 elementParams.pTableViewItemBase->SetIndividualSelectionEnabled(pTextElementView, true);
150 _BitmapElementModel::_BitmapElementModel(void)
152 for (int i = 0; i <= CUSTOM_LIST_ITEM_STATUS_FOCUSED; i++)
158 _BitmapElementModel::~_BitmapElementModel(void)
160 for (int i = 0; i <= CUSTOM_LIST_ITEM_STATUS_FOCUSED; i++)
167 _BitmapElementModel::GetData(void) const
169 return __pBitmap[_itemStatus];
173 _BitmapElementModel::CreateElementView(_ElementViewParams& elementParams)
175 _BitmapElementModel* pBitmapElementModel = dynamic_cast<_BitmapElementModel*>(elementParams.pElementModel);
176 SysTryReturn(NID_UI_CTRL, (pBitmapElementModel != null), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get element model");
178 SysTryReturn(NID_UI_CTRL, (elementParams.pElementFormatData != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pElementFormatData must not be null");
179 SysTryReturn(NID_UI_CTRL, (elementParams.pCustomListItemImpl != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pCustomListItemImpl must not be null");
180 SysTryReturn(NID_UI_CTRL, (elementParams.pTableViewItemBase != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pTableViewItemBase must not be null");
182 _BitmapElementView* pBitmapElementView = new (std::nothrow) _BitmapElementView();
183 SysTryReturn(NID_UI_CTRL, (pBitmapElementView != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
185 pBitmapElementView->Construct(_CoordinateSystemUtils::ConvertToFloat(elementParams.pElementFormatData->rect));
186 pBitmapElementView->AddTouchEventListener(*elementParams.pCustomListItemImpl);
187 elementParams.pTableViewItemBase->AddControl(*pBitmapElementView);
188 pBitmapElementView->SetModel(pBitmapElementModel);
189 elementParams.pTableViewItemBase->SetIndividualSelectionEnabled(pBitmapElementView, true);
194 _CustomElementModel::_CustomElementModel(void)
195 : __pListElement(null)
199 _CustomElementModel::~_CustomElementModel(void)
204 _CustomElementModel::GetData(void) const
206 return __pListElement;
210 _CustomElementModel::CreateElementView(_ElementViewParams& elementParams)
212 _CustomElementModel* pCustomElementModel = dynamic_cast<_CustomElementModel*>(elementParams.pElementModel);
213 SysTryReturn(NID_UI_CTRL, (pCustomElementModel != null), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get element model");
215 SysTryReturn(NID_UI_CTRL, (elementParams.pElementFormatData != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pElementFormatData must not be null");
216 SysTryReturn(NID_UI_CTRL, (elementParams.pCustomListItemImpl != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pCustomListItemImpl must not be null");
217 SysTryReturn(NID_UI_CTRL, (elementParams.pTableViewItemBase != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pTableViewItemBase must not be null");
219 _CustomElementView* pCustomElementView = new (std::nothrow) _CustomElementView();
220 SysTryReturn(NID_UI_CTRL, (pCustomElementView != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
222 pCustomElementView->Construct(_CoordinateSystemUtils::ConvertToFloat(elementParams.pElementFormatData->rect));
223 pCustomElementView->AddTouchEventListener(*elementParams.pCustomListItemImpl);
224 elementParams.pTableViewItemBase->AddControl(*pCustomElementView);
225 pCustomElementView->SetModel(pCustomElementModel);
226 elementParams.pTableViewItemBase->SetIndividualSelectionEnabled(pCustomElementView, true);
231 _CheckElementModel::_CheckElementModel(void)
232 : __checkBoxStatus(CHECK_BOX_UNCHECKED)
233 , __pCheckBitmaps(null)
234 , __isDividerEnabled(false)
235 , __rightDivider(false)
236 , __leftDivider(false)
240 _CheckElementModel::~_CheckElementModel(void)
245 _CheckElementModel::SetCheckBoxStatus(_CheckBoxBitmapType checkBoxStatus)
247 __checkBoxStatus = checkBoxStatus;
251 _CheckElementModel::GetCheckBoxStatus(void)
253 return __checkBoxStatus;
256 const _CheckBoxBitmapType
257 _CheckElementModel::GetCheckBoxStatus(void) const
259 return __checkBoxStatus;
263 _CheckElementModel::GetData(Rectangle& bitmapBounds, bool& isDividerEnabled, bool& leftDivider, bool& rightDivider) const
265 bitmapBounds = __bitmapBounds;
266 isDividerEnabled = __isDividerEnabled;
267 leftDivider = __leftDivider;
268 rightDivider = __rightDivider;
274 _CheckElementModel::GetCheckBitmap(_BitmapType checkBoxStatus) const
276 return __pCheckBitmaps[checkBoxStatus];
280 _CheckElementModel::CreateElementView(_ElementViewParams& elementParams)
282 SysTryReturn(NID_UI_CTRL, (elementParams.pElementFormatData != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pElementFormatData must not be null");
283 SysTryReturn(NID_UI_CTRL, (elementParams.pCustomListItemImpl != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pCustomListItemImpl must not be null");
284 SysTryReturn(NID_UI_CTRL, (elementParams.pTableViewItemBase != null), E_SYSTEM, E_SYSTEM, "[E_INVALID_ARG] Invalid argument is used. pTableViewItemBase must not be null");
286 if (elementParams.annexStyle != TABLE_VIEW_ANNEX_STYLE_NORMAL)
288 Rectangle checkBoxBounds(elementParams.pElementFormatData->rect);
289 int dividerMargin = 0;
291 GET_SHAPE_CONFIG(LIST::CHECK_ELEMENT_DIVIDER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerMargin);
293 if (elementParams.isDividerEnabled)
295 checkBoxBounds.width += 2 * dividerMargin;
296 checkBoxBounds.y = 0;
297 checkBoxBounds.height = elementParams.pCustomListItemImpl->height;
300 _CheckElementModel* pCheckElementModel = dynamic_cast<_CheckElementModel*>(elementParams.pElementModel);
301 SysTryReturn(NID_UI_CTRL, (pCheckElementModel != null), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get element model");
303 pCheckElementModel->__pCheckBitmaps = elementParams.pCheckBitmaps;
304 pCheckElementModel->__isDividerEnabled = elementParams.isDividerEnabled;
306 pCheckElementModel->__bitmapBounds.width = elementParams.pElementFormatData->rect.width;
307 pCheckElementModel->__bitmapBounds.height = elementParams.pElementFormatData->rect.height;
309 if (elementParams.isDividerEnabled)
311 pCheckElementModel->__bitmapBounds.x = ((checkBoxBounds.x + dividerMargin) > elementParams.pElementFormatData->rect.x) ? (dividerMargin) : (0);
312 pCheckElementModel->__bitmapBounds.y = elementParams.pElementFormatData->rect.y;
314 _CustomListItemImpl::SetDividerRequired(*elementParams.pElementFormat, elementParams.pElementFormatData->rect, pCheckElementModel->__leftDivider, pCheckElementModel->__rightDivider);
318 pCheckElementModel->__bitmapBounds.x = 0;
319 pCheckElementModel->__bitmapBounds.y = 0;
322 _CheckElementView* pCheckElementView = new (std::nothrow) _CheckElementView();
323 SysTryReturn(NID_UI_CTRL, (pCheckElementView != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
325 pCheckElementView->Construct(_CoordinateSystemUtils::ConvertToFloat(elementParams.pElementFormatData->rect));
326 pCheckElementView->AddTouchEventListener(*elementParams.pCustomListItemImpl);
327 elementParams.pTableViewItemBase->AddControl(*pCheckElementView);
328 pCheckElementView->SetModel(pCheckElementModel);
329 elementParams.pTableViewItemBase->SetIndividualSelectionEnabled(pCheckElementView, true);
335 _ElementBaseView::_ElementBaseView(void)
336 : __pElementBaseModel(null)
340 _ElementBaseView::~_ElementBaseView(void)
345 _ElementBaseView::GetElementId(void) const
347 SysTryReturn(NID_UI_CTRL, (__pElementBaseModel != null), -1, E_SYSTEM, "Element model not set");
349 return __pElementBaseModel->GetElementId();
352 _TextElementView::_TextElementView(TextObject* pText)
357 _TextElementView::~_TextElementView(void)
359 __pText->RemoveAll();
367 _TextElementView::OnDraw(void)
369 result r = E_SUCCESS;
371 _TextElementModel* __pTextElementModel = dynamic_cast<_TextElementModel*>(__pElementBaseModel);
372 SysTryReturn(NID_UI_CTRL, (__pTextElementModel), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occured. Failed to get _TextElementModel.");
374 Canvas* pCanvas = GetCanvasN();
376 SysTryReturn(NID_UI_CTRL, (pCanvas), r, r, "[%s] Propagating.", GetErrorMessage(r));
382 __pTextElementModel->GetData(text, textColor, textSize);
384 if (IsEnabled() == false)
386 GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_DISABLED, textColor);
389 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
394 FloatRectangle bounds = GetBoundsF();
398 _ListBaseImpl* pListBaseImpl = _CustomListItemImpl::GetListBaseImplFromElement(*this);
399 SysTryCatch(NID_UI_CTRL, (pListBaseImpl != null), , E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get _ListBaseImpl instance.");
402 r = font.Construct(pListBaseImpl->GetCore().GetFont(), FONT_STYLE_PLAIN, textSize);
405 font.Construct(FONT_STYLE_PLAIN, textSize);
408 __pText->SetFont(&font, 0, __pText->GetTextLength());
409 __pText->SetForegroundColor(textColor, 0, __pText->GetTextLength());
410 __pText->SetBounds(bounds);
411 __pText->Draw(*_CanvasImpl::GetInstance(*pCanvas));
423 _TextElementView::SetModel(_TextElementModel* pTextElementModel)
425 __pElementBaseModel = pTextElementModel;
429 _TextElementView::StartTextSlide(void)
431 if (IsEnabled() == false)
436 Canvas* pCanvas = GetCanvasN();
437 SysTryReturnVoidResult(NID_UI_CTRL, (pCanvas != null), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
439 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
442 if (__pText->GetTextLengthAt(0) < __pText->GetTextLength())
444 __pText->SetAction(TEXT_OBJECT_ACTION_TYPE_SLIDE_LEFT);
446 __pText->DrawWithOffset(*_CanvasImpl::GetInstance(*pCanvas));
450 __pText->Draw(*_CanvasImpl::GetInstance(*pCanvas));
457 _TextElementView::StopTextSlide(void)
459 if (IsEnabled() == false)
464 Canvas* pCanvas = GetCanvasN();
465 SysTryReturnVoidResult(NID_UI_CTRL, (pCanvas != null), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
467 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
470 __pText->SetAction(TEXT_OBJECT_ACTION_TYPE_NONE);
471 __pText->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
472 __pText->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
474 __pText->DrawWithOffset(*_CanvasImpl::GetInstance(*pCanvas));
479 _BitmapElementView::_BitmapElementView(void)
483 _BitmapElementView::~_BitmapElementView(void)
488 _BitmapElementView::OnDraw(void)
490 result r = E_SUCCESS;
491 Canvas* pCanvas = GetCanvasN();
494 SysTryReturn(NID_UI_CTRL, (pCanvas), r, r, "[%s] Propagating.", GetErrorMessage(r));
496 _BitmapElementModel* __pBitmapElementModel = dynamic_cast<_BitmapElementModel*>(__pElementBaseModel);
497 SysTryReturn(NID_UI_CTRL, (__pBitmapElementModel), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occured. Failed to get _BitmapElementModel.");
499 Bitmap *pBitmap = __pBitmapElementModel->GetData();
503 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
506 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
508 pCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, GetWidthF(), GetHeightF()), *pBitmap);
512 pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, GetWidthF(), GetHeightF()), *pBitmap);
522 _BitmapElementView::SetModel(_BitmapElementModel* pBitmapElementModel)
524 __pElementBaseModel = static_cast<_ElementBaseModel*>(pBitmapElementModel);
527 _CustomElementView::_CustomElementView(void)
531 _CustomElementView::~_CustomElementView(void)
536 _CustomElementView::OnDraw(void)
538 result r = E_SUCCESS;
539 Canvas* pCanvas = GetCanvasN();
541 CustomListItemStatus itemStatus;
542 ICustomListElement* pListElement;
545 SysTryReturn(NID_UI_CTRL, (pCanvas), r, r, "[%s] Propagating.", GetErrorMessage(r));
547 _CustomElementModel* __pCustomElementModel = dynamic_cast<_CustomElementModel*>(__pElementBaseModel);
548 SysTryCatch(NID_UI_CTRL, (__pCustomElementModel), , E_SYSTEM, "[E_SYSTEM] A system error has occured. Failed to get _CustomElementModel.");
550 itemStatus = __pCustomElementModel->GetItemStatus();
551 pListElement = __pCustomElementModel->GetData();
555 TableViewItemBase* pParentItem = dynamic_cast<TableViewItemBase*>(GetParent());
556 SysTryCatch(NID_UI_CTRL, pParentItem, , E_SYSTEM, "[E_SYSTEM] Failed to get parent item");
558 Color bgColor = pParentItem->GetBackgroundColor(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
560 pCanvas->SetBackgroundColor(bgColor);
562 pListElement->DrawElement(*pCanvas, Rectangle(0, 0, GetWidth(), GetHeight()), itemStatus);
575 _CustomElementView::SetModel(_CustomElementModel* pCustomElementModel)
577 __pElementBaseModel = static_cast<_ElementBaseModel*>(pCustomElementModel);
580 _CheckElementView::_CheckElementView(void)
581 : __pressedState(false)
583 GET_COLOR_CONFIG(LIST::LISTITEM_DIVIDER_LEFT_HALF_COLOR, __leftHalfDividerColor);
584 GET_COLOR_CONFIG(LIST::LISTITEM_DIVIDER_RIGHT_HALF_COLOR, __rightHalfDividerColor);
587 _CheckElementView::~_CheckElementView(void)
592 _CheckElementView::OnDraw(void)
594 result r = E_SUCCESS;
595 Canvas* pCanvas = GetCanvasN();
598 SysTryReturn(NID_UI_CTRL, (pCanvas), r, r, "[%s] Propagating.", GetErrorMessage(r));
600 Rectangle bitmapBounds;
601 bool isDividerEnabled = false;
602 bool leftDivider = false;
603 bool rightDivider = false;
604 Bitmap* pCheckBitmap = null;
605 _CheckElementModel* pCheckElementModel = null;
607 _ListBaseImpl* pListBaseImpl = _CustomListItemImpl::GetListBaseImplFromElement(*this);
608 SysTryCatch(NID_UI_CTRL, (pListBaseImpl), , E_SYSTEM, "[E_SYSTEM] A system error has occured. Failed to get _ListBaseImpl.");
610 pCheckElementModel = dynamic_cast<_CheckElementModel*>(__pElementBaseModel);
611 SysTryCatch(NID_UI_CTRL, (pCheckElementModel), , E_SYSTEM, "[E_SYSTEM] A system error has occured. Failed to get _CheckElementModel.");
613 pCheckElementModel->GetData(bitmapBounds, isDividerEnabled, leftDivider, rightDivider);
615 if (isDividerEnabled)
617 Color bgColor(0, 0, 0, 0);
619 if (__pressedState == true)
621 GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, bgColor);
625 bgColor = pListBaseImpl->GetBackgroundColor();
628 pCanvas->SetBackgroundColor(bgColor);
632 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
635 if (__pressedState == true && pListBaseImpl->GetAnnexStyle() != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING
636 && pListBaseImpl->GetAnnexStyle() != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
638 if (pCheckElementModel->GetCheckBoxStatus() == CHECK_BOX_UNCHECKED)
640 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_UNCHECKED_PRESSED);
644 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_CHECKED_PRESSED);
649 if (pListBaseImpl->GetAnnexStyle() == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
650 pListBaseImpl->GetAnnexStyle() == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
652 if (IsEnabled() == true)
654 if (pCheckElementModel->GetCheckBoxStatus() == CHECK_BOX_CHECKED)
656 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_CHECKED);
660 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_UNCHECKED);
665 if (pCheckElementModel->GetCheckBoxStatus() == CHECK_BOX_CHECKED)
667 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_CHECKED_DISABLED);
671 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_UNCHECKED_DISABLED);
677 if (IsEnabled() == true)
679 if (pCheckElementModel->GetCheckBoxStatus() == CHECK_BOX_CHECKED)
681 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_CHECKED);
685 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_UNCHECKED);
690 if (pCheckElementModel->GetCheckBoxStatus() != CHECK_BOX_UNCHECKED)
692 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_CHECKED_DISABLED);
696 pCheckBitmap = pCheckElementModel->GetCheckBitmap(BITMAP_UNCHECKED);
704 if (bitmapBounds.width > pCheckBitmap->GetWidth())
706 bitmapBounds.width = pCheckBitmap->GetWidth();
709 if (bitmapBounds.height > pCheckBitmap->GetHeight())
711 bitmapBounds.height = pCheckBitmap->GetHeight();
714 pCanvas->DrawBitmap(bitmapBounds, *pCheckBitmap);
716 if (isDividerEnabled)
718 float lineWidth = 0.0f;
720 GET_SHAPE_CONFIG(LIST::CHECK_ELEMENT_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, lineWidth);
722 FloatRectangle bounds = GetBoundsF();
723 float dividerHeight = 0.0f;
725 dividerHeight = bounds.height / 2.0f;
726 bounds.y = bounds.y + ((bounds.height - dividerHeight) / 2.0f);
730 pCanvas->SetLineWidth(lineWidth / 2.0f);
731 pCanvas->SetForegroundColor(__leftHalfDividerColor);
732 pCanvas->DrawLine(FloatPoint(0.0f, bounds.y), FloatPoint(0.0f, dividerHeight + bounds.y));
734 pCanvas->SetLineWidth(lineWidth / 2.0f);
735 pCanvas->SetForegroundColor(__rightHalfDividerColor);
736 pCanvas->DrawLine(FloatPoint(1.0f, bounds.y), FloatPoint(1.0f, dividerHeight + bounds.y));
741 pCanvas->SetLineWidth(lineWidth / 2.0f);
742 pCanvas->SetForegroundColor(__leftHalfDividerColor);
743 pCanvas->DrawLine(FloatPoint(bounds.width - lineWidth, bounds.y), FloatPoint(bounds.width - lineWidth, dividerHeight + bounds.y));
745 pCanvas->SetLineWidth(lineWidth / 2.0f);
746 pCanvas->SetForegroundColor(__rightHalfDividerColor);
747 pCanvas->DrawLine(FloatPoint(bounds.width - lineWidth + 1.0f, bounds.y), FloatPoint(bounds.width - lineWidth + 1.0f, dividerHeight + bounds.y));
760 _CheckElementView::SetModel(_CheckElementModel* pCheckElementModel)
762 __pElementBaseModel = static_cast<_ElementBaseModel*>(pCheckElementModel);
766 _CheckElementView::SetPressed(bool pressedState)
768 __pressedState = pressedState;
771 }}} //Tizen::Ui::Controls