~josephjamesmills/ubuntutv/mockup-ppa-branch

« back to all changes in this revision

Viewing changes to Unity-2d/ubuntu-tv/shell/dash/GridViewWithSpacing.qml

  • Committer: Joseph Mills
  • Date: 2012-11-19 21:25:03 UTC
  • Revision ID: josephjamesmills@gmail.com-20121119212503-lwix013dozhb0ar4
adding Unity 2d stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of unity-2d
 
3
 *
 
4
 * Copyright 2010-2011 Canonical Ltd.
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
import QtQuick 1.0
 
20
 
 
21
GridView {
 
22
    property int horizontalSpacing: 0
 
23
    property int verticalSpacing: 0
 
24
    property int columns: 2
 
25
    property int rows: 2
 
26
 
 
27
    function delegateX(column) {
 
28
        return column * horizontalSpacing / columns
 
29
    }
 
30
    function delegateY(row) {
 
31
        return row * verticalSpacing / rows
 
32
    }
 
33
 
 
34
    property int delegateWidth: cellWidth - horizontalSpacing + horizontalSpacing / columns
 
35
    property int delegateHeight: cellHeight - verticalSpacing + verticalSpacing / rows
 
36
    cellWidth: delegateWidth + horizontalSpacing - horizontalSpacing / rows
 
37
    cellHeight: delegateHeight + verticalSpacing - verticalSpacing / rows
 
38
}