Added DetailButton
authorTomasz Olszak <olszak.tomasz@gmail.com>
Thu, 30 May 2013 14:16:10 +0000 (14:16 +0000)
committerTomasz Olszak <olszak.tomasz@gmail.com>
Mon, 10 Jun 2013 21:50:39 +0000 (23:50 +0200)
Change-Id: I5301cb5169037253cd6ac393c737fa3176353f64
Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
examples/touch/content/CheckBoxPage.qml
src/controls/DetailButton.qml [new file with mode: 0644]
src/controls/controls.pro
src/controls/qmldir
src/styles/DefaultSettings.js
src/styles/DetailButtonStyle.qml [new file with mode: 0644]
src/styles/qmldir
src/styles/styles.pro

index 02b71de..179fef1 100644 (file)
@@ -42,6 +42,21 @@ Item {
 
         CheckBox {
             text:"Check box"
+            width:implicitWidth-detail.width
+            DetailButton {
+                id:detail
+                anchors.left:parent.right
+                anchors.verticalCenter: parent.verticalCenter
+            }
+        }
+        CheckBox {
+            text:"Check box 2"
+            DetailButton {
+                anchors.right:parent.right
+                anchors.verticalCenter: parent.verticalCenter
+                arrowType: Qt.LeftArrow
+                onClicked: if (pageStack) pageStack.pop()
+            }
         }
         CheckBox {
             text:"Inverted"
diff --git a/src/controls/DetailButton.qml b/src/controls/DetailButton.qml
new file mode 100644 (file)
index 0000000..09528ca
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Private 1.0
+
+Button {
+    id:detailButton
+    property int arrowType: Qt.RightArrow
+
+    style: Qt.createComponent(Settings.style + "/DetailButtonStyle.qml", detailButton)
+}
index 993d178..011d27b 100644 (file)
@@ -2,7 +2,8 @@ TARGETPATH = QtQuick/Controls/Tizen
 
 
 QML_FILES += \
-    Switch.qml
+    Switch.qml \
+    DetailButton.qml
 
 CONFIG += force_independent
 
index 2ec7b63..61e242f 100644 (file)
@@ -1,3 +1,4 @@
 module QtQuick.Controls.Tizen
 
-Switch 1.0 Switch.qml
\ No newline at end of file
+Switch 1.0 Switch.qml
+DetailButton 1.0 DetailButton.qml
index 4f158ec..8936db7 100644 (file)
@@ -930,3 +930,32 @@ var tabBar = {
     },
     height: 90
 }
+
+var detailButton = {
+    color: {
+        normal: checkBox.details.color.normal,
+        disabled: checkBox.details.color.disabled,
+        pressed: checkBox.details.color.pressed
+    },
+    source: {
+        normal: checkBox.details.source.normal
+    },
+    effectSource: {
+        normal: checkBox.details.effectSource.normal,
+        disabled: checkBox.details.effectSource.disabled,
+        pressed: checkBox.details.effectSource.pressed
+    },
+    iconSource: {
+        normal: checkBox.details.iconSource.normal
+    },
+    iconEffectSource: {
+        normal: checkBox.details.iconEffectSource.normal,
+        pressed: checkBox.details.iconEffectSource.pressed
+    },
+    iconColor: {
+        normal: checkBox.details.iconColor.normal,
+        disabled: checkBox.details.iconColor.disabled,
+        pressed: checkBox.details.iconColor.pressed
+        //highlighted: colors.F032L1P,
+    }
+}
diff --git a/src/styles/DetailButtonStyle.qml b/src/styles/DetailButtonStyle.qml
new file mode 100644 (file)
index 0000000..0124266
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Styles 1.0
+import QtQuick.Controls.Tizen 1.0
+import "DefaultSettings.js" as Theme
+
+ButtonStyle {
+    id: buttonstyle
+
+    readonly property DetailButton control: __control
+
+    background: TizenBorderImage {
+        id:detailsBg
+        source: Theme.detailButton.source.normal
+        backgroundColor: control.enabled ? (control.pressed ? Theme.detailButton.color.pressed : Theme.detailButton.color.normal) : Theme.detailButton.color.disabled
+        effectSource: control.enabled ? (control.pressed ? Theme.detailButton.effectSource.pressed : Theme.detailButton.effectSource.normal) : Theme.detailButton.effectSource.disabled
+    }
+
+    /*! The label of the button. */
+    label: TizenBorderImage {
+        id: arrow
+        function __rotation(arrowType) {
+            switch (arrowType) {
+            case Qt.RightArrow: return 0;
+            case Qt.DownArrow: return 90;
+            case Qt.LeftArrow: return 180;
+            case Qt.UpArrow: return -90;
+            default: return 0;
+            }
+        }
+        rotation: __rotation(control.arrowType)
+        source: Theme.detailButton.iconSource.normal
+        backgroundColor: control.enabled ? (control.pressed ? Theme.detailButton.iconColor.pressed : Theme.detailButton.iconColor.normal) : Theme.detailButton.iconColor.disabled
+        effectSource: Theme.detailButton.iconEffectSource.normal
+    }
+}
+
index f1d8fe5..98ddb32 100644 (file)
@@ -8,5 +8,7 @@ TizenBorderImage 1.0 TizenBorderImage.qml
 Panel 1.0 Panel.qml
 Floater 1.0 Floater.qml
 SwitchStyle 1.0 SwitchStyle.qml
+DetailButtonStyle 1.0 DetailButtonStyle.qml
+
 Theme 1.0 DefaultSettings.js
 
index 95adb9d..9a05b35 100644 (file)
@@ -9,7 +9,8 @@ QML_FILES = \
     Panel.qml \
     TabViewStyle.qml \
     Floater.qml \
-    SwitchStyle.qml
+    SwitchStyle.qml\
+    DetailButtonStyle.qml
 
 # Images
 QML_FILES += \