Button SetLabel padding fix 84/44684/2
authorTom Robinson <tom.robinson@samsung.com>
Fri, 24 Jul 2015 13:58:25 +0000 (14:58 +0100)
committerTom Robinson <tom.robinson@samsung.com>
Fri, 24 Jul 2015 14:00:01 +0000 (07:00 -0700)
Change-Id: If9db6c7817811bb2d54edba9909db4e48dc3fd6f

dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/button-impl.h
dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp
dali-toolkit/internal/controls/buttons/check-box-button-impl.h
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.h
dali-toolkit/internal/controls/buttons/radio-button-impl.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.h

index 28b9d4a..ff395ae 100644 (file)
@@ -445,7 +445,7 @@ void Button::SetLabelText( const std::string& label )
       Self().Add( mLabel );
     }
 
       Self().Add( mLabel );
     }
 
-    OnLabelSet();
+    OnLabelSet( false );
 
     RelayoutRequest();
   }
 
     RelayoutRequest();
   }
@@ -1577,7 +1577,8 @@ void Button::SetLabel( Actor label )
     // label should be the top of the button
     Self().Add( mLabel );
 
     // label should be the top of the button
     Self().Add( mLabel );
 
-    OnLabelSet();
+    ResetImageLayers();
+    OnLabelSet( true );
 
     RelayoutRequest();
   }
 
     RelayoutRequest();
   }
index a8e9c6b..d9d4bd6 100644 (file)
@@ -334,8 +334,9 @@ private:
 
   /**
    * This method is called when the label is set.
 
   /**
    * This method is called when the label is set.
+   * @param[in] noPadding Used to bypass padding if the label is to be treated generically.
    */
    */
-  virtual void OnLabelSet() {}
+  virtual void OnLabelSet( bool noPadding ) {}
 
   /**
    * This method is called when the unselected button image is set
 
   /**
    * This method is called when the unselected button image is set
index 0aa4e83..30aba5e 100644 (file)
@@ -92,7 +92,7 @@ void CheckBoxButton::OnButtonInitialize()
   SetDisabledSelectedImage( DISABLED_SELECTED_BUTTON_IMAGE_DIR );
 }
 
   SetDisabledSelectedImage( DISABLED_SELECTED_BUTTON_IMAGE_DIR );
 }
 
-void CheckBoxButton::OnLabelSet()
+void CheckBoxButton::OnLabelSet( bool noPadding )
 {
   Actor& label = GetLabelActor();
 
 {
   Actor& label = GetLabelActor();
 
index 25945d2..1697001 100644 (file)
@@ -68,17 +68,17 @@ private: // From Button
 
 
   /**
 
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
+   * @copydoc Toolkit::Internal::Button::OnButtonInitialize
    */
   virtual void OnButtonInitialize();
 
   /**
    */
   virtual void OnButtonInitialize();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnLabelSet()
+   * @copydoc Toolkit::Internal::Button::OnLabelSet
    */
    */
-  virtual void OnLabelSet();
+  virtual void OnLabelSet( bool noPadding );
 
   /**
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnDisabled()
+   * @copydoc Toolkit::Internal::Button::OnDisabled
    */
   virtual void OnDisabled();
 
    */
   virtual void OnDisabled();
 
index 7a8ec5d..b168916 100644 (file)
@@ -273,12 +273,17 @@ Property::Value PushButton::GetProperty( BaseObject* object, Property::Index pro
   return value;
 }
 
   return value;
 }
 
-void PushButton::OnLabelSet()
+void PushButton::OnLabelSet( bool noPadding )
 {
   Actor& label = GetLabelActor();
 
   if( label )
   {
 {
   Actor& label = GetLabelActor();
 
   if( label )
   {
+    if( noPadding )
+    {
+      mLabelPadding = Padding( 0.0f, 0.0f, 0.0f, 0.0f );
+    }
+
     Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( label );
     if( textLabel )
     {
     Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( label );
     if( textLabel )
     {
@@ -557,6 +562,7 @@ void PushButton::ConfigureSizeNegotiation()
   RelayoutRequest();
 }
 
   RelayoutRequest();
 }
 
+
 void PushButton::ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label )
 {
   ResizePolicy::Type imageResizePolicy = ResizePolicy::FILL_TO_PARENT;
 void PushButton::ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label )
 {
   ResizePolicy::Type imageResizePolicy = ResizePolicy::FILL_TO_PARENT;
index f1925a3..44e447c 100644 (file)
@@ -96,47 +96,47 @@ public:
 private: // From Button
 
   /**
 private: // From Button
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
+   * @copydoc Toolkit::Internal::Button::OnButtonInitialize
    */
   virtual void OnButtonInitialize();
 
   /**
    */
   virtual void OnButtonInitialize();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnLabelSet()
+   * @copydoc Toolkit::Internal::Button::OnLabelSet
    */
    */
-  virtual void OnLabelSet();
+  virtual void OnLabelSet( bool noPadding );
 
   /**
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonImageSet()
+   * @copydoc Toolkit::Internal::Button::OnButtonImageSet
    */
   virtual void OnButtonImageSet();
 
   /**
    */
   virtual void OnButtonImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnSelectedImageSet()
+   * @copydoc Toolkit::Internal::Button::OnSelectedImageSet
    */
   virtual void OnSelectedImageSet();
 
   /**
    */
   virtual void OnSelectedImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnBackgroundImage()
+   * @copydoc Toolkit::Internal::Button::OnBackgroundImage
    */
   virtual void OnBackgroundImageSet();
 
   /**
    */
   virtual void OnBackgroundImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet()
+   * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet
    */
   virtual void OnSelectedBackgroundImageSet();
 
   /**
    */
   virtual void OnSelectedBackgroundImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnDisabledImageSet()
+   * @copydoc Toolkit::Internal::Button::OnDisabledImageSet
    */
   virtual void OnDisabledImageSet();
 
   /**
    */
   virtual void OnDisabledImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet()
+   * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet
    */
   virtual void OnDisabledSelectedImageSet();
 
   /**
    */
   virtual void OnDisabledSelectedImageSet();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet()
+   * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet
    */
   virtual void OnDisabledBackgroundImageSet();
 
    */
   virtual void OnDisabledBackgroundImageSet();
 
index 739972a..e980ec9 100644 (file)
@@ -101,7 +101,7 @@ void RadioButton::OnButtonUp()
   }
 }
 
   }
 }
 
-void RadioButton::OnLabelSet()
+void RadioButton::OnLabelSet( bool noPadding )
 {
   Actor& label = GetLabelActor();
 
 {
   Actor& label = GetLabelActor();
 
index e7703a0..039a2f0 100644 (file)
@@ -65,24 +65,24 @@ private:
 private: // From Button
 
   /**
 private: // From Button
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
+   * @copydoc Toolkit::Internal::Button::OnButtonInitialize
    */
   virtual void OnButtonInitialize();
 
   /**
    */
   virtual void OnButtonInitialize();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnButtonUp()
+   * @copydoc Toolkit::Internal::Button::OnButtonUp
    */
   virtual void OnButtonUp();
 
   /**
    */
   virtual void OnButtonUp();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnSelected()
+   * @copydoc Toolkit::Internal::Button::OnSelected
    */
   virtual void OnSelected();
 
   /**
    */
   virtual void OnSelected();
 
   /**
-   * @copydoc Toolkit::Internal::Button::OnLabelSet()
+   * @copydoc Toolkit::Internal::Button::OnLabelSet
    */
    */
-  virtual void OnLabelSet();
+  virtual void OnLabelSet( bool noPadding );
 
 private:
 
 
 private: