apply float parse to button
authorMyung Jin Kim <critical.kim@samsung.com>
Tue, 2 Apr 2013 03:12:46 +0000 (12:12 +0900)
committerMyung Jin Kim <critical.kim@samsung.com>
Tue, 2 Apr 2013 03:12:46 +0000 (12:12 +0900)
Change-Id: If3692b2ae9f9ae6654927524504e8a1fdb7b0aa1

src/ui/controls/FUiCtrl_Button.cpp
src/ui/controls/FUiCtrl_ButtonImpl.cpp
src/ui/controls/FUiCtrl_ButtonPresenter.cpp
src/ui/controls/FUiCtrl_FooterImpl.cpp
src/ui/controls/FUiCtrl_HeaderImpl.cpp
src/ui/inc/FUiCtrl_Button.h
src/ui/resource/FUi_ResourceHeaderConfig.cpp

index 1daaa2c..ec96b04 100644 (file)
@@ -1511,7 +1511,7 @@ _Button::SetMultilineTextSize(const Variant& textSize)
 }
 
 float
-_Button::GetMultilineTextSize(void) const
+_Button::GetMultilineTextSizeF(void) const
 {
        return __multilineFontSize;
 }
index c38c3e1..bde8a15 100644 (file)
@@ -622,7 +622,7 @@ protected:
                HorizontalAlignment horizontalAlignment;
                VerticalAlignment verticalAlignment;
                Color color;
-               int size = 0;
+               float size = 0;
                int opacity = 0;
                Rectangle buttonRect(0, 0, 0, 0);
                Tizen::Base::String elementString;
