@@ -6,34 +6,53 @@ import QtQuick
66import org.deepin.dtk 1.0 as D
77import org.deepin.dtk.style 1.0 as DS
88
9- Control {
9+ D . IconButton {
1010 id: control
11- property alias icon: iconLoader
12- readonly property bool pressed: mouseArea .pressed
13- signal clicked (var mouse)
14- property D .Palette textColor: DS .Style .button .text
15- property D .Palette backgroundColor: DS .Style .windowButton .background
1611
17- palette .windowText : D .ColorSelector .textColor
18- hoverEnabled: true
19- contentItem: D .DciIcon {
20- id: iconLoader
21- palette: D .DTK .makeIconPalette (control .palette )
22- sourceSize {
23- width: DS .Style .windowButton .width
24- height: DS .Style .windowButton .height
12+ property int topRightRadius: (Window .window .visibility !== Window .Maximized &&
13+ Window .window .visibility !== Window .FullScreen &&
14+ isOnRightEdgeOfWindow) ? D .DTK .platformTheme .windowRadius : 0
15+ readonly property bool isOnRightEdgeOfWindow: __itemGlobalPoint .x + control .width >= Window .window .width
16+
17+ readonly property var __itemGlobalPoint: {
18+ var a = control
19+ var x = 0 , y = 0
20+ while (a .parent ) {
21+ x += a .x
22+ y += a .y
23+ a = a .parent
2524 }
26- mode: control .D .ColorSelector .controlState
27- theme: control .D .ColorSelector .controlTheme
25+ return Qt .point (x, y)
2826 }
29- MouseArea {
30- id: mouseArea
31- anchors .fill : parent
32- Component .onCompleted : clicked .connect (control .clicked )
27+
28+ topPadding: 0
29+ bottomPadding: 0
30+ leftPadding: 0
31+ rightPadding: 0
32+ icon {
33+ width: DS .Style .windowButton .width
34+ height: DS .Style .windowButton .height
3335 }
34- background: Rectangle {
36+ background: D . BoxPanel {
3537 implicitWidth: DS .Style .windowButton .width
3638 implicitHeight: DS .Style .windowButton .height
37- color: control .D .ColorSelector .backgroundColor
39+ insideBorderColor: null
40+ outsideBorderColor: null
41+ color1: DS .Style .windowButton .background
42+ color2: color1
43+ radius: 0
44+
45+ Loader {
46+ anchors .fill : parent
47+ active: control .visualFocus
48+ sourceComponent: Rectangle {
49+ topRightRadius: control .topRightRadius
50+ color: " transparent"
51+ border {
52+ width: DS .Style .control .focusBorderWidth
53+ color: control .palette .highlight
54+ }
55+ }
56+ }
3857 }
3958}
0 commit comments