*/
#include <FBaseSysLog.h>
+#include <FGrp_BitmapImpl.h>
#include "FUi_AccessibilityContainer.h"
#include "FUi_AccessibilityElement.h"
#include "FUi_EcoreEvas.h"
#include "FUi_EcoreEvasMgr.h"
#include "FUi_CoordinateSystemUtils.h"
+#include "FUi_SystemUtilImpl.h"
#include "FUiCtrlForm.h"
#include "FUiCtrl_Edit.h"
#include "FUiCtrl_Frame.h"
{
const int COMMAND_DONE_BUTTON_ID = 100;
const int COMMAND_CANCEL_BUTTON_ID = 101;
+const int FOOTER_BACK_BUTTON_ID = 102;
IMPLEMENT_PROPERTY(_Keypad);
, __pOwner(null)
, __pCallerEdit(null)
, __pChildEdit(null)
- , __pHeaderForSIP(null)
+ , __pFooter(null)
, __text()
, __pTextEvent(null)
, __isCommandButtonPressed(false)
__pOwner = GetOwner();
}
- __pHeaderForSIP = CreateHeaderForSIP();
+ __pFooter = CreateFooter();
+
+ if (!__pFooter)
+ {
+ SysTryReturnResult(NID_UI_CTRL, __pFooter, GetLastResult(), "Unable to create Edit");
+ }
if (pCallerEdit)
{
}
_Toolbar*
-_Keypad::CreateHeaderForSIP(void)
+_Keypad::CreateFooter(void)
{
result r = E_SUCCESS;
- _Toolbar* pHeaderForSIP = null;
+ _Toolbar* pFooter = null;
- if (!__pHeaderForSIP)
+ if (!__pFooter)
{
_ControlManager* pControlManager = _ControlManager::GetInstance();
SysTryReturn(NID_UI_CTRL, pControlManager, null, E_SYSTEM, "Fail to get ControlManager instance");
SysTryReturn(NID_UI_CTRL, pFrame, null, E_SYSTEM, "This instance is not constructed.");
String doneText;
- String cancelText;
+
FloatRectangle bounds(0.0f,0.0f,0.0f,0.0f);
FloatDimension screenSize = pControlManager->GetScreenSizeF();
- pHeaderForSIP = _Toolbar::CreateToolbarN(true);
- SysTryReturn(NID_UI_CTRL, pHeaderForSIP, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create instance.");
+ pFooter = _Toolbar::CreateToolbarN(false);
+ SysTryReturn(NID_UI_CTRL, pFooter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create instance.");
- r = pHeaderForSIP->Construct();
+ r = pFooter->Construct();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = pHeaderForSIP->SetStyle(TOOLBAR_TEXT);
+ r = pFooter->SetStyle(TOOLBAR_TEXT);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- pHeaderForSIP->SetResizable(true);
- pHeaderForSIP->SetMovable(true);
+ pFooter->SetResizable(true);//[twt] is it necessary???????
+ pFooter->SetMovable(true);
_ControlOrientation orientation = GetOrientation();
}
float height = 0.0f;
- GET_SHAPE_CONFIG(HEADER::HEIGHT, orientation, height);
+ GET_SHAPE_CONFIG(FOOTER::HEIGHT, orientation, height);
bounds.height = height;
- r = pHeaderForSIP->SetBounds(bounds);
+ r = pFooter->SetBounds(bounds);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- pHeaderForSIP->SetResizable(false);
- pHeaderForSIP->SetMovable(false);
+ pFooter->SetResizable(false);
+ pFooter->SetMovable(false);
GET_STRING_CONFIG(IDS_COM_SK_DONE, doneText);
- GET_STRING_CONFIG(IDS_COM_SK_CANCEL, cancelText);
+ //GET_STRING_CONFIG(IDS_COM_SK_CANCEL, cancelText);
- r = pHeaderForSIP->AddItem(CreateButtonItemN(COMMAND_DONE_BUTTON_ID, doneText));
+ r = pFooter->AddItem(CreateButtonItemN(COMMAND_DONE_BUTTON_ID, doneText));
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = pHeaderForSIP->AddItem(CreateButtonItemN(COMMAND_CANCEL_BUTTON_ID, cancelText));
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ pFooter->SetBackEventListener(*this, FOOTER_BACK_BUTTON_ID);
+ pFooter->AddActionEventListener(*this);
- pHeaderForSIP->AddActionEventListener(*this);
+ pFooter->SetButton(BACK_BUTTON, CreateFooterBackButton(pFooter));
- r = AttachChild(*pHeaderForSIP);
+ r = AttachChild(*pFooter);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- return pHeaderForSIP;
+ return pFooter;
}
else
{
- return __pHeaderForSIP;
+ return __pFooter;
}
CATCH:
- delete pHeaderForSIP;
+ delete pFooter;
return null;
}
_Button*
+_Keypad::CreateFooterBackButton(_Toolbar* pFooter)
+{
+ _Button* pButton = _Button::CreateButtonN();
+
+ float buttonHeight = 0.0f;
+ float buttonWidth = 0.0f;
+ float iconSize = 0.0f;
+
+ GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_HEIGHT, pFooter->GetOrientation(), buttonHeight);
+ GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, pFooter->GetOrientation(), buttonWidth);
+ GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_ICON_SIZE, pFooter->GetOrientation(), iconSize);
+
+ pButton->SetSize(FloatDimension(buttonWidth, buttonHeight));
+
+ Bitmap* pBackgroundNormalBitmap = null;
+ Bitmap* pBackgroundPressedBitmap = null;
+ Bitmap* pColorReplacedBitmap = null;
+ Bitmap* pBackIconNormalBitmap = null;
+ Bitmap* pBackIconNormalEffectBitmap = null;
+
+ GET_BITMAP_CONFIG_N(FOOTER::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBackgroundNormalBitmap);
+ GET_BITMAP_CONFIG_N(FOOTER::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pBackgroundPressedBitmap);
+ GET_BITMAP_CONFIG_N(FOOTER::BACK_ICON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBackIconNormalBitmap);
+ GET_BITMAP_CONFIG_N(FOOTER::BACK_ICON_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBackIconNormalEffectBitmap);
+
+ bool themeBackNormalBitmap = IS_CUSTOM_BITMAP(FOOTER::BACK_ICON_NORMAL);
+ if (!themeBackNormalBitmap)
+ {
+ GET_BITMAP_CONFIG_N(FOOTER::BACK_ICON_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBackIconNormalEffectBitmap);
+ }
+
+ if (pBackgroundNormalBitmap)
+ {
+ pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBackgroundNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA),
+ pFooter->GetButtonColor(_BUTTON_STATUS_NORMAL));
+ pButton->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *pColorReplacedBitmap);
+ delete pColorReplacedBitmap;
+
+ pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBackgroundNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA),
+ pFooter->GetButtonColor(_BUTTON_STATUS_HIGHLIGHTED));
+ pButton->SetBackgroundBitmap(_BUTTON_STATUS_HIGHLIGHTED, *pColorReplacedBitmap);
+ delete pColorReplacedBitmap;
+
+ pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBackgroundNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA),
+ pFooter->GetButtonColor(_BUTTON_STATUS_DISABLED));
+ pButton->SetBackgroundBitmap(_BUTTON_STATUS_DISABLED, *pColorReplacedBitmap);
+ delete pColorReplacedBitmap;
+
+ delete pBackgroundNormalBitmap;
+ }
+
+ if (pBackgroundPressedBitmap)
+ {
+ pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBackgroundPressedBitmap, Color::GetColor(COLOR_ID_MAGENTA),
+ pFooter->GetButtonColor(_BUTTON_STATUS_PRESSED));
+ pButton->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *pColorReplacedBitmap);
+ delete pColorReplacedBitmap;
+
+ delete pBackgroundPressedBitmap;
+ }
+
+ if (pBackIconNormalBitmap)
+ {
+ Color normalColor;
+ Color pressedColor;
+ Color disabledColor;
+
+ GET_COLOR_CONFIG(FOOTER::BACK_ICON_NORMAL, normalColor);
+ GET_COLOR_CONFIG(FOOTER::BACK_ICON_PRESSED, pressedColor);
+ GET_COLOR_CONFIG(FOOTER::BACK_ICON_DISABLED, disabledColor);
+
+ pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBackIconNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), normalColor);
+ if (pColorReplacedBitmap)
+ {
+ pColorReplacedBitmap->Scale(FloatDimension(iconSize, iconSize));
+
+ pButton->SetBitmap(_BUTTON_STATUS_NORMAL, FloatPoint(0.0f, 0.0f), *pColorReplacedBitmap);
+
+ delete pColorReplacedBitmap;
+ }
+
+ pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBackIconNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), pressedColor);
+ if (pColorReplacedBitmap)
+ {
+ pColorReplacedBitmap->Scale(FloatDimension(iconSize, iconSize));
+
+ pButton->SetBitmap(_BUTTON_STATUS_PRESSED, FloatPoint(0.0f, 0.0f), *pColorReplacedBitmap);
+ delete pColorReplacedBitmap;
+ }
+
+ pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBackIconNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), disabledColor);
+ if (pColorReplacedBitmap)
+ {
+ pColorReplacedBitmap->Scale(FloatDimension(iconSize, iconSize));
+
+ pButton->SetBitmap(_BUTTON_STATUS_DISABLED, FloatPoint(0.0f, 0.0f), *pColorReplacedBitmap);
+ delete pColorReplacedBitmap;
+ }
+
+ delete pBackIconNormalBitmap;
+ }
+
+ if (pBackIconNormalEffectBitmap)
+ {
+ pButton->SetEffectBitmap(_BUTTON_STATUS_NORMAL, FloatPoint(0.0f, 0.0f), *pBackIconNormalEffectBitmap);
+ pButton->SetEffectBitmap(_BUTTON_STATUS_PRESSED, FloatPoint(0.0f, 0.0f), *pBackIconNormalEffectBitmap);
+ pButton->SetEffectBitmap(_BUTTON_STATUS_SELECTED, FloatPoint(0.0f, 0.0f), *pBackIconNormalEffectBitmap);
+ pButton->SetEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED, FloatPoint(0.0f, 0.0f), *pBackIconNormalEffectBitmap);
+ pButton->SetEffectBitmap(_BUTTON_STATUS_DISABLED, FloatPoint(0.0f, 0.0f), *pBackIconNormalEffectBitmap);
+
+ delete pBackIconNormalEffectBitmap;
+ }
+
+ return pButton;
+}
+
+_Button*
_Keypad::CreateButtonItemN(int actionId, const String& text)
{
result r = E_SUCCESS;
editRect.y = 0.0f;//_keypad's client doesn't include indicator
float footerHeight = 0.0f;
- GET_SHAPE_CONFIG(HEADER::HEIGHT, orientation, footerHeight);
+ GET_SHAPE_CONFIG(FOOTER::HEIGHT, orientation, footerHeight);
- editRect.y += footerHeight;
editRect.height -= footerHeight;
FloatRectangle keypadRect;
r = __pChildEdit->GetKeypadBounds(keypadRect);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
editRect.height -= keypadRect.height;
+
+ if (!__isPredictionWindowOpendInUSBMode)
+ {
+ __pFooter->SetHideButton(true);
+ __pFooter->Invalidate(true);
+ }
}
+ else
+ {
+ __pFooter->SetHideButton(false);
+ __pFooter->Invalidate(true);
+ }
+
r = __pChildEdit->SetBounds(editRect);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ FloatRectangle footerBounds(0.0f, 0.0f, 0.0f, 0.0f);
+
+ footerBounds.y = editRect.height;
+ footerBounds.width = editRect.width;
+ footerBounds.height = footerHeight;
+
+ __pFooter->SetResizable(true);
+ __pFooter->SetMovable(true);
+
+ __pFooter->SetBounds(footerBounds);
+
+ __pFooter->SetResizable(false);
+ __pFooter->SetMovable(false);
+
return r;
}
_Keypad::OnActionPerformed(const _Control& source, int actionId)
{
bool isReCreationLock = false;
- if ((actionId != COMMAND_DONE_BUTTON_ID) && (actionId != COMMAND_CANCEL_BUTTON_ID))
+ if ((actionId != COMMAND_DONE_BUTTON_ID) && (actionId != FOOTER_BACK_BUTTON_ID))
{
return;
}
+ if (actionId == FOOTER_BACK_BUTTON_ID)
+ {
+ if (__pChildEdit->IsKeypadExist())
+ {
+ _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_PRESSED, _KEY_STOP);
+ _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_RELEASED, _KEY_STOP);
+ return;
+ }
+ }
__pChildEdit->HideKeypad();
void
_Keypad::OnKeypadOpened(void)
{
- ChangeLayoutInternal();//usb off & bounded or usb on & prediction
if (__pChildEdit->IsUsbKeyboardConnected())
{
__isPredictionWindowOpendInUSBMode = true;
}
+
+ ChangeLayoutInternal();//usb off & bounded or usb on & prediction
+
return;
}
_Keypad::Dispose(void)
{
result r = E_SUCCESS;
- if (__pHeaderForSIP)
+ if (__pFooter)
{
- DetachChild(*__pHeaderForSIP);
- delete __pHeaderForSIP;
- __pHeaderForSIP = null;
+ DetachChild(*__pFooter);
+ delete __pFooter;
+ __pFooter = null;
}
if (__pChildEdit)
{