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: textbox.width<100 ? 120 : textbox.width+20
32 width: root.iconSource=="" ? textbox.width+30 : icon.width+30
41 color: Const.WARM_GREY_COLOR
43 visible: root.state == "pressed"
44 //border.color: "black"
45 //border.width: Const.SHADOW_OFFSET
53 source: root.iconSource == "" ? "" : "../" + root.iconSource
54 sourceSize.width: width
55 sourceSize.height: height
59 if(root.label.length>root.maxSize) {
60 //console.log("root.label: "+root.label)
61 //console.log("root.label.length: "+root.label.length)
62 //console.log("root.maxSize: "+root.maxSize)
63 textbox.text = root.label.substring(0,root.maxSize-3)+"...";
65 textbox.text = root.label;
71 font.pixelSize: root.fontSize
72 color: root.disabled ? "gray" : "white"
74 visible: root.iconSource == ""
81 onClicked: root.buttonClicked(root.label)
82 enabled: !root.disabled
88 PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
89 PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
90 PropertyChanges {target: box; x: 0}
91 PropertyChanges {target: box; y: 0}
95 PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
96 PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
97 PropertyChanges {target: box; x: Const.SHADOW_OFFSET}
98 PropertyChanges {target: box; y: Const.SHADOW_OFFSET}