| 1 |
/* |
| 2 |
* Copyright 2012 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
import QtQuick 2.4 |
| 18 |
import Lomiri.Components 1.2 |
| 19 |
|
| 20 |
// frame |
| 21 |
// FIXME: stabilize API |
| 22 |
Item { |
| 23 |
id: visuals |
| 24 |
// style properties |
| 25 |
// FIXME: needs type checking in themes to define the proper type to be used |
| 26 |
// if color type is used, alpha value gets lost |
| 27 |
|
| 28 |
property color color: (styledItem.focus || styledItem.highlighted) ? Theme.palette.selected.fieldText : Theme.palette.normal.fieldText |
| 29 |
property color selectedTextColor: Theme.palette.selected.foregroundText |
| 30 |
property color selectionColor: Theme.palette.selected.foreground |
| 31 |
/*! |
| 32 |
Background fill color |
| 33 |
*/ |
| 34 |
property color backgroundColor: (styledItem.focus || styledItem.highlighted) ? Theme.palette.selected.field : Theme.palette.normal.field |
| 35 |
property color errorColor: LomiriColors.orange |
| 36 |
|
| 37 |
/*! |
| 38 |
Spacing between the frame and the text editor area |
| 39 |
*/ |
| 40 |
property real frameSpacing: units.gu(1) |
| 41 |
// Obsolete |
| 42 |
property alias overlaySpacing: visuals.frameSpacing |
| 43 |
|
| 44 |
// style body |
| 45 |
anchors.fill: parent |
| 46 |
objectName: "textarea_style" |
| 47 |
|
| 48 |
z: -1 |
| 49 |
|
| 50 |
/*! |
| 51 |
Text input background |
| 52 |
*/ |
| 53 |
property Component background: LomiriShape { |
| 54 |
property bool error: (styledItem.hasOwnProperty("errorHighlight") && styledItem.errorHighlight && !styledItem.acceptableInput) |
| 55 |
onErrorChanged: (error) ? visuals.errorColor : visuals.backgroundColor; |
| 56 |
color: visuals.backgroundColor; |
| 57 |
anchors.fill: parent |
| 58 |
visible: !styledItem.readOnly |
| 59 |
} |
| 60 |
|
| 61 |
Loader { |
| 62 |
id: backgroundLoader |
| 63 |
sourceComponent: background |
| 64 |
anchors.fill: parent |
| 65 |
} |
| 66 |
} |