Commit af1c7e2550765e3137b82a0b12904fbfeffe5d27
1 parent
8e5284c6
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 <minho.sun@samsung.com>
Showing
5 changed files
with
73 additions
and
0 deletions
build/tizen/CMakeLists.txt
| @@ -117,6 +117,7 @@ CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE | @@ -117,6 +117,7 @@ CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE | ||
| 117 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json ) | 117 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json ) |
| 118 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/tooltip-example-theme.json.in ${LOCAL_STYLE_DIR}/tooltip-example-theme.json ) | 118 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/tooltip-example-theme.json.in ${LOCAL_STYLE_DIR}/tooltip-example-theme.json ) |
| 119 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/basic-light-theme.json.in ${LOCAL_STYLE_DIR}/basic-light-theme.json ) | 119 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/basic-light-theme.json.in ${LOCAL_STYLE_DIR}/basic-light-theme.json ) |
| 120 | +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/text-editor-example-theme.json.in ${LOCAL_STYLE_DIR}/text-editor-example-theme.json ) | ||
| 120 | MESSAGE("Configured ${LOCAL_STYLE_DIR}/style-example-theme<>.json files") | 121 | MESSAGE("Configured ${LOCAL_STYLE_DIR}/style-example-theme<>.json files") |
| 121 | 122 | ||
| 122 | FILE(GLOB LOCAL_STYLES_LIST "${LOCAL_STYLE_DIR}/*.json") | 123 | FILE(GLOB LOCAL_STYLES_LIST "${LOCAL_STYLE_DIR}/*.json") |
examples/text-editor/text-editor-example.cpp
| @@ -34,6 +34,7 @@ using namespace Dali::Toolkit; | @@ -34,6 +34,7 @@ using namespace Dali::Toolkit; | ||
| 34 | namespace | 34 | namespace |
| 35 | { | 35 | { |
| 36 | 36 | ||
| 37 | +const char * const THEME_PATH( DEMO_STYLE_DIR "text-editor-example-theme.json" ); ///< The theme used for this example | ||
| 37 | const Vector4 BACKGROUND_COLOR( 0.04f, 0.345f, 0.392f, 1.0f ); ///< The background color. | 38 | const Vector4 BACKGROUND_COLOR( 0.04f, 0.345f, 0.392f, 1.0f ); ///< The background color. |
| 38 | const char* TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png"; ///< The tool-bar image. | 39 | const char* TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png"; ///< The tool-bar image. |
| 39 | const float TOOLBAR_BUTTON_PERCENTAGE = 0.1f; ///< The button's space width as a percentage of the toolbar's width. | 40 | 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: | @@ -182,6 +183,8 @@ public: | ||
| 182 | mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged ); | 183 | mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged ); |
| 183 | 184 | ||
| 184 | contents.Add( mEditor ); | 185 | contents.Add( mEditor ); |
| 186 | + StyleManager styleManager = StyleManager::Get(); | ||
| 187 | + styleManager.ApplyTheme( THEME_PATH ); | ||
| 185 | } | 188 | } |
| 186 | 189 | ||
| 187 | void CreateButtonContainer() | 190 | void CreateButtonContainer() |
resources/style/.gitignore
resources/style/mobile/text-editor-example-theme.json.in
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd | ||
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + * you may not use this file except in compliance with the License. | ||
| 5 | + * You may obtain a copy of the License at | ||
| 6 | + * | ||
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + * | ||
| 9 | + * Unless required by applicable law or agreed to in writing, software | ||
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + * See the License for the specific language governing permissions and | ||
| 13 | + * limitations under the License. | ||
| 14 | + * | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +{ | ||
| 18 | + "styles": | ||
| 19 | + { | ||
| 20 | + "ScrollBar": | ||
| 21 | + { | ||
| 22 | + "indicatorShowDuration":1.0, | ||
| 23 | + "indicatorHideDuration":1.0, | ||
| 24 | + "background": { | ||
| 25 | + "rendererType": "image", | ||
| 26 | + "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png" | ||
| 27 | + } | ||
| 28 | + }, | ||
| 29 | + "ScrollBarIndicator": | ||
| 30 | + { | ||
| 31 | + "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png" | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | +} |
resources/style/text-editor-example-theme.json.in
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd | ||
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + * you may not use this file except in compliance with the License. | ||
| 5 | + * You may obtain a copy of the License at | ||
| 6 | + * | ||
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + * | ||
| 9 | + * Unless required by applicable law or agreed to in writing, software | ||
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + * See the License for the specific language governing permissions and | ||
| 13 | + * limitations under the License. | ||
| 14 | + * | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +{ | ||
| 18 | + "styles": | ||
| 19 | + { | ||
| 20 | + "ScrollBar": | ||
| 21 | + { | ||
| 22 | + "indicatorShowDuration":1.0, | ||
| 23 | + "indicatorHideDuration":1.0, | ||
| 24 | + "background": { | ||
| 25 | + "rendererType": "image", | ||
| 26 | + "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png" | ||
| 27 | + } | ||
| 28 | + }, | ||
| 29 | + "ScrollBarIndicator": | ||
| 30 | + { | ||
| 31 | + "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png" | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | +} |