~josephjamesmills/ubuntuchristianedition/0.1

« back to all changes in this revision

Viewing changes to shell/qml/dash/ListViewWithHeaders.qml

  • Committer: Ugo Riboni
  • Date: 2011-11-18 16:49:28 UTC
  • mfrom: (771.3.57 unity-2d-tv)
  • Revision ID: ugo.riboni@canonical.com-20111118164928-6b0zsae7984nym6w
Merge launcher and dash into an unified shell

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
import QtQuick 1.0
 
20
import "../utils.js" as Utils
20
21
 
21
22
/*
22
23
  List item that behaves similarly to a ListView but supports adding headers
125
126
            return totalHeight
126
127
        }
127
128
 
128
 
        function clamp(x, min, max) {
129
 
            return Math.max(Math.min(x, max), min)
130
 
        }
131
 
 
132
 
 
133
129
        /* Keyboard navigation */
134
130
        function isIndexValid(index) {
135
131
            /* Assuming that children contains exactly one item that is not a child (repeater) */
230
226
                property int bodyVirtualY: heightFirstChildren - items.value
231
227
                /* Y coordinate where the body becomes visible (in body coordinates) */
232
228
                property int bodyVisibleY: ymin - bodyVirtualY
233
 
                y: items.clamp(bodyVirtualY, ymin, ymax)
 
229
                y: Utils.clamp(bodyVirtualY, ymin, ymax)
234
230
 
235
231
 
236
232
                Loader {
264
260
                    onLoaded: item.focus = true
265
261
                    width: parent.width
266
262
                    anchors.top: headerLoader.bottom
267
 
                    height: Math.min(items.clamp(item.totalHeight - bodyVisibleY, 0, item.totalHeight), bodyAvailableHeight)
 
263
                    height: Math.min(Utils.clamp(item.totalHeight - bodyVisibleY, 0, item.totalHeight), bodyAvailableHeight)
268
264
 
269
265
                    Binding {
270
266
                        target: bodyLoader.item