From: minho.sun Date: Wed, 31 May 2017 12:12:01 +0000 (+0900) Subject: Update example to show how to style TextEditor ScrollBar X-Git-Tag: dali_1.2.43~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af1c7e2550765e3137b82a0b12904fbfeffe5d27;p=platform%2Fcore%2Fuifw%2Fdali-demo.git Update example to show how to style TextEditor ScrollBar Update example to show how to style TextEditor ScrollBar Change-Id: I62ebf0035490dff2c26f7e7c4df095bd2bc93345 Signed-off-by: minho.sun --- diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 90b1349..509afef 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -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") diff --git a/examples/text-editor/text-editor-example.cpp b/examples/text-editor/text-editor-example.cpp index 23d9dbb..44b08c8 100644 --- a/examples/text-editor/text-editor-example.cpp +++ b/examples/text-editor/text-editor-example.cpp @@ -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() diff --git a/resources/style/.gitignore b/resources/style/.gitignore index fe1c128..dd5d467 100644 --- a/resources/style/.gitignore +++ b/resources/style/.gitignore @@ -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 index 0000000..48470b4 --- /dev/null +++ b/resources/style/mobile/text-editor-example-theme.json.in @@ -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 index 0000000..48470b4 --- /dev/null +++ b/resources/style/text-editor-example-theme.json.in @@ -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" + } + } +}