Update example to show how to style TextEditor ScrollBar 90/131990/3
authorminho.sun <minho.sun@samsung.com>
Wed, 31 May 2017 12:12:01 +0000 (21:12 +0900)
committerminho.sun <minho.sun@samsung.com>
Wed, 7 Jun 2017 01:41:16 +0000 (10:41 +0900)
Update example to show how to style TextEditor ScrollBar

Change-Id: I62ebf0035490dff2c26f7e7c4df095bd2bc93345
Signed-off-by: minho.sun <minho.sun@samsung.com>
build/tizen/CMakeLists.txt
examples/text-editor/text-editor-example.cpp
resources/style/.gitignore
resources/style/mobile/text-editor-example-theme.json.in [new file with mode: 0644]
resources/style/text-editor-example-theme.json.in [new file with mode: 0644]

index 90b1349..509afef 100644 (file)
@@ -117,6 +117,7 @@ CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE
 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json )
 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/tooltip-example-theme.json.in ${LOCAL_STYLE_DIR}/tooltip-example-theme.json )
 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/basic-light-theme.json.in ${LOCAL_STYLE_DIR}/basic-light-theme.json )
+CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/text-editor-example-theme.json.in ${LOCAL_STYLE_DIR}/text-editor-example-theme.json )
 MESSAGE("Configured ${LOCAL_STYLE_DIR}/style-example-theme<>.json files")
 
 FILE(GLOB LOCAL_STYLES_LIST "${LOCAL_STYLE_DIR}/*.json")
index 23d9dbb..44b08c8 100644 (file)
@@ -34,6 +34,7 @@ using namespace Dali::Toolkit;
 namespace
 {
 
+const char * const THEME_PATH( DEMO_STYLE_DIR "text-editor-example-theme.json" ); ///< The theme used for this example
 const Vector4 BACKGROUND_COLOR( 0.04f, 0.345f, 0.392f, 1.0f );      ///< The background color.
 const char*   TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png";         ///< The tool-bar image.
 const float   TOOLBAR_BUTTON_PERCENTAGE = 0.1f;                     ///< The button's space width as a percentage of the toolbar's width.
@@ -182,6 +183,8 @@ public:
     mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged );
 
     contents.Add( mEditor );
+    StyleManager styleManager = StyleManager::Get();
+    styleManager.ApplyTheme( THEME_PATH );
   }
 
   void CreateButtonContainer()
index fe1c128..dd5d467 100644 (file)
@@ -7,3 +7,4 @@ style-example-theme-two.json
 style-example-theme-one.json
 tooltip-example-theme.json
 basic-light-theme.json
+text-editor-example-theme.json
diff --git a/resources/style/mobile/text-editor-example-theme.json.in b/resources/style/mobile/text-editor-example-theme.json.in
new file mode 100644 (file)
index 0000000..48470b4
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+{
+  "styles":
+  {
+    "ScrollBar":
+    {
+      "indicatorShowDuration":1.0,
+      "indicatorHideDuration":1.0,
+      "background": {
+        "rendererType": "image",
+        "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png"
+        }
+    },
+    "ScrollBarIndicator":
+    {
+      "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png"
+    }
+  }
+}
diff --git a/resources/style/text-editor-example-theme.json.in b/resources/style/text-editor-example-theme.json.in
new file mode 100644 (file)
index 0000000..48470b4
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+{
+  "styles":
+  {
+    "ScrollBar":
+    {
+      "indicatorShowDuration":1.0,
+      "indicatorHideDuration":1.0,
+      "background": {
+        "rendererType": "image",
+        "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png"
+        }
+    },
+    "ScrollBarIndicator":
+    {
+      "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png"
+    }
+  }
+}