Commit 0a28d6445ef0ce95e46769a0c4208291ff094603
1 parent
fdeaf935
Added a simple application for testing Styling
Added a simple application that has examples of different button types, sliders and popups, that can all be themed. Change-Id: I6d74357b79def0c8d0f7195adf0be7c1270fe9ce Signed-off-by: David Steele <david.steele@samsung.com>
Showing
42 changed files
with
1824 additions
and
9 deletions
build/tizen/CMakeLists.txt
| ... | ... | @@ -35,7 +35,7 @@ SET(IMAGES_DIR ${APP_DATA_DIR}/images/) |
| 35 | 35 | SET(VIDEOS_DIR ${APP_DATA_DIR}/videos/) |
| 36 | 36 | SET(MODELS_DIR ${APP_DATA_DIR}/models/) |
| 37 | 37 | SET(SCRIPTS_DIR ${APP_DATA_DIR}/scripts/) |
| 38 | -SET(STYLE_DIR ${APP_DATA_DIR}/style/) | |
| 38 | +SET(STYLE_DIR ${APP_DATA_DIR}style/) | |
| 39 | 39 | |
| 40 | 40 | IF(NOT DEFINED LOCALE_DIR) |
| 41 | 41 | SET(LOCALE_DIR ${PREFIX}/share/locale) |
| ... | ... | @@ -46,11 +46,13 @@ SET(DEMO_VIDEO_DIR \\"${VIDEOS_DIR}\\") |
| 46 | 46 | SET(DEMO_MODEL_DIR \\"${MODELS_DIR}\\") |
| 47 | 47 | SET(DEMO_SCRIPT_DIR \\"${SCRIPTS_DIR}\\") |
| 48 | 48 | SET(DEMO_STYLE_DIR \\"${STYLE_DIR}\\") |
| 49 | -SET(DEMO_THEME_PATH \\"${STYLE_DIR}/demo-theme.json\") | |
| 49 | +SET(DEMO_THEME_PATH \\"${STYLE_DIR}demo-theme.json\") | |
| 50 | 50 | SET(DEMO_EXAMPLE_BIN \\"${BINDIR}/\\") |
| 51 | 51 | SET(DEMO_LOCALE_DIR \\"${LOCALE_DIR}\\") |
| 52 | 52 | SET(DEMO_LANG \\"${LANG}\\") |
| 53 | 53 | |
| 54 | +SET(DEMO_STYLE_IMAGE_DIR ${STYLE_DIR}images) | |
| 55 | + | |
| 54 | 56 | FILE(GLOB LOCAL_IMAGES_PNG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.png") |
| 55 | 57 | FILE(GLOB LOCAL_IMAGES_JPG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.jpg") |
| 56 | 58 | FILE(GLOB LOCAL_IMAGES_GIF RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.gif") |
| ... | ... | @@ -82,11 +84,23 @@ FOREACH(flag ${LOCAL_SCRIPTS_LIST}) |
| 82 | 84 | ENDFOREACH(flag) |
| 83 | 85 | |
| 84 | 86 | #Replace @DEMO_STYLE_IMAGE_DIR@ in following files |
| 85 | -SET(DEMO_STYLE_IMAGE_DIR ${IMAGES_DIR}) | |
| 86 | 87 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json ) |
| 87 | -INSTALL(FILES ${LOCAL_STYLE_DIR}/demo-theme.json DESTINATION ${STYLE_DIR}) | |
| 88 | -CONFIGURE_FILE( ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js.in ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js ) | |
| 89 | -INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/simple-image-wall.js DESTINATION ${SCRIPTS_DIR}) | |
| 88 | +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-one.json.in ${LOCAL_STYLE_DIR}/style-example-theme-one.json ) | |
| 89 | +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE_DIR}/style-example-theme-two.json ) | |
| 90 | +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json ) | |
| 91 | +MESSAGE("Configured ${LOCAL_STYLE_DIR}/style-example-theme<>.json files") | |
| 92 | + | |
| 93 | +FILE(GLOB LOCAL_STYLES_LIST "${LOCAL_STYLE_DIR}/*.json") | |
| 94 | +FOREACH(flag ${LOCAL_STYLES_LIST}) | |
| 95 | + INSTALL(FILES ${flag} DESTINATION ${STYLE_DIR}) | |
| 96 | +ENDFOREACH(flag) | |
| 97 | +MESSAGE("Installed ${LOCAL_STYLES_LIST} to ${STYLE_DIR}") | |
| 98 | + | |
| 99 | +FILE(GLOB LOCAL_STYLE_IMAGES_LIST "${LOCAL_STYLE_DIR}/images/*.png") | |
| 100 | +FOREACH(flag ${LOCAL_STYLE_IMAGES_LIST}) | |
| 101 | + INSTALL(FILES ${flag} DESTINATION ${STYLE_DIR}/images) | |
| 102 | +ENDFOREACH(flag) | |
| 103 | +MESSAGE("Installed style resources ${LOCAL_STYLE_IMAGES_LIST} to ${STYLE_DIR}/images") | |
| 90 | 104 | |
| 91 | 105 | SET(PKG_LIST dali-core |
| 92 | 106 | dali-adaptor |
| ... | ... | @@ -99,7 +113,7 @@ FOREACH(flag ${REQUIRED_PKGS_CFLAGS}) |
| 99 | 113 | SET(REQUIRED_CFLAGS "${REQUIRED_CFLAGS} ${flag}") |
| 100 | 114 | ENDFOREACH(flag) |
| 101 | 115 | |
| 102 | -SET(DALI_DEMO_CFLAGS "-DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_VIDEO_DIR=${DEMO_VIDEO_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDEMO_LANG=${DEMO_LANG}") | |
| 116 | +SET(DALI_DEMO_CFLAGS "-DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_VIDEO_DIR=${DEMO_VIDEO_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_STYLE_DIR=${DEMO_STYLE_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDEMO_LANG=${DEMO_LANG}") | |
| 103 | 117 | |
| 104 | 118 | ########################################################################### |
| 105 | 119 | # Internationalization | ... | ... |
com.samsung.dali-demo.xml
| ... | ... | @@ -169,4 +169,7 @@ |
| 169 | 169 | <ui-application appid="primitive-shapes.example" exec="/usr/apps/com.samsung.dali-demo/bin/primitive-shapes.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 170 | 170 | <label>Primitive Shapes</label> |
| 171 | 171 | </ui-application> |
| 172 | + <ui-application appid="styling.example" exec="/usr/apps/com.samsung.dali-demo/bin/styling.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 173 | + <label>Styling</label> | |
| 174 | + </ui-application> | |
| 172 | 175 | </manifest> | ... | ... |
demo/dali-demo.cpp
| ... | ... | @@ -80,6 +80,7 @@ int DALI_EXPORT_API main(int argc, char **argv) |
| 80 | 80 | demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE)); |
| 81 | 81 | demo.AddExample(Example("mesh-visual.example", DALI_DEMO_STR_TITLE_MESH_VISUAL)); |
| 82 | 82 | demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES)); |
| 83 | + demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING)); | |
| 83 | 84 | |
| 84 | 85 | demo.SortAlphabetically( true ); |
| 85 | 86 | ... | ... |
examples/line-mesh/line-mesh-example.cpp
| ... | ... | @@ -234,7 +234,7 @@ public: |
| 234 | 234 | |
| 235 | 235 | Dali::Toolkit::RadioButton radio = Dali::Toolkit::RadioButton::New(); |
| 236 | 236 | |
| 237 | - radio.SetProperty( Dali::Toolkit::RadioButton::Property::LABEL, labelMap ); | |
| 237 | + radio.SetProperty( Dali::Toolkit::Button::Property::LABEL, labelMap ); | |
| 238 | 238 | radio.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 239 | 239 | radio.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 240 | 240 | radio.SetSelected( i == 0 ); | ... | ... |
examples/styling/image-channel-control-impl.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +#include "image-channel-control-impl.h" | |
| 18 | +#include <dali-toolkit/dali-toolkit.h> | |
| 19 | +#include <dali/public-api/object/type-registry-helper.h> | |
| 20 | +#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 21 | + | |
| 22 | +using namespace Dali; // Needed for macros | |
| 23 | + | |
| 24 | +namespace Demo | |
| 25 | +{ | |
| 26 | +namespace Internal | |
| 27 | +{ | |
| 28 | + | |
| 29 | +namespace | |
| 30 | +{ | |
| 31 | + | |
| 32 | +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( | |
| 33 | + varying mediump vec2 vTexCoord;\n | |
| 34 | + uniform sampler2D sTexture;\n | |
| 35 | + uniform mediump vec4 uColor;\n | |
| 36 | + uniform mediump vec3 uChannels;\n | |
| 37 | + \n | |
| 38 | + void main()\n | |
| 39 | + {\n | |
| 40 | + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4(uChannels, 1.0) ;\n | |
| 41 | + }\n | |
| 42 | +); | |
| 43 | + | |
| 44 | +Dali::BaseHandle Create() | |
| 45 | +{ | |
| 46 | + return Demo::ImageChannelControl::New(); | |
| 47 | +} | |
| 48 | + | |
| 49 | +DALI_TYPE_REGISTRATION_BEGIN( ImageChannelControl, Dali::Toolkit::Control, Create ); | |
| 50 | + | |
| 51 | +DALI_PROPERTY_REGISTRATION( Demo, ImageChannelControl, "url", STRING, RESOURCE_URL ); | |
| 52 | +DALI_PROPERTY_REGISTRATION( Demo, ImageChannelControl, "redChannel", FLOAT, RED_CHANNEL ); | |
| 53 | +DALI_PROPERTY_REGISTRATION( Demo, ImageChannelControl, "greenChannel", FLOAT, GREEN_CHANNEL ); | |
| 54 | +DALI_PROPERTY_REGISTRATION( Demo, ImageChannelControl, "blueChannel", FLOAT, BLUE_CHANNEL ); | |
| 55 | + | |
| 56 | +DALI_TYPE_REGISTRATION_END(); | |
| 57 | + | |
| 58 | +} // anonymous namespace | |
| 59 | + | |
| 60 | + | |
| 61 | +Internal::ImageChannelControl::ImageChannelControl() | |
| 62 | +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ), | |
| 63 | + mChannels( 1.0f, 1.0f, 1.0f ) | |
| 64 | +{ | |
| 65 | +} | |
| 66 | + | |
| 67 | +Internal::ImageChannelControl::~ImageChannelControl() | |
| 68 | +{ | |
| 69 | +} | |
| 70 | + | |
| 71 | +Demo::ImageChannelControl Internal::ImageChannelControl::New() | |
| 72 | +{ | |
| 73 | + IntrusivePtr<Internal::ImageChannelControl> impl = new Internal::ImageChannelControl(); | |
| 74 | + Demo::ImageChannelControl handle = Demo::ImageChannelControl( *impl ); | |
| 75 | + impl->Initialize(); | |
| 76 | + return handle; | |
| 77 | +} | |
| 78 | + | |
| 79 | +void ImageChannelControl::SetImage( const std::string& url ) | |
| 80 | +{ | |
| 81 | + mUrl = url; | |
| 82 | + | |
| 83 | + Actor self = Self(); | |
| 84 | + | |
| 85 | + Property::Map properties; | |
| 86 | + Property::Map shader; | |
| 87 | + shader[Dali::Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = FRAGMENT_SHADER; | |
| 88 | + properties[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE; | |
| 89 | + properties[Dali::Toolkit::Visual::Property::SHADER]=shader; | |
| 90 | + properties[Dali::Toolkit::ImageVisual::Property::URL] = url; | |
| 91 | + | |
| 92 | + Dali::Toolkit::InitializeVisual( self, mVisual, properties ); | |
| 93 | + | |
| 94 | + RelayoutRequest(); | |
| 95 | +} | |
| 96 | + | |
| 97 | +void ImageChannelControl::OnInitialize() | |
| 98 | +{ | |
| 99 | + Actor self = Self(); | |
| 100 | + mChannelIndex = self.RegisterProperty( "uChannels", Vector3(1.0f, 1.0f, 1.0f) ); | |
| 101 | +} | |
| 102 | + | |
| 103 | +void ImageChannelControl::OnStageConnection( int depth ) | |
| 104 | +{ | |
| 105 | + Control::OnStageConnection( depth ); | |
| 106 | + | |
| 107 | + if( mVisual ) | |
| 108 | + { | |
| 109 | + CustomActor self = Self(); | |
| 110 | + mVisual.SetOnStage( self ); | |
| 111 | + } | |
| 112 | +} | |
| 113 | + | |
| 114 | +void ImageChannelControl::OnStageDisconnection() | |
| 115 | +{ | |
| 116 | + if( mVisual ) | |
| 117 | + { | |
| 118 | + CustomActor self = Self(); | |
| 119 | + mVisual.SetOffStage( self ); | |
| 120 | + } | |
| 121 | + | |
| 122 | + Control::OnStageDisconnection(); | |
| 123 | +} | |
| 124 | + | |
| 125 | +void ImageChannelControl::OnSizeSet( const Vector3& targetSize ) | |
| 126 | +{ | |
| 127 | + Control::OnSizeSet( targetSize ); | |
| 128 | + | |
| 129 | + if( mVisual ) | |
| 130 | + { | |
| 131 | + Vector2 size( targetSize ); | |
| 132 | + mVisual.SetSize( size ); | |
| 133 | + } | |
| 134 | +} | |
| 135 | + | |
| 136 | +Vector3 ImageChannelControl::GetNaturalSize() | |
| 137 | +{ | |
| 138 | + if( mVisual ) | |
| 139 | + { | |
| 140 | + Vector2 naturalSize; | |
| 141 | + mVisual.GetNaturalSize(naturalSize); | |
| 142 | + return Vector3(naturalSize); | |
| 143 | + } | |
| 144 | + return Vector3::ZERO; | |
| 145 | +} | |
| 146 | + | |
| 147 | + | |
| 148 | +/////////////////////////////////////////////////////////// | |
| 149 | +// | |
| 150 | +// Properties | |
| 151 | +// | |
| 152 | + | |
| 153 | +void ImageChannelControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) | |
| 154 | +{ | |
| 155 | + Demo::ImageChannelControl imageChannelControl = Demo::ImageChannelControl::DownCast( Dali::BaseHandle( object ) ); | |
| 156 | + | |
| 157 | + if ( imageChannelControl ) | |
| 158 | + { | |
| 159 | + ImageChannelControl& impl = GetImpl( imageChannelControl ); | |
| 160 | + Actor self = impl.Self(); | |
| 161 | + switch ( index ) | |
| 162 | + { | |
| 163 | + case Demo::ImageChannelControl::Property::RED_CHANNEL: | |
| 164 | + { | |
| 165 | + impl.mChannels[0] = value.Get<float>(); | |
| 166 | + self.SetProperty( impl.mChannelIndex, impl.mChannels ); | |
| 167 | + break; | |
| 168 | + } | |
| 169 | + case Demo::ImageChannelControl::Property::GREEN_CHANNEL: | |
| 170 | + { | |
| 171 | + impl.mChannels[1] = value.Get<float>(); | |
| 172 | + self.SetProperty( impl.mChannelIndex, impl.mChannels ); | |
| 173 | + break; | |
| 174 | + } | |
| 175 | + case Demo::ImageChannelControl::Property::BLUE_CHANNEL: | |
| 176 | + { | |
| 177 | + impl.mChannels[2] = value.Get<float>(); | |
| 178 | + self.SetProperty( impl.mChannelIndex, impl.mChannels ); | |
| 179 | + break; | |
| 180 | + } | |
| 181 | + } | |
| 182 | + } | |
| 183 | +} | |
| 184 | + | |
| 185 | +Property::Value ImageChannelControl::GetProperty( BaseObject* object, Property::Index propertyIndex ) | |
| 186 | +{ | |
| 187 | + Property::Value value; | |
| 188 | + | |
| 189 | + Demo::ImageChannelControl imageChannelControl = Demo::ImageChannelControl::DownCast( Dali::BaseHandle( object ) ); | |
| 190 | + | |
| 191 | + if ( imageChannelControl ) | |
| 192 | + { | |
| 193 | + ImageChannelControl& impl = GetImpl( imageChannelControl ); | |
| 194 | + switch ( propertyIndex ) | |
| 195 | + { | |
| 196 | + case Demo::ImageChannelControl::Property::RED_CHANNEL: | |
| 197 | + { | |
| 198 | + value = impl.mChannels[0]; | |
| 199 | + break; | |
| 200 | + } | |
| 201 | + case Demo::ImageChannelControl::Property::GREEN_CHANNEL: | |
| 202 | + { | |
| 203 | + value = impl.mChannels[1]; | |
| 204 | + break; | |
| 205 | + } | |
| 206 | + case Demo::ImageChannelControl::Property::BLUE_CHANNEL: | |
| 207 | + { | |
| 208 | + value = impl.mChannels[2]; | |
| 209 | + break; | |
| 210 | + } | |
| 211 | + } | |
| 212 | + } | |
| 213 | + | |
| 214 | + return value; | |
| 215 | +} | |
| 216 | + | |
| 217 | +} // Internal | |
| 218 | +} // Demo | ... | ... |
examples/styling/image-channel-control-impl.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_INTERNAL_IMAGE_CHANNEL_CONTROL_IMPL_H | |
| 2 | +#define DALI_DEMO_INTERNAL_IMAGE_CHANNEL_CONTROL_IMPL_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#include "image-channel-control.h" | |
| 21 | +#include <dali-toolkit/public-api/controls/control-impl.h> | |
| 22 | +#include <dali-toolkit/devel-api/visual-factory/visual-base.h> | |
| 23 | + | |
| 24 | +namespace Demo | |
| 25 | +{ | |
| 26 | + | |
| 27 | +namespace Internal // To use TypeRegistry, handle and body classes need the same name | |
| 28 | +{ | |
| 29 | + | |
| 30 | +class ImageChannelControl : public Dali::Toolkit::Internal::Control | |
| 31 | +{ | |
| 32 | +public: | |
| 33 | + /** | |
| 34 | + * Instantiate a new ImageChannelControl object | |
| 35 | + */ | |
| 36 | + static Demo::ImageChannelControl New(); | |
| 37 | + ImageChannelControl(); | |
| 38 | + ~ImageChannelControl(); | |
| 39 | + | |
| 40 | +public: // API | |
| 41 | + /** | |
| 42 | + * @copydoc ImageChannelControl::SetImage | |
| 43 | + */ | |
| 44 | + void SetImage( const std::string& url ); | |
| 45 | + | |
| 46 | +public: // Properties | |
| 47 | + /** | |
| 48 | + * Called when a property of an object of this type is set. | |
| 49 | + * @param[in] object The object whose property is set. | |
| 50 | + * @param[in] index The property index. | |
| 51 | + * @param[in] value The new property value. | |
| 52 | + */ | |
| 53 | + static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Called to retrieve a property of an object of this type. | |
| 57 | + * @param[in] object The object whose property is to be retrieved. | |
| 58 | + * @param[in] index The property index. | |
| 59 | + * @return The current value of the property. | |
| 60 | + */ | |
| 61 | + static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex ); | |
| 62 | + | |
| 63 | +private: // From Control | |
| 64 | + /** | |
| 65 | + * @copydoc Toolkit::Control::OnInitialize() | |
| 66 | + */ | |
| 67 | + virtual void OnInitialize(); | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * @copydoc Toolkit::Control::OnStageConnect() | |
| 71 | + */ | |
| 72 | + virtual void OnStageConnection( int depth ); | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * @copydoc Toolkit::Control::OnStageDisconnection() | |
| 76 | + */ | |
| 77 | + virtual void OnStageDisconnection(); | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * @copydoc Toolkit::Control::OnSizeSet() | |
| 81 | + */ | |
| 82 | + virtual void OnSizeSet( const Dali::Vector3& targetSize ); | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * @copydoc Toolkit::Control::GetNaturalSize | |
| 86 | + */ | |
| 87 | + virtual Dali::Vector3 GetNaturalSize(); | |
| 88 | + | |
| 89 | +private: | |
| 90 | + //undefined | |
| 91 | + ImageChannelControl( const ImageChannelControl& ); | |
| 92 | + ImageChannelControl& operator=( const ImageChannelControl& ); | |
| 93 | + | |
| 94 | +private: | |
| 95 | + // Implementation details | |
| 96 | + std::string mUrl; | |
| 97 | + Dali::Toolkit::Visual::Base mVisual; | |
| 98 | + Dali::Vector3 mChannels; | |
| 99 | + Dali::Property::Index mChannelIndex; | |
| 100 | +}; | |
| 101 | + | |
| 102 | +} // Internal | |
| 103 | + | |
| 104 | +inline Internal::ImageChannelControl& GetImpl( Demo::ImageChannelControl& handle ) | |
| 105 | +{ | |
| 106 | + DALI_ASSERT_ALWAYS( handle ); | |
| 107 | + Dali::RefObject& object = handle.GetImplementation(); | |
| 108 | + return static_cast<Internal::ImageChannelControl&>(object); | |
| 109 | +} | |
| 110 | + | |
| 111 | +inline const Internal::ImageChannelControl& GetImpl( const Demo::ImageChannelControl& handle ) | |
| 112 | +{ | |
| 113 | + DALI_ASSERT_ALWAYS( handle ); | |
| 114 | + const Dali::RefObject& object = handle.GetImplementation(); | |
| 115 | + return static_cast<const Internal::ImageChannelControl&>(object); | |
| 116 | +} | |
| 117 | + | |
| 118 | +} // Demo | |
| 119 | + | |
| 120 | +#endif // DALI_DEMO_IMAGE_CHANNEL_CONTROL_IMPL_H | ... | ... |
examples/styling/image-channel-control.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +#include "image-channel-control.h" | |
| 18 | +#include "image-channel-control-impl.h" | |
| 19 | + | |
| 20 | +namespace Demo | |
| 21 | +{ | |
| 22 | + | |
| 23 | +ImageChannelControl::ImageChannelControl() | |
| 24 | +{ | |
| 25 | +} | |
| 26 | + | |
| 27 | +ImageChannelControl::ImageChannelControl( const ImageChannelControl& imageChannelControl ) | |
| 28 | +: Control( imageChannelControl ) | |
| 29 | +{ | |
| 30 | +} | |
| 31 | + | |
| 32 | +ImageChannelControl& ImageChannelControl::operator= ( const ImageChannelControl& rhs ) | |
| 33 | +{ | |
| 34 | + if( &rhs != this ) | |
| 35 | + { | |
| 36 | + Control::operator=( rhs ); | |
| 37 | + } | |
| 38 | + return *this; | |
| 39 | +} | |
| 40 | + | |
| 41 | +ImageChannelControl::~ImageChannelControl() | |
| 42 | +{ | |
| 43 | +} | |
| 44 | + | |
| 45 | +ImageChannelControl ImageChannelControl::New() | |
| 46 | +{ | |
| 47 | + ImageChannelControl imageChannelControl = Internal::ImageChannelControl::New(); | |
| 48 | + return imageChannelControl; | |
| 49 | +} | |
| 50 | + | |
| 51 | +ImageChannelControl ImageChannelControl::New( const std::string& url ) | |
| 52 | +{ | |
| 53 | + ImageChannelControl imageChannelControl = Internal::ImageChannelControl::New(); | |
| 54 | + imageChannelControl.SetImage( url ); | |
| 55 | + return imageChannelControl; | |
| 56 | +} | |
| 57 | + | |
| 58 | +ImageChannelControl ImageChannelControl::DownCast( BaseHandle handle ) | |
| 59 | +{ | |
| 60 | + return Control::DownCast< ImageChannelControl, Internal::ImageChannelControl > ( handle ); | |
| 61 | +} | |
| 62 | + | |
| 63 | +void ImageChannelControl::SetImage( const std::string& url ) | |
| 64 | +{ | |
| 65 | + GetImpl( *this ).SetImage( url ); | |
| 66 | +} | |
| 67 | + | |
| 68 | +ImageChannelControl::ImageChannelControl( Internal::ImageChannelControl& implementation ) | |
| 69 | +: Control( implementation ) | |
| 70 | +{ | |
| 71 | +} | |
| 72 | + | |
| 73 | +ImageChannelControl::ImageChannelControl( Dali::Internal::CustomActor* internal ) | |
| 74 | +: Control( internal ) | |
| 75 | +{ | |
| 76 | + VerifyCustomActorPointer< Internal::ImageChannelControl >( internal ) ; | |
| 77 | +} | |
| 78 | + | |
| 79 | + | |
| 80 | +} //namespace Demo | ... | ... |
examples/styling/image-channel-control.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_IMAGE_CHANNEL_CONTROL_H | |
| 2 | +#define DALI_DEMO_IMAGE_CHANNEL_CONTROL_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#include <dali-toolkit/dali-toolkit.h> | |
| 21 | +#include <string> | |
| 22 | + | |
| 23 | +namespace Demo | |
| 24 | +{ | |
| 25 | + | |
| 26 | +namespace Internal | |
| 27 | +{ | |
| 28 | +// All type registered types need to have the same name for the body and the handle | |
| 29 | +class ImageChannelControl; | |
| 30 | +} | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * Control that allows the RGB channels of an image to be altered. | |
| 34 | + */ | |
| 35 | +class ImageChannelControl : public Dali::Toolkit::Control | |
| 36 | +{ | |
| 37 | +public: | |
| 38 | + /** | |
| 39 | + * The start and end property ranges for this control | |
| 40 | + */ | |
| 41 | + enum PropertyRange | |
| 42 | + { | |
| 43 | + PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1, | |
| 44 | + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, | |
| 45 | + | |
| 46 | + ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, | |
| 47 | + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000 | |
| 48 | + }; | |
| 49 | + | |
| 50 | + struct Property | |
| 51 | + { | |
| 52 | + enum | |
| 53 | + { | |
| 54 | + | |
| 55 | + RESOURCE_URL = PROPERTY_START_INDEX, | |
| 56 | + RED_CHANNEL, | |
| 57 | + GREEN_CHANNEL, | |
| 58 | + BLUE_CHANNEL | |
| 59 | + }; | |
| 60 | + }; | |
| 61 | + | |
| 62 | +public: // Construction / destruction | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * Create an uninitialized handle | |
| 66 | + */ | |
| 67 | + ImageChannelControl(); | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * Create a new image channel control without an image. Use | |
| 71 | + * SetImage to give this control an image | |
| 72 | + */ | |
| 73 | + static ImageChannelControl New(); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * Create a new image channel control from a given URL | |
| 77 | + */ | |
| 78 | + static ImageChannelControl New( const std::string& url ); | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * Destructor. This is non-virtual since derived Handle types must not | |
| 82 | + * contain data or virtual methods | |
| 83 | + */ | |
| 84 | + ~ImageChannelControl(); | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Copy Constructor | |
| 88 | + */ | |
| 89 | + ImageChannelControl( const ImageChannelControl& imageChannelControl ); | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * Assignment Operator | |
| 93 | + */ | |
| 94 | + ImageChannelControl& operator=( const ImageChannelControl& imageChannelControl ); | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Downcast | |
| 98 | + */ | |
| 99 | + static ImageChannelControl DownCast( BaseHandle handle ); | |
| 100 | + | |
| 101 | +public: // API | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * Set the image for this ImageChannelControl | |
| 105 | + * @param[in] url The url of the image resource | |
| 106 | + */ | |
| 107 | + void SetImage( const std::string& url ); | |
| 108 | + | |
| 109 | +public: // Not for public use | |
| 110 | + /** | |
| 111 | + * Create a handle from an implementation | |
| 112 | + */ | |
| 113 | + ImageChannelControl( Internal::ImageChannelControl& implementation ); | |
| 114 | + | |
| 115 | + /** | |
| 116 | + * Allow the creation of an ImageChannelControl handle from an internal CustomActor pointer | |
| 117 | + */ | |
| 118 | + ImageChannelControl( Dali::Internal::CustomActor* internal ); | |
| 119 | +}; | |
| 120 | + | |
| 121 | +} // namespace Demo | |
| 122 | + | |
| 123 | +#endif // DALI_DEMO_IMAGE_CHANNEL_CONTROL_H | ... | ... |
examples/styling/style-example.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * @file style-example.cpp | |
| 19 | + * @brief Example of styling Toolkit controls. | |
| 20 | + */ | |
| 21 | + | |
| 22 | +// External includes | |
| 23 | +#include <dali/dali.h> | |
| 24 | + | |
| 25 | +// Internal includes | |
| 26 | +#include "styling-application.h" | |
| 27 | + | |
| 28 | + | |
| 29 | +/// Entry point for applications | |
| 30 | +int DALI_EXPORT_API main( int argc, char** argv ) | |
| 31 | +{ | |
| 32 | + const char* themeName = Demo::StylingApplication::DEMO_THEME_ONE_PATH; | |
| 33 | + | |
| 34 | + if( argc > 1 ) | |
| 35 | + { | |
| 36 | + int theme = atoi(argv[1]); | |
| 37 | + if( theme == 2 ) | |
| 38 | + { | |
| 39 | + themeName = Demo::StylingApplication::DEMO_THEME_TWO_PATH; | |
| 40 | + } | |
| 41 | + else if( theme == 3 ) | |
| 42 | + { | |
| 43 | + themeName = Demo::StylingApplication::DEMO_THEME_THREE_PATH; | |
| 44 | + } | |
| 45 | + } | |
| 46 | + | |
| 47 | + Application application = Application::New( &argc, &argv, themeName ); | |
| 48 | + { | |
| 49 | + Demo::StylingApplication stylingApplication( application ); | |
| 50 | + application.MainLoop(); | |
| 51 | + } | |
| 52 | + return 0; | |
| 53 | +} | ... | ... |
examples/styling/styling-application.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * @file style-example.cpp | |
| 19 | + * @brief Example of styling Toolkit controls. | |
| 20 | + */ | |
| 21 | + | |
| 22 | +// Class include | |
| 23 | +#include "styling-application.h" | |
| 24 | + | |
| 25 | +// External includes | |
| 26 | +#include <dali-toolkit/dali-toolkit.h> | |
| 27 | +//#include <dali-toolkit/devel-api/controls/slider/slider.h> | |
| 28 | +#include <dali-toolkit/devel-api/controls/popup/popup.h> | |
| 29 | +#include "image-channel-control.h" | |
| 30 | +#include <cstdio> | |
| 31 | +#include <sstream> | |
| 32 | + | |
| 33 | +// Internal includes | |
| 34 | + | |
| 35 | +using namespace Dali; | |
| 36 | +using namespace Dali::Toolkit; | |
| 37 | + | |
| 38 | +namespace Demo | |
| 39 | +{ | |
| 40 | + | |
| 41 | +const char* StylingApplication::DEMO_THEME_ONE_PATH( DEMO_STYLE_DIR "style-example-theme-one.json" ); | |
| 42 | +const char* StylingApplication::DEMO_THEME_TWO_PATH( DEMO_STYLE_DIR "style-example-theme-two.json" ); | |
| 43 | +const char* StylingApplication::DEMO_THEME_THREE_PATH( DEMO_STYLE_DIR "style-example-theme-three.json" ); | |
| 44 | + | |
| 45 | +namespace | |
| 46 | +{ | |
| 47 | +#define DP(x) x | |
| 48 | + | |
| 49 | +const char* DEFAULT_CONTROL_AREA_IMAGE_PATH( DEMO_IMAGE_DIR "popup_button_background.9.png" ); | |
| 50 | + | |
| 51 | +const char* POPUP_CONTROL_OK_NAME( "PopupControlOk" ); | |
| 52 | +const char* POPUP_CONTROL_CANCEL_NAME( "PopupControlCancel" ); | |
| 53 | +const char* BORDER_IMAGE( DEMO_IMAGE_DIR "border-4px.9.png" ); | |
| 54 | +const char* RESIZE_HANDLE_IMAGE( DEMO_IMAGE_DIR "resize-handle.png" ); | |
| 55 | + | |
| 56 | +const int NUMBER_OF_THEMES(3); // The default theme is considered. | |
| 57 | + | |
| 58 | +const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); | |
| 59 | +const int BORDER_WIDTH( 4 ); | |
| 60 | + | |
| 61 | +const char* const SMALL_IMAGE_1 = DEMO_IMAGE_DIR "gallery-small-14.jpg"; | |
| 62 | +const char* const BIG_IMAGE_1 = DEMO_IMAGE_DIR "gallery-large-4.jpg"; | |
| 63 | + | |
| 64 | +const char* const SMALL_IMAGE_2 = DEMO_IMAGE_DIR "gallery-small-39.jpg"; | |
| 65 | +const char* const BIG_IMAGE_2 = DEMO_IMAGE_DIR "gallery-large-7.jpg"; | |
| 66 | + | |
| 67 | +const char* const SMALL_IMAGE_3 = DEMO_IMAGE_DIR "gallery-small-20.jpg"; | |
| 68 | +const char* const BIG_IMAGE_3 = DEMO_IMAGE_DIR "gallery-large-11.jpg"; | |
| 69 | + | |
| 70 | +// Layout | |
| 71 | +const int MARGIN_SIZE = 10; | |
| 72 | + | |
| 73 | +const int RADIO_LABEL_THUMBNAIL_SIZE = 60; | |
| 74 | +const int RADIO_LABEL_THUMBNAIL_SIZE_SMALL = 40; | |
| 75 | +const int RADIO_IMAGE_SPACING = 8; | |
| 76 | +const int BUTTON_HEIGHT = 48; | |
| 77 | + | |
| 78 | +Property::Index GetChannelProperty( int index ) | |
| 79 | +{ | |
| 80 | + Property::Index channelIndex = Property::INVALID_INDEX; | |
| 81 | + switch(index) | |
| 82 | + { | |
| 83 | + case 0: { channelIndex = ImageChannelControl::Property::RED_CHANNEL; break; } | |
| 84 | + case 1: { channelIndex = ImageChannelControl::Property::GREEN_CHANNEL; break; } | |
| 85 | + case 2: { channelIndex = ImageChannelControl::Property::BLUE_CHANNEL; break; } | |
| 86 | + } | |
| 87 | + return channelIndex; | |
| 88 | +} | |
| 89 | + | |
| 90 | +} // anonymous namespace | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | +StylingApplication::StylingApplication( Application& application ) | |
| 95 | +: mApplication( application ) | |
| 96 | +{ | |
| 97 | + application.InitSignal().Connect( this, &StylingApplication::Create ); | |
| 98 | +} | |
| 99 | + | |
| 100 | +StylingApplication::~StylingApplication() | |
| 101 | +{ | |
| 102 | +} | |
| 103 | + | |
| 104 | +void StylingApplication::Create( Application& application ) | |
| 105 | +{ | |
| 106 | + Stage stage = Stage::GetCurrent(); | |
| 107 | + stage.KeyEventSignal().Connect(this, &StylingApplication::OnKeyEvent); | |
| 108 | + stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) ); | |
| 109 | + | |
| 110 | + // Hide the indicator bar | |
| 111 | + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | |
| 112 | + | |
| 113 | + mContentPane = CreateContentPane(); | |
| 114 | + stage.Add( mContentPane ); | |
| 115 | + mContentPane.SetSize( stage.GetSize() ); | |
| 116 | + | |
| 117 | + // Content panes: | |
| 118 | + TableView contentLayout = TableView::New( 5, 1 ); | |
| 119 | + contentLayout.SetName("ContentLayout"); | |
| 120 | + contentLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 121 | + contentLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 122 | + contentLayout.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 123 | + contentLayout.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); | |
| 124 | + | |
| 125 | + // Assign all rows the size negotiation property of fitting to children | |
| 126 | + for( unsigned int i = 0; i < contentLayout.GetRows(); ++i ) | |
| 127 | + { | |
| 128 | + if( i != 1 ) | |
| 129 | + { | |
| 130 | + contentLayout.SetFitHeight(i); // Row 1 should fill | |
| 131 | + } | |
| 132 | + } | |
| 133 | + | |
| 134 | + mContentPane.Add( contentLayout ); | |
| 135 | + | |
| 136 | + mTitle = TextLabel::New( "Styling Example" ); | |
| 137 | + mTitle.SetName( "Title" ); | |
| 138 | + mTitle.SetStyleName("title"); | |
| 139 | + mTitle.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 140 | + mTitle.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 141 | + mTitle.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 142 | + mTitle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 143 | + mTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | |
| 144 | + contentLayout.Add( mTitle ); | |
| 145 | + | |
| 146 | + // Buttons: | |
| 147 | + | |
| 148 | + TableView imageSelectLayout = TableView::New( 1, 2 ); | |
| 149 | + imageSelectLayout.SetName("ImageSelectLayout"); | |
| 150 | + | |
| 151 | + imageSelectLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 152 | + imageSelectLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); | |
| 153 | + imageSelectLayout.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 154 | + imageSelectLayout.SetParentOrigin( ParentOrigin::CENTER ); | |
| 155 | + imageSelectLayout.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); | |
| 156 | + | |
| 157 | + // Fit radio button column to child width, leave image to fill remainder | |
| 158 | + imageSelectLayout.SetFitWidth( 0 ); | |
| 159 | + | |
| 160 | + contentLayout.Add( imageSelectLayout ); | |
| 161 | + | |
| 162 | + TableView radioButtonsLayout = TableView::New( 3, 2 ); | |
| 163 | + radioButtonsLayout.SetName("RadioButtonsLayout"); | |
| 164 | + radioButtonsLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); | |
| 165 | + // Leave each row to fill to parent height | |
| 166 | + // Set each column to fit to child width | |
| 167 | + radioButtonsLayout.SetFitWidth(0); | |
| 168 | + radioButtonsLayout.SetFitWidth(1); | |
| 169 | + radioButtonsLayout.SetCellPadding( Vector2( 6.0f, 0.0f ) ); | |
| 170 | + | |
| 171 | + imageSelectLayout.AddChild( radioButtonsLayout, TableView::CellPosition(0, 0) ); | |
| 172 | + imageSelectLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); | |
| 173 | + | |
| 174 | + const char* images[] = { SMALL_IMAGE_1, SMALL_IMAGE_2, SMALL_IMAGE_3 }; | |
| 175 | + | |
| 176 | + for( int i=0; i<3; ++i ) | |
| 177 | + { | |
| 178 | + std::ostringstream thumbnailName; thumbnailName << "thumbnail" << i+1; | |
| 179 | + ImageView image = ImageView::New( ResourceImage::New( images[i] ) ); | |
| 180 | + image.SetName( thumbnailName.str() ); | |
| 181 | + image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); | |
| 182 | + | |
| 183 | + std::ostringstream label; label << (i+1); | |
| 184 | + std::ostringstream radioButtonStyleName; | |
| 185 | + radioButtonStyleName << "imageSelectButton" << i+1; | |
| 186 | + mRadioButtons[i] = RadioButton::New( label.str() ); | |
| 187 | + mRadioButtons[i].SetName( radioButtonStyleName.str() ); | |
| 188 | + mRadioButtons[i].SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 189 | + mRadioButtons[i].SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 190 | + mRadioButtons[i].SetSelected( false ); | |
| 191 | + mRadioButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnButtonStateChange ); | |
| 192 | + | |
| 193 | + radioButtonsLayout.AddChild( mRadioButtons[i], TableView::CellPosition( i, 0 ) ); | |
| 194 | + radioButtonsLayout.AddChild( image, TableView::CellPosition( i, 1 ) ); | |
| 195 | + radioButtonsLayout.SetCellAlignment( TableView::CellPosition( i, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); | |
| 196 | + radioButtonsLayout.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); | |
| 197 | + } | |
| 198 | + | |
| 199 | + mRadioButtons[0].SetSelected( true ); | |
| 200 | + | |
| 201 | + mImageChannelControl = ImageChannelControl::New( BIG_IMAGE_1 ); | |
| 202 | + mImageChannelControl.SetName("ImageChannelControl"); | |
| 203 | + mImageChannelControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT , Dimension::ALL_DIMENSIONS ); | |
| 204 | + mImageChannelControl.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); | |
| 205 | + imageSelectLayout.AddChild( mImageChannelControl, TableView::CellPosition( 0, 1 ) ); | |
| 206 | + | |
| 207 | + imageSelectLayout.SetCellAlignment( TableView::CellPosition( 0, 1 ), HorizontalAlignment::RIGHT, VerticalAlignment::CENTER ); | |
| 208 | + | |
| 209 | + | |
| 210 | + TableView channelSliderLayout = TableView::New( 3, 3 ); | |
| 211 | + channelSliderLayout.SetName("ChannelSliderLayout"); | |
| 212 | + | |
| 213 | + // Contains a column of check buttons and a column of sliders for R/G/B | |
| 214 | + channelSliderLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 215 | + channelSliderLayout.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 216 | + channelSliderLayout.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 217 | + channelSliderLayout.SetParentOrigin( ParentOrigin::CENTER ); | |
| 218 | + channelSliderLayout.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); | |
| 219 | + | |
| 220 | + // Set each row to fit to child height | |
| 221 | + channelSliderLayout.SetFitHeight( 0 ); | |
| 222 | + channelSliderLayout.SetFitHeight( 1 ); | |
| 223 | + channelSliderLayout.SetFitHeight( 2 ); | |
| 224 | + | |
| 225 | + // Set each column to fit to child width | |
| 226 | + channelSliderLayout.SetFitWidth( 0 ); | |
| 227 | + channelSliderLayout.SetFitWidth( 1 ); | |
| 228 | + | |
| 229 | + contentLayout.Add( channelSliderLayout ); | |
| 230 | + const char *checkboxLabels[3] = {"R", "G", "B"}; | |
| 231 | + | |
| 232 | + for( int i=0; i<3; ++i ) | |
| 233 | + { | |
| 234 | + std::ostringstream checkBoxStyleName; | |
| 235 | + checkBoxStyleName << "channelActiveCheckBox" << i+1; | |
| 236 | + mCheckButtons[i] = CheckBoxButton::New(); | |
| 237 | + mCheckButtons[i].SetName( checkBoxStyleName.str() ); | |
| 238 | + mCheckButtons[i].SetParentOrigin( ParentOrigin::CENTER ); | |
| 239 | + mCheckButtons[i].SetAnchorPoint( AnchorPoint::CENTER ); | |
| 240 | + mCheckButtons[i].SetSelected( true ); | |
| 241 | + | |
| 242 | + mCheckButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnCheckButtonChange ); | |
| 243 | + mCheckButtons[i].RegisterProperty( "channel", i, Property::READ_WRITE ); | |
| 244 | + | |
| 245 | + channelSliderLayout.AddChild( mCheckButtons[i], TableView::CellPosition( i, 0 ) ); | |
| 246 | + channelSliderLayout.SetCellAlignment( TableView::CellPosition( i, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); | |
| 247 | + | |
| 248 | + TextLabel label = TextLabel::New( checkboxLabels[i] ); | |
| 249 | + std::ostringstream labelStyleName; labelStyleName << "colorLabel" << i+1; | |
| 250 | + label.SetName( labelStyleName.str() ); | |
| 251 | + label.SetStyleName( labelStyleName.str() ); | |
| 252 | + label.SetParentOrigin( ParentOrigin::CENTER ); | |
| 253 | + label.SetAnchorPoint ( AnchorPoint::CENTER ); | |
| 254 | + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); | |
| 255 | + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 256 | + | |
| 257 | + channelSliderLayout.AddChild( label, TableView::CellPosition( i, 1 ) ); | |
| 258 | + channelSliderLayout.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); | |
| 259 | + | |
| 260 | + mChannelSliders[i] = Slider::New(); | |
| 261 | + std::ostringstream sliderStyleName; sliderStyleName << "colorSlider" << i+1; | |
| 262 | + mChannelSliders[i].SetName( sliderStyleName.str() ); | |
| 263 | + mChannelSliders[i].SetStyleName( sliderStyleName.str() ); | |
| 264 | + mChannelSliders[i].SetParentOrigin( ParentOrigin::CENTER ); | |
| 265 | + mChannelSliders[i].SetAnchorPoint ( AnchorPoint::CENTER ); | |
| 266 | + mChannelSliders[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 267 | + mChannelSliders[i].SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN , Dimension::HEIGHT ); | |
| 268 | + mChannelSliders[i].SetProperty( Slider::Property::LOWER_BOUND, 0.0f ); | |
| 269 | + mChannelSliders[i].SetProperty( Slider::Property::UPPER_BOUND, 100.0f ); | |
| 270 | + mChannelSliders[i].SetProperty( Slider::Property::VALUE_PRECISION, 0 ); | |
| 271 | + mChannelSliders[i].SetProperty( Slider::Property::VALUE, 100.0f ); | |
| 272 | + mChannelSliders[i].SetProperty( Slider::Property::SHOW_POPUP, true ); | |
| 273 | + mChannelSliders[i].SetProperty( Slider::Property::SHOW_VALUE, true ); | |
| 274 | + | |
| 275 | + mChannelSliders[i].RegisterProperty( "channel", i, Property::READ_WRITE ); | |
| 276 | + | |
| 277 | + channelSliderLayout.AddChild( mChannelSliders[i], TableView::CellPosition( i, 2 ) ); | |
| 278 | + channelSliderLayout.SetCellAlignment( TableView::CellPosition( i, 2 ), HorizontalAlignment::RIGHT, VerticalAlignment::CENTER ); | |
| 279 | + | |
| 280 | + mChannelSliders[i].ValueChangedSignal().Connect( this, &StylingApplication::OnSliderChanged ); | |
| 281 | + } | |
| 282 | + | |
| 283 | + mResetButton = PushButton::New(); | |
| 284 | + mResetButton.SetLabelText( "Reset" ); | |
| 285 | + mResetButton.SetName("ResetButton"); | |
| 286 | + mResetButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | |
| 287 | + mResetButton.ClickedSignal().Connect( this, &StylingApplication::OnResetClicked ); | |
| 288 | + | |
| 289 | + contentLayout.Add( mResetButton ); | |
| 290 | + contentLayout.SetCellAlignment( TableView::CellPosition( 3, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); | |
| 291 | + | |
| 292 | + TableView themeButtonLayout = TableView::New( 1, 4 ); | |
| 293 | + themeButtonLayout.SetName("ThemeButtonsLayout"); | |
| 294 | + themeButtonLayout.SetCellPadding( Vector2( 6.0f, 0.0f ) ); | |
| 295 | + | |
| 296 | + themeButtonLayout.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 297 | + themeButtonLayout.SetParentOrigin( ParentOrigin::CENTER ); | |
| 298 | + themeButtonLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 299 | + themeButtonLayout.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); | |
| 300 | + themeButtonLayout.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); | |
| 301 | + themeButtonLayout.SetFitHeight( 0 ); | |
| 302 | + | |
| 303 | + TextLabel label = TextLabel::New( "Theme: "); | |
| 304 | + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | |
| 305 | + label.SetStyleName("themelabel"); | |
| 306 | + label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 307 | + label.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 308 | + themeButtonLayout.AddChild( label, TableView::CellPosition( 0, 0 ) ); | |
| 309 | + themeButtonLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); | |
| 310 | + | |
| 311 | + for( int i=0; i<3; ++i ) | |
| 312 | + { | |
| 313 | + mThemeButtons[i] = PushButton::New(); | |
| 314 | + mThemeButtons[i].SetName("ThemeButton"); | |
| 315 | + mThemeButtons[i].SetStyleName("ThemeButton"); | |
| 316 | + mThemeButtons[i].SetParentOrigin( ParentOrigin::CENTER ); | |
| 317 | + mThemeButtons[i].SetAnchorPoint( ParentOrigin::CENTER ); | |
| 318 | + mThemeButtons[i].SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 319 | + mThemeButtons[i].SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 320 | + mThemeButtons[i].RegisterProperty( "theme", i, Property::READ_WRITE ); | |
| 321 | + mThemeButtons[i].ClickedSignal().Connect( this, &StylingApplication::OnThemeButtonClicked ); | |
| 322 | + themeButtonLayout.AddChild( mThemeButtons[i], TableView::CellPosition( 0, 1+i ) ); | |
| 323 | + } | |
| 324 | + mThemeButtons[0].SetLabelText( "Lite" ); // Lightweight changes on top of Dali | |
| 325 | + mThemeButtons[1].SetLabelText( "App1" ); // Different application style | |
| 326 | + mThemeButtons[2].SetLabelText( "App2" ); | |
| 327 | + | |
| 328 | + contentLayout.Add( themeButtonLayout ); | |
| 329 | +} | |
| 330 | + | |
| 331 | +Actor StylingApplication::CreateContentPane() | |
| 332 | +{ | |
| 333 | + Toolkit::ImageView contentPane = Toolkit::ImageView::New( BORDER_IMAGE ); | |
| 334 | + contentPane.SetName("ContentPane"); | |
| 335 | + contentPane.SetParentOrigin( ParentOrigin::CENTER ); | |
| 336 | + contentPane.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 337 | + contentPane.SetPadding( Padding( BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH ) ); | |
| 338 | + return contentPane; | |
| 339 | +} | |
| 340 | + | |
| 341 | +Actor StylingApplication::CreateResizableContentPane() | |
| 342 | +{ | |
| 343 | + Toolkit::ImageView contentPane = Toolkit::ImageView::New( BORDER_IMAGE ); | |
| 344 | + contentPane.SetName("ContentPane"); | |
| 345 | + contentPane.SetParentOrigin( ParentOrigin::CENTER ); | |
| 346 | + contentPane.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 347 | + contentPane.SetPadding( Padding( BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH ) ); | |
| 348 | + | |
| 349 | + Toolkit::ImageView grabHandle = Toolkit::ImageView::New( RESIZE_HANDLE_IMAGE ); | |
| 350 | + grabHandle.SetName("GrabHandle"); | |
| 351 | + grabHandle.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | |
| 352 | + grabHandle.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); | |
| 353 | + grabHandle.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT ); | |
| 354 | + grabHandle.SetPosition( -BORDER_WIDTH, -BORDER_WIDTH ); | |
| 355 | + grabHandle.SetOpacity( 0.6f ); | |
| 356 | + | |
| 357 | + Layer grabCornerLayer = Layer::New(); | |
| 358 | + grabCornerLayer.SetName("GrabCornerLayer"); | |
| 359 | + grabCornerLayer.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); | |
| 360 | + grabCornerLayer.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT ); | |
| 361 | + grabCornerLayer.Add( grabHandle ); | |
| 362 | + contentPane.Add( grabCornerLayer ); | |
| 363 | + | |
| 364 | + mPanGestureDetector = PanGestureDetector::New(); | |
| 365 | + mPanGestureDetector.Attach( grabHandle ); | |
| 366 | + mPanGestureDetector.DetectedSignal().Connect( this, &StylingApplication::OnPan ); | |
| 367 | + | |
| 368 | + return contentPane; | |
| 369 | +} | |
| 370 | + | |
| 371 | +Popup StylingApplication::CreateResetPopup() | |
| 372 | +{ | |
| 373 | + Stage stage = Stage::GetCurrent(); | |
| 374 | + | |
| 375 | + Popup popup= Popup::New(); | |
| 376 | + popup.SetName("ResetPopup"); | |
| 377 | + popup.SetStyleName("ResetPopup"); | |
| 378 | + popup.SetParentOrigin( ParentOrigin::CENTER ); | |
| 379 | + popup.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 380 | + popup.SetSize( stage.GetSize().width * 0.75f, 0.0f ); | |
| 381 | + popup.SetProperty( Popup::Property::TAIL_VISIBILITY, false ); | |
| 382 | + popup.OutsideTouchedSignal().Connect( this, &StylingApplication::HidePopup ); | |
| 383 | + popup.HiddenSignal().Connect( this, &StylingApplication::PopupHidden ); | |
| 384 | + | |
| 385 | + popup.SetTitle( CreateTitle( "Reset channels" ) ); | |
| 386 | + | |
| 387 | + TextLabel text = TextLabel::New( "This will reset the channel data to full value. Are you sure?" ); | |
| 388 | + text.SetName( "PopupContentText" ); | |
| 389 | + text.SetStyleName( "popupBody" ); | |
| 390 | + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 391 | + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); | |
| 392 | + text.SetProperty( TextLabel::Property::MULTI_LINE, true ); | |
| 393 | + text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) ); | |
| 394 | + popup.SetContent( text ); | |
| 395 | + | |
| 396 | + ImageView footer = ImageView::New( DEFAULT_CONTROL_AREA_IMAGE_PATH ); | |
| 397 | + footer.SetName( "PopupFooter" ); | |
| 398 | + footer.SetStyleName( "PopupFooter" ); | |
| 399 | + footer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 400 | + footer.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); | |
| 401 | + footer.SetSize( 0.0f, 80.0f ); | |
| 402 | + footer.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 403 | + footer.SetParentOrigin( ParentOrigin::CENTER ); | |
| 404 | + | |
| 405 | + TableView footerLayout = TableView::New( 1, 2 ); | |
| 406 | + footerLayout.SetParentOrigin( ParentOrigin::CENTER ); | |
| 407 | + footerLayout.SetAnchorPoint ( AnchorPoint::CENTER ); | |
| 408 | + footerLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 409 | + | |
| 410 | + PushButton okayButton = PushButton::New(); | |
| 411 | + okayButton.SetName( POPUP_CONTROL_OK_NAME ); | |
| 412 | + okayButton.SetStyleName( POPUP_CONTROL_OK_NAME ); | |
| 413 | + okayButton.SetLabelText( "Ok!" ); | |
| 414 | + okayButton.ClickedSignal().Connect( this, &StylingApplication::OnReset ); | |
| 415 | + okayButton.SetParentOrigin( ParentOrigin::CENTER ); | |
| 416 | + okayButton.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 417 | + okayButton.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 418 | + okayButton.SetSizeModeFactor( Vector3( -20.0f, -20.0f, 0.0f ) ); | |
| 419 | + | |
| 420 | + PushButton cancelButton = PushButton::New(); | |
| 421 | + cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME ); | |
| 422 | + cancelButton.SetStyleName( POPUP_CONTROL_CANCEL_NAME ); | |
| 423 | + cancelButton.SetLabelText( "Cancel" ); | |
| 424 | + cancelButton.ClickedSignal().Connect( this, &StylingApplication::OnResetCancelled ); | |
| 425 | + cancelButton.SetParentOrigin( ParentOrigin::CENTER ); | |
| 426 | + cancelButton.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 427 | + cancelButton.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 428 | + cancelButton.SetSizeModeFactor( Vector3( -20.0f, -20.0f, 0.0f ) ); | |
| 429 | + | |
| 430 | + footerLayout.SetCellAlignment( TableView::CellPosition( 0, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); | |
| 431 | + footerLayout.SetCellAlignment( TableView::CellPosition( 0, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); | |
| 432 | + footerLayout.AddChild( okayButton, TableView::CellPosition( 0, 0 ) ); | |
| 433 | + footerLayout.AddChild( cancelButton, TableView::CellPosition( 0, 1 ) ); | |
| 434 | + footerLayout.SetCellPadding( Size( 10.f, 10.f ) ); | |
| 435 | + footer.Add( footerLayout ); | |
| 436 | + | |
| 437 | + popup.SetFooter( footer ); | |
| 438 | + return popup; | |
| 439 | +} | |
| 440 | + | |
| 441 | +TextLabel StylingApplication::CreateTitle( std::string title ) | |
| 442 | +{ | |
| 443 | + TextLabel titleActor = TextLabel::New( title ); | |
| 444 | + titleActor.SetName( "titleActor" ); | |
| 445 | + titleActor.SetStyleName( "popupTitle" ); | |
| 446 | + titleActor.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | |
| 447 | + titleActor.SetProperty( TextLabel::Property::MULTI_LINE, false ); | |
| 448 | + | |
| 449 | + return titleActor; | |
| 450 | +} | |
| 451 | + | |
| 452 | +bool StylingApplication::OnButtonStateChange( Button button ) | |
| 453 | +{ | |
| 454 | + // Todo: save / restore slider states per image | |
| 455 | + | |
| 456 | + if( mImageChannelControl ) | |
| 457 | + { | |
| 458 | + if( mRadioButtons[0].IsSelected() ) | |
| 459 | + { | |
| 460 | + mImageChannelControl.SetImage( BIG_IMAGE_1 ); | |
| 461 | + } | |
| 462 | + else if( mRadioButtons[1].IsSelected() ) | |
| 463 | + { | |
| 464 | + mImageChannelControl.SetImage( BIG_IMAGE_2 ); | |
| 465 | + } | |
| 466 | + else if( mRadioButtons[2].IsSelected() ) | |
| 467 | + { | |
| 468 | + mImageChannelControl.SetImage( BIG_IMAGE_3 ); | |
| 469 | + } | |
| 470 | + } | |
| 471 | + return true; | |
| 472 | +} | |
| 473 | + | |
| 474 | +bool StylingApplication::OnCheckButtonChange( Button button ) | |
| 475 | +{ | |
| 476 | + Property::Index index = button.GetPropertyIndex("channel"); | |
| 477 | + if( index != Property::INVALID_INDEX ) | |
| 478 | + { | |
| 479 | + int channel = button.GetProperty<int>( index ); | |
| 480 | + float value = mChannelSliders[channel].GetProperty<float>( Slider::Property::VALUE ); | |
| 481 | + if( !button.IsSelected() ) | |
| 482 | + { | |
| 483 | + // "Turn off" the channel's contribution | |
| 484 | + value = 0.0f; | |
| 485 | + } | |
| 486 | + Property::Index channelIndex = GetChannelProperty( channel ); | |
| 487 | + mImageChannelControl.SetProperty(channelIndex, value/100.0f); | |
| 488 | + } | |
| 489 | + return true; | |
| 490 | +} | |
| 491 | + | |
| 492 | +bool StylingApplication::OnThemeButtonClicked( Button button ) | |
| 493 | +{ | |
| 494 | + int theme = button.GetProperty<int>(button.GetPropertyIndex("theme")); | |
| 495 | + const char* themePath=NULL; | |
| 496 | + | |
| 497 | + switch( theme ) | |
| 498 | + { | |
| 499 | + case 0: | |
| 500 | + { | |
| 501 | + themePath = DEMO_THEME_ONE_PATH; | |
| 502 | + break; | |
| 503 | + } | |
| 504 | + case 1: | |
| 505 | + { | |
| 506 | + themePath = DEMO_THEME_TWO_PATH; | |
| 507 | + break; | |
| 508 | + } | |
| 509 | + case 2: | |
| 510 | + { | |
| 511 | + themePath = DEMO_THEME_THREE_PATH; | |
| 512 | + break; | |
| 513 | + } | |
| 514 | + } | |
| 515 | + StyleManager::Get().ApplyTheme( themePath ); | |
| 516 | + | |
| 517 | + return true; | |
| 518 | +} | |
| 519 | + | |
| 520 | +bool StylingApplication::OnResetClicked( Button button ) | |
| 521 | +{ | |
| 522 | + if( ! mResetPopup ) | |
| 523 | + { | |
| 524 | + mResetPopup = CreateResetPopup (); | |
| 525 | + } | |
| 526 | + | |
| 527 | + Stage::GetCurrent().Add( mResetPopup ); | |
| 528 | + | |
| 529 | + mResetPopup.SetDisplayState( Popup::SHOWN ); | |
| 530 | + return true; | |
| 531 | +} | |
| 532 | + | |
| 533 | +bool StylingApplication::OnReset( Button button ) | |
| 534 | +{ | |
| 535 | + // todo: Reset the sliders for this image | |
| 536 | + for( int i=0; i<3; ++i ) | |
| 537 | + { | |
| 538 | + mChannelSliders[i].SetProperty( Slider::Property::VALUE, 100.0f ); | |
| 539 | + } | |
| 540 | + HidePopup(); | |
| 541 | + return true; | |
| 542 | +} | |
| 543 | + | |
| 544 | +bool StylingApplication::OnResetCancelled( Button button ) | |
| 545 | +{ | |
| 546 | + HidePopup(); | |
| 547 | + return true; | |
| 548 | +} | |
| 549 | + | |
| 550 | +bool StylingApplication::OnSliderChanged( Slider slider, float value ) | |
| 551 | +{ | |
| 552 | + // todo - change color channel's saturation | |
| 553 | + Property::Index index = slider.GetPropertyIndex("channel"); | |
| 554 | + if( index != Property::INVALID_INDEX ) | |
| 555 | + { | |
| 556 | + int channel = slider.GetProperty<int>( index ); | |
| 557 | + if( mCheckButtons[channel].IsSelected() ) | |
| 558 | + { | |
| 559 | + Property::Index channelIndex = GetChannelProperty( channel ); | |
| 560 | + mImageChannelControl.SetProperty(channelIndex, value/100.0f); | |
| 561 | + } | |
| 562 | + } | |
| 563 | + return true; | |
| 564 | +} | |
| 565 | + | |
| 566 | +void StylingApplication::HidePopup() | |
| 567 | +{ | |
| 568 | + if( mResetPopup ) | |
| 569 | + { | |
| 570 | + mResetPopup.SetDisplayState( Popup::HIDDEN ); | |
| 571 | + } | |
| 572 | +} | |
| 573 | + | |
| 574 | +void StylingApplication::PopupHidden() | |
| 575 | +{ | |
| 576 | + if( mResetPopup ) | |
| 577 | + { | |
| 578 | + // Clear down resources | |
| 579 | + mResetPopup.Unparent(); | |
| 580 | + mResetPopup.Reset(); | |
| 581 | + } | |
| 582 | +} | |
| 583 | + | |
| 584 | +void StylingApplication::OnPan( Actor actor, const PanGesture& gesture ) | |
| 585 | +{ | |
| 586 | + Vector3 size = mContentPane.GetTargetSize(); | |
| 587 | + mContentPane.SetSize( size.GetVectorXY() + gesture.displacement * 2.0f ); | |
| 588 | +} | |
| 589 | + | |
| 590 | +void StylingApplication::OnKeyEvent( const KeyEvent& keyEvent ) | |
| 591 | +{ | |
| 592 | + static int keyPressed = 0; | |
| 593 | + | |
| 594 | + if( keyEvent.state == KeyEvent::Down) | |
| 595 | + { | |
| 596 | + if( keyPressed == 0 ) // Is this the first down event? | |
| 597 | + { | |
| 598 | + printf("Key pressed: %s %d\n", keyEvent.keyPressedName.c_str(), keyEvent.keyCode ); | |
| 599 | + | |
| 600 | + if( IsKey( keyEvent, DALI_KEY_ESCAPE) || IsKey( keyEvent, DALI_KEY_BACK ) ) | |
| 601 | + { | |
| 602 | + mApplication.Quit(); | |
| 603 | + } | |
| 604 | + else if( keyEvent.keyPressedName.compare("Return") == 0 ) | |
| 605 | + { | |
| 606 | + mCurrentTheme++; | |
| 607 | + mCurrentTheme %= NUMBER_OF_THEMES; | |
| 608 | + | |
| 609 | + StyleManager styleManager = StyleManager::Get(); | |
| 610 | + switch( mCurrentTheme ) | |
| 611 | + { | |
| 612 | + case 0: | |
| 613 | + { | |
| 614 | + styleManager.ApplyTheme( DEMO_THEME_ONE_PATH ); | |
| 615 | + printf("Changing to theme One\n"); | |
| 616 | + break; | |
| 617 | + } | |
| 618 | + case 1: | |
| 619 | + { | |
| 620 | + styleManager.ApplyTheme( DEMO_THEME_TWO_PATH ); | |
| 621 | + printf("Changing to theme Two\n"); | |
| 622 | + break; | |
| 623 | + } | |
| 624 | + case 2: | |
| 625 | + { | |
| 626 | + styleManager.ApplyDefaultTheme(); | |
| 627 | + printf("Changing to Toolkit theme\n"); | |
| 628 | + break; | |
| 629 | + } | |
| 630 | + } | |
| 631 | + } | |
| 632 | + } | |
| 633 | + keyPressed = 1; | |
| 634 | + } | |
| 635 | + else if( keyEvent.state == KeyEvent::Up ) | |
| 636 | + { | |
| 637 | + keyPressed = 0; | |
| 638 | + } | |
| 639 | +} | |
| 640 | + | |
| 641 | +} // namespace Demo | ... | ... |
examples/styling/styling-application.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_STYLING_APPLICATION_H | |
| 2 | +#define DALI_DEMO_STYLING_APPLICATION_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +// External includes | |
| 21 | +#include <dali-toolkit/dali-toolkit.h> | |
| 22 | +//#include <dali-toolkit/devel-api/controls/slider/slider.h> | |
| 23 | +#include <dali-toolkit/devel-api/controls/popup/popup.h> | |
| 24 | +#include "image-channel-control.h" | |
| 25 | +#include <cstdio> | |
| 26 | +#include <sstream> | |
| 27 | + | |
| 28 | +// Internal includes | |
| 29 | + | |
| 30 | +using namespace Dali; | |
| 31 | +using namespace Dali::Toolkit; | |
| 32 | + | |
| 33 | +namespace Demo | |
| 34 | +{ | |
| 35 | + | |
| 36 | +class StylingApplication : public ConnectionTracker | |
| 37 | +{ | |
| 38 | +public: | |
| 39 | + // Constructor | |
| 40 | + StylingApplication( Application& application ); | |
| 41 | + | |
| 42 | + // Destructor | |
| 43 | + ~StylingApplication(); | |
| 44 | + | |
| 45 | + // Init signal handler | |
| 46 | + void Create( Application& application ); | |
| 47 | + | |
| 48 | + // Create the GUI components | |
| 49 | + Actor CreateContentPane(); | |
| 50 | + Actor CreateResizableContentPane(); | |
| 51 | + Toolkit::Popup CreateResetPopup(); | |
| 52 | + Toolkit::TextLabel CreateTitle( std::string title ); | |
| 53 | + | |
| 54 | + // Key event handler | |
| 55 | + void OnKeyEvent( const KeyEvent& event ); | |
| 56 | + | |
| 57 | + // Button event handlers | |
| 58 | + bool OnButtonStateChange( Toolkit::Button button ); | |
| 59 | + bool OnCheckButtonChange( Toolkit::Button button ); | |
| 60 | + bool OnResetClicked( Toolkit::Button button ); | |
| 61 | + bool OnThemeButtonClicked( Toolkit::Button button ); | |
| 62 | + | |
| 63 | + // Slider event handler | |
| 64 | + bool OnSliderChanged( Toolkit::Slider slider, float value ); | |
| 65 | + | |
| 66 | + // Popup event handlers | |
| 67 | + void HidePopup(); | |
| 68 | + void PopupHidden(); | |
| 69 | + bool OnReset(Button button); | |
| 70 | + bool OnResetCancelled(Button button); | |
| 71 | + | |
| 72 | + // Grab handle handler | |
| 73 | + void OnPan( Actor actor, const PanGesture& gesture ); | |
| 74 | + | |
| 75 | + static const char* DEMO_THEME_ONE_PATH; | |
| 76 | + static const char* DEMO_THEME_TWO_PATH; | |
| 77 | + static const char* DEMO_THEME_THREE_PATH; | |
| 78 | + | |
| 79 | +private: | |
| 80 | + Application& mApplication; | |
| 81 | + int mCurrentTheme; | |
| 82 | + Actor mContentPane; | |
| 83 | + TextLabel mTitle; | |
| 84 | + RadioButton mRadioButtons[3]; // 3 demo images | |
| 85 | + CheckBoxButton mCheckButtons[3]; // rgb buttons | |
| 86 | + Slider mChannelSliders[3]; // rgb sliders | |
| 87 | + PushButton mThemeButtons[3]; | |
| 88 | + PushButton mResetButton; | |
| 89 | + ImageChannelControl mImageChannelControl; | |
| 90 | + Popup mResetPopup; | |
| 91 | + PanGestureDetector mPanGestureDetector; | |
| 92 | +}; | |
| 93 | + | |
| 94 | +} // Namespace Demo | |
| 95 | + | |
| 96 | + | |
| 97 | +#endif // DALI_DEMO_STYLING_APPLICATION_H | ... | ... |
packaging/com.samsung.dali-demo.spec
resources/po/as.po
| ... | ... | @@ -106,6 +106,9 @@ msgstr "লিপি" |
| 106 | 106 | msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" |
| 107 | 107 | msgstr "স্ক্ৰ'ল কৰক" |
| 108 | 108 | |
| 109 | +msgid "DALI_DEMO_STR_TITLE_STYLING" | |
| 110 | +msgstr "শৈলী" | |
| 111 | + | |
| 109 | 112 | msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" |
| 110 | 113 | msgstr "অস্পষ্টকৈ অপুষ্পক" |
| 111 | 114 | |
| ... | ... | @@ -128,4 +131,4 @@ msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" |
| 128 | 131 | msgstr "অকনিষ্ঠ অৰ্জুন বঁটা" |
| 129 | 132 | |
| 130 | 133 | msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" |
| 131 | -msgstr "টিল্ট অনুভূতি" | |
| 132 | 134 | \ No newline at end of file |
| 135 | +msgstr "টিল্ট অনুভূতি" | ... | ... |
resources/po/de.po
| ... | ... | @@ -106,6 +106,9 @@ msgstr "Scripting" |
| 106 | 106 | msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" |
| 107 | 107 | msgstr "Scroll-Ansicht" |
| 108 | 108 | |
| 109 | +msgid "DALI_DEMO_STR_TITLE_STYLING" | |
| 110 | +msgstr "Styling" | |
| 111 | + | |
| 109 | 112 | msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" |
| 110 | 113 | msgstr "Unschärfe und blühen" |
| 111 | 114 | ... | ... |
resources/po/en_GB.po
| ... | ... | @@ -106,6 +106,9 @@ msgstr "Script-based UI" |
| 106 | 106 | msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" |
| 107 | 107 | msgstr "Scroll View" |
| 108 | 108 | |
| 109 | +msgid "DALI_DEMO_STR_TITLE_STYLING" | |
| 110 | +msgstr "Styling" | |
| 111 | + | |
| 109 | 112 | msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" |
| 110 | 113 | msgstr "Super Blur and Bloom" |
| 111 | 114 | ... | ... |
resources/po/en_US.po
| ... | ... | @@ -106,6 +106,9 @@ msgstr "Script-based UI" |
| 106 | 106 | msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" |
| 107 | 107 | msgstr "Scroll View" |
| 108 | 108 | |
| 109 | +msgid "DALI_DEMO_STR_TITLE_STYLING" | |
| 110 | +msgstr "Styling" | |
| 111 | + | |
| 109 | 112 | msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" |
| 110 | 113 | msgstr "Super Blur and Bloom" |
| 111 | 114 | ... | ... |
resources/po/es.po
| ... | ... | @@ -106,6 +106,9 @@ msgstr "Interfaz definida por Script" |
| 106 | 106 | msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" |
| 107 | 107 | msgstr "Vista de desplazamiento" |
| 108 | 108 | |
| 109 | +msgid "DALI_DEMO_STR_TITLE_STYLING" | |
| 110 | +msgstr "Estilo" | |
| 111 | + | |
| 109 | 112 | msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" |
| 110 | 113 | msgstr "Efecto blur y bloom" |
| 111 | 114 | ... | ... |
resources/po/ko.po
resources/po/ml.po
| ... | ... | @@ -106,6 +106,9 @@ msgstr "സ്ക്രിപ്റ്റ്" |
| 106 | 106 | msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" |
| 107 | 107 | msgstr "സ്ക്രോള്ചെയ്യുക കാഴ്ച" |
| 108 | 108 | |
| 109 | +msgid "DALI_DEMO_STR_TITLE_STYLING" | |
| 110 | +msgstr "ശൈലി" | |
| 111 | + | |
| 109 | 112 | msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" |
| 110 | 113 | msgstr "മങ്ങൽ പൂക്കൽ" |
| 111 | 114 | ... | ... |
resources/po/ur.po
| ... | ... | @@ -106,6 +106,9 @@ msgstr "سکرپٹ" |
| 106 | 106 | msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" |
| 107 | 107 | msgstr "سکرول ویو" |
| 108 | 108 | |
| 109 | +msgid "DALI_DEMO_STR_TITLE_STYLING" | |
| 110 | +msgstr "سٹائل" | |
| 111 | + | |
| 109 | 112 | msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" |
| 110 | 113 | msgstr "دھندلاپن اور بلوم" |
| 111 | 114 | ... | ... |
resources/po/zn_CH.po
resources/style/.gitignore
0 → 100644
resources/style/images/.gitignore
0 → 100644
| 1 | +*.xcf | ... | ... |
resources/style/images/radio-button-selected.png
0 → 100644
3.74 KB
resources/style/images/radio-button-unselected-disabled.png
0 → 100644
2.61 KB
resources/style/images/radio-button-unselected.png
0 → 100644
3.07 KB
resources/style/images/slider-skin-progress-blue.9.png
0 → 100644
405 Bytes
resources/style/images/slider-skin-progress-green.9.png
0 → 100644
425 Bytes
resources/style/images/slider-skin-progress-red.9.png
0 → 100644
424 Bytes
resources/style/mobile/images/radio-button-selected.png
0 → 100644
3.74 KB
resources/style/mobile/images/radio-button-unselected-disabled.png
0 → 100644
2.61 KB
resources/style/mobile/images/radio-button-unselected.png
0 → 100644
3.07 KB
resources/style/mobile/images/slider-skin-progress-blue.9.png
0 → 100644
405 Bytes
resources/style/mobile/images/slider-skin-progress-green.9.png
0 → 100644
425 Bytes
resources/style/mobile/images/slider-skin-progress-red.9.png
0 → 100644
424 Bytes
resources/style/mobile/style-example-theme-one.json.in
0 → 100644
| 1 | +{ | |
| 2 | + "styles": | |
| 3 | + { | |
| 4 | + "title":{ | |
| 5 | + "textColor":"#0000ff", | |
| 6 | + "background": | |
| 7 | + { | |
| 8 | + "visualType":"COLOR", | |
| 9 | + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] | |
| 10 | + } | |
| 11 | + }, | |
| 12 | + "tableview":{ | |
| 13 | + "background": | |
| 14 | + { | |
| 15 | + "visualType":"COLOR", | |
| 16 | + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] | |
| 17 | + } | |
| 18 | + }, | |
| 19 | + "flexcontainer":{ | |
| 20 | + "background": | |
| 21 | + { | |
| 22 | + "visualType":"COLOR", | |
| 23 | + "mixColor": [ 1.0, 1.0, 1.0, 0.1 ] | |
| 24 | + } | |
| 25 | + }, | |
| 26 | + "radiobutton":{ | |
| 27 | + "label":{ | |
| 28 | + "textColor": [1,1,1,1] | |
| 29 | + } | |
| 30 | + }, | |
| 31 | + "checkboxbutton":{ | |
| 32 | + "label":{ | |
| 33 | + "textColor": [1,1,1,1] | |
| 34 | + } | |
| 35 | + }, | |
| 36 | + "colorLabel1":{ | |
| 37 | + "textColor": [1,0,0,1] | |
| 38 | + }, | |
| 39 | + "colorLabel2":{ | |
| 40 | + "textColor": [0,1,0,1] | |
| 41 | + }, | |
| 42 | + "colorLabel3":{ | |
| 43 | + "textColor": [0.3,0.3,1,1] | |
| 44 | + }, | |
| 45 | + "themelabel":{ | |
| 46 | + "textColor":[0,1,1,1] | |
| 47 | + }, | |
| 48 | + "popupTitle":{ | |
| 49 | + "textColor":[1,1,1,1] | |
| 50 | + }, | |
| 51 | + "popupBody":{ | |
| 52 | + "textColor":[1,1,0,1] | |
| 53 | + }, | |
| 54 | + "textlabel":{ | |
| 55 | + "textColor":[0,0,0,1] | |
| 56 | + }, | |
| 57 | + "colorSlider1":{ | |
| 58 | + "styles":["slider"] | |
| 59 | + }, | |
| 60 | + "colorSlider2":{ | |
| 61 | + "styles":["slider"] | |
| 62 | + }, | |
| 63 | + "colorSlider3":{ | |
| 64 | + "styles":["slider"] | |
| 65 | + } | |
| 66 | + } | |
| 67 | +} | ... | ... |
resources/style/mobile/style-example-theme-three.json.in
0 → 100644
| 1 | +{ | |
| 2 | + "styles": | |
| 3 | + { | |
| 4 | + "title":{ | |
| 5 | + "textColor":"#0000ff", | |
| 6 | + "background": | |
| 7 | + { | |
| 8 | + "rendererType":"color", | |
| 9 | + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] | |
| 10 | + } | |
| 11 | + }, | |
| 12 | + "tableview":{ | |
| 13 | + "background": | |
| 14 | + { | |
| 15 | + "rendererType":"color", | |
| 16 | + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] | |
| 17 | + } | |
| 18 | + }, | |
| 19 | + "radiobutton":{ | |
| 20 | + "label":{ | |
| 21 | + "textColor": [1,1,1,1] | |
| 22 | + } | |
| 23 | + }, | |
| 24 | + "checkboxbutton":{ | |
| 25 | + "label":{ | |
| 26 | + "textColor": [1,1,1,1] | |
| 27 | + } | |
| 28 | + }, | |
| 29 | + "colorLabel1":{ | |
| 30 | + "textColor": [1,0,0,1] | |
| 31 | + }, | |
| 32 | + "colorLabel2":{ | |
| 33 | + "textColor": [0,1,0,1] | |
| 34 | + }, | |
| 35 | + "colorLabel3":{ | |
| 36 | + "textColor": [0.3,0.3,1,1] | |
| 37 | + }, | |
| 38 | + "themelabel":{ | |
| 39 | + "textColor":[0,1,1,1] | |
| 40 | + }, | |
| 41 | + "popupTitle":{ | |
| 42 | + "textColor":[1,1,1,1] | |
| 43 | + }, | |
| 44 | + "popupBody":{ | |
| 45 | + "textColor":[1,1,0,1] | |
| 46 | + }, | |
| 47 | + "textlabel":{ | |
| 48 | + "textColor":[0,0,0,1] | |
| 49 | + } | |
| 50 | + } | |
| 51 | +} | ... | ... |
resources/style/mobile/style-example-theme-two.json.in
0 → 100644
| 1 | +{ | |
| 2 | + "constants": | |
| 3 | + { | |
| 4 | + "DEMO_IMAGE_DIR":"@DEMO_STYLE_IMAGE_DIR@" | |
| 5 | + }, | |
| 6 | + "styles": | |
| 7 | + { | |
| 8 | + "title":{ | |
| 9 | + "textColor":"#0000ff", | |
| 10 | + "background": | |
| 11 | + { | |
| 12 | + "visualType":"COLOR", | |
| 13 | + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] | |
| 14 | + } | |
| 15 | + }, | |
| 16 | + "tableview":{ | |
| 17 | + "background": | |
| 18 | + { | |
| 19 | + "visualType":"GRADIENT", | |
| 20 | + "startPosition": [0,-1], | |
| 21 | + "endPosition": [0,1], | |
| 22 | + "stopColor": [ [ 1.0, 0.0, 1.0, 0.03 ], [1.0,0.0,1.0,0.15] ] | |
| 23 | + } | |
| 24 | + }, | |
| 25 | + | |
| 26 | + // Change an icon size, see if it gets properly re-sized | |
| 27 | + "radiobutton":{ | |
| 28 | + "unselectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected.png", | |
| 29 | + "selectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-selected.png", | |
| 30 | + "disabledStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected-disabled.png", | |
| 31 | + "imageLabelGap":10, | |
| 32 | + "label":{ | |
| 33 | + "textColor": [0.1,1,1,1] | |
| 34 | + } | |
| 35 | + }, | |
| 36 | + "checkboxbutton":{ | |
| 37 | + "label":{ | |
| 38 | + "textColor": [1,1,1,1] | |
| 39 | + } | |
| 40 | + }, | |
| 41 | + "colorLabel1":{ | |
| 42 | + "textColor": [1,0,0,1] | |
| 43 | + }, | |
| 44 | + "colorLabel2":{ | |
| 45 | + "textColor": [0,1,0,1] | |
| 46 | + }, | |
| 47 | + "colorLabel3":{ | |
| 48 | + "textColor": [0.3,0.3,1,1] | |
| 49 | + }, | |
| 50 | + "themelabel":{ | |
| 51 | + "textColor":[0,1,1,1] | |
| 52 | + }, | |
| 53 | + "popupTitle":{ | |
| 54 | + "textColor":[1,1,1,1] | |
| 55 | + }, | |
| 56 | + "popupBody":{ | |
| 57 | + "textColor":[1,1,0,1] | |
| 58 | + }, | |
| 59 | + | |
| 60 | + // Note, this overrides any non-renamed label styles, e.g. those in a button. | |
| 61 | + "textlabel":{ | |
| 62 | + //"textColor":[0,0,0,1] | |
| 63 | + }, | |
| 64 | + | |
| 65 | + "thinslider":{ | |
| 66 | + "styles": ["slider"], | |
| 67 | + "showPopup":true, | |
| 68 | + "showValue":false, | |
| 69 | + "valuePrecision":0, | |
| 70 | + "handleVisual":{ | |
| 71 | + "size":[48,48] | |
| 72 | + }, | |
| 73 | + "trackVisual":{ | |
| 74 | + "size":[10, 10] | |
| 75 | + }, | |
| 76 | + "enabled":true | |
| 77 | + }, | |
| 78 | + "colorSlider1":{ | |
| 79 | + "styles":["thinslider"], | |
| 80 | + "progressVisual":{ | |
| 81 | + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-red.9.png" | |
| 82 | + } | |
| 83 | + }, | |
| 84 | + "colorSlider2":{ | |
| 85 | + "styles":["thinslider"], | |
| 86 | + "progressVisual":{ | |
| 87 | + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-green.9.png" | |
| 88 | + } | |
| 89 | + }, | |
| 90 | + "colorSlider3":{ | |
| 91 | + "styles":["thinslider"], | |
| 92 | + "progressVisual":{ | |
| 93 | + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-blue.9.png" | |
| 94 | + } | |
| 95 | + } | |
| 96 | + } | |
| 97 | +} | ... | ... |
resources/style/style-example-theme-one.json.in
0 → 100644
| 1 | +{ | |
| 2 | + "styles": | |
| 3 | + { | |
| 4 | + "title":{ | |
| 5 | + "textColor":"#0000ff", | |
| 6 | + "background": | |
| 7 | + { | |
| 8 | + "visualType":"COLOR", | |
| 9 | + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] | |
| 10 | + } | |
| 11 | + }, | |
| 12 | + "tableview":{ | |
| 13 | + "background": | |
| 14 | + { | |
| 15 | + "visualType":"COLOR", | |
| 16 | + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] | |
| 17 | + } | |
| 18 | + }, | |
| 19 | + "flexcontainer":{ | |
| 20 | + "background": | |
| 21 | + { | |
| 22 | + "visualType":"COLOR", | |
| 23 | + "mixColor": [ 1.0, 1.0, 1.0, 0.1 ] | |
| 24 | + } | |
| 25 | + }, | |
| 26 | + "radiobutton":{ | |
| 27 | + "label":{ | |
| 28 | + "textColor": [1,1,1,1] | |
| 29 | + } | |
| 30 | + }, | |
| 31 | + "checkboxbutton":{ | |
| 32 | + "label":{ | |
| 33 | + "textColor": [1,1,1,1] | |
| 34 | + } | |
| 35 | + }, | |
| 36 | + "colorLabel1":{ | |
| 37 | + "textColor": [1,0,0,1] | |
| 38 | + }, | |
| 39 | + "colorLabel2":{ | |
| 40 | + "textColor": [0,1,0,1] | |
| 41 | + }, | |
| 42 | + "colorLabel3":{ | |
| 43 | + "textColor": [0.3,0.3,1,1] | |
| 44 | + }, | |
| 45 | + "themelabel":{ | |
| 46 | + "textColor":[0,1,1,1] | |
| 47 | + }, | |
| 48 | + "popupTitle":{ | |
| 49 | + "textColor":[1,1,1,1] | |
| 50 | + }, | |
| 51 | + "popupBody":{ | |
| 52 | + "textColor":[1,1,0,1] | |
| 53 | + }, | |
| 54 | + "textlabel":{ | |
| 55 | + "textColor":[0,0,0,1] | |
| 56 | + }, | |
| 57 | + "colorSlider1":{ | |
| 58 | + "styles":["slider"] | |
| 59 | + }, | |
| 60 | + "colorSlider2":{ | |
| 61 | + "styles":["slider"] | |
| 62 | + }, | |
| 63 | + "colorSlider3":{ | |
| 64 | + "styles":["slider"] | |
| 65 | + } | |
| 66 | + } | |
| 67 | +} | ... | ... |
resources/style/style-example-theme-three.json.in
0 → 100644
| 1 | +{ | |
| 2 | + "styles": | |
| 3 | + { | |
| 4 | + "title":{ | |
| 5 | + "textColor":"#0000ff", | |
| 6 | + "background": | |
| 7 | + { | |
| 8 | + "visualType":"COLOR", | |
| 9 | + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] | |
| 10 | + } | |
| 11 | + }, | |
| 12 | + "tableview":{ | |
| 13 | + "background": | |
| 14 | + { | |
| 15 | + "visualType":"COLOR", | |
| 16 | + "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] | |
| 17 | + } | |
| 18 | + }, | |
| 19 | + "radiobutton":{ | |
| 20 | + "label":{ | |
| 21 | + "textColor": [1,1,1,1] | |
| 22 | + } | |
| 23 | + }, | |
| 24 | + "checkboxbutton":{ | |
| 25 | + "label":{ | |
| 26 | + "textColor": [1,1,1,1] | |
| 27 | + } | |
| 28 | + }, | |
| 29 | + "colorLabel1":{ | |
| 30 | + "textColor": [1,0,0,1] | |
| 31 | + }, | |
| 32 | + "colorLabel2":{ | |
| 33 | + "textColor": [0,1,0,1] | |
| 34 | + }, | |
| 35 | + "colorLabel3":{ | |
| 36 | + "textColor": [0.3,0.3,1,1] | |
| 37 | + }, | |
| 38 | + "themelabel":{ | |
| 39 | + "textColor":[0,1,1,1] | |
| 40 | + }, | |
| 41 | + "popupTitle":{ | |
| 42 | + "textColor":[1,1,1,1] | |
| 43 | + }, | |
| 44 | + "popupBody":{ | |
| 45 | + "textColor":[1,1,0,1] | |
| 46 | + }, | |
| 47 | + "textlabel":{ | |
| 48 | + "textColor":[0,0,0,1] | |
| 49 | + } | |
| 50 | + } | |
| 51 | +} | ... | ... |
resources/style/style-example-theme-two.json.in
0 → 100644
| 1 | +{ | |
| 2 | + "constants": | |
| 3 | + { | |
| 4 | + "DEMO_IMAGE_DIR":"@DEMO_STYLE_IMAGE_DIR@" | |
| 5 | + }, | |
| 6 | + "styles": | |
| 7 | + { | |
| 8 | + "title":{ | |
| 9 | + "textColor":"#0000ff", | |
| 10 | + "background": | |
| 11 | + { | |
| 12 | + "visualType":"COLOR", | |
| 13 | + "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] | |
| 14 | + } | |
| 15 | + }, | |
| 16 | + "tableview":{ | |
| 17 | + "background": | |
| 18 | + { | |
| 19 | + "visualType":"GRADIENT", | |
| 20 | + "startPosition": [0,-1], | |
| 21 | + "endPosition": [0,1], | |
| 22 | + "stopColor": [ [ 1.0, 0.0, 1.0, 0.03 ], [1.0,0.0,1.0,0.15] ] | |
| 23 | + } | |
| 24 | + }, | |
| 25 | + | |
| 26 | + // Change an icon size, see if it gets properly re-sized | |
| 27 | + "radiobutton":{ | |
| 28 | + "unselectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected.png", | |
| 29 | + "selectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-selected.png", | |
| 30 | + "disabledStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected-disabled.png", | |
| 31 | + "imageLabelGap":10, | |
| 32 | + "label":{ | |
| 33 | + "textColor": [0.1,1,1,1] | |
| 34 | + } | |
| 35 | + }, | |
| 36 | + "checkboxbutton":{ | |
| 37 | + "label":{ | |
| 38 | + "textColor": [1,1,1,1] | |
| 39 | + } | |
| 40 | + }, | |
| 41 | + "colorLabel1":{ | |
| 42 | + "textColor": [1,0,0,1] | |
| 43 | + }, | |
| 44 | + "colorLabel2":{ | |
| 45 | + "textColor": [0,1,0,1] | |
| 46 | + }, | |
| 47 | + "colorLabel3":{ | |
| 48 | + "textColor": [0.3,0.3,1,1] | |
| 49 | + }, | |
| 50 | + "themelabel":{ | |
| 51 | + "textColor":[0,1,1,1] | |
| 52 | + }, | |
| 53 | + "popupTitle":{ | |
| 54 | + "textColor":[1,1,1,1] | |
| 55 | + }, | |
| 56 | + "popupBody":{ | |
| 57 | + "textColor":[1,1,0,1] | |
| 58 | + }, | |
| 59 | + | |
| 60 | + // Note, this overrides any non-renamed label styles, e.g. those in a button. | |
| 61 | + "textlabel":{ | |
| 62 | + //"textColor":[0,0,0,1] | |
| 63 | + }, | |
| 64 | + | |
| 65 | + "thinslider":{ | |
| 66 | + "styles": ["slider"], | |
| 67 | + "showPopup":true, | |
| 68 | + "showValue":false, | |
| 69 | + "valuePrecision":0, | |
| 70 | + "handleVisual":{ | |
| 71 | + "size":[48,48] | |
| 72 | + }, | |
| 73 | + "trackVisual":{ | |
| 74 | + "size":[10, 10] | |
| 75 | + }, | |
| 76 | + "enabled":true | |
| 77 | + }, | |
| 78 | + "colorSlider1":{ | |
| 79 | + "styles":["thinslider"], | |
| 80 | + "progressVisual":{ | |
| 81 | + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-red.9.png" | |
| 82 | + } | |
| 83 | + }, | |
| 84 | + "colorSlider2":{ | |
| 85 | + "styles":["thinslider"], | |
| 86 | + "progressVisual":{ | |
| 87 | + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-green.9.png" | |
| 88 | + } | |
| 89 | + }, | |
| 90 | + "colorSlider3":{ | |
| 91 | + "styles":["thinslider"], | |
| 92 | + "progressVisual":{ | |
| 93 | + "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-blue.9.png" | |
| 94 | + } | |
| 95 | + } | |
| 96 | + } | |
| 97 | +} | ... | ... |
shared/dali-demo-strings.h
| ... | ... | @@ -68,6 +68,7 @@ extern "C" |
| 68 | 68 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") |
| 69 | 69 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") |
| 70 | 70 | #define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW") |
| 71 | +#define DALI_DEMO_STR_TITLE_STYLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_STYLING") | |
| 71 | 72 | #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM") |
| 72 | 73 | #define DALI_DEMO_STR_TITLE_TEXTURED_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXTURED_MESH") |
| 73 | 74 | #define DALI_DEMO_STR_TITLE_TEXT_EDITOR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_EDITOR") |
| ... | ... | @@ -115,6 +116,7 @@ extern "C" |
| 115 | 116 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" |
| 116 | 117 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" |
| 117 | 118 | #define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View" |
| 119 | +#define DALI_DEMO_STR_TITLE_STYLING "Styling" | |
| 118 | 120 | #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom" |
| 119 | 121 | #define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture" |
| 120 | 122 | #define DALI_DEMO_STR_TITLE_TEXT_EDITOR "Text Editor" | ... | ... |