, __itemChanged(true)
, __reorderMode(false)
, __itemSelected(false)
+ , __itemTouchMoved(false)
, __childMarginState(false)
, __annexStyle(TABLE_VIEW_ANNEX_STYLE_NORMAL)
, __drawingStatus(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
, __animationCount(0)
, __pAccessibilityElement(null)
, __pPressedTimer(null)
+ , __pReleasedTimer(null)
, __isPressedTimerEnabled(false)
+ , __isReleasedTimerEnabled(false)
, __pressedControl(TABLE_VIEW_ITEM_PRESSED_NONE)
, __pCheckedTimer(null)
, __isCheckedTimerEnabled(false)
delete __pFadeInOutItemtAnimation;
__pFadeInOutItemtAnimation = null;
- if (__isPressedTimerEnabled)
+ if (__isPressedTimerEnabled && __pPressedTimer != null)
{
__pPressedTimer->Cancel();
}
delete __pPressedTimer;
__pPressedTimer = null;
+ if (__isReleasedTimerEnabled && __pReleasedTimer != null)
+ {
+ __pReleasedTimer->Cancel();
+ }
+
+ delete __pReleasedTimer;
+ __pReleasedTimer = null;
+
if (__isCheckedTimerEnabled)
{
__pCheckedTimer->Cancel();
if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
|| (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
- || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING)
- || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER))
+ || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
{
if (IsChecked())
{
eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_MORE;
}
}
+ else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
+ {
+ if (selectedItem)
+ {
+ eventType = TABLEVIEW_NOTIFY_TYPE_SELECTED_ITEM;
+ }
+ else
+ {
+ if (IsChecked())
+ {
+ eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_CHECK;
+ }
+ else
+ {
+ eventType = TABLEVIEW_NOTIFY_TYPE_ANNEX_UNCHECK;
+ }
+ }
+ }
if (__isItemTapSoundEnabled)
{
StopTouchPressedTimer();
}
+ if(!__itemTouchMoved && !IsContextItem())
+ {
+ if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
+ {
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
+ SetItemChanged(true);
+ Invalidate();
+ }
+ else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
+ {
+ if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
+ {
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
+ SetChecked(true);
+ DrawAnnexStyle();
+ }
+ else if (__annexStyle != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING &&
+ __annexStyle != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
+ {
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
+ SetItemChanged(true);
+ Invalidate();
+ }
+ }
+ else
+ {
+ if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
+ {
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
+ SetItemChanged(true);
+ Invalidate();
+ }
+ }
+
+ if (&source == this)
+ {
+ __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
+ }
+ else if (&source == __pItemAnnex)
+ {
+ __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
+ }
+ else if (IsIndividualSelectionEnabled(source))
+ {
+ __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
+ }
+ else
+ {
+ __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
+ }
+
+ StartTouchReleasedTimer();
+
+ return true;
+ }
+
+ if (&source == this)
+ {
+ __pressedControl = TABLE_VIEW_ITEM_PRESSED_ITEM;
+ }
+ else if (&source == __pItemAnnex)
+ {
+ __pressedControl = TABLE_VIEW_ITEM_PRESSED_ANNEX;
+ }
+ else if (IsIndividualSelectionEnabled(source))
+ {
+ __pressedControl = TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL;
+ }
+ else
+ {
+ __pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
+ }
+
+ FireItemTouchRelease();
+ return true;
+}
+
+void
+_TableViewItem::FireItemTouchRelease()
+{
bool fireItemEvent = false;
bool selectedItem = true;
bool checked = IsChecked();
fireItemEvent = true;
- if (&source == this)
+ if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
{
if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
|| (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
SetCheckedAnimationEnabled(!checked);
}
}
- else if(&source == __pItemAnnex)
+ else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
{
- if (__selectionStyle == TABLE_VIEW_ITEM_SELECTION_STYLE_WHOLE)
+ if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
{
- if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
- {
- SetChecked(false);
- DrawAnnexStyle();
- selectedItem = false;
- }
- else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
- __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
- {
- AdjustAnnexOnOffHandlerPosition();
- }
- else
- {
- SetChecked(!checked);
- SetCheckedAnimationEnabled(!checked);
- }
+ SetChecked(false);
+ DrawAnnexStyle();
+ selectedItem = false;
+ }
+ else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
+ __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
+ {
+ AdjustAnnexOnOffHandlerPosition();
+ selectedItem = false;
}
else
{
SetChecked(!checked);
SetCheckedAnimationEnabled(!checked);
-
- if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
- {
- SetChecked(false);
- DrawAnnexStyle();
- selectedItem = false;
- }
- else if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
- __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
- {
- AdjustAnnexOnOffHandlerPosition();
- }
}
}
else
{
- if(!IsIndividualSelectionEnabled(source))
+ if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
{
if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
|| (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
}
else
{
- if (&source == __pItemAnnex)
+ if (__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
{
if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING ||
__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
__itemSelected = false;
__annexOnOffHandlerMoved = false;
+ __itemTouchMoved = false;
if (fireItemEvent)
{
FireItemEvent(selectedItem);
}
-
- return true;
}
bool
}
}
+ __itemTouchMoved = true;
+
return retVal;
}
}
__annexOnOffHandlerMoved = false;
+ __itemTouchMoved = false;
__itemSelected = false;
__drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
{
__isPressedTimerEnabled = false;
- __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
-
if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
{
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
SetItemChanged(true);
Invalidate();
}
else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
{
- if (__selectionStyle == TABLE_VIEW_ITEM_SELECTION_STYLE_WHOLE)
+ if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
{
- if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
- {
- SetChecked(true);
- DrawAnnexStyle();
- }
- else if (__annexStyle != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING &&
- __annexStyle != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
- {
- SetItemChanged(true);
- Invalidate();
- }
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
+ SetChecked(true);
+ DrawAnnexStyle();
}
- else
+ else if (__annexStyle != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING &&
+ __annexStyle != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
{
- if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
- {
- SetChecked(true);
- DrawAnnexStyle();
- }
- else
- {
- SetItemChanged(true);
- Invalidate();
- }
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
+ SetItemChanged(true);
+ Invalidate();
}
}
else
{
if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
{
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
SetItemChanged(true);
Invalidate();
}
}
}
+ else if(&timer == __pReleasedTimer)
+ {
+ __isReleasedTimerEnabled = false;
+ FireItemTouchRelease();
+ }
}
result
return r;
}
+result
+_TableViewItem::StartTouchReleasedTimer()
+{
+ result r = E_SUCCESS;
+
+ if (__pReleasedTimer == null)
+ {
+ __pReleasedTimer = new (std::nothrow) Timer();
+ SysTryCatch(NID_UI_CTRL, __pReleasedTimer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ r = __pReleasedTimer->Construct(*this);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
+ }
+
+ r = __pReleasedTimer->Start(TOUCH_RELREASED_DURATION);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
+
+ __isReleasedTimerEnabled = true;
+
+ return r;
+
+CATCH:
+ if (__isReleasedTimerEnabled && __pReleasedTimer != null)
+ {
+ __pReleasedTimer->Cancel();
+ }
+
+ delete __pReleasedTimer;
+ __pReleasedTimer = null;
+
+ return r;
+}
+
void
_TableViewItem::StopTouchPressedTimer(void)
{
{
pCanvas = __pBitmapVisualElement->GetCanvasN();
SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-
- pCanvas->SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
+ pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
pCanvas->Clear();
}
- if(__enabledState)
+ if(pDrawBitmap != null && __enabledState)
{
- if(pDrawBitmap != null)
+ if(pCanvas != null)
{
- if(pCanvas != null)
- {
- __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
- SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
+ __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
+ DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
+ }
+ }
- DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pDrawBitmap);
- }
+ if(__enabledState)
+ {
+ if (__pDrawingProperty->sectionStyleEnabled == true)
+ {
+ DrawSectionStyleBackground();
}
else if (__itemType == TABLE_VIEW_ITEM_TYPE_HEADER || __itemType == TABLE_VIEW_ITEM_TYPE_FOOTER)
{
SetBackgroundColor(Color(0, 0, 0, 0));
__pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
}
- else if (__pDrawingProperty->sectionStyleEnabled == true)
- {
- DrawSectionStyleBackground();
- }
else
{
SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]);
{
GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor);
SetBackgroundColor(bgColor);
+ __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
if (__pDrawingProperty->groupedLookEnabled == true)
{
Bitmap* pReplacementSectionBg = null;
Color bgColor = __colorItemBg[__drawingStatus];
FloatRectangle bounds = GetBoundsF();
+ float dividerHeight = 0.0f;
+
result r = E_SUCCESS;
pCanvas = GetVisualElement()->GetCanvasN();
pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor);
}
- DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
-
if (__drawingStatus != TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
{
+ Color pressColor;
+
if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE)
{
r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressedBg);
{
r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressedBg);
}
- }
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
-
- if (__drawingStatus != TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
- {
- Color pressColor;
- int dividerHeightInt = 0;
- float dividerHeight = 0.0f;
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed");
GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, pressColor);
pSectionPressedBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), pressColor);
- GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeightInt);
- dividerHeight = _CoordinateSystemUtils::ConvertToFloat(dividerHeightInt);
+ GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height-dividerHeight * 2), *pSectionPressedBg);
}
+ else
+ {
+ DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg);
+ }
if (__pDrawingProperty->groupedLookEnabled == true)
{
}
nextHandlerBounds = handlerBounds.x + (position - __annexOnOffTouchPosition);
- annexAbsoluteBoundsStart = __pItemAnnex->GetBounds().x;
+ annexAbsoluteBoundsStart = __pItemAnnex->GetBoundsF().x;
annexAbsoluteBoundsEnd = __pItemAnnex->GetBoundsF().x + __pItemAnnex->GetBoundsF().width + annexMargin;
if((annexAbsoluteBoundsStart + nextHandlerBounds + handlerBounds.width) < annexAbsoluteBoundsEnd &&
void
_TableViewItem::DrawItemDivider(void)
{
+ FloatRectangle dividerBottomBounds;
+ FloatRectangle dividerTopBounds;
+ Color dividerColor;
+ Color underLineColor;
+ FloatRectangle bounds;
+ FloatPoint topPoint;
+ FloatPoint bottomPoint;
+
if (__pDrawingProperty->itemDividerEnabled == false ||
__itemType == TABLE_VIEW_ITEM_TYPE_HEADER ||
__itemType == TABLE_VIEW_ITEM_TYPE_FOOTER ||
}
else
{
- Color underLineColor;
- FloatRectangle bounds = GetBoundsF();
-
float lineHeight = 0.0f;
float lineLeftMargin = 0.0f;
float lineBottomMargin = 0.0f;
+ bounds = GetBoundsF();
if (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL)
{
{
GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_PRESSED, underLineColor);
}
+
GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineBottomMargin);
- if(__pItemDivider != null)
- {
- __pItemDivider->SetBounds(FloatRectangle(lineLeftMargin, bounds.height - lineBottomMargin, bounds.width - lineLeftMargin * 2, lineHeight));
- __pItemDivider->SetBackgroundColor(underLineColor);
- __pItemDivider->SetVisibleState(true);
- __pItemDivider->Invalidate();
- }
+ bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, bounds.height - lineBottomMargin));
+ dividerBottomBounds = FloatRectangle(bottomPoint.x, bottomPoint.y, bounds.width - lineLeftMargin * 2, lineHeight);
}
}
else
{
- Color dividerColor;
- FloatRectangle bounds = GetBoundsF();
-
float lineLeftMargin = 0.0f;
float lineHeight = 0.0f;
int groupIndex = -1;
int itemIndex = -1;
+ bounds = GetBoundsF();
+
+ GetItemIndex(groupIndex, itemIndex);
+ if (itemIndex < 1)
+ {
+ __pItemTopDivider->SetVisibleState(false);
+ }
GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, dividerColor);
GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_INDEX_BAR_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, lineLeftMargin);
GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, lineHeight);
+ underLineColor = __pDrawingProperty->dividerColor;
- __pItemDivider->SetBounds(FloatRectangle(lineLeftMargin, (bounds.height - lineHeight), bounds.width - lineLeftMargin * 2, lineHeight));
- __pItemDivider->SetBackgroundColor(__pDrawingProperty->dividerColor);
- __pItemDivider->Invalidate();
+ topPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, 0.0f));
+ bottomPoint = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatPoint(lineLeftMargin, (bounds.height - lineHeight)));
+ dividerTopBounds.SetBounds(topPoint.x, topPoint.y, bounds.width - lineLeftMargin * 2, lineHeight);
+ dividerBottomBounds.SetBounds(bottomPoint.x, bottomPoint.y, bounds.width - lineLeftMargin * 2, lineHeight);
+ }
- GetItemIndex(groupIndex, itemIndex);
- if (itemIndex != 0)
+ if (__pItemDivider != null )
+ {
+ if(__pItemDivider->GetVisibleState())
{
- __pItemTopDivider->SetBounds(FloatRectangle(lineLeftMargin, 0.0f, bounds.width - lineLeftMargin * 2, lineHeight));
- __pItemTopDivider->SetBackgroundColor(dividerColor);
- __pItemTopDivider->Invalidate();
+ __pItemDivider->SetBounds(dividerBottomBounds);
+ __pItemDivider->SetBackgroundColor(underLineColor);
+ __pItemDivider->Invalidate();
}
- }
- if (__pItemDivider != null)
- {
_AccessibilityContainer* pContainer = __pItemDivider->GetAccessibilityContainer();
pContainer->Activate(false);
}
if (__pItemTopDivider != null)
{
+ if(__pItemTopDivider->GetVisibleState())
+ {
+ __pItemTopDivider->SetBounds(dividerTopBounds);
+ __pItemTopDivider->SetBackgroundColor(dividerColor);
+ __pItemTopDivider->Invalidate();
+ }
+
_AccessibilityContainer* pContainer = __pItemTopDivider->GetAccessibilityContainer();
pContainer->Activate(false);
}