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;
30 color: root.disabled ? Const.COOL_GREY_COLOR : "black"
31 height: root.iconSource=="" ? textbox.height+20 : icon.height+20
32 //width: textbox.width<100 ? 120 : textbox.width+20
33 width: root.iconSource=="" ? textbox.width+30 : icon.width+30
39 source: root.state != "pressed" ?
40 "../images/pushbutton_normal.png" :
41 "../images/pushbutton_disabled.png"
49 color: Const.WARM_GREY_COLOR
51 //visible: root.state == "pressed"
53 //border.color: "black"
54 //border.width: Const.SHADOW_OFFSET
62 source: root.iconSource == "" ? "" : "../" + root.iconSource
63 sourceSize.width: width
64 sourceSize.height: height
68 if(root.label.length>root.maxSize) {
69 //console.log("root.label: "+root.label)
70 //console.log("root.label.length: "+root.label.length)
71 //console.log("root.maxSize: "+root.maxSize)
72 textbox.text = root.label.substring(0,root.maxSize-3)+"...";
74 textbox.text = root.label;
80 font.pixelSize: root.fontSize
81 color: root.disabled ? "gray" : "white"
83 visible: root.iconSource == ""
90 onClicked: root.buttonClicked(root.label)
91 enabled: !root.disabled
97 PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
98 PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
99 PropertyChanges {target: box; x: 0}
100 PropertyChanges {target: box; y: 0}
104 PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
105 PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
106 PropertyChanges {target: box; x: Const.SHADOW_OFFSET}
107 PropertyChanges {target: box; y: Const.SHADOW_OFFSET}