1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "../UIConstants.js" as Const
7 property bool disabled: false
8 property int fontSize: 30
9 property int maxSize: 27
10 property string iconSource
12 state: mouseArea.pressed && !root.disabled ? "pressed" : "unpressed"
17 signal buttonClicked(string label)
23 color: Const.SHADOW_COLOR;
29 color: root.disabled ? Const.COOL_GREY_COLOR : "black"
30 height: root.iconSource=="" ? textbox.height+20 : icon.height+20
31 width: root.iconSource=="" ? textbox.width+30 : icon.width+30
40 color: Const.WARM_GREY_COLOR
42 visible: root.state == "pressed"
50 source: root.iconSource == "" ? "" : "../" + root.iconSource
51 sourceSize.width: width
52 sourceSize.height: height
56 if(root.label.length>root.maxSize) {
57 textbox.text = root.label.substring(0,root.maxSize-3)+"...";
59 textbox.text = root.label;
65 font.pixelSize: root.fontSize
66 color: root.disabled ? "gray" : "white"
68 visible: root.iconSource == ""
75 onClicked: root.buttonClicked(root.label)
76 enabled: !root.disabled
82 PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
83 PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
84 PropertyChanges {target: box; x: 0}
85 PropertyChanges {target: box; y: 0}
89 PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
90 PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
91 PropertyChanges {target: box; x: Const.SHADOW_OFFSET}
92 PropertyChanges {target: box; y: Const.SHADOW_OFFSET}