2
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library General Public License as
6
* published by the Free Software Foundation; either version 2, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Library General Public License for more details
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
TODO i need more info here
33
Returns if the Button is checked or not.
36
TODO i need more info here
39
Sets the text for the button
51
The signal is emited when the button is clicked!
55
import org.kde.plasma.core 0.1 as PlasmaCore
62
property alias pressed: mouseArea.pressed
67
property alias text: label.text // TODO: Not yet part of the common API
68
property alias view: surfaceLoader.sourceComponent
69
property alias shadow: shadowLoader.sourceComponent
71
width: surfaceLoader.width + label.paintedWidth
72
height: theme.defaultFont.mSize.height*1.6
73
// TODO: needs to define if there will be specific graphics for
75
opacity: dualButton.enabled ? 1.0 : 0.5
78
if (dualButton.enabled) {
79
shadowLoader.state = "hover"
84
if (dualButton.enabled) {
85
dualButton.checked = !dualButton.checked;
90
Keys.onSpacePressed: entered();
91
Keys.onReturnPressed: entered();
93
if(event.key == Qt.Key_Space ||
94
event.key == Qt.Key_Return)
100
anchors.fill: surfaceLoader
107
verticalCenter: parent.verticalCenter
108
left: text ? parent.left : undefined
109
horizontalCenter: text ? undefined : parent.horizontalCenter
116
text: dualButton.text
119
bottom: parent.bottom
120
left: surfaceLoader.right
122
//FIXME: see how this margin will be set
125
color: theme.textColor
126
verticalAlignment: Text.AlignVCenter
135
onReleased: dualButton.released();
136
onEntered: dualButton.entered();
137
onPressed: dualButton.forceActiveFocus();
139
shadowLoader.state = "shadow"