_TableViewItemControl::~_TableViewItemControl(void)
{
- delete __pBackgroundBitmap;
- __pBackgroundBitmap = null;
-
+ if(__pBackgroundBitmap)
+ {
+ delete __pBackgroundBitmap;
+ __pBackgroundBitmap = null;
+ }
ClearLastResult();
}
{
__isAnimationCallbackBlocked = true;
+ StopTouchPressedTimer();
+ delete __pPressedTimer;
+ __pPressedTimer = null;
+
+ StopTouchReleasedTimer();
+ delete __pReleasedTimer;
+ __pReleasedTimer = null;
+
_VisualElement* pVisualElement = GetVisualElement();
if (pVisualElement != null)
{
- __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(null);
- __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(null);
-
- __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(null);
- __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(null);
+ if(__pMoveItemAnimation != null)
+ {
+ __pMoveItemAnimation->SetVisualElementAnimationTickEventListener(null);
+ __pMoveItemAnimation->SetVisualElementAnimationStatusEventListener(null);
+ }
- __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(null);
- __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(null);
+ if(__pZoomInOutItemAnimation != null)
+ {
+ __pZoomInOutItemAnimation->SetVisualElementAnimationTickEventListener(null);
+ __pZoomInOutItemAnimation->SetVisualElementAnimationStatusEventListener(null);
+ }
+ if(__pFadeInOutItemtAnimation != null)
+ {
+ __pFadeInOutItemtAnimation->SetVisualElementAnimationTickEventListener(null);
+ __pFadeInOutItemtAnimation->SetVisualElementAnimationStatusEventListener(null);
+ }
pVisualElement->RemoveAllAnimations();
}
delete __pFadeInOutItemtAnimation;
__pFadeInOutItemtAnimation = null;
- if (__isPressedTimerEnabled && __pPressedTimer != null)
- {
- __pPressedTimer->Cancel();
- }
-
- delete __pPressedTimer;
- __pPressedTimer = null;
-
- if (__isReleasedTimerEnabled && __pReleasedTimer != null)
- {
- __pReleasedTimer->Cancel();
- }
-
- delete __pReleasedTimer;
- __pReleasedTimer = null;
-
if (__isCheckedTimerEnabled)
{
__pCheckedTimer->Cancel();
return r;
}
+result
+_TableViewItem::CreateCheckBox(void)
+{
+ result r = E_SUCCESS;
+
+ if (__pItemAnnex == null)
+ {
+ float annexWidth = 0.0f;
+ float annexHeight = 0.0f;
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
+
+ __pItemAnnex = _Label::CreateLabelN();
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ float leftMargin = 0.0f;
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
+
+ float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
+ __pItemAnnex->SetBounds(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight));
+ __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
+
+ AttachSystemChild(*__pItemAnnex);
+ }
+
+ return r;
+}
+
+
+result
+_TableViewItem::CreateRadioBox(void)
+{
+ result r = E_SUCCESS;
+
+ if (__pItemAnnex == null)
+ {
+ float annexWidth = 0.0f;
+ float annexHeight = 0.0f;
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
+
+ __pItemAnnex = _Label::CreateLabelN();
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ float leftMargin = 0.0f;
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
+
+ float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
+ __pItemAnnex->SetBounds(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight));
+ __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
+
+ AttachSystemChild(*__pItemAnnex);
+ }
+
+ return r;
+}
+
+result
+_TableViewItem::CreateOnOffButton(void)
+{
+ result r = E_SUCCESS;
+
+ if (__pItemAnnex == null)
+ {
+ float annexWidth = 0.0f;
+ float annexHeight = 0.0f;
+
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
+
+ __pItemAnnex = _Label::CreateLabelN();
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ float leftMargin = 0.0f;
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
+
+ leftMargin += __pDrawingProperty->scrollMargin;
+
+ float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
+ __pItemAnnex->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight));
+ __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
+
+ AttachSystemChild(*__pItemAnnex);
+ }
+
+ return r;
+}
+
+result
+_TableViewItem::CreateDetailButton(void)
+{
+ result r = E_SUCCESS;
+
+ if (__pItemAnnex == null)
+ {
+ float annexWidth = 0.0f;
+ float annexHeight = 0.0f;
+
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth);
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MORE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight);
+ __pItemAnnex = _Label::CreateLabelN();
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, __pItemAnnex != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ float leftMargin = 0.0f;
+ GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
+
+ leftMargin += __pDrawingProperty->scrollMargin;
+ float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
+ __pItemAnnex->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight));
+ __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
+
+ AttachSystemChild(*__pItemAnnex);
+ }
+
+ return r;
+}
+
void
_TableViewItem::ExposeContextItem(FloatRectangle itemBounds, float targetWidth)
{
return true;
}
- if(__isReleasedTimerEnabled)
- {
- StopTouchReleasedTimer();
- FireItemTouchReleased();
- }
-
__annexOnOffHandlerMoved = false;
__touchStartPosition = touchinfo.GetCurrentPosition(); // +++ check floating
__pressedControl = TABLE_VIEW_ITEM_PRESSED_NONE;
}
- if (!IsIndividualSelectionEnabled(source))
+ if(__isReleasedTimerEnabled)
+ {
+ StopTouchReleasedTimer();
+
+ if (!IsIndividualSelectionEnabled(source))
+ {
+ __itemSelected = true;
+ FireItemTouchPressed();
+ }
+
+ FireItemTouchReleased();
+ }
+ else
{
- StartTouchPressedTimer(source, touchinfo);
+ if (!IsIndividualSelectionEnabled(source))
+ {
+ __itemSelected = true;
+ StartTouchPressedTimer(source, touchinfo);
+ }
}
return true;
void
_TableViewItem::FireItemTouchPressed()
{
- __itemSelected = true;
-
if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
{
__drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
__isSelectedDetailButton = true;
DrawAnnexStyle();
}
- else if (__annexStyle != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING &&
- __annexStyle != TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
+ 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;
+ }
+ else
+ {
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
SetItemChanged(true);
Invalidate();
}
Invalidate();
}
}
-
}
void
if (__releasedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
{
- if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
- || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
+ if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)
|| (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING))
{
SetChecked(!checked);
+ }
+ else if(__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK)
+ {
+ SetChecked(!checked);
SetCheckedAnimationEnabled(!checked);
}
}
{
result r = E_SUCCESS;
- if(__pReleasedTimer != null)
+ if(__pReleasedTimer == null)
{
- delete __pReleasedTimer;
- __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.");
- __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_RELEASED_DURATION);
- SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
+ r = __pReleasedTimer->Construct(*this);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage);
+ }
+ if(!__isReleasedTimerEnabled)
+ {
+ r = __pReleasedTimer->Start(TOUCH_RELEASED_DURATION);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage);
+ }
__isReleasedTimerEnabled = true;
return r;
_TableViewItem::SetDrawingProperty(_ItemDrawingProperty* pDrawingProperty)
{
__pDrawingProperty = pDrawingProperty;
+
+ CreateAnnexStyle();
}
_ItemDrawingProperty*
}
void
+_TableViewItem::CreateAnnexStyle(void)
+{
+ switch (__annexStyle)
+ {
+ case TABLE_VIEW_ANNEX_STYLE_MARK:
+ CreateCheckBox();
+ break;
+ case TABLE_VIEW_ANNEX_STYLE_RADIO:
+ CreateRadioBox();
+ break;
+ case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
+ CreateOnOffButton();
+ break;
+ case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER:
+ CreateOnOffButton();
+ break;
+ case TABLE_VIEW_ANNEX_STYLE_DETAILED:
+ CreateDetailButton();
+ break;
+ default:
+ break;
+ }
+}
+
+void
_TableViewItem::DrawAnnexStyle(void)
{
switch (__annexStyle)
r = GET_BITMAP_CONFIG_N(TABLEVIEW::CHECKBOX_CHECK_MARK_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pCheckBox);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pCheckBox != null), , E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+
}
else
{
pMergeBitmap->Construct(*pCanvas, bounds);
}
- if (__pItemAnnex == null)
- {
- __pItemAnnex = _Label::CreateLabelN();
-
- r = GetLastResult();
- SysTryCatch(NID_UI_CTRL, __pItemAnnex != null, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- float leftMargin = 0.0f;
- GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
-
- float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
- __pItemAnnex->SetBounds(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight));
- __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
-
- AttachSystemChild(*__pItemAnnex);
- }
-
__pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
__pItemAnnex->Invalidate();
pMergeBitmap->Construct(*pCanvas, bounds);
}
- if (__pItemAnnex == null)
- {
- __pItemAnnex = _Label::CreateLabelN();
- SysTryReturnVoidResult(NID_UI_CTRL, __pItemAnnex, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
- float leftMargin = 0.0f;
- GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
-
- float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
- __pItemAnnex->SetBounds(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight));
- __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
-
- AttachSystemChild(*__pItemAnnex);
- }
-
__pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
__pItemAnnex->Invalidate();
pMergeBitmap->Construct(*pCanvas, bounds);
- if (__pItemAnnex == null)
- {
- __pItemAnnex = _Label::CreateLabelN();
- SysTryReturnVoidResult(NID_UI_CTRL, __pItemAnnex, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
- float leftMargin = 0.0f;
- GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
-
- leftMargin += __pDrawingProperty->scrollMargin;
-
- float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
- __pItemAnnex->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight));
- __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
-
- AttachSystemChild(*__pItemAnnex);
- }
-
__pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
__pItemAnnex->Invalidate();
pMergeBitmap->Construct(*pCanvas, bounds);
- if (__pItemAnnex == null)
- {
- __pItemAnnex = _Label::CreateLabelN();
- SysTryReturnVoidResult(NID_UI_CTRL, __pItemAnnex, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
- float leftMargin = 0.0f;
- GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
-
- leftMargin += __pDrawingProperty->scrollMargin;
- float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height);
- __pItemAnnex->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight));
- __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0));
-
- AttachSystemChild(*__pItemAnnex);
- }
-
__pItemAnnex->SetBackgroundBitmap(*pMergeBitmap);
__pItemAnnex->Invalidate();
}
void
+_TableViewItem::SetPressedControl(TableViewItemPressedControl pressedControl)
+{
+ __pressedControl = pressedControl;
+
+ if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ITEM)
+ {
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
+ }
+ else if(__pressedControl == TABLE_VIEW_ITEM_PRESSED_ANNEX)
+ {
+ if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_DETAILED)
+ {
+ __isSelectedDetailButton = true;
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
+ }
+ 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;
+ }
+ else
+ {
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
+ }
+ }
+ else
+ {
+ if(__pressedControl != TABLE_VIEW_ITEM_PRESSED_INDIVIDUAL)
+ {
+ __drawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
+ }
+ }
+}
+
+TableViewItemPressedControl
+_TableViewItem::GetPressedControl(void)
+{
+ return __pressedControl;
+}
+
+void
_TableViewItem::AdjustChildControlMargin(void)
{
if (__childMarginState)