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 maxSize: 27
9 property string iconSource
11 state: mouseArea.pressed && !root.disabled ? "pressed" : "unpressed"
16 signal buttonClicked(string label)
22 color: Const.SHADOW_COLOR;
28 color: root.disabled ? Const.COOL_GREY_COLOR : "black"
29 //height: textbox.height+20
31 //width: textbox.width<100 ? 120 : textbox.width+20
41 color: Const.WARM_GREY_COLOR
43 visible: root.state == "pressed"
44 //border.color: "black"
45 //border.width: Const.SHADOW_OFFSET
49 if(root.label.length>root.maxSize) {
50 //console.log("root.label: "+root.label)
51 //console.log("root.label.length: "+root.label.length)
52 //console.log("root.maxSize: "+root.maxSize)
53 textbox.text = root.label.substring(0,root.maxSize-3)+"...";
55 textbox.text = root.label;
61 spacing: Const.DEFAULT_MARGIN
66 source: root.iconSource == "" ? "" : "../" + root.iconSource
67 sourceSize.width: width
68 sourceSize.height: height
69 visible: root.iconSource!=""
77 color: root.disabled ? "gray" : "white"
85 onClicked: root.buttonClicked(root.label)
86 enabled: !root.disabled
92 PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
93 PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
94 PropertyChanges {target: box; x: 0}
95 PropertyChanges {target: box; y: 0}
99 PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
100 PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
101 PropertyChanges {target: box; x: Const.SHADOW_OFFSET}
102 PropertyChanges {target: box; y: Const.SHADOW_OFFSET}