@@ -694,24 +694,24 @@ protected:
                if (pControl->GetElement(L"normalBitmapPath", elementString) || pControl->GetElement(L"NormalBitmapPath", elementString))
                {
                        Bitmap* pNormalBitmap = null;
-                       Point position;
+                       FloatPoint position;
                        pNormalBitmap = LoadBitmapN(elementString);
 
                        if (pControl->GetElement(L"NormalBitmapX", elementString))
                        {
-                               Base::Integer::Parse(elementString, position.x);
-                               if ((position.x < 0) || (position.x > ((Control*) (GetContainer()))->GetBounds().width - ((Control*) (GetContainer()))->GetBounds().x))
+                               Base::Float::Parse(elementString, position.x);
+                               if ((position.x < 0.0f) || (position.x > ((Control*) (GetContainer()))->GetBoundsF().width - ((Control*) (GetContainer()))->GetBoundsF().x))
                                {
-                                       position.x = 0;
+                                       position.x = 0.0f;
                                }
                        }
 
                        if (pControl->GetElement(L"NormalBitmapY", elementString))
                        {
-                               Base::Integer::Parse(elementString, position.y);
-                               if (position.y < 0 || (position.y > ((Control*) (GetContainer()))->GetBounds().width - ((Control*) (GetContainer()))->GetBounds().x))
+                               Base::Float::Parse(elementString, position.y);
+                               if (position.y < 0.0f || (position.y > ((Control*) (GetContainer()))->GetBoundsF().width - ((Control*) (GetContainer()))->GetBoundsF().x))
                                {
-                                       position.y = 0;
+                                       position.y = 0.0f;
                                }
                        }
 
@@ -725,24 +725,24 @@ protected:
                if (pControl->GetElement(L"PressedBitmapPath", elementString))
                {
                        Bitmap* pPressedBitmap = null;
-                       Point position;
+                       FloatPoint position;
 
                        pPressedBitmap = LoadBitmapN(elementString);
                        if (pControl->GetElement(L"PressedBitmapX", elementString))
                        {
-                               Base::Integer::Parse(elementString, position.x);
-                               if ((position.x < 0) || (position.x > ((Control*) (GetContainer()))->GetBounds().width - ((Control*) (GetContainer()))->GetBounds().x))
+                               Base::Float::Parse(elementString, position.x);
+                               if ((position.x < 0.0f) || (position.x > ((Control*) (GetContainer()))->GetBoundsF().width - ((Control*) (GetContainer()))->GetBoundsF().x))
                                {
-                                       position.x = 0;
+                                       position.x = 0.0f;
                                }
                        }
 
                        if (pControl->GetElement(L"PressedBitmapY", elementString))
                        {
-                               Base::Integer::Parse(elementString, position.y);
-                               if (position.y < 0 || (position.y > ((Control*) (GetContainer()))->GetBounds().width - ((Control*) (GetContainer()))->GetBounds().x))
+                               Base::Float::Parse(elementString, position.y);
+                               if (position.y < 0.0f || (position.y > ((Control*) (GetContainer()))->GetBoundsF().width - ((Control*) (GetContainer()))->GetBoundsF().x))
                                {
-                                       position.y = 0;
+                                       position.y = 0.0f;
                                }
                        }
 
@@ -756,23 +756,23 @@ protected:
                if (pControl->GetElement(L"DisabledBitmapPath", elementString))
                {
                        Bitmap* pDisabledBitmap = null;
-                       Point position;
+                       FloatPoint position;
                        pDisabledBitmap = LoadBitmapN(elementString);
                        if (pControl->GetElement(L"DisabledBitmapX", elementString))
                        {
-                               Base::Integer::Parse(elementString, position.x);
-                               if ((position.x < 0) || (position.x > ((Control*) (GetContainer()))->GetBounds().width - ((Control*) (GetContainer()))->GetBounds().x))
+                               Base::Float::Parse(elementString, position.x);
+                               if ((position.x < 0.0f) || (position.x > ((Control*) (GetContainer()))->GetBoundsF().width - ((Control*) (GetContainer()))->GetBoundsF().x))
                                {
-                                       position.x = 0;
+                                       position.x = 0.0f;
                                }
                        }
 
                        if (pControl->GetElement(L"DisabledBitmapY", elementString))
                        {
-                               Base::Integer::Parse(elementString, position.y);
-                               if (position.y < 0 || (position.y > ((Control*) (GetContainer()))->GetBounds().width - ((Control*) (GetContainer()))->GetBounds().x))
+                               Base::Float::Parse(elementString, position.y);
+                               if (position.y < 0.0f || (position.y > ((Control*) (GetContainer()))->GetBoundsF().width - ((Control*) (GetContainer()))->GetBoundsF().x))
                                {
-                                       position.y = 0;
+                                       position.y = 0.0f;
                                }
                        }
 
@@ -870,12 +870,7 @@ protected:
                {
                        _ICoordinateSystemTransformer* pTransform = GetTransformer();
                        
-                       if (Base::Integer::Parse(elementString, size) != E_SUCCESS)
-                       {
-                               float val = 0.0f;
-                               Base::Float::Parse(elementString, val);
-                               size = (int)val;
-                       }
+                       Base::Float::Parse(elementString, size);
                        
                        if (pTransform)
                        {
index 2d24704..83c607f 100755 (executable)
@@ -771,12 +771,20 @@ _ButtonPresenter::DrawText(void)
        __pTextObject->SetFont(__pFont, 0, __pTextObject->GetTextLength());
        __pTextObject->Compose();
 
-       float multilineFontSize = 0.0f;
+       float fontSize = 0.0f;
 
        if (__pTextObject->GetTotalLineCount() >= 2)
        {
-               multilineFontSize = __pButton->GetMultilineTextSize();  
-               SetTextSize(multilineFontSize);
+               fontSize = __pButton->GetMultilineTextSizeF();
+               SetTextSize(fontSize);
+
+               __pTextObject->SetFont(__pFont, 0, __pTextObject->GetTextLength());
+               __pTextObject->Compose();
+       }
+       else
+       {
+               fontSize = __pButton->GetTextSizeF();
+               SetTextSize(fontSize);
 
                __pTextObject->SetFont(__pFont, 0, __pTextObject->GetTextLength());
                __pTextObject->Compose();
index f4f1ee4..4e59bae 100644 (file)
@@ -1820,7 +1820,7 @@ protected:
                                {
                                        _FooterItemImpl::GetInstance(footerItem)->SetAccessibilityHint(elementString);
                                }
-                               
+
                                pFooter->AddItem(footerItem);
                        }
                        else if (footerItemString.Equals(L"buttonItem", false))
index 7537e8d..a1f1093 100644 (file)
@@ -1812,6 +1812,14 @@ protected:
                                SysLogException(NID_UI_CTRL, r, "[E_INVALID_STATE] Failed to set an icon");
                        }
 
+                       if (pControl->GetElement(L"titleBadgeIconPath", elementString))
+                       {
+                               Bitmap* pBitmap = null;
+                               pBitmap = LoadBitmapN(elementString);
+                               result r = pHeader->SetTitleBadgeIcon(pBitmap);
+                               SysLogException(NID_UI_CTRL, r, "[E_INVALID_STATE] Failed to set an icon");
+                       }
+
                        // description
                        if (pControl->GetElement(L"descriptionText", elementString))
                        {
index 930d70d..1a00b6e 100644 (file)
@@ -245,7 +245,7 @@ public:
        float GetTextExtentSizeF(void) const;
 
        result SetMultilineTextSize(const Variant& textsize);
-       float GetMultilineTextSize(void) const;
+       float GetMultilineTextSizeF(void) const;
 
        bool IsMultilineFontSizeSet(void) const;
 
index 1912cbc..b5da057 100755 (executable)
@@ -194,7 +194,7 @@ START_UI_CONFIG(HEADER);
                ADD_SHAPE_CONFIG(BUTTON_ITEM_MULTILINE_FONT_SIZE, 27);
                ADD_SHAPE_CONFIG(SEGMENTED_ITEM_FONT_SIZE, 28)
                ADD_SHAPE_CONFIG(TAB_ITEM_FONT_SIZE, 30);
-               ADD_SHAPE_CONFIG(TAB_ITEM_FONT_SIZE_3_ITEM, 28);//720x1280
+               ADD_SHAPE_CONFIG(TAB_ITEM_FONT_SIZE_3_ITEM, 26);//720x1280
                ADD_SHAPE_CONFIG(TAB_ITEM_FONT_SIZE_4_ITEM, 24);
                ADD_SHAPE_CONFIG(BADGE_FONT_SIZE, 26);
                ADD_SHAPE_CONFIG(BADGE_FONT_SIZE_WITH_BUTTON, 20);
@@ -279,7 +279,7 @@ START_UI_CONFIG(HEADER);
                ADD_SHAPE_CONFIG(BUTTON_ITEM_MULTILINE_FONT_SIZE, 27);
                ADD_SHAPE_CONFIG(SEGMENTED_ITEM_FONT_SIZE, 28);
                ADD_SHAPE_CONFIG(TAB_ITEM_FONT_SIZE, 30);//1280x720
-               ADD_SHAPE_CONFIG(TAB_ITEM_FONT_SIZE_3_ITEM, 28);
+               ADD_SHAPE_CONFIG(TAB_ITEM_FONT_SIZE_3_ITEM, 26);
                ADD_SHAPE_CONFIG(TAB_ITEM_FONT_SIZE_4_ITEM, 24);
                ADD_SHAPE_CONFIG(BADGE_FONT_SIZE, 26);
                ADD_SHAPE_CONFIG(BADGE_FONT_SIZE_WITH_BUTTON, 20);