21 import org.kde.plasma.core 0.1 as PlasmaCore
29 height: (tools && enabled) ? tools.height + frameSvg.margins.top + frameSvg.margins.bottom : 0
37 property alias margins: frameSvg.margins
66 property string transition:
"set"
82 function setTools(tools, transition)
84 if (toolBar.tools == tools) {
88 if (connection.oldTools) {
89 connection.oldTools.parent = oldToolsItem
91 connection.oldTools = toolBar.tools
92 toolBar.transition = transition
98 property Item oldTools
100 function internalToolsChanged()
104 if (containerA.current) {
105 newContainer = containerB
106 oldContainer = containerA
108 newContainer = containerA
109 oldContainer = containerB
111 containerA.current = !containerA.current
114 tools.parent = newContainer
116 tools.anchors.left = newContainer.left
117 tools.anchors.right = newContainer.right
120 switch (transition) {
122 containerA.animationsEnabled =
true
123 oldContainer.x = -oldContainer.width/2
125 containerA.animationsEnabled =
false
126 newContainer.x = newContainer.width/2
128 containerA.animationsEnabled =
true
132 containerA.animationsEnabled =
true
133 oldContainer.x = oldContainer.width/2
135 containerA.animationsEnabled =
false
136 newContainer.x = -newContainer.width/2
138 containerA.animationsEnabled =
true
142 containerA.animationsEnabled =
true
143 oldContainer.y = oldContainer.height
145 containerA.animationsEnabled =
false
147 newContainer.y = -newContainer.height
148 containerA.animationsEnabled =
true
153 containerA.animationsEnabled =
false
154 containerA.animationsEnabled =
false
155 oldContainer.x = -oldContainer.width/2
160 newContainer.opacity = 1
161 oldContainer.opacity = 0
163 onToolsChanged: connection.internalToolsChanged()
164 Component.onCompleted: connection.internalToolsChanged()
167 PlasmaCore.FrameSvgItem {
169 imagePath:
"widgets/toolbar"
172 leftMargin: -margins.left
173 rightMargin: -margins.right
175 topMargin: toolBar.y <= 0 ? -margins.top : -margins.top/2
176 bottomMargin: toolBar.y >= toolBar.parent.height - toolBar.height ? -margins.bottom : -margins.bottom/2
181 clip: containerAOpacityAnimation.running || heightAnimation.running
184 leftMargin: frameSvg.margins.left
185 topMargin: frameSvg.margins.top
186 rightMargin: frameSvg.margins.right
187 bottomMargin: frameSvg.margins.bottom
196 height: parent.height
197 property bool animationsEnabled:
false
200 property bool current:
false
201 Behavior on opacity {
203 id: containerAOpacityAnimation
208 enabled: containerA.animationsEnabled
214 enabled: containerA.animationsEnabled
223 height: parent.height
225 Behavior on opacity {
226 PropertyAnimation { duration: 250 }
229 enabled: containerA.animationsEnabled
235 enabled: containerA.animationsEnabled