Button: Added changing background color feature
authorTomasz Olszak <olszak.tomasz@gmail.com>
Fri, 31 May 2013 09:43:28 +0000 (11:43 +0200)
committerTomasz Olszak <olszak.tomasz@gmail.com>
Mon, 10 Jun 2013 21:50:58 +0000 (23:50 +0200)
Change-Id: I9a9e0489867dd40096cc0ad795c3dbb755cfdba5
Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
examples/touch/content/ButtonPage.qml
src/styles/ButtonStyle.qml

index 0675934..3c94e32 100644 (file)
@@ -53,6 +53,7 @@ Item {
         Button {
             anchors.margins: 20
             text: "Press me"
+            styleHints:( {color:"yellow",pressedColor:"red"})
         }
 
         Button {
index b322649..eed4047 100644 (file)
@@ -28,9 +28,14 @@ ButtonStyle {
     background: TizenBorderImage {
         implicitWidth: 400
         implicitHeight: 80
+
+        property color bgColorNormal: control.styleHints && control.styleHints.color ? control.styleHints.color :Theme.button.backgroundColor.normal
+        property color bgColorPressed: control.styleHints && control.styleHints.pressedColor ? control.styleHints.pressedColor :Theme.button.backgroundColor.pressed
+        property color bgColorDisabled: control.styleHints && control.styleHints.disabledColor ? control.styleHints.disabledColor : Theme.button.backgroundColor.disabled
+
         source: control.enabled ? (control.pressed ? Theme.button.source.pressed: Theme.button.source.normal) : Theme.button.source.disabled
         effectSource: control.enabled ? (control.pressed ? Theme.button.effectSource.pressed: Theme.button.effectSource.normal) : Theme.button.effectSource.disabled
-        backgroundColor: control.enabled ? (control.pressed ? Theme.button.backgroundColor.pressed: Theme.button.backgroundColor.normal) : Theme.button.backgroundColor.disabled
+        backgroundColor: control.enabled ? (control.pressed ? bgColorPressed : bgColorNormal) : bgColorDisabled
     }
 
     /*! The label of the button. */