123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- /****************************************************************************
- **
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
- ** All rights reserved.
- ** Contact: Nokia Corporation (qt-info@nokia.com)
- **
- ** This file is part of the Qt Components project.
- **
- ** $QT_BEGIN_LICENSE:BSD$
- ** You may use this file under the terms of the BSD license as follows:
- **
- ** "Redistribution and use in source and binary forms, with or without
- ** modification, are permitted provided that the following conditions are
- ** met:
- ** * Redistributions of source code must retain the above copyright
- ** notice, this list of conditions and the following disclaimer.
- ** * Redistributions in binary form must reproduce the above copyright
- ** notice, this list of conditions and the following disclaimer in
- ** the documentation and/or other materials provided with the
- ** distribution.
- ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
- ** the names of its contributors may be used to endorse or promote
- ** products derived from this software without specific prior written
- ** permission.
- **
- ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
- // MenuItem is a component that is used in menus.
- import QtQuick 1.1
- import "." 1.0
- import "UIConstants.js" as UI
- Item {
- id: root
- // Common API
- property string text
- property string selectionText
- signal clicked
- property alias pressed: mouseArea.pressed
- width: parent ? parent.width: 0
- height: 80
- /*
- Rectangle {
- id: backgroundRec
- // ToDo: remove hardcoded values
- color: pressed ? "darkgray" : "transparent"
- anchors.fill : root
- opacity : 0.5
- }
- */
- BorderImage {
- id: backgroundImage
- // ToDo: remove hardcoded values
- source: root.parent.children.length == 1 ? (pressed ? "image://theme/meegotouch-list-background-pressed" : "image://theme/meegotouch-list-background")
- : root.parent.children[0] == root ? (pressed ? "image://theme/meegotouch-list-background-pressed-vertical-top" : "image://theme/meegotouch-list-background-vertical-top")
- : root.parent.children[root.parent.children.length-1] == root ? (pressed ? "image://theme/meegotouch-list-background-pressed-vertical-bottom" : "image://theme/meegotouch-list-background-vertical-bottom")
- : (pressed ? "image://theme/meegotouch-list-background-pressed-vertical-center" : "image://theme/meegotouch-list-background-vertical-center")
- anchors.fill : root
- border { left: 22; top: 22;
- right: 22; bottom: 22 }
- }
- Text {
- id: menuText
- anchors.left: parent.left
- anchors.right: filterIndicator.left
- anchors.leftMargin: UI.PADDING_XXLARGE
- anchors.rightMargin: UI.PADDING_XXLARGE
- anchors.bottom: parent.verticalCenter
- text: root.text
- elide: Text.ElideRight
- font.family : UI.FONT_FAMILY
- font.pixelSize : UI.FONT_SLARGE
- font.weight: Font.Bold
- color: "black"
- }
- Text {
- id: filterText
- anchors.left: parent.left
- anchors.right: filterIndicator.left
- anchors.leftMargin: UI.PADDING_XXLARGE
- anchors.rightMargin: UI.PADDING_XXLARGE
- anchors.top: parent.verticalCenter
- text: root.selectionText
- elide: Text.ElideRight
- font.family : UI.FONT_FAMILY_LIGHT
- font.pixelSize : UI.FONT_LSMALL
- font.weight: Font.Normal
- color: "black"
- }
- Image {
- id: filterIndicator
- anchors.right: parent.right
- anchors.rightMargin: UI.PADDING_XXLARGE
- anchors.verticalCenter: parent.verticalCenter
- width: 32
- height: 32
- source: "qrc:/shared/images/filter_indicator_inverted.png"
- }
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: { if (parent.enabled) parent.clicked();}
- }
- onClicked: if (parent) parent.closeLayout();
- }
|