Commit 792e47588113b8b48ac9526dde5444e9895377e9
1 parent
4699adbb
Update the scripts with the changed control property and remove cluster demo
Change-Id: I2d5c022ceee49e7d5732fee4c952f801b72bdcb8
Showing
21 changed files
with
59 additions
and
3373 deletions
com.samsung.dali-demo.xml
| ... | ... | @@ -25,9 +25,6 @@ |
| 25 | 25 | <ui-application appid="bubble-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/bubble-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 26 | 26 | <label>Bubble Effect</label> |
| 27 | 27 | </ui-application> |
| 28 | - <ui-application appid="cluster.example" exec="/usr/apps/com.samsung.dali-demo/bin/cluster.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 29 | - <label>Cluster example</label> | |
| 30 | - </ui-application> | |
| 31 | 28 | <ui-application appid="cube-transition-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/cube-transition-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 32 | 29 | <label>Cube transition effect</label> |
| 33 | 30 | </ui-application> | ... | ... |
demo/dali-demo.cpp
| ... | ... | @@ -38,7 +38,6 @@ int main(int argc, char **argv) |
| 38 | 38 | |
| 39 | 39 | demo.AddExample(Example("bubble-effect.example", DALI_DEMO_STR_TITLE_BUBBLES)); |
| 40 | 40 | demo.AddExample(Example("blocks.example", DALI_DEMO_STR_TITLE_BLOCKS)); |
| 41 | - demo.AddExample(Example("cluster.example", DALI_DEMO_STR_TITLE_CLUSTER)); | |
| 42 | 41 | demo.AddExample(Example("cube-transition-effect.example", DALI_DEMO_STR_TITLE_CUBE_TRANSITION)); |
| 43 | 42 | demo.AddExample(Example("dissolve-effect.example", DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION)); |
| 44 | 43 | demo.AddExample(Example("item-view.example", DALI_DEMO_STR_TITLE_ITEM_VIEW)); | ... | ... |
examples/cluster/cluster-example.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2014 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 | -#include <sstream> | |
| 19 | -#include <iomanip> | |
| 20 | - | |
| 21 | -#include "shared/view.h" | |
| 22 | -#include <dali/dali.h> | |
| 23 | -#include <dali-toolkit/dali-toolkit.h> | |
| 24 | -#include <dali-toolkit/devel-api/shader-effects/motion-blur-effect.h> | |
| 25 | -#include <dali-toolkit/devel-api/controls/popup/popup.h> | |
| 26 | -#include <dali-toolkit/devel-api/shader-effects/carousel-effect.h> | |
| 27 | - | |
| 28 | -#include "cluster.h" | |
| 29 | -#include "cluster-style.h" | |
| 30 | - | |
| 31 | - | |
| 32 | -using namespace Dali; | |
| 33 | -using namespace Dali::Demo; | |
| 34 | -using namespace Dali::Toolkit; | |
| 35 | -using namespace DemoHelper; | |
| 36 | - | |
| 37 | -namespace // unnamed namespace | |
| 38 | -{ | |
| 39 | - | |
| 40 | -const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); | |
| 41 | -const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); | |
| 42 | -const char * const APPLICATION_TITLE( "Clusters" ); | |
| 43 | -const char * const LAYOUT_NONE_IMAGE( DALI_IMAGE_DIR "icon-cluster-none.png" ); | |
| 44 | -const char * const LAYOUT_NONE_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-none-selected.png" ); | |
| 45 | -const char * const LAYOUT_MOTION_BLUR_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" ); | |
| 46 | -const char * const LAYOUT_MOTION_BLUR_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-wobble-selected.png" ); | |
| 47 | -const char * const LAYOUT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-cluster-carousel.png" ); | |
| 48 | -const char * const LAYOUT_CAROUSEL_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-carousel-selected.png" ); | |
| 49 | -const char * const LAYOUT_SPHERE_IMAGE( DALI_IMAGE_DIR "icon-cluster-sphere.png" ); | |
| 50 | -const char * const LAYOUT_SPHERE_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-sphere-selected.png" ); | |
| 51 | - | |
| 52 | -enum ClusterType | |
| 53 | -{ | |
| 54 | - PEOPLE, | |
| 55 | - TODAY, | |
| 56 | - PHONE, | |
| 57 | - PICTURES, | |
| 58 | - MUSIC, | |
| 59 | - MAGAZINE, | |
| 60 | - | |
| 61 | - CLUSTER_COUNT | |
| 62 | -}; | |
| 63 | - | |
| 64 | -const char* PEOPLE_IMAGE_PATHS[] = { DALI_IMAGE_DIR "people-medium-1.jpg", | |
| 65 | - DALI_IMAGE_DIR "people-medium-2.jpg", | |
| 66 | - DALI_IMAGE_DIR "people-medium-3.jpg", | |
| 67 | - DALI_IMAGE_DIR "people-medium-4.jpg", | |
| 68 | - DALI_IMAGE_DIR "people-medium-5.jpg", | |
| 69 | - DALI_IMAGE_DIR "people-medium-6.jpg", | |
| 70 | - DALI_IMAGE_DIR "people-medium-7.jpg", | |
| 71 | - DALI_IMAGE_DIR "people-medium-8.jpg", | |
| 72 | - NULL }; | |
| 73 | - | |
| 74 | -const char* TODAY_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-1.jpg", | |
| 75 | - DALI_IMAGE_DIR "gallery-medium-2.jpg", | |
| 76 | - DALI_IMAGE_DIR "gallery-medium-3.jpg", | |
| 77 | - DALI_IMAGE_DIR "gallery-medium-4.jpg", | |
| 78 | - DALI_IMAGE_DIR "gallery-medium-5.jpg", | |
| 79 | - DALI_IMAGE_DIR "gallery-medium-6.jpg", | |
| 80 | - NULL }; | |
| 81 | - | |
| 82 | -const char* PHONE_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-7.jpg", | |
| 83 | - DALI_IMAGE_DIR "gallery-medium-8.jpg", | |
| 84 | - DALI_IMAGE_DIR "gallery-medium-9.jpg", | |
| 85 | - DALI_IMAGE_DIR "gallery-medium-10.jpg", | |
| 86 | - DALI_IMAGE_DIR "gallery-medium-11.jpg", | |
| 87 | - DALI_IMAGE_DIR "gallery-medium-12.jpg", | |
| 88 | - NULL }; | |
| 89 | - | |
| 90 | -const char* PICTURES_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-13.jpg", | |
| 91 | - DALI_IMAGE_DIR "gallery-medium-14.jpg", | |
| 92 | - DALI_IMAGE_DIR "gallery-medium-15.jpg", | |
| 93 | - DALI_IMAGE_DIR "gallery-medium-16.jpg", | |
| 94 | - DALI_IMAGE_DIR "gallery-medium-17.jpg", | |
| 95 | - DALI_IMAGE_DIR "gallery-medium-18.jpg", | |
| 96 | - NULL }; | |
| 97 | - | |
| 98 | -const char* MUSIC_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-19.jpg", | |
| 99 | - DALI_IMAGE_DIR "gallery-medium-20.jpg", | |
| 100 | - DALI_IMAGE_DIR "gallery-medium-21.jpg", | |
| 101 | - DALI_IMAGE_DIR "gallery-medium-22.jpg", | |
| 102 | - DALI_IMAGE_DIR "gallery-medium-23.jpg", | |
| 103 | - DALI_IMAGE_DIR "gallery-medium-24.jpg", | |
| 104 | - NULL }; | |
| 105 | - | |
| 106 | -const char* MAGAZINE_IMAGE_PATHS[] = { DALI_IMAGE_DIR "gallery-medium-25.jpg", | |
| 107 | - DALI_IMAGE_DIR "gallery-medium-26.jpg", | |
| 108 | - DALI_IMAGE_DIR "gallery-medium-27.jpg", | |
| 109 | - DALI_IMAGE_DIR "gallery-medium-28.jpg", | |
| 110 | - DALI_IMAGE_DIR "gallery-medium-29.jpg", | |
| 111 | - DALI_IMAGE_DIR "gallery-medium-30.jpg", | |
| 112 | - NULL }; | |
| 113 | - | |
| 114 | -const char **IMAGE_GROUPS[] = {PEOPLE_IMAGE_PATHS, | |
| 115 | - TODAY_IMAGE_PATHS, | |
| 116 | - PHONE_IMAGE_PATHS, | |
| 117 | - PICTURES_IMAGE_PATHS, | |
| 118 | - MUSIC_IMAGE_PATHS, | |
| 119 | - MAGAZINE_IMAGE_PATHS, | |
| 120 | - NULL}; | |
| 121 | - | |
| 122 | -const float CLUSTER_IMAGE_THUMBNAIL_WIDTH = 256.0f; | |
| 123 | -const float CLUSTER_IMAGE_THUMBNAIL_HEIGHT = 256.0f; | |
| 124 | - | |
| 125 | -const char* CLUSTER_SHADOW_IMAGE_PATH = DALI_IMAGE_DIR "cluster-image-shadow.png"; | |
| 126 | -const char* CLUSTER_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "cluster-image-frame.png"; | |
| 127 | -const char* CLUSTER_BACKGROUND_IMAGE_PATH = DALI_IMAGE_DIR "cluster-background.png"; | |
| 128 | - | |
| 129 | -const float CLUSTER_IMAGE_BORDER_INDENT = 14.0f; ///< Indent of border in pixels. | |
| 130 | -const float CLUSTER_IMAGE_BORDER_WIDTH = 128; ///< Width of border in pixels. | |
| 131 | -const float CLUSTER_IMAGE_BORDER_HEIGHT = 128; ///< Height of border in pixels. | |
| 132 | - | |
| 133 | -const Vector4 CLUSTER_IMAGE_BORDER_ABSOLUTE( 16.0f, 16.0f, 16.0f, 16.0f ); // Border dimensions in absolute pixel coordinates. | |
| 134 | - | |
| 135 | -// These values depend on the border image | |
| 136 | -const float CLUSTER_RELATIVE_SIZE = 0.65f; ///< Cluster size relative to screen width | |
| 137 | - | |
| 138 | -const float CLUSTER_GROUP_DELAY_TOP = 0.25f; ///< Delay for top Clusters in seconds. | |
| 139 | -const float CLUSTER_GROUP_DELAY_BOTTOM = 0.0f; ///< Delay for bottom Clusters in seconds. | |
| 140 | - | |
| 141 | -const float CLUSTER_COLUMN_INDENT = 0.1f; ///< Left Indentation in screen coordinates. | |
| 142 | -const float CLUSTER_ROW_INDENT = 0.13f; ///< Top Indentation in screen coordinates. | |
| 143 | - | |
| 144 | -const float UI_MARGIN = 10.0f; ///< Screen Margin for placement of UI buttons | |
| 145 | - | |
| 146 | -const float CAROUSEL_EFFECT_RADIUS = 500.0f; ///< In Carousel Effect mode: Radius of carousel (Z peak depth) | |
| 147 | -const float CAROUSEL_EFFECT_ANGLE_SWEEP = 90.0f; ///< In Carousel Effect mode: Angle sweep from left to right of screen | |
| 148 | -const float SPHERE_EFFECT_RADIUS = 1000.0f; ///< In Sphere Effect mode: Radius of sphere carousel (Z peak depth) | |
| 149 | -const float SPHERE_EFFECT_POSITION_Z = -700.0f; ///< In Sphere Effect mode: Z position alter (as carousel is coming out to screen we move back) | |
| 150 | -const float SPHERE_EFFECT_ANGLE_SWEEP = 90.0f; ///< In Sphere Effect mode: Angle sweep from edge to opposite side of circle. | |
| 151 | -const float SPHERE_EFFECT_VERTICAL_DOMAIN = 0.15f; ///< In Sphere Effect mode: How much the user can pan in the vertical axis. (in stageHeights) | |
| 152 | - | |
| 153 | -/** | |
| 154 | - * List of effect types that user can select through. | |
| 155 | - */ | |
| 156 | -enum ExampleEffectType | |
| 157 | -{ | |
| 158 | - NO_EFFECT = 0, | |
| 159 | - MOTION_BLUR_EFFECT, | |
| 160 | - CAROUSEL_EFFECT, | |
| 161 | - SPHERE_EFFECT, | |
| 162 | - TOTAL_EFFECTS, | |
| 163 | -}; | |
| 164 | - | |
| 165 | -/** | |
| 166 | - * List of effect type names that appear on the Effect button. | |
| 167 | - */ | |
| 168 | -const char* EXAMPLE_EFFECT_LABEL[] = { "None", | |
| 169 | - "Motion Blur", | |
| 170 | - "Carousel", | |
| 171 | - "Sphere", | |
| 172 | - }; | |
| 173 | - | |
| 174 | -/** | |
| 175 | - * CarouselEffectOrientationConstraint | |
| 176 | - * Based on the View orientation i.e. portrait (0 degrees), landscape (90 degrees) etc. | |
| 177 | - * carousel shader effect should bend differently (as a function of this orientation), | |
| 178 | - * as shader effect is applied to the screen coordinates. | |
| 179 | - */ | |
| 180 | -struct CarouselEffectOrientationConstraint | |
| 181 | -{ | |
| 182 | - /** | |
| 183 | - * Constructor | |
| 184 | - * @param[in] angleSweep The amount of degrees to rotate by per pixel. | |
| 185 | - */ | |
| 186 | - CarouselEffectOrientationConstraint( const Vector2 angleSweep ) | |
| 187 | - : mAngleSweep( angleSweep ) | |
| 188 | - { | |
| 189 | - } | |
| 190 | - | |
| 191 | - /** | |
| 192 | - * @param[in] current The object's current property value | |
| 193 | - * @return The object's new property value | |
| 194 | - */ | |
| 195 | - void operator()( Vector2& current, const PropertyInputContainer& inputs ) | |
| 196 | - { | |
| 197 | - Vector3 axis; | |
| 198 | - Radian angle; | |
| 199 | - inputs[0]->GetQuaternion().ToAxisAngle( axis, angle ); | |
| 200 | - | |
| 201 | - current.x = cosf(angle); | |
| 202 | - current.y = sinf(angle); | |
| 203 | - | |
| 204 | - current *= mAngleSweep; | |
| 205 | - } | |
| 206 | - | |
| 207 | - Vector2 mAngleSweep; | |
| 208 | - | |
| 209 | -}; | |
| 210 | - | |
| 211 | -/** | |
| 212 | - * SphereEffectOffsetConstraint | |
| 213 | - * | |
| 214 | - * Sets SphereEffect's center to be a function of the | |
| 215 | - * screen orientation (portrait or landscape). | |
| 216 | - */ | |
| 217 | -struct SphereEffectOffsetConstraint | |
| 218 | -{ | |
| 219 | - /** | |
| 220 | - * @param[in] stageSize The stage size (not subject to orientation) | |
| 221 | - * @param[in] center Shear Center position based on initial orientation. | |
| 222 | - */ | |
| 223 | - SphereEffectOffsetConstraint(float offset) | |
| 224 | - : mOffset(offset) | |
| 225 | - { | |
| 226 | - } | |
| 227 | - | |
| 228 | - /** | |
| 229 | - * @param[in] current The current center | |
| 230 | - * @param[in] propertyViewSize The current view size | |
| 231 | - * @return vector to provide SphereShaderEffect | |
| 232 | - */ | |
| 233 | - void operator()( float& current, const PropertyInputContainer& /* inputs */ ) | |
| 234 | - { | |
| 235 | - current += mOffset; | |
| 236 | - } | |
| 237 | - | |
| 238 | - float mOffset; | |
| 239 | -}; | |
| 240 | - | |
| 241 | -/** | |
| 242 | - * ClusterInfo struct | |
| 243 | - * | |
| 244 | - * Contains information about each cluster in mClusterInfo list. | |
| 245 | - */ | |
| 246 | -struct ClusterInfo | |
| 247 | -{ | |
| 248 | - /** | |
| 249 | - * Constructor | |
| 250 | - * | |
| 251 | - * @param[in] cluster The cluster instance | |
| 252 | - * @param[in] index The cluster's index (starting from 0 for the first cluster) | |
| 253 | - * @param[in] position The cluster's original position | |
| 254 | - * @param[in] size The cluster's original size | |
| 255 | - */ | |
| 256 | - ClusterInfo(Cluster cluster, int index, const Vector3& position, const Vector3& size) | |
| 257 | - : mCluster(cluster), | |
| 258 | - mIndex(index), | |
| 259 | - mPosition(position), | |
| 260 | - mSize(size) | |
| 261 | - { | |
| 262 | - | |
| 263 | - } | |
| 264 | - | |
| 265 | - /** | |
| 266 | - * Copy constructor | |
| 267 | - * | |
| 268 | - * @param[in] rhs The ClusterInfo struct to be copied. | |
| 269 | - */ | |
| 270 | - ClusterInfo( const ClusterInfo& rhs ) | |
| 271 | - : mCluster(rhs.mCluster), | |
| 272 | - mIndex(rhs.mIndex), | |
| 273 | - mPosition(rhs.mPosition), | |
| 274 | - mSize(rhs.mSize) | |
| 275 | - { | |
| 276 | - | |
| 277 | - } | |
| 278 | - | |
| 279 | - /** | |
| 280 | - * Assignment operator | |
| 281 | - */ | |
| 282 | - ClusterInfo& operator=( const ClusterInfo& rhs ) | |
| 283 | - { | |
| 284 | - if( this != &rhs ) | |
| 285 | - { | |
| 286 | - mCluster = rhs.mCluster; | |
| 287 | - mIndex = rhs.mIndex; | |
| 288 | - mPosition = rhs.mPosition; | |
| 289 | - mSize = rhs.mSize; | |
| 290 | - } | |
| 291 | - return *this; | |
| 292 | - } | |
| 293 | - | |
| 294 | - | |
| 295 | - Cluster mCluster; ///< Cluster instance | |
| 296 | - int mIndex; ///< Cluster index | |
| 297 | - Vector3 mPosition; ///< Cluster original position | |
| 298 | - Vector3 mSize; ///< Cluster original size | |
| 299 | - Constraint mEffectConstraint; ///< Cluster constraint | |
| 300 | -}; | |
| 301 | - | |
| 302 | -/** | |
| 303 | - * Shrinks Actor based on parent's aspect ratio. | |
| 304 | - */ | |
| 305 | -struct ShrinkConstraint | |
| 306 | -{ | |
| 307 | - /** | |
| 308 | - * Constructor | |
| 309 | - */ | |
| 310 | - ShrinkConstraint() | |
| 311 | - { | |
| 312 | - } | |
| 313 | - | |
| 314 | - /** | |
| 315 | - * @param[in] current The object's current scale value | |
| 316 | - * @param[in] parentScale The parent's scale | |
| 317 | - * @return The object's new scale value | |
| 318 | - */ | |
| 319 | - Vector3 operator()(const Vector3& current, | |
| 320 | - const PropertyInput& parentScale) | |
| 321 | - { | |
| 322 | - return Vector3( parentScale.GetVector3().x / parentScale.GetVector3().y, 1.0f, 1.0f ); | |
| 323 | - } | |
| 324 | -}; | |
| 325 | - | |
| 326 | -struct ButtonImages | |
| 327 | -{ | |
| 328 | - std::string mButtonImage; | |
| 329 | - std::string mSelectedImage; | |
| 330 | -}; | |
| 331 | - | |
| 332 | - | |
| 333 | -} // unnamed namespace | |
| 334 | - | |
| 335 | -/** | |
| 336 | - * Custom position and size of shadow image | |
| 337 | - */ | |
| 338 | -namespace ShadowProperty | |
| 339 | -{ | |
| 340 | -const Vector3 ANCHOR_POINT (0.54f, 0.6f, 0.5f); | |
| 341 | -const Vector3 RELATIVE_POSITION (0.0f, 0.0f, -0.1f); | |
| 342 | -const Vector3 SIZE_SCALE (1.4f, 1.4f, 1.0f); | |
| 343 | -} | |
| 344 | - | |
| 345 | -// This example shows how to use Cluster UI control | |
| 346 | -// | |
| 347 | -class ClusterController : public ConnectionTracker | |
| 348 | -{ | |
| 349 | -public: | |
| 350 | - | |
| 351 | - /** | |
| 352 | - * Constructor | |
| 353 | - * @param application class, stored as reference | |
| 354 | - */ | |
| 355 | - ClusterController(Application &app) | |
| 356 | - : mApplication(app), | |
| 357 | - mClusterCount(0), | |
| 358 | - mExampleEffect(NO_EFFECT) | |
| 359 | - { | |
| 360 | - // Connect to the Application's Init signal | |
| 361 | - app.InitSignal().Connect(this, &ClusterController::Create); | |
| 362 | - } | |
| 363 | - | |
| 364 | - ~ClusterController() | |
| 365 | - { | |
| 366 | - // Nothing to do here; everything gets deleted automatically | |
| 367 | - } | |
| 368 | - | |
| 369 | - /** | |
| 370 | - * This method gets called once the main loop of application is up and running | |
| 371 | - */ | |
| 372 | - void Create(Application& application) | |
| 373 | - { | |
| 374 | - Stage::GetCurrent().KeyEventSignal().Connect(this, &ClusterController::OnKeyEvent); | |
| 375 | - | |
| 376 | - // The Init signal is received once (only) during the Application lifetime | |
| 377 | - | |
| 378 | - // Hide the indicator bar | |
| 379 | - application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | |
| 380 | - | |
| 381 | - // Creates a default view with a default tool bar. | |
| 382 | - // The view is added to the stage. | |
| 383 | - mContentLayer = DemoHelper::CreateView( application, | |
| 384 | - mView, | |
| 385 | - mToolBar, | |
| 386 | - BACKGROUND_IMAGE, | |
| 387 | - TOOLBAR_IMAGE, | |
| 388 | - "" ); | |
| 389 | - | |
| 390 | - mContentLayer.SetProperty(Layer::Property::BEHAVIOR, "Dali::Layer::LAYER_3D"); | |
| 391 | - | |
| 392 | - // Create a effect toggle button. (right of toolbar) | |
| 393 | - mLayoutButtonImages[ NO_EFFECT ].mButtonImage = LAYOUT_NONE_IMAGE; | |
| 394 | - mLayoutButtonImages[ NO_EFFECT ].mSelectedImage = LAYOUT_NONE_IMAGE_SELECTED; | |
| 395 | - mLayoutButtonImages[ MOTION_BLUR_EFFECT ].mButtonImage = LAYOUT_MOTION_BLUR_IMAGE; | |
| 396 | - mLayoutButtonImages[ MOTION_BLUR_EFFECT ].mSelectedImage = LAYOUT_MOTION_BLUR_IMAGE_SELECTED; | |
| 397 | - mLayoutButtonImages[ CAROUSEL_EFFECT ].mButtonImage = LAYOUT_CAROUSEL_IMAGE; | |
| 398 | - mLayoutButtonImages[ CAROUSEL_EFFECT ].mSelectedImage = LAYOUT_CAROUSEL_IMAGE_SELECTED; | |
| 399 | - mLayoutButtonImages[ SPHERE_EFFECT ].mButtonImage = LAYOUT_SPHERE_IMAGE; | |
| 400 | - mLayoutButtonImages[ SPHERE_EFFECT ].mSelectedImage = LAYOUT_SPHERE_IMAGE_SELECTED; | |
| 401 | - | |
| 402 | - mLayoutButton = Toolkit::PushButton::New(); | |
| 403 | - mLayoutButton.ClickedSignal().Connect( this, &ClusterController::OnEffectTouched ); | |
| 404 | - mToolBar.AddControl( mLayoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | |
| 405 | - | |
| 406 | - // create and setup the scroll view... | |
| 407 | - mScrollView = ScrollView::New(); | |
| 408 | - mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 409 | - | |
| 410 | - // anchor the scroll view from its center point to the middle of its parent | |
| 411 | - mScrollView.SetAnchorPoint(AnchorPoint::CENTER); | |
| 412 | - mScrollView.SetParentOrigin(ParentOrigin::CENTER); | |
| 413 | - | |
| 414 | - // Scale ScrollView to fit parent (mContentLayer) | |
| 415 | - mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 416 | - | |
| 417 | - // Add the scroll view to the content layer | |
| 418 | - mContentLayer.Add(mScrollView); | |
| 419 | - | |
| 420 | - // Create the image border shared by all the cluster image actors | |
| 421 | - mClusterBorderImage = ResourceImage::New(CLUSTER_BORDER_IMAGE_PATH); | |
| 422 | - | |
| 423 | - AddCluster( PEOPLE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1) ); | |
| 424 | - AddCluster( TODAY, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) ); | |
| 425 | - AddCluster( PHONE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle3) ); | |
| 426 | - AddCluster( PICTURES, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle4) ); | |
| 427 | - AddCluster( MUSIC, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) ); | |
| 428 | - AddCluster( MAGAZINE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle3) ); | |
| 429 | - | |
| 430 | - SetEffect(MOTION_BLUR_EFFECT); | |
| 431 | - } | |
| 432 | - | |
| 433 | - /** | |
| 434 | - * Helper to create the cluster actors | |
| 435 | - */ | |
| 436 | - Cluster CreateClusterActor(ClusterType clusterType, ClusterStyle style, Vector3& clusterSize) | |
| 437 | - { | |
| 438 | - // Create the cluster actor with the given cluster style | |
| 439 | - Cluster clusterActor = Cluster::New(style); | |
| 440 | - clusterActor.SetParentOrigin(ParentOrigin::CENTER); | |
| 441 | - clusterActor.SetAnchorPoint(AnchorPoint::CENTER); | |
| 442 | - | |
| 443 | - Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); | |
| 444 | - float minStageDimension = std::min(stageSize.x, stageSize.y); | |
| 445 | - | |
| 446 | - clusterSize.x = minStageDimension * CLUSTER_RELATIVE_SIZE; | |
| 447 | - clusterSize.y = minStageDimension * CLUSTER_RELATIVE_SIZE; | |
| 448 | - | |
| 449 | - clusterActor.SetSize( clusterSize ); | |
| 450 | - | |
| 451 | - DALI_ASSERT_ALWAYS(clusterType < CLUSTER_COUNT); | |
| 452 | - const char **paths = IMAGE_GROUPS[clusterType]; | |
| 453 | - DALI_ASSERT_ALWAYS(paths); | |
| 454 | - | |
| 455 | - // Add a background image to the cluster, limiting the loaded size by | |
| 456 | - // fitting it inside a quarter of the stage area with the conservative BOX | |
| 457 | - // filter mode: | |
| 458 | - Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH, Dali::ImageDimensions( stageSize.x * 0.5f, stageSize.y * 0.5f ), Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX ); | |
| 459 | - Control clusterControl = Control::DownCast( clusterActor ); | |
| 460 | - clusterControl.SetBackgroundImage( bg ); | |
| 461 | - | |
| 462 | - // Add actors (pictures) as the children of the cluster | |
| 463 | - for (unsigned int i = 0; (i < style.GetMaximumNumberOfChildren()) && (*paths); i++, paths++) | |
| 464 | - { | |
| 465 | - clusterActor.AddChild(CreateClusterPictureActor(clusterType, *paths), i); | |
| 466 | - } | |
| 467 | - | |
| 468 | - return clusterActor; | |
| 469 | - } | |
| 470 | - | |
| 471 | - /** | |
| 472 | - * Helper to create the picture actors in the cluster | |
| 473 | - */ | |
| 474 | - Actor CreateClusterPictureActor(ClusterType clusterType, const std::string& imagePath) | |
| 475 | - { | |
| 476 | - // Create a picture for this cluster image | |
| 477 | - // actor|->shadow | |
| 478 | - // |->image | |
| 479 | - // |->border | |
| 480 | - Actor actor = Actor::New(); | |
| 481 | - actor.SetSize(CLUSTER_IMAGE_THUMBNAIL_WIDTH, CLUSTER_IMAGE_THUMBNAIL_HEIGHT); | |
| 482 | - actor.SetParentOrigin( ParentOrigin::CENTER ); | |
| 483 | - actor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 484 | - | |
| 485 | - // Load the thumbnail at quarter of screen width or standard size if that is smaller: | |
| 486 | - Size stageQuarter = Stage::GetCurrent().GetSize() * 0.25f; | |
| 487 | - const ImageDimensions requestedDims = ImageDimensions( std::min( stageQuarter.x, CLUSTER_IMAGE_THUMBNAIL_WIDTH ), std::min( stageQuarter.y, CLUSTER_IMAGE_THUMBNAIL_HEIGHT ) ); | |
| 488 | - | |
| 489 | - // Add a shadow image child actor | |
| 490 | - Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, requestedDims, Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX ); | |
| 491 | - ImageActor shadowActor = ImageActor::New(shadowImage); | |
| 492 | - | |
| 493 | - // Shadow is not exactly located on the center of the image, so it is moved to a little | |
| 494 | - // upper-left side of the image relatively using customised AnchorPoint. | |
| 495 | - shadowActor.SetParentOrigin(ShadowProperty::ANCHOR_POINT); | |
| 496 | - shadowActor.SetAnchorPoint(AnchorPoint::CENTER); | |
| 497 | - shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f)); | |
| 498 | - | |
| 499 | - // Apply size-relative mode to auto-size the image shadow | |
| 500 | - shadowActor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 501 | - shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE ); | |
| 502 | - actor.Add( shadowActor ); | |
| 503 | - | |
| 504 | - // Add a picture image actor to actor (with equal size to the parent). | |
| 505 | - Image image = ResourceImage::New( imagePath, requestedDims, Dali::FittingMode::SHRINK_TO_FIT, Dali::SamplingMode::BOX ); | |
| 506 | - ImageActor imageActor = ImageActor::New( image ); | |
| 507 | - imageActor.SetParentOrigin( ParentOrigin::CENTER ); | |
| 508 | - imageActor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 509 | - imageActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 510 | - actor.Add( imageActor ); | |
| 511 | - | |
| 512 | - // Add a border image child actor (with a fixed size offset from parent). | |
| 513 | - ImageActor borderActor = ImageActor::New( mClusterBorderImage ); | |
| 514 | - borderActor.SetParentOrigin( ParentOrigin::CENTER ); | |
| 515 | - borderActor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 516 | - borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); | |
| 517 | - borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE ); | |
| 518 | - borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) ); | |
| 519 | - borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 520 | - borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f ); | |
| 521 | - actor.Add( borderActor ); | |
| 522 | - | |
| 523 | - return actor; | |
| 524 | - } | |
| 525 | - | |
| 526 | - | |
| 527 | - /** | |
| 528 | - * Adds a Cluster to the ScrollView | |
| 529 | - * | |
| 530 | - * @param[in] clusterType The type of cluster (determines the image content) | |
| 531 | - * @param[in] style The style to be used for this cluster. | |
| 532 | - */ | |
| 533 | - void AddCluster(ClusterType clusterType, ClusterStyle style) | |
| 534 | - { | |
| 535 | - Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); | |
| 536 | - | |
| 537 | - int column = mClusterCount>>1; | |
| 538 | - int row = mClusterCount&1; | |
| 539 | - | |
| 540 | - float minStageDimension = std::min(stageSize.x, stageSize.y); | |
| 541 | - float clusterRightShift = 1.0f - CLUSTER_COLUMN_INDENT * 2.0f; | |
| 542 | - Vector3 clusterPosition = Vector3(CLUSTER_COLUMN_INDENT * stageSize.width + row * (clusterRightShift * stageSize.width - minStageDimension * CLUSTER_RELATIVE_SIZE), | |
| 543 | - CLUSTER_ROW_INDENT * stageSize.height + row * (clusterRightShift * stageSize.height - minStageDimension * CLUSTER_RELATIVE_SIZE), 0.0f); | |
| 544 | - | |
| 545 | - Actor pageView = Actor::New(); | |
| 546 | - mScrollView.Add(pageView); | |
| 547 | - pageView.SetParentOrigin(ParentOrigin::CENTER); | |
| 548 | - pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); | |
| 549 | - pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 550 | - | |
| 551 | - // Create cluster actors and add them to scroll view | |
| 552 | - Vector3 clusterSize; | |
| 553 | - Cluster cluster = CreateClusterActor( clusterType, style, clusterSize ); | |
| 554 | - cluster.SetParentOrigin(ParentOrigin::TOP_LEFT); | |
| 555 | - cluster.SetAnchorPoint(AnchorPoint::TOP_LEFT); | |
| 556 | - cluster.SetPosition( clusterPosition ); | |
| 557 | - | |
| 558 | - pageView.Add(cluster); | |
| 559 | - | |
| 560 | - mClusterInfo.push_back( ClusterInfo( cluster, mClusterCount, clusterPosition, clusterSize ) ); | |
| 561 | - | |
| 562 | - mClusterCount++; | |
| 563 | - } | |
| 564 | - | |
| 565 | - /** | |
| 566 | - * Sets motion blur effect to a cluster and all its children | |
| 567 | - * | |
| 568 | - * @param[in] actor Cluster control to which the effect will be applied | |
| 569 | - */ | |
| 570 | - void SetMotionBlurEffect( Actor actor ) | |
| 571 | - { | |
| 572 | - | |
| 573 | - // only do something if the actor and effect are valid | |
| 574 | - if( actor ) | |
| 575 | - { | |
| 576 | - // first remove from this actor | |
| 577 | - ImageActor imageActor = ImageActor::DownCast( actor ); | |
| 578 | - if( imageActor ) | |
| 579 | - { | |
| 580 | - ShaderEffect shaderEffect = Toolkit::CreateMotionBlurEffect(); | |
| 581 | - shaderEffect.SetUniform("uSpeedScalingFactor",0.1f); | |
| 582 | - | |
| 583 | - Dali::Property::Index uModelProperty = shaderEffect.GetPropertyIndex( "uModelLastFrame" ); | |
| 584 | - Constraint constraint = Constraint::New<Matrix>( shaderEffect, uModelProperty, EqualToConstraint() ); | |
| 585 | - constraint.AddSource( Source( imageActor , Actor::Property::WORLD_MATRIX ) ); | |
| 586 | - constraint.Apply(); | |
| 587 | - imageActor.SetShaderEffect( shaderEffect ); | |
| 588 | - } | |
| 589 | - // then all children recursively | |
| 590 | - const unsigned int count = actor.GetChildCount(); | |
| 591 | - for( unsigned int index = 0; index < count; ++index ) | |
| 592 | - { | |
| 593 | - Actor child( actor.GetChildAt( index ) ); | |
| 594 | - SetMotionBlurEffect( child ); | |
| 595 | - } | |
| 596 | - } | |
| 597 | - } | |
| 598 | - | |
| 599 | - /** | |
| 600 | - * Resets ScrollView and Clusters settings | |
| 601 | - * to reflect the new ExampleEffectType | |
| 602 | - * | |
| 603 | - * TODO: Add animation transition to fade out of existing effect, | |
| 604 | - * and into new effect. | |
| 605 | - * | |
| 606 | - * @param[in] type The desired effect to switch to. | |
| 607 | - */ | |
| 608 | - void SetEffect(ExampleEffectType type) | |
| 609 | - { | |
| 610 | - Vector2 stageSize(Dali::Stage::GetCurrent().GetSize()); | |
| 611 | - | |
| 612 | - mExampleEffect = type; | |
| 613 | - | |
| 614 | - std::stringstream ss(APPLICATION_TITLE); | |
| 615 | - ss << APPLICATION_TITLE << ": " << EXAMPLE_EFFECT_LABEL[mExampleEffect]; | |
| 616 | - SetTitle(ss.str()); | |
| 617 | - | |
| 618 | - // Set up default ruler settings (fixed in horizontal, disabled in vertical) | |
| 619 | - RulerPtr rulerX; | |
| 620 | - rulerX = new FixedRuler(stageSize.x); | |
| 621 | - int columns = (mClusterCount + 1) >> 1; | |
| 622 | - rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * columns, true)); | |
| 623 | - mScrollView.SetRulerX(rulerX); | |
| 624 | - | |
| 625 | - RulerPtr rulerY = new DefaultRuler(); | |
| 626 | - rulerY->Disable(); | |
| 627 | - mScrollView.SetRulerY(rulerY); | |
| 628 | - | |
| 629 | - mScrollView.SetActorAutoSnap(false); | |
| 630 | - | |
| 631 | - // Remove all shader-effects from mScrollView and it's children (the clusters) | |
| 632 | - mScrollView.SetPosition(Vector3::ZERO); | |
| 633 | - | |
| 634 | - mLayoutButton.SetUnselectedImage( mLayoutButtonImages[ type ].mButtonImage ); | |
| 635 | - mLayoutButton.SetSelectedImage( mLayoutButtonImages[ type ].mSelectedImage ); | |
| 636 | - | |
| 637 | - for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) | |
| 638 | - { | |
| 639 | - Cluster cluster = i->mCluster; | |
| 640 | - RemoveShaderEffectRecursively( cluster ); | |
| 641 | - if( i->mEffectConstraint ) | |
| 642 | - { | |
| 643 | - i->mEffectConstraint.Remove(); | |
| 644 | - i->mEffectConstraint.Reset(); | |
| 645 | - } | |
| 646 | - } | |
| 647 | - | |
| 648 | - // Apply new shader-effects. | |
| 649 | - // Move Y to origin incase we came from an effect where user could free pan in y axis. | |
| 650 | - const Vector2 currentScrollPosition(mScrollView.GetCurrentScrollPosition()); | |
| 651 | - mScrollView.ScrollTo(Vector2(currentScrollPosition.x, 0.0f)); | |
| 652 | - | |
| 653 | - switch(type) | |
| 654 | - { | |
| 655 | - case NO_EFFECT: | |
| 656 | - { | |
| 657 | - break; | |
| 658 | - } | |
| 659 | - | |
| 660 | - case MOTION_BLUR_EFFECT: | |
| 661 | - { | |
| 662 | - for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) | |
| 663 | - { | |
| 664 | - SetMotionBlurEffect( i->mCluster ); | |
| 665 | - } | |
| 666 | - break; | |
| 667 | - } | |
| 668 | - | |
| 669 | - case CAROUSEL_EFFECT: | |
| 670 | - { | |
| 671 | - // Apply Carousel Shader Effect to scrollView | |
| 672 | - ShaderEffect shaderEffect = Toolkit::CreateCarouselEffect(); | |
| 673 | - shaderEffect.SetUniform( "uRadius", -CAROUSEL_EFFECT_RADIUS ); | |
| 674 | - // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc | |
| 675 | - for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) | |
| 676 | - { | |
| 677 | - Cluster cluster = i->mCluster; | |
| 678 | - SetShaderEffectRecursively( cluster, shaderEffect ); | |
| 679 | - } | |
| 680 | - mScrollView.SetPosition( Vector3( 0.0f, 0.0f, CAROUSEL_EFFECT_RADIUS ) ); | |
| 681 | - | |
| 682 | - const Vector2 angleSweep( CAROUSEL_EFFECT_ANGLE_SWEEP / stageSize.width, | |
| 683 | - CAROUSEL_EFFECT_ANGLE_SWEEP / stageSize.width ); | |
| 684 | - | |
| 685 | - Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( "uAnglePerUnit" ); | |
| 686 | - Constraint constraint = Constraint::New<Vector2>( shaderEffect, anglePerUnit, CarouselEffectOrientationConstraint( angleSweep ) ); | |
| 687 | - constraint.AddSource( Source(mView, Actor::Property::ORIENTATION) ); | |
| 688 | - constraint.Apply(); | |
| 689 | - | |
| 690 | - break; | |
| 691 | - } | |
| 692 | - | |
| 693 | - case SPHERE_EFFECT: | |
| 694 | - { | |
| 695 | - // Change ruler to free panning... | |
| 696 | - RulerPtr rulerX; | |
| 697 | - rulerX = new DefaultRuler(); | |
| 698 | - int columns = (mClusterCount + 1) >> 1; | |
| 699 | - rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * columns, true)); | |
| 700 | - mScrollView.SetRulerX(rulerX); | |
| 701 | - | |
| 702 | - RulerPtr rulerY = new DefaultRuler(); | |
| 703 | - rulerY->SetDomain(RulerDomain( -stageSize.y * SPHERE_EFFECT_VERTICAL_DOMAIN, stageSize.y * (1.0f + SPHERE_EFFECT_VERTICAL_DOMAIN), true)); | |
| 704 | - mScrollView.SetRulerY(rulerY); | |
| 705 | - | |
| 706 | - // Apply Carousel Shader Effect to scrollView (Spherical style) | |
| 707 | - ShaderEffect shaderEffect = Toolkit::CreateCarouselEffect(); | |
| 708 | - | |
| 709 | - shaderEffect.SetUniform( "uRadius", SPHERE_EFFECT_RADIUS ); | |
| 710 | - shaderEffect.SetUniform( "uAnglePerUnit", Vector2( SPHERE_EFFECT_ANGLE_SWEEP / stageSize.y, SPHERE_EFFECT_ANGLE_SWEEP / stageSize.y ) ); | |
| 711 | - // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc | |
| 712 | - for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) | |
| 713 | - { | |
| 714 | - Cluster cluster = i->mCluster; | |
| 715 | - i->mEffectConstraint = Constraint::New<float>( cluster, Actor::Property::POSITION_Z, SphereEffectOffsetConstraint( SPHERE_EFFECT_POSITION_Z ) ); | |
| 716 | - i->mEffectConstraint.SetRemoveAction(Constraint::Discard); | |
| 717 | - SetShaderEffectRecursively( cluster, shaderEffect ); | |
| 718 | - i->mEffectConstraint.Apply(); | |
| 719 | - } | |
| 720 | - break; | |
| 721 | - } | |
| 722 | - | |
| 723 | - default: | |
| 724 | - break; | |
| 725 | - } | |
| 726 | - | |
| 727 | - } | |
| 728 | - | |
| 729 | - /** | |
| 730 | - * Signal handler, called when quit button is pressed | |
| 731 | - */ | |
| 732 | - bool OnEffectTouched( Toolkit::Button button ) | |
| 733 | - { | |
| 734 | - // quit the application | |
| 735 | - SetEffect(static_cast<ExampleEffectType>( (mExampleEffect + 1) % TOTAL_EFFECTS) ); | |
| 736 | - return true; | |
| 737 | - } | |
| 738 | - | |
| 739 | - /** | |
| 740 | - * Sets/Updates the title of the View | |
| 741 | - * @param[in] title The new title for the view. | |
| 742 | - */ | |
| 743 | - void SetTitle(const std::string& title) | |
| 744 | - { | |
| 745 | - if(!mTitleActor) | |
| 746 | - { | |
| 747 | - mTitleActor = DemoHelper::CreateToolBarLabel( "" ); | |
| 748 | - | |
| 749 | - // Add title to the tool bar. | |
| 750 | - mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter ); | |
| 751 | - } | |
| 752 | - | |
| 753 | - mTitleActor.SetProperty( TextLabel::Property::TEXT, title ); | |
| 754 | - } | |
| 755 | - | |
| 756 | - /** | |
| 757 | - * Main key event handler | |
| 758 | - */ | |
| 759 | - void OnKeyEvent(const KeyEvent& event) | |
| 760 | - { | |
| 761 | - if(event.state == KeyEvent::Down) | |
| 762 | - { | |
| 763 | - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) | |
| 764 | - { | |
| 765 | - mApplication.Quit(); | |
| 766 | - } | |
| 767 | - } | |
| 768 | - } | |
| 769 | - | |
| 770 | -private: | |
| 771 | - | |
| 772 | - Application& mApplication; ///< Application instance | |
| 773 | - Toolkit::Control mView; ///< The View instance. | |
| 774 | - Toolkit::ToolBar mToolBar; ///< The View's Toolbar. | |
| 775 | - TextLabel mTitleActor; ///< The Toolbar's Title. | |
| 776 | - | |
| 777 | - Layer mContentLayer; ///< Content layer (scrolling cluster content) | |
| 778 | - | |
| 779 | - ScrollView mScrollView; ///< The ScrollView container for all clusters | |
| 780 | - Image mClusterBorderImage; ///< The border frame that appears on each image | |
| 781 | - | |
| 782 | - std::vector<ClusterInfo> mClusterInfo; ///< Keeps track of each cluster's information. | |
| 783 | - int mClusterCount; ///< Current number of clusters in use | |
| 784 | - ExampleEffectType mExampleEffect; ///< Current example effect. | |
| 785 | - | |
| 786 | - Toolkit::PushButton mLayoutButton; ///< The layout button | |
| 787 | - ButtonImages mLayoutButtonImages[TOTAL_EFFECTS]; ///< Image when no layout | |
| 788 | -}; | |
| 789 | - | |
| 790 | -// Entry point for Linux & Tizen applications | |
| 791 | -// | |
| 792 | -int main(int argc, char **argv) | |
| 793 | -{ | |
| 794 | - Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); | |
| 795 | - ClusterController test(app); | |
| 796 | - app.MainLoop(); | |
| 797 | - | |
| 798 | - return 0; | |
| 799 | -} |
examples/cluster/cluster-impl.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2014 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 | -// CLASS HEADER | |
| 19 | -#include "cluster-impl.h" | |
| 20 | - | |
| 21 | -// EXTERNAL INCLUDES | |
| 22 | -#include <algorithm> | |
| 23 | -#include <cstring> // for strcmp | |
| 24 | -#include <dali/public-api/animation/animation.h> | |
| 25 | -#include <dali/public-api/object/type-registry.h> | |
| 26 | -#include <dali/public-api/object/property-array.h> | |
| 27 | -#include <dali/devel-api/object/type-registry-helper.h> | |
| 28 | -#include <dali/devel-api/scripting/scripting.h> | |
| 29 | -#include <dali/integration-api/debug.h> | |
| 30 | - | |
| 31 | -// INTERNAL INCLUDES | |
| 32 | -#include "cluster-style.h" | |
| 33 | -#include "cluster-style-impl.h" | |
| 34 | - | |
| 35 | -using namespace Dali; | |
| 36 | - | |
| 37 | -namespace Dali | |
| 38 | -{ | |
| 39 | - | |
| 40 | -namespace Demo | |
| 41 | -{ | |
| 42 | - | |
| 43 | -namespace Internal | |
| 44 | -{ | |
| 45 | - | |
| 46 | -namespace | |
| 47 | -{ | |
| 48 | - | |
| 49 | -BaseHandle Create() | |
| 50 | -{ | |
| 51 | - Demo::ClusterStyleStandard s = Demo::ClusterStyleStandard::New( Demo::ClusterStyleStandard::ClusterStyle1 ); | |
| 52 | - return Demo::Cluster::New( s ); | |
| 53 | -} | |
| 54 | - | |
| 55 | -DALI_TYPE_REGISTRATION_BEGIN( Demo::Cluster, Toolkit::Control, Create ) | |
| 56 | - | |
| 57 | -DALI_ACTION_REGISTRATION( Demo, Cluster, "expand", ACTION_EXPAND ) | |
| 58 | -DALI_ACTION_REGISTRATION( Demo, Cluster, "collapse", ACTION_COLLAPSE ) | |
| 59 | -DALI_ACTION_REGISTRATION( Demo, Cluster, "transform", ACTION_TRANSFORM ) | |
| 60 | - | |
| 61 | -DALI_TYPE_REGISTRATION_END() | |
| 62 | - | |
| 63 | -const float CLUSTER_STYLE_CONSTRAINT_DURATION = 1.0f; | |
| 64 | - | |
| 65 | -} | |
| 66 | - | |
| 67 | -/////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 68 | -// Cluster | |
| 69 | -/////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 70 | - | |
| 71 | -Dali::Demo::Cluster Cluster::New(Demo::ClusterStyle& style) | |
| 72 | -{ | |
| 73 | - // Create the implementation | |
| 74 | - ClusterPtr cluster(new Cluster(style)); | |
| 75 | - | |
| 76 | - // Pass ownership to CustomActor via derived handle | |
| 77 | - Dali::Demo::Cluster handle(*cluster); | |
| 78 | - | |
| 79 | - // Second-phase init of the implementation | |
| 80 | - // This can only be done after the CustomActor connection has been made... | |
| 81 | - cluster->Initialize(); | |
| 82 | - | |
| 83 | - return handle; | |
| 84 | -} | |
| 85 | - | |
| 86 | -Cluster::Cluster(Demo::ClusterStyle& style) | |
| 87 | -: Toolkit::Internal::Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | DISABLE_SIZE_NEGOTIATION ) ), | |
| 88 | - mClusterStyle(style), | |
| 89 | - mExpandedCount(0) | |
| 90 | -{ | |
| 91 | -} | |
| 92 | - | |
| 93 | -void Cluster::OnInitialize() | |
| 94 | -{ | |
| 95 | -} | |
| 96 | - | |
| 97 | -void Cluster::OnSizeSet( const Vector3& targetSize ) | |
| 98 | -{ | |
| 99 | - mClusterSize = targetSize; | |
| 100 | - GetImpl(mClusterStyle).SetClusterSize(targetSize); | |
| 101 | - | |
| 102 | - for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter) | |
| 103 | - { | |
| 104 | - | |
| 105 | - if((*iter).mActor) | |
| 106 | - { | |
| 107 | - mClusterStyle.ApplyStyle( (*iter).mActor, | |
| 108 | - (*iter).mPositionIndex, | |
| 109 | - AlphaFunction::EASE_OUT, | |
| 110 | - TimePeriod(0.f) ); | |
| 111 | - } | |
| 112 | - } | |
| 113 | - | |
| 114 | - UpdateBackground(0.f); | |
| 115 | - UpdateTitle(0.f); | |
| 116 | -} | |
| 117 | - | |
| 118 | -Cluster::~Cluster() | |
| 119 | -{ | |
| 120 | -} | |
| 121 | - | |
| 122 | -void Cluster::AddChild( Actor child ) | |
| 123 | -{ | |
| 124 | - // automatically add child with a position at end. | |
| 125 | - AddChild( child, mChildren.size() ); | |
| 126 | -} | |
| 127 | - | |
| 128 | -void Cluster::AddChild( Actor child, unsigned int positionIndex ) | |
| 129 | -{ | |
| 130 | - AddChildInfo( ChildInfo(child, positionIndex) ); | |
| 131 | -} | |
| 132 | - | |
| 133 | -void Cluster::AddChildAt( Actor child, unsigned int index ) | |
| 134 | -{ | |
| 135 | - // automatically add child with a position at end. | |
| 136 | - AddChild( child, mChildren.size() ); | |
| 137 | -} | |
| 138 | - | |
| 139 | -void Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index ) | |
| 140 | -{ | |
| 141 | - AddChildInfoAt( ChildInfo(child, positionIndex), index ); | |
| 142 | -} | |
| 143 | - | |
| 144 | -void Cluster::AddChildInfo( ChildInfo childInfo ) | |
| 145 | -{ | |
| 146 | - AddChildInfoAt(childInfo, mChildren.size()); | |
| 147 | -} | |
| 148 | - | |
| 149 | -void Cluster::AddChildInfoAt( ChildInfo childInfo, unsigned int index ) | |
| 150 | -{ | |
| 151 | - // check that the child is valid | |
| 152 | - DALI_ASSERT_ALWAYS( childInfo.mActor ); | |
| 153 | - | |
| 154 | - ChildInfoIter offset = index < mChildren.size() ? (mChildren.begin() + index) : mChildren.end(); | |
| 155 | - // now perform customization on this child. | |
| 156 | - | |
| 157 | - // adopt the child | |
| 158 | - if(childInfo.mActor.GetParent() != Self()) | |
| 159 | - { | |
| 160 | - Actor& child = childInfo.mActor; | |
| 161 | - const float depth = std::distance(mChildren.begin(), offset); | |
| 162 | - | |
| 163 | - Property::Index depthProperty = child.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH); | |
| 164 | - if(depthProperty == Property::INVALID_INDEX) | |
| 165 | - { | |
| 166 | - child.RegisterProperty(Demo::Cluster::CLUSTER_ACTOR_DEPTH, depth); | |
| 167 | - } | |
| 168 | - | |
| 169 | - // not added prior | |
| 170 | - Self().Add( childInfo.mActor ); | |
| 171 | - mChildren.insert( offset, childInfo ); | |
| 172 | - | |
| 173 | - // Use parent position plus relative position. | |
| 174 | - child.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION ); | |
| 175 | - | |
| 176 | - // remove old constraints | |
| 177 | - child.RemoveConstraints(); | |
| 178 | - | |
| 179 | - // apply new constraints to the child | |
| 180 | - mClusterStyle.ApplyStyle(child, childInfo.mPositionIndex, AlphaFunction::EASE_OUT, TimePeriod(0.0f)); | |
| 181 | - } | |
| 182 | - else | |
| 183 | - { | |
| 184 | - // already added. | |
| 185 | - ChildInfoContainer mNewChildren; | |
| 186 | - ChildInfoIter iter = mChildren.begin(); | |
| 187 | - float depth = 0.0f; | |
| 188 | - | |
| 189 | - for( ; iter != mChildren.end(); ++iter) | |
| 190 | - { | |
| 191 | - if(iter == offset) | |
| 192 | - { | |
| 193 | - SetDepth(childInfo, depth); | |
| 194 | - depth++; | |
| 195 | - // insert the new childInfo before offset. | |
| 196 | - mNewChildren.push_back(childInfo); | |
| 197 | - } | |
| 198 | - // copy all children except the one that we wish to move. | |
| 199 | - if((*iter).mActor != childInfo.mActor) | |
| 200 | - { | |
| 201 | - SetDepth(*iter, depth); | |
| 202 | - depth++; | |
| 203 | - mNewChildren.push_back(*iter); | |
| 204 | - } | |
| 205 | - } // end for. | |
| 206 | - | |
| 207 | - if(iter == offset) | |
| 208 | - { | |
| 209 | - SetDepth(childInfo, depth); | |
| 210 | - // insert the new childInfo before offset (end). | |
| 211 | - mNewChildren.push_back(childInfo); | |
| 212 | - } | |
| 213 | - | |
| 214 | - mChildren = mNewChildren; | |
| 215 | - | |
| 216 | - // Todo somehow adjust their perceived depth. | |
| 217 | - } | |
| 218 | -} | |
| 219 | - | |
| 220 | -void Cluster::SetDepth( ChildInfo& childInfo, float depth ) | |
| 221 | -{ | |
| 222 | - Property::Index depthProperty = childInfo.mActor.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH); | |
| 223 | - childInfo.mActor.SetProperty( depthProperty, depth ); | |
| 224 | -} | |
| 225 | - | |
| 226 | -ChildInfo Cluster::GetChildInfoAt( unsigned int index ) | |
| 227 | -{ | |
| 228 | - // check if we have this position in the cluster | |
| 229 | - if( index < mChildren.size() ) | |
| 230 | - { | |
| 231 | - // return the child handle | |
| 232 | - return mChildren[ index ]; | |
| 233 | - } | |
| 234 | - | |
| 235 | - // return an empty handle | |
| 236 | - return ChildInfo(); | |
| 237 | -} | |
| 238 | - | |
| 239 | -Actor Cluster::GetChildAt( unsigned int index ) | |
| 240 | -{ | |
| 241 | - // check if we have this position in the cluster | |
| 242 | - if( index < mChildren.size() ) | |
| 243 | - { | |
| 244 | - // return the child handle | |
| 245 | - return mChildren[ index ].mActor; | |
| 246 | - } | |
| 247 | - | |
| 248 | - // return an empty handle | |
| 249 | - return Actor(); | |
| 250 | -} | |
| 251 | - | |
| 252 | -Actor Cluster::RemoveChildAt( unsigned int index ) | |
| 253 | -{ | |
| 254 | - DALI_ASSERT_ALWAYS( index < mChildren.size() ); | |
| 255 | - | |
| 256 | - ChildInfoIter iter = mChildren.begin() + index; | |
| 257 | - Actor child = (*iter).mActor; | |
| 258 | - mChildren.erase( iter ); | |
| 259 | - Self().Remove(child); | |
| 260 | - // note: constraints will automatically be removed in OnControlChildRemove | |
| 261 | - | |
| 262 | - // update depths. | |
| 263 | - float depth = 0.0f; | |
| 264 | - | |
| 265 | - for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter) | |
| 266 | - { | |
| 267 | - SetDepth(*iter, depth); | |
| 268 | - depth++; | |
| 269 | - } // end for. | |
| 270 | - | |
| 271 | - return child; | |
| 272 | -} | |
| 273 | - | |
| 274 | -void Cluster::ExpandChild( unsigned int index ) | |
| 275 | -{ | |
| 276 | - if( index < mChildren.size() ) | |
| 277 | - { | |
| 278 | - ChildInfo& childInfo = mChildren[ index ]; | |
| 279 | - DALI_ASSERT_ALWAYS(childInfo.mActor); | |
| 280 | - | |
| 281 | - if(!childInfo.mExpanded) | |
| 282 | - { | |
| 283 | - // expand child to a random position/angle. | |
| 284 | - const Vector3 clusterSize = Self().GetCurrentSize(); | |
| 285 | - const float length = clusterSize.Length() * 0.1f; | |
| 286 | - const float zOffset = 50.0f; | |
| 287 | - const float angle = (rand()%360) * Math::PI / 180.0f; | |
| 288 | - Vector3 position(sin(angle) * length, -cos(angle) * length, zOffset); | |
| 289 | - const float scale(1.2f); | |
| 290 | - const Radian rotate( Degree( (rand()%30) - 15 ) ); | |
| 291 | - | |
| 292 | - position += childInfo.mActor.GetCurrentPosition(); | |
| 293 | - | |
| 294 | - TransformChild(index, | |
| 295 | - position, | |
| 296 | - Vector3::ONE * scale, | |
| 297 | - Quaternion(rotate, Vector3::ZAXIS), | |
| 298 | - AlphaFunction::EASE_OUT, | |
| 299 | - TimePeriod(0.5f)); | |
| 300 | - } | |
| 301 | - } | |
| 302 | -} | |
| 303 | - | |
| 304 | -void Cluster::ExpandAllChildren() | |
| 305 | -{ | |
| 306 | - for(unsigned int index = 0;index < mChildren.size(); index++) | |
| 307 | - { | |
| 308 | - ExpandChild( index ); | |
| 309 | - } | |
| 310 | -} | |
| 311 | - | |
| 312 | -void Cluster::CollapseChild( unsigned int index, bool front ) | |
| 313 | -{ | |
| 314 | - if( index < mChildren.size() ) | |
| 315 | - { | |
| 316 | - RestoreChild(index, | |
| 317 | - AlphaFunction::EASE_OUT, | |
| 318 | - TimePeriod(0.25f), | |
| 319 | - front); | |
| 320 | - } | |
| 321 | -} | |
| 322 | - | |
| 323 | -void Cluster::CollapseAllChildren( bool front ) | |
| 324 | -{ | |
| 325 | - for(unsigned int index = 0;index < mChildren.size(); index++) | |
| 326 | - { | |
| 327 | - RestoreChild(index, | |
| 328 | - AlphaFunction::EASE_OUT, | |
| 329 | - TimePeriod(0.25f), | |
| 330 | - front); | |
| 331 | - } | |
| 332 | -} | |
| 333 | - | |
| 334 | -void Cluster::TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period ) | |
| 335 | -{ | |
| 336 | - if( index < mChildren.size() ) | |
| 337 | - { | |
| 338 | - ChildInfo& childInfo = mChildren[ index ]; | |
| 339 | - DALI_ASSERT_ALWAYS(childInfo.mActor); | |
| 340 | - | |
| 341 | - if(!childInfo.mExpanded) | |
| 342 | - { | |
| 343 | - Actor child = childInfo.mActor; | |
| 344 | - childInfo.mExpanded = true; | |
| 345 | - mExpandedCount++; | |
| 346 | - | |
| 347 | - child.RemoveConstraints(); | |
| 348 | - Animation animation = Animation::New(period.delaySeconds + period.durationSeconds); | |
| 349 | - animation.AnimateTo( Property(child, Actor::Property::POSITION), position, AlphaFunction::EASE_OUT, period); | |
| 350 | - animation.AnimateTo( Property(child, Actor::Property::SCALE), scale, AlphaFunction::EASE_OUT, period); | |
| 351 | - animation.AnimateTo( Property(child, Actor::Property::ORIENTATION), rotation, AlphaFunction::EASE_OUT, period); | |
| 352 | - animation.Play(); | |
| 353 | - } | |
| 354 | - } | |
| 355 | -} | |
| 356 | - | |
| 357 | -void Cluster::RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front ) | |
| 358 | -{ | |
| 359 | - if( index < mChildren.size() ) | |
| 360 | - { | |
| 361 | - ChildInfo& childInfo = mChildren[ index ]; | |
| 362 | - DALI_ASSERT_ALWAYS(childInfo.mActor); | |
| 363 | - | |
| 364 | - if(childInfo.mExpanded) | |
| 365 | - { | |
| 366 | - Actor child = childInfo.mActor; | |
| 367 | - childInfo.mExpanded = false; | |
| 368 | - mExpandedCount--; | |
| 369 | - mClusterStyle.ApplyStyle( child, childInfo.mPositionIndex, alpha, period ); | |
| 370 | - | |
| 371 | - const unsigned int hideIndex = front ? mChildren.size() : 0; | |
| 372 | - AddChildInfoAt(childInfo, hideIndex); // move child info to the back or front of the pack. | |
| 373 | - } | |
| 374 | - } | |
| 375 | -} | |
| 376 | - | |
| 377 | -void Cluster::SetTitle( Actor text ) | |
| 378 | -{ | |
| 379 | - // Replaces the title actor. | |
| 380 | - if(mTitle && mTitle.GetParent()) | |
| 381 | - { | |
| 382 | - mTitle.GetParent().Remove( mTitle ); | |
| 383 | - } | |
| 384 | - | |
| 385 | - mTitle = text; | |
| 386 | - Self().Add( mTitle ); | |
| 387 | - | |
| 388 | - mTitle.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 389 | - mTitle.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 390 | - | |
| 391 | - UpdateTitle(0.0f); | |
| 392 | -} | |
| 393 | - | |
| 394 | -void Cluster::SetStyle(Demo::ClusterStyle style) | |
| 395 | -{ | |
| 396 | - unsigned int previousChildrenNum = mChildren.size(); | |
| 397 | - mClusterStyle = style; | |
| 398 | - GetImpl(mClusterStyle).SetClusterSize(mClusterSize); | |
| 399 | - unsigned int newChildrenNum = mClusterStyle.GetMaximumNumberOfChildren(); | |
| 400 | - | |
| 401 | - // New style supports less children (remove those that no longer belong) | |
| 402 | - if(newChildrenNum < previousChildrenNum) | |
| 403 | - { | |
| 404 | - ChildInfoIter removeStart = mChildren.begin() + newChildrenNum; | |
| 405 | - | |
| 406 | - for(ChildInfoIter iter = removeStart; iter != mChildren.end(); ++iter) | |
| 407 | - { | |
| 408 | - Actor child = (*iter).mActor; | |
| 409 | - child.RemoveConstraints(); | |
| 410 | - Self().Remove(child); | |
| 411 | - } | |
| 412 | - | |
| 413 | - mChildren.erase( removeStart, mChildren.end() ); | |
| 414 | - } | |
| 415 | - | |
| 416 | - for(ChildInfoIter iter = mChildren.begin(); iter != mChildren.end(); ++iter) | |
| 417 | - { | |
| 418 | - | |
| 419 | - if((*iter).mActor) | |
| 420 | - { | |
| 421 | - mClusterStyle.ApplyStyle( (*iter).mActor, | |
| 422 | - (*iter).mPositionIndex, | |
| 423 | - AlphaFunction::EASE_OUT, | |
| 424 | - TimePeriod(CLUSTER_STYLE_CONSTRAINT_DURATION) ); | |
| 425 | - } | |
| 426 | - } | |
| 427 | - | |
| 428 | - UpdateBackground(CLUSTER_STYLE_CONSTRAINT_DURATION); | |
| 429 | - UpdateTitle(CLUSTER_STYLE_CONSTRAINT_DURATION); | |
| 430 | -} | |
| 431 | - | |
| 432 | -Demo::ClusterStyle Cluster::GetStyle() const | |
| 433 | -{ | |
| 434 | - return mClusterStyle; | |
| 435 | -} | |
| 436 | - | |
| 437 | -unsigned int Cluster::GetExpandedCount() const | |
| 438 | -{ | |
| 439 | - return mExpandedCount; | |
| 440 | -} | |
| 441 | - | |
| 442 | -unsigned int Cluster::GetTotalCount() const | |
| 443 | -{ | |
| 444 | - return mChildren.size(); | |
| 445 | -} | |
| 446 | - | |
| 447 | -void Cluster::UpdateBackground(float duration) | |
| 448 | -{ | |
| 449 | - if (mBackgroundImage) | |
| 450 | - { | |
| 451 | - mClusterStyle.ApplyStyleToBackground(mBackgroundImage, AlphaFunction::EASE_OUT, TimePeriod(duration)); | |
| 452 | - } | |
| 453 | -} | |
| 454 | - | |
| 455 | -void Cluster::UpdateTitle(float duration) | |
| 456 | -{ | |
| 457 | - if (mTitle) | |
| 458 | - { | |
| 459 | - mClusterStyle.ApplyStyleToTitle(mTitle, AlphaFunction::EASE_OUT, TimePeriod(duration)); | |
| 460 | - } | |
| 461 | -} | |
| 462 | - | |
| 463 | -void Cluster::DoExpandAction(const Property::Map& attributes) | |
| 464 | -{ | |
| 465 | - Property::Value* value = attributes.Find( "indices" ); | |
| 466 | - | |
| 467 | - if( value ) | |
| 468 | - { | |
| 469 | - if( value->GetType() == Property::ARRAY ) | |
| 470 | - { | |
| 471 | - Property::Array array = value->Get<Property::Array>(); | |
| 472 | - for( size_t i = 0; i < array.Size(); i++ ) | |
| 473 | - { | |
| 474 | - Property::Value& item = array[i]; | |
| 475 | - DALI_ASSERT_ALWAYS(item.GetType() == Property::INTEGER); | |
| 476 | - ExpandChild( item.Get<int>() ); | |
| 477 | - } | |
| 478 | - } | |
| 479 | - } | |
| 480 | - else | |
| 481 | - { | |
| 482 | - ExpandAllChildren(); | |
| 483 | - } | |
| 484 | -} | |
| 485 | - | |
| 486 | -void Cluster::DoCollapseAction(const Property::Map& attributes) | |
| 487 | -{ | |
| 488 | - Property::Value* value = attributes.Find( "indices" ); | |
| 489 | - | |
| 490 | - if( value ) | |
| 491 | - { | |
| 492 | - if( value->GetType() == Property::ARRAY ) | |
| 493 | - { | |
| 494 | - Property::Array array = value->Get<Property::Array>(); | |
| 495 | - for( size_t i = 0; i < array.Size(); i++ ) | |
| 496 | - { | |
| 497 | - Property::Value& item = array[i]; | |
| 498 | - DALI_ASSERT_ALWAYS(item.GetType() == Property::INTEGER); | |
| 499 | - CollapseChild( item.Get<int>(), false ); | |
| 500 | - } | |
| 501 | - } | |
| 502 | - } | |
| 503 | - else | |
| 504 | - { | |
| 505 | - CollapseAllChildren( false ); | |
| 506 | - } | |
| 507 | -} | |
| 508 | - | |
| 509 | - | |
| 510 | -void Cluster::DoTransformAction(const Property::Map& attributes) | |
| 511 | -{ | |
| 512 | - typedef Dali::StringValuePair StringValuePair; | |
| 513 | - | |
| 514 | - int index = 0; | |
| 515 | - Vector3 position; | |
| 516 | - Vector3 scale(Vector3::ONE); | |
| 517 | - Quaternion rotation( Dali::ANGLE_0, Vector3::ZAXIS ); | |
| 518 | - | |
| 519 | - for(size_t i = 0; i < attributes.Count(); i++) | |
| 520 | - { | |
| 521 | - StringValuePair& stringValue = attributes.GetPair(i); | |
| 522 | - Property::Type type = stringValue.second.GetType(); | |
| 523 | - | |
| 524 | - if( Property::VECTOR3 == type && "position" == stringValue.first ) | |
| 525 | - { | |
| 526 | - stringValue.second.Get( position ); | |
| 527 | - } | |
| 528 | - else if( Property::VECTOR3 == type && "scale" == stringValue.first ) | |
| 529 | - { | |
| 530 | - stringValue.second.Get( scale ); | |
| 531 | - } | |
| 532 | - else if( "rotation" == stringValue.first ) | |
| 533 | - { | |
| 534 | - stringValue.second.Get( rotation ); | |
| 535 | - } | |
| 536 | - } | |
| 537 | - | |
| 538 | - // wrap index around -1 => size - 1 | |
| 539 | - index%= mChildren.size(); | |
| 540 | - | |
| 541 | - TransformChild(index, position, scale, rotation, AlphaFunction::EASE_OUT, TimePeriod(0.5f)); | |
| 542 | -} | |
| 543 | - | |
| 544 | -void Cluster::OnControlChildRemove(Actor& child) | |
| 545 | -{ | |
| 546 | - child.RemoveConstraints(); | |
| 547 | -} | |
| 548 | - | |
| 549 | -bool Cluster::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes) | |
| 550 | -{ | |
| 551 | - bool ret = false; | |
| 552 | - | |
| 553 | - Dali::BaseHandle handle( object ); | |
| 554 | - | |
| 555 | - Demo::Cluster cluster = Demo::Cluster::DownCast( handle ); | |
| 556 | - | |
| 557 | - DALI_ASSERT_ALWAYS( cluster ); | |
| 558 | - | |
| 559 | - if( 0 == strcmp( actionName.c_str(), ACTION_EXPAND ) ) | |
| 560 | - { | |
| 561 | - GetImpl( cluster ).DoExpandAction( attributes ); | |
| 562 | - ret = true; | |
| 563 | - } | |
| 564 | - else if( 0 == strcmp( actionName.c_str(), ACTION_COLLAPSE ) ) | |
| 565 | - { | |
| 566 | - GetImpl( cluster ).DoCollapseAction( attributes ); | |
| 567 | - ret = true; | |
| 568 | - } | |
| 569 | - else if( 0 == strcmp( actionName.c_str(), ACTION_TRANSFORM ) ) | |
| 570 | - { | |
| 571 | - GetImpl( cluster ).DoTransformAction( attributes ); | |
| 572 | - ret = true; | |
| 573 | - } | |
| 574 | - | |
| 575 | - return ret; | |
| 576 | -} | |
| 577 | - | |
| 578 | -} // namespace Internal | |
| 579 | - | |
| 580 | -} // namespace Demo | |
| 581 | - | |
| 582 | -} // namespace Dali |
examples/cluster/cluster-impl.h deleted
| 1 | -#ifndef __DALI_DEMO_INTERNAL_CLUSTER_H__ | |
| 2 | -#define __DALI_DEMO_INTERNAL_CLUSTER_H__ | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2014 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 | - | |
| 21 | -// EXTERNAL INCLUDES | |
| 22 | -#include <dali/public-api/object/ref-object.h> | |
| 23 | - | |
| 24 | -// INTERNAL INCLUDES | |
| 25 | -#include "cluster.h" | |
| 26 | -#include "cluster-style.h" | |
| 27 | -#include <dali-toolkit/public-api/controls/control-impl.h> | |
| 28 | - | |
| 29 | -namespace Dali | |
| 30 | -{ | |
| 31 | - | |
| 32 | -namespace Demo | |
| 33 | -{ | |
| 34 | - | |
| 35 | -namespace Internal | |
| 36 | -{ | |
| 37 | - | |
| 38 | -class Cluster; | |
| 39 | - | |
| 40 | -typedef IntrusivePtr<Cluster> ClusterPtr; | |
| 41 | - | |
| 42 | -class ChildInfo | |
| 43 | -{ | |
| 44 | - | |
| 45 | -public: | |
| 46 | - | |
| 47 | - ChildInfo() | |
| 48 | - : mExpanded(false) | |
| 49 | - { | |
| 50 | - } | |
| 51 | - | |
| 52 | - ChildInfo(Actor actor, unsigned int positionIndex) | |
| 53 | - : mActor(actor), | |
| 54 | - mExpanded(false), | |
| 55 | - mPositionIndex(positionIndex) | |
| 56 | - { | |
| 57 | - } | |
| 58 | - | |
| 59 | - Actor mActor; | |
| 60 | - bool mExpanded; | |
| 61 | - unsigned int mPositionIndex; | |
| 62 | -}; | |
| 63 | - | |
| 64 | -typedef std::vector<ChildInfo> ChildInfoContainer; | |
| 65 | -typedef ChildInfoContainer::iterator ChildInfoIter; | |
| 66 | -typedef ChildInfoContainer::const_iterator ChildInfoConstIter; | |
| 67 | - | |
| 68 | -/** | |
| 69 | - * Cluster is a container of grouped actors positioned in different cluster styles. | |
| 70 | - * Multiple cluster styles may be provided, to determine the position, size, rotation, scale, color and visibility | |
| 71 | - * of the child actors in the cluster. | |
| 72 | - */ | |
| 73 | -class Cluster : public Toolkit::Internal::Control | |
| 74 | -{ | |
| 75 | -public: | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * Create a new Cluster. | |
| 79 | - * @param[in] style of the cluster | |
| 80 | - * @return A public handle to the newly allocated Cluster. | |
| 81 | - */ | |
| 82 | - static Dali::Demo::Cluster New(Demo::ClusterStyle& style); | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * @copydoc Demo::Cluster::AddChild( Actor child ) | |
| 86 | - */ | |
| 87 | - void AddChild( Actor child ); | |
| 88 | - | |
| 89 | - /** | |
| 90 | - * @copydoc Demo::Cluster::AddChild( Actor child, unsigned int positionIndex ) | |
| 91 | - */ | |
| 92 | - void AddChild( Actor child, unsigned int positionIndex ); | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * @copydoc Demo::Cluster::AddChildAt( Actor child, unsigned int index ); | |
| 96 | - */ | |
| 97 | - void AddChildAt( Actor child, unsigned int index ); | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * @copydoc Demo::Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index ); | |
| 101 | - */ | |
| 102 | - void AddChildAt( Actor child, unsigned int positionIndex, unsigned int index ); | |
| 103 | - | |
| 104 | - /** | |
| 105 | - * Adds a ChildInfo struct to the end of the children list. | |
| 106 | - * @param[in] childInfo the child info to that to children list. | |
| 107 | - */ | |
| 108 | - void AddChildInfo( ChildInfo childInfo ); | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * Adds a ChildInfo struct before the specified index. | |
| 112 | - * @param[in] childInfo the child info to that to children list. | |
| 113 | - * @param[in] index the index within the children list to insert | |
| 114 | - * ChildInfo | |
| 115 | - */ | |
| 116 | - void AddChildInfoAt( ChildInfo childInfo, unsigned int index ); | |
| 117 | - | |
| 118 | - /** | |
| 119 | - * @copydoc Demo::Cluster::GetChildAt | |
| 120 | - */ | |
| 121 | - Actor GetChildAt( unsigned int index ); | |
| 122 | - | |
| 123 | - /** | |
| 124 | - * @copydoc Demo::Cluster::RemoveChildAt | |
| 125 | - */ | |
| 126 | - Actor RemoveChildAt( unsigned int index ); | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * @copydoc Demo::Cluster::ExpandChild | |
| 130 | - */ | |
| 131 | - void ExpandChild( unsigned int index ); | |
| 132 | - | |
| 133 | - /** | |
| 134 | - * @copydoc Demo::Cluster::ExpandAllChildren | |
| 135 | - */ | |
| 136 | - void ExpandAllChildren(); | |
| 137 | - | |
| 138 | - /** | |
| 139 | - * @copydoc Demo::Cluster::CollapseChild | |
| 140 | - */ | |
| 141 | - void CollapseChild( unsigned int index, bool front ); | |
| 142 | - | |
| 143 | - /** | |
| 144 | - * @copydoc Demo::Cluster::CollapseAllChildren | |
| 145 | - */ | |
| 146 | - void CollapseAllChildren( bool front ); | |
| 147 | - | |
| 148 | - /** | |
| 149 | - * @copydoc Demo::Cluster::TransformChild | |
| 150 | - */ | |
| 151 | - void TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period ); | |
| 152 | - | |
| 153 | - /** | |
| 154 | - * @copydoc Demo::Cluster::RestoreChild | |
| 155 | - */ | |
| 156 | - void RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front ); | |
| 157 | - | |
| 158 | - /** | |
| 159 | - * @copydoc Demo::Cluster::SetTitle | |
| 160 | - */ | |
| 161 | - void SetTitle( Actor text ); | |
| 162 | - | |
| 163 | - /** | |
| 164 | - * @copydoc Demo::Cluster::SetStyle | |
| 165 | - */ | |
| 166 | - void SetStyle(Demo::ClusterStyle style); | |
| 167 | - | |
| 168 | - /** | |
| 169 | - * @copydoc Demo::Cluster::GetStyle | |
| 170 | - */ | |
| 171 | - Demo::ClusterStyle GetStyle() const; | |
| 172 | - | |
| 173 | - /** | |
| 174 | - * @copydoc Demo::Cluster::GetExpandedCount | |
| 175 | - */ | |
| 176 | - unsigned int GetExpandedCount() const; | |
| 177 | - | |
| 178 | - /** | |
| 179 | - * @copydoc Demo::Cluster::GetTotalCount | |
| 180 | - */ | |
| 181 | - unsigned int GetTotalCount() const; | |
| 182 | - | |
| 183 | -private: | |
| 184 | - | |
| 185 | - ChildInfo GetChildInfoAt( unsigned int index ); | |
| 186 | - | |
| 187 | - void SetDepth( ChildInfo& childInfo, float depth ); | |
| 188 | - | |
| 189 | - /** | |
| 190 | - * Updates the style of the Background | |
| 191 | - * (occurs when either background changes or style changes) | |
| 192 | - * @param[in] duration apply duration for style | |
| 193 | - */ | |
| 194 | - void UpdateBackground(float duration); | |
| 195 | - | |
| 196 | - /** | |
| 197 | - * Updates the style of the Title | |
| 198 | - * (occurs when either background changes or style changes) | |
| 199 | - * @param[in] duration apply duration for style | |
| 200 | - */ | |
| 201 | - void UpdateTitle(float duration); | |
| 202 | - | |
| 203 | - /** | |
| 204 | - * Action: Expand | |
| 205 | - * Expands one or more actors. | |
| 206 | - * | |
| 207 | - * @param[in] attributes list of indices of actors to expand. | |
| 208 | - * (if no attributes specifies, then all actors expand) | |
| 209 | - */ | |
| 210 | - void DoExpandAction(const Property::Map& attributes); | |
| 211 | - | |
| 212 | - /** | |
| 213 | - * Action: Collapse | |
| 214 | - * Collapses one or more actors. | |
| 215 | - * | |
| 216 | - * @param[in] attributes list of indices of actors to collapse. | |
| 217 | - * (if no attributes specifies, then all actors collapse) | |
| 218 | - */ | |
| 219 | - void DoCollapseAction(const Property::Map& attributes); | |
| 220 | - | |
| 221 | - /** | |
| 222 | - * Action: Transform | |
| 223 | - * Transforms one actor (index) to a specified position (Vector3), | |
| 224 | - * scale (Vector3), and rotation (Quaternion). | |
| 225 | - * | |
| 226 | - * @param[in] attributes index and transform values. | |
| 227 | - */ | |
| 228 | - void DoTransformAction(const Property::Map& attributes); | |
| 229 | - | |
| 230 | -private: // From Control | |
| 231 | - /** | |
| 232 | - * From Control; called shortly before a child is removed from the owning actor. | |
| 233 | - * @param[in] child The child being removed.Ptr | |
| 234 | - */ | |
| 235 | - virtual void OnControlChildRemove(Actor& child); | |
| 236 | - | |
| 237 | -public: | |
| 238 | - | |
| 239 | - /** | |
| 240 | - * Performs actions as requested using the action name. | |
| 241 | - * @param[in] object The object on which to perform the action. | |
| 242 | - * @param[in] actionName The action to perform. | |
| 243 | - * @param[in] attributes The attributes with which to perfrom this action. | |
| 244 | - * @return true if action has been accepted by this control | |
| 245 | - */ | |
| 246 | - static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes); | |
| 247 | - | |
| 248 | -private: // From Control | |
| 249 | - | |
| 250 | - /** | |
| 251 | - * @copydoc Control::OnInitialize() | |
| 252 | - */ | |
| 253 | - virtual void OnInitialize(); | |
| 254 | - | |
| 255 | - /** | |
| 256 | - * | |
| 257 | - * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize ) | |
| 258 | - */ | |
| 259 | - virtual void OnSizeSet( const Vector3& targetSize ); | |
| 260 | - | |
| 261 | -protected: | |
| 262 | - | |
| 263 | - /** | |
| 264 | - * Construct a new Cluster. | |
| 265 | - * @param[in] style of the cluster | |
| 266 | - */ | |
| 267 | - Cluster(Demo::ClusterStyle& style); | |
| 268 | - | |
| 269 | - /** | |
| 270 | - * A reference counted object may only be deleted by calling Unreference() | |
| 271 | - */ | |
| 272 | - virtual ~Cluster(); | |
| 273 | - | |
| 274 | -private: | |
| 275 | - | |
| 276 | - // Undefined | |
| 277 | - Cluster(const Cluster&); | |
| 278 | - | |
| 279 | - // Undefined | |
| 280 | - Cluster& operator=(const Cluster& rhs); | |
| 281 | - | |
| 282 | -private: | |
| 283 | - | |
| 284 | - Demo::ClusterStyle mClusterStyle; | |
| 285 | - ChildInfoContainer mChildren; | |
| 286 | - Vector3 mClusterSize; | |
| 287 | - | |
| 288 | - Actor mBackgroundImage; ///< Stores the background image. | |
| 289 | - Actor mTitle; ///< Stores the text title. | |
| 290 | - unsigned int mExpandedCount; ///< A count of how many children have been expanded. | |
| 291 | - | |
| 292 | -}; | |
| 293 | - | |
| 294 | -} // namespace Internal | |
| 295 | - | |
| 296 | -// Helpers for public-api forwarding methods | |
| 297 | - | |
| 298 | -inline Demo::Internal::Cluster& GetImpl(Demo::Cluster& cluster) | |
| 299 | -{ | |
| 300 | - DALI_ASSERT_ALWAYS(cluster); | |
| 301 | - | |
| 302 | - Dali::RefObject& handle = cluster.GetImplementation(); | |
| 303 | - | |
| 304 | - return static_cast<Demo::Internal::Cluster&>(handle); | |
| 305 | -} | |
| 306 | - | |
| 307 | -inline const Demo::Internal::Cluster& GetImpl(const Demo::Cluster& cluster) | |
| 308 | -{ | |
| 309 | - DALI_ASSERT_ALWAYS(cluster); | |
| 310 | - | |
| 311 | - const Dali::RefObject& handle = cluster.GetImplementation(); | |
| 312 | - | |
| 313 | - return static_cast<const Demo::Internal::Cluster&>(handle); | |
| 314 | -} | |
| 315 | - | |
| 316 | -} // namespace Demo | |
| 317 | - | |
| 318 | -} // namespace Dali | |
| 319 | - | |
| 320 | -#endif // __DALI_TOOLKIT_INTERNAL_CLUSTER_H__ |
examples/cluster/cluster-style-impl.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2014 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 | -// CLASS HEADER | |
| 19 | -#include "cluster-style-impl.h" | |
| 20 | - | |
| 21 | -// EXTERNAL INCLUDES | |
| 22 | -#include <dali/public-api/animation/animation.h> | |
| 23 | - | |
| 24 | -// INTERNAL INCLUDES | |
| 25 | -#include "cluster.h" | |
| 26 | - | |
| 27 | -namespace Dali | |
| 28 | -{ | |
| 29 | - | |
| 30 | -namespace // unnamed namespace | |
| 31 | -{ | |
| 32 | -// Cluster style one | |
| 33 | - | |
| 34 | -const unsigned int STYLE_1_CHILDREN_NUMBER = 8; | |
| 35 | - | |
| 36 | -const float STYLE_1_BACKGROUND_IMAGE_OFFSET_Z = 1.0f; | |
| 37 | - | |
| 38 | -const float STYLE_1_CHILD_OFFSET_Z = 2.0f; | |
| 39 | -const float STYLE_1_CHILD_GAP_FACTOR = 0.03f; | |
| 40 | -const float STYLE_1_CHILD_SIZE_FACTOR[] = { 0.4f, 0.15f, 0.25f, 0.15f, 0.4f, 0.15f, 0.25f, 0.15f }; | |
| 41 | -const Vector3 STYLE_1_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 42 | - 0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 43 | - STYLE_1_CHILD_OFFSET_Z), | |
| 44 | - Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 45 | - 0.5f - STYLE_1_CHILD_SIZE_FACTOR[1] - STYLE_1_CHILD_SIZE_FACTOR[2] - STYLE_1_CHILD_GAP_FACTOR * 1.5f, | |
| 46 | - STYLE_1_CHILD_OFFSET_Z + 0.5f), | |
| 47 | - Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 48 | - 0.5f - STYLE_1_CHILD_SIZE_FACTOR[2] - STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 49 | - STYLE_1_CHILD_OFFSET_Z + 1.0f), | |
| 50 | - Vector3(0.5f + STYLE_1_CHILD_SIZE_FACTOR[2] + STYLE_1_CHILD_GAP_FACTOR * 1.5f, | |
| 51 | - 0.5f - STYLE_1_CHILD_SIZE_FACTOR[3] - STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 52 | - STYLE_1_CHILD_OFFSET_Z + 1.5f), | |
| 53 | - Vector3(0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 54 | - 0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 55 | - STYLE_1_CHILD_OFFSET_Z + 2.0f), | |
| 56 | - Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[5] - STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 57 | - 0.5f + STYLE_1_CHILD_SIZE_FACTOR[6] + STYLE_1_CHILD_GAP_FACTOR * 1.5f, | |
| 58 | - STYLE_1_CHILD_OFFSET_Z + 2.5f), | |
| 59 | - Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[6] - STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 60 | - 0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 61 | - STYLE_1_CHILD_OFFSET_Z + 3.0f), | |
| 62 | - Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[6] - STYLE_1_CHILD_SIZE_FACTOR[7] - STYLE_1_CHILD_GAP_FACTOR * 1.5f, | |
| 63 | - 0.5f + STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 64 | - STYLE_1_CHILD_OFFSET_Z + 3.5f) }; | |
| 65 | - | |
| 66 | -const Vector3 STYLE_1_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f); | |
| 67 | -const Vector3 STYLE_1_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f, | |
| 68 | - 0.5f - STYLE_1_CHILD_SIZE_FACTOR[0] - STYLE_1_CHILD_GAP_FACTOR * 0.5f - STYLE_1_TITLE_SIZE_FACTOR.height + 0.02f, | |
| 69 | - 0.0f); | |
| 70 | -const Vector3 STYLE_1_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f); | |
| 71 | - | |
| 72 | -// Cluster style two | |
| 73 | - | |
| 74 | -const unsigned int STYLE_2_CHILDREN_NUMBER = 6; | |
| 75 | - | |
| 76 | -const float STYLE_2_BACKGROUND_IMAGE_OFFSET_Z = 1.0f; | |
| 77 | - | |
| 78 | -const float STYLE_2_CHILD_OFFSET_Z = 2.0f; | |
| 79 | -const float STYLE_2_CHILD_GAP_FACTOR = 0.03f; | |
| 80 | -const float STYLE_2_CHILD_SIZE_FACTOR[] = { 0.4f, 0.25f, 0.15f, 0.4f, 0.25f, 0.15f }; | |
| 81 | -const Vector3 STYLE_2_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] - STYLE_2_CHILD_GAP_FACTOR * 0.5f, | |
| 82 | - 0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] * 0.75f, | |
| 83 | - STYLE_2_CHILD_OFFSET_Z), | |
| 84 | - Vector3(0.5f + STYLE_2_CHILD_GAP_FACTOR * 0.5f, | |
| 85 | - 0.5f - STYLE_2_CHILD_SIZE_FACTOR[1] - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f - STYLE_2_CHILD_GAP_FACTOR, | |
| 86 | - STYLE_2_CHILD_OFFSET_Z + 0.5f), | |
| 87 | - Vector3(0.5f + STYLE_2_CHILD_SIZE_FACTOR[1] + STYLE_2_CHILD_GAP_FACTOR * 1.5f, | |
| 88 | - 0.5f - STYLE_2_CHILD_SIZE_FACTOR[2] - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f - STYLE_2_CHILD_GAP_FACTOR, | |
| 89 | - STYLE_2_CHILD_OFFSET_Z + 1.0f), | |
| 90 | - Vector3(0.5f + STYLE_2_CHILD_GAP_FACTOR * 0.5f, | |
| 91 | - 0.5f - STYLE_2_CHILD_SIZE_FACTOR[3] * 0.25f, | |
| 92 | - STYLE_2_CHILD_OFFSET_Z + 1.5f), | |
| 93 | - Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[4] - STYLE_2_CHILD_GAP_FACTOR * 0.5f, | |
| 94 | - 0.5f + STYLE_2_CHILD_SIZE_FACTOR[0] * 0.25f + STYLE_2_CHILD_GAP_FACTOR, | |
| 95 | - STYLE_2_CHILD_OFFSET_Z + 2.0f), | |
| 96 | - Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[4] - STYLE_2_CHILD_SIZE_FACTOR[5] - STYLE_2_CHILD_GAP_FACTOR * 1.5f, | |
| 97 | - 0.5f + STYLE_2_CHILD_SIZE_FACTOR[0] * 0.25f + STYLE_2_CHILD_GAP_FACTOR, | |
| 98 | - STYLE_2_CHILD_OFFSET_Z + 2.5f) }; | |
| 99 | - | |
| 100 | -const Vector3 STYLE_2_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f); | |
| 101 | -const Vector3 STYLE_2_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] - STYLE_2_CHILD_GAP_FACTOR * 0.5f, | |
| 102 | - 0.5f - STYLE_2_CHILD_SIZE_FACTOR[0] * 0.75f - STYLE_2_TITLE_SIZE_FACTOR.height + 0.02f, | |
| 103 | - 0.0f); | |
| 104 | -const Vector3 STYLE_2_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f); | |
| 105 | - | |
| 106 | -// Cluster style three | |
| 107 | - | |
| 108 | -const unsigned int STYLE_3_CHILDREN_NUMBER = 6; | |
| 109 | - | |
| 110 | -const Vector3 STYLE_3_TITLE_SIZE_FACTOR = Vector3(0.4f, 0.15f, 1.0f); | |
| 111 | - | |
| 112 | -const float STYLE_3_BACKGROUND_IMAGE_OFFSET_Z = 1.0f; | |
| 113 | - | |
| 114 | -const float STYLE_3_CHILD_OFFSET_Z = 2.0f; | |
| 115 | -const float STYLE_3_CHILD_GAP_FACTOR = 0.03f; | |
| 116 | -const float STYLE_3_CHILD_SIZE_FACTOR[] = { 0.4f, 0.4f, 0.15f, 0.25f, 0.25f, 0.15f }; | |
| 117 | -const float STYLE_3_CHILD_POSITION_OFFSET_Y = (1.0f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_SIZE_FACTOR[3] - STYLE_3_CHILD_GAP_FACTOR - STYLE_3_TITLE_SIZE_FACTOR.height) * 0.5f; | |
| 118 | -const Vector3 STYLE_3_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f, | |
| 119 | - 0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y, | |
| 120 | - STYLE_3_CHILD_OFFSET_Z), | |
| 121 | - Vector3(0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f, | |
| 122 | - 0.5f - STYLE_3_CHILD_SIZE_FACTOR[1] - STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y, | |
| 123 | - STYLE_3_CHILD_OFFSET_Z + 0.5f), | |
| 124 | - Vector3(0.5f + STYLE_3_CHILD_SIZE_FACTOR[3] + STYLE_3_CHILD_GAP_FACTOR * 1.5f, | |
| 125 | - 0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y, | |
| 126 | - STYLE_3_CHILD_OFFSET_Z + 1.0f), | |
| 127 | - Vector3(0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f, | |
| 128 | - 0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y, | |
| 129 | - STYLE_3_CHILD_OFFSET_Z + 1.5f), | |
| 130 | - Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[4] - STYLE_3_CHILD_GAP_FACTOR * 0.5f, | |
| 131 | - 0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y, | |
| 132 | - STYLE_3_CHILD_OFFSET_Z + 2.0f), | |
| 133 | - Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[4] - STYLE_3_CHILD_SIZE_FACTOR[5] - STYLE_3_CHILD_GAP_FACTOR * 1.5f, | |
| 134 | - 0.5f + STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y, | |
| 135 | - STYLE_3_CHILD_OFFSET_Z + 2.5f) }; | |
| 136 | - | |
| 137 | -const Vector3 STYLE_3_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f, | |
| 138 | - 0.5f - STYLE_3_CHILD_SIZE_FACTOR[0] - STYLE_3_CHILD_GAP_FACTOR * 0.5f + STYLE_3_CHILD_POSITION_OFFSET_Y - STYLE_3_TITLE_SIZE_FACTOR.height + 0.02f, | |
| 139 | - 0.0f); | |
| 140 | -const Vector3 STYLE_3_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f); | |
| 141 | - | |
| 142 | -// Cluster style four | |
| 143 | - | |
| 144 | -const unsigned int STYLE_4_CHILDREN_NUMBER = 6; | |
| 145 | - | |
| 146 | -const float STYLE_4_BACKGROUND_IMAGE_OFFSET_Z = 1.0f; | |
| 147 | - | |
| 148 | -const float STYLE_4_CHILD_OFFSET_Z = 2.0f; | |
| 149 | -const float STYLE_4_CHILD_GAP_FACTOR = 0.03f; | |
| 150 | -const float STYLE_4_CHILD_SIZE_FACTOR[] = { 0.4f, 0.22f, 0.13f, 0.4f, 0.22f, 0.13f }; | |
| 151 | -const Vector3 STYLE_4_CHILD_POSITION_FACTOR[] = { Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] * 0.9f, | |
| 152 | - 0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] - STYLE_4_CHILD_GAP_FACTOR * 0.5f, | |
| 153 | - STYLE_4_CHILD_OFFSET_Z), | |
| 154 | - Vector3(0.5f + STYLE_4_CHILD_SIZE_FACTOR[0] * 0.1f + STYLE_4_CHILD_GAP_FACTOR, | |
| 155 | - 0.5f - STYLE_4_CHILD_SIZE_FACTOR[1] - STYLE_4_CHILD_GAP_FACTOR * 0.5f, | |
| 156 | - STYLE_4_CHILD_OFFSET_Z + 0.5f), | |
| 157 | - Vector3(0.5f + STYLE_4_CHILD_SIZE_FACTOR[0] * 0.1f + STYLE_4_CHILD_SIZE_FACTOR[1] + STYLE_4_CHILD_GAP_FACTOR * 2.0f, | |
| 158 | - 0.5f - STYLE_4_CHILD_SIZE_FACTOR[2] - STYLE_4_CHILD_GAP_FACTOR * 0.5f, | |
| 159 | - STYLE_4_CHILD_OFFSET_Z + 1.0f), | |
| 160 | - Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[3] * 0.1f, | |
| 161 | - 0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f, | |
| 162 | - STYLE_4_CHILD_OFFSET_Z + 1.5f), | |
| 163 | - Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[3] * 0.1f - STYLE_4_CHILD_SIZE_FACTOR[4] - STYLE_4_CHILD_GAP_FACTOR, | |
| 164 | - 0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f, | |
| 165 | - STYLE_4_CHILD_OFFSET_Z + 2.0f), | |
| 166 | - Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[3] * 0.1f - STYLE_4_CHILD_SIZE_FACTOR[4] - STYLE_4_CHILD_SIZE_FACTOR[5] - STYLE_4_CHILD_GAP_FACTOR * 2.0f, | |
| 167 | - 0.5f + STYLE_4_CHILD_GAP_FACTOR * 0.5f, | |
| 168 | - STYLE_4_CHILD_OFFSET_Z + 2.5f) }; | |
| 169 | - | |
| 170 | -const Vector3 STYLE_4_TITLE_SIZE_FACTOR = Vector3(0.3f, 0.11f, 1.0f); | |
| 171 | -const Vector3 STYLE_4_TITLE_POSITION_FACTOR = Vector3(0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] * 0.9f, | |
| 172 | - 0.5f - STYLE_4_CHILD_SIZE_FACTOR[0] - STYLE_4_CHILD_GAP_FACTOR * 0.5f - STYLE_4_TITLE_SIZE_FACTOR.height + 0.02f, | |
| 173 | - 0.0f); | |
| 174 | -const Vector3 STYLE_4_TITLE_POSITION_OFFSET = Vector3(0.0f, 0.0f, 8.0f); | |
| 175 | -const unsigned int CLUSTER_RANDOM_SEED(0x17eac9f3); ///< Random seed for cluster data. | |
| 176 | - | |
| 177 | -const int STYLE_RANDOM_CHILDREN_NUMBER = 16; | |
| 178 | - | |
| 179 | -Vector3 FirstOrderEquation( const Vector3& source, const Vector3& relative, const Vector3& offset = Vector3::ZERO ) | |
| 180 | -{ | |
| 181 | - return source * relative + offset; | |
| 182 | -} | |
| 183 | - | |
| 184 | -// random data generator ////////////////////////////////////////////////////// | |
| 185 | - | |
| 186 | -const unsigned int GEN_RAND_CONST = 0x15d9a373; | |
| 187 | - | |
| 188 | -unsigned int genRandom(unsigned int& seed, unsigned int offset) | |
| 189 | -{ | |
| 190 | - unsigned int shft = offset&31; | |
| 191 | - | |
| 192 | - offset++; | |
| 193 | - | |
| 194 | - seed^= (seed << (shft) | seed >> (32 - shft)) * (offset * GEN_RAND_CONST); | |
| 195 | - | |
| 196 | - return seed; | |
| 197 | -} | |
| 198 | - | |
| 199 | -float genRandomFloat(unsigned int& seed, unsigned int offset, float min, float max) | |
| 200 | -{ | |
| 201 | - const float f = static_cast<float>(genRandom(seed, offset)) / 0xffffffff; | |
| 202 | - return f * (max - min) + min; | |
| 203 | -} | |
| 204 | - | |
| 205 | -} // unnamed namespace | |
| 206 | - | |
| 207 | -namespace Demo | |
| 208 | -{ | |
| 209 | - | |
| 210 | -namespace Internal | |
| 211 | -{ | |
| 212 | - | |
| 213 | -// ClusterStyle /////////////////////////////////////////////////////////////// | |
| 214 | - | |
| 215 | -ClusterStyle::ClusterStyle() | |
| 216 | -: mMaxChildren(0), | |
| 217 | - mTitlePositionRelative(Vector3::ONE), | |
| 218 | - mTitlePositionOffset(Vector3::ZERO), | |
| 219 | - mTitleSize(Vector3::ONE), | |
| 220 | - mBackgroundPositionRelative(Vector3::ONE), | |
| 221 | - mBackgroundPositionOffset(Vector3::ZERO), | |
| 222 | - mBackgroundSize(Vector3::ONE), | |
| 223 | - mClusterSize( Vector3::ZERO ) | |
| 224 | -{ | |
| 225 | -} | |
| 226 | - | |
| 227 | -ClusterStyle::~ClusterStyle() | |
| 228 | -{ | |
| 229 | - | |
| 230 | -} | |
| 231 | - | |
| 232 | -void ClusterStyle::SetMaximumNumberOfChildren(unsigned int maxChildren) | |
| 233 | -{ | |
| 234 | - mMaxChildren = maxChildren; | |
| 235 | -} | |
| 236 | - | |
| 237 | -unsigned int ClusterStyle::GetMaximumNumberOfChildren() const | |
| 238 | -{ | |
| 239 | - return mMaxChildren; | |
| 240 | -} | |
| 241 | - | |
| 242 | -void ClusterStyle::ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds) | |
| 243 | -{ | |
| 244 | - Apply( background, | |
| 245 | - FirstOrderEquation( GetClusterSize(), mBackgroundPositionRelative, mBackgroundPositionOffset ), | |
| 246 | - FirstOrderEquation( GetClusterSize(), mBackgroundSize ), | |
| 247 | - alpha, | |
| 248 | - durationSeconds); | |
| 249 | -} | |
| 250 | - | |
| 251 | -void ClusterStyle::ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds) | |
| 252 | -{ | |
| 253 | - Apply( title, | |
| 254 | - FirstOrderEquation( GetClusterSize(), mTitlePositionRelative, mTitlePositionOffset ), | |
| 255 | - FirstOrderEquation( GetClusterSize(), mTitleSize ), | |
| 256 | - alpha, | |
| 257 | - durationSeconds); | |
| 258 | -} | |
| 259 | - | |
| 260 | -void ClusterStyle::SetTitleProperties(const Vector3& relativePosition, | |
| 261 | - const Vector3& offsetPosition, | |
| 262 | - const Vector3& size) | |
| 263 | -{ | |
| 264 | - mTitlePositionRelative = relativePosition; | |
| 265 | - mTitlePositionOffset = offsetPosition; | |
| 266 | - mTitleSize = size; | |
| 267 | -} | |
| 268 | - | |
| 269 | -void ClusterStyle::SetBackgroundProperties(const Vector3& relativePosition, | |
| 270 | - const Vector3& offsetPosition, | |
| 271 | - const Vector3& size) | |
| 272 | -{ | |
| 273 | - mBackgroundPositionRelative = relativePosition; | |
| 274 | - mBackgroundPositionOffset = offsetPosition; | |
| 275 | - mBackgroundSize = size; | |
| 276 | -} | |
| 277 | - | |
| 278 | -void ClusterStyle::SetClusterSize( const Vector3& clusterSize ) | |
| 279 | -{ | |
| 280 | - mClusterSize = clusterSize; | |
| 281 | -} | |
| 282 | - | |
| 283 | -Vector3 ClusterStyle::GetClusterSize() const | |
| 284 | -{ | |
| 285 | - return mClusterSize; | |
| 286 | -} | |
| 287 | - | |
| 288 | -void ClusterStyle::Apply( Actor actor, | |
| 289 | - const Vector3& position, | |
| 290 | - const Vector3& size, | |
| 291 | - AlphaFunction alpha, | |
| 292 | - const TimePeriod& durationSeconds) | |
| 293 | -{ | |
| 294 | - float animationDuration = durationSeconds.delaySeconds + durationSeconds.durationSeconds; | |
| 295 | - if( animationDuration > 0.f ) | |
| 296 | - { | |
| 297 | - Animation animation = Animation::New(animationDuration); | |
| 298 | - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); | |
| 299 | - animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); | |
| 300 | - animation.Play(); | |
| 301 | - } | |
| 302 | - else | |
| 303 | - { | |
| 304 | - actor.SetPosition( position ); | |
| 305 | - actor.SetSize( size ); | |
| 306 | - } | |
| 307 | -} | |
| 308 | - | |
| 309 | -void ClusterStyle::Apply( Actor actor, | |
| 310 | - const Vector3& position, | |
| 311 | - const Vector3& size, | |
| 312 | - const Quaternion& rotation, | |
| 313 | - const Vector3& scale, | |
| 314 | - AlphaFunction alpha, | |
| 315 | - const TimePeriod& durationSeconds) | |
| 316 | -{ | |
| 317 | - float animationDuration = durationSeconds.delaySeconds + durationSeconds.durationSeconds; | |
| 318 | - if( animationDuration > 0.f ) | |
| 319 | - { | |
| 320 | - Animation animation = Animation::New(animationDuration); | |
| 321 | - animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); | |
| 322 | - animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); | |
| 323 | - animation.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), rotation, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); | |
| 324 | - animation.AnimateTo( Property( actor, Actor::Property::SCALE ), scale, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); | |
| 325 | - animation.Play(); | |
| 326 | - } | |
| 327 | - else | |
| 328 | - { | |
| 329 | - actor.SetPosition( position ); | |
| 330 | - actor.SetSize( size ); | |
| 331 | - actor.SetOrientation( rotation ); | |
| 332 | - actor.SetScale( scale ); | |
| 333 | - } | |
| 334 | -} | |
| 335 | - | |
| 336 | -// ClusterStyleStandard /////////////////////////////////////////////////////// | |
| 337 | - | |
| 338 | -ClusterStylePtr ClusterStyleStandard::New(StyleType style) | |
| 339 | -{ | |
| 340 | - ClusterStylePtr impl( new ClusterStyleStandard(style) ); | |
| 341 | - | |
| 342 | - return impl; | |
| 343 | -} | |
| 344 | - | |
| 345 | -ClusterStyleStandard::ClusterStyleStandard(StyleType style) | |
| 346 | -: ClusterStyle(), | |
| 347 | - mSizes(NULL), | |
| 348 | - mPositions(NULL) | |
| 349 | -{ | |
| 350 | - switch(style) | |
| 351 | - { | |
| 352 | - case Demo::ClusterStyleStandard::ClusterStyle1: | |
| 353 | - { | |
| 354 | - SetMaximumNumberOfChildren(STYLE_1_CHILDREN_NUMBER); | |
| 355 | - SetSizes(STYLE_1_CHILD_SIZE_FACTOR); | |
| 356 | - SetPositions(STYLE_1_CHILD_POSITION_FACTOR); | |
| 357 | - SetTitleProperties(STYLE_1_TITLE_POSITION_FACTOR, | |
| 358 | - STYLE_1_TITLE_POSITION_OFFSET, | |
| 359 | - STYLE_1_TITLE_SIZE_FACTOR); | |
| 360 | - SetBackgroundProperties(Vector3::ZERO, | |
| 361 | - Vector3(0.0f, 0.0f, STYLE_1_BACKGROUND_IMAGE_OFFSET_Z), | |
| 362 | - Vector3::ONE); | |
| 363 | - break; | |
| 364 | - } | |
| 365 | - case Demo::ClusterStyleStandard::ClusterStyle2: | |
| 366 | - { | |
| 367 | - SetMaximumNumberOfChildren(STYLE_2_CHILDREN_NUMBER); | |
| 368 | - SetSizes(STYLE_2_CHILD_SIZE_FACTOR); | |
| 369 | - SetPositions(STYLE_2_CHILD_POSITION_FACTOR); | |
| 370 | - SetTitleProperties(STYLE_2_TITLE_POSITION_FACTOR, | |
| 371 | - STYLE_2_TITLE_POSITION_OFFSET, | |
| 372 | - STYLE_2_TITLE_SIZE_FACTOR); | |
| 373 | - SetBackgroundProperties(Vector3::ZERO, | |
| 374 | - Vector3(0.0f, 0.0f, STYLE_2_BACKGROUND_IMAGE_OFFSET_Z), | |
| 375 | - Vector3::ONE); | |
| 376 | - break; | |
| 377 | - } | |
| 378 | - case Demo::ClusterStyleStandard::ClusterStyle3: | |
| 379 | - { | |
| 380 | - SetMaximumNumberOfChildren(STYLE_3_CHILDREN_NUMBER); | |
| 381 | - SetSizes(STYLE_3_CHILD_SIZE_FACTOR); | |
| 382 | - SetPositions(STYLE_3_CHILD_POSITION_FACTOR); | |
| 383 | - SetTitleProperties(STYLE_3_TITLE_POSITION_FACTOR, | |
| 384 | - STYLE_3_TITLE_POSITION_OFFSET, | |
| 385 | - STYLE_3_TITLE_SIZE_FACTOR); | |
| 386 | - SetBackgroundProperties(Vector3::ZERO, | |
| 387 | - Vector3(0.0f, 0.0f, STYLE_3_BACKGROUND_IMAGE_OFFSET_Z), | |
| 388 | - Vector3::ONE); | |
| 389 | - break; | |
| 390 | - } | |
| 391 | - case Demo::ClusterStyleStandard::ClusterStyle4: | |
| 392 | - { | |
| 393 | - SetMaximumNumberOfChildren(STYLE_4_CHILDREN_NUMBER); | |
| 394 | - SetSizes(STYLE_4_CHILD_SIZE_FACTOR); | |
| 395 | - SetPositions(STYLE_4_CHILD_POSITION_FACTOR); | |
| 396 | - SetTitleProperties(STYLE_4_TITLE_POSITION_FACTOR, | |
| 397 | - STYLE_4_TITLE_POSITION_OFFSET, | |
| 398 | - STYLE_4_TITLE_SIZE_FACTOR); | |
| 399 | - SetBackgroundProperties(Vector3::ZERO, | |
| 400 | - Vector3(0.0f, 0.0f, STYLE_4_BACKGROUND_IMAGE_OFFSET_Z), | |
| 401 | - Vector3::ONE); | |
| 402 | - break; | |
| 403 | - } | |
| 404 | - default: | |
| 405 | - { | |
| 406 | - DALI_ASSERT_ALWAYS(false && "Invalid Style"); | |
| 407 | - break; | |
| 408 | - } | |
| 409 | - } // end switch | |
| 410 | -} | |
| 411 | - | |
| 412 | -void ClusterStyleStandard::SetSizes(const float *sizes) | |
| 413 | -{ | |
| 414 | - mSizes = sizes; | |
| 415 | -} | |
| 416 | - | |
| 417 | -void ClusterStyleStandard::SetPositions(const Vector3 *positions) | |
| 418 | -{ | |
| 419 | - mPositions = positions; | |
| 420 | -} | |
| 421 | - | |
| 422 | -void ClusterStyleStandard::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds) | |
| 423 | -{ | |
| 424 | - if(mPositions) | |
| 425 | - { | |
| 426 | - const float& size = mSizes[index]; | |
| 427 | - // counter top-left parent origin and top-left anchor point. | |
| 428 | - const Vector3 position = mPositions[index] - Vector3(0.5f, 0.5f, 0.0f) + Vector3(size, size, 0.0f) * 0.5f; | |
| 429 | - | |
| 430 | - Apply( child, | |
| 431 | - FirstOrderEquation( GetClusterSize(), Vector3(position.x, position.y, 0.0f), Vector3(0.0f, 0.0f, position.z) ), | |
| 432 | - FirstOrderEquation( GetClusterSize(), Vector3::ONE * size ), | |
| 433 | - Quaternion(), | |
| 434 | - Vector3::ONE, | |
| 435 | - alpha, | |
| 436 | - durationSeconds); | |
| 437 | - } | |
| 438 | -} | |
| 439 | - | |
| 440 | -// ClusterStyleRandom ///////////////////////////////////////////////////////// | |
| 441 | - | |
| 442 | -ClusterStylePtr ClusterStyleRandom::New() | |
| 443 | -{ | |
| 444 | - ClusterStylePtr impl( new ClusterStyleRandom() ); | |
| 445 | - | |
| 446 | - return impl; | |
| 447 | -} | |
| 448 | - | |
| 449 | -ClusterStyleRandom::ClusterStyleRandom() | |
| 450 | -: ClusterStyle() | |
| 451 | -{ | |
| 452 | - SetMaximumNumberOfChildren(STYLE_RANDOM_CHILDREN_NUMBER); | |
| 453 | - SetTitleProperties(Vector3::ZERO, | |
| 454 | - Vector3::ZERO, | |
| 455 | - Vector3::ONE); | |
| 456 | - SetBackgroundProperties(Vector3::ZERO, | |
| 457 | - Vector3(0.0f, 0.0f, 0.0f), | |
| 458 | - Vector3::ONE); | |
| 459 | -} | |
| 460 | - | |
| 461 | -void ClusterStyleRandom::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds) | |
| 462 | -{ | |
| 463 | - unsigned int seed = CLUSTER_RANDOM_SEED; | |
| 464 | - const float size = 0.5f; | |
| 465 | - const float rotation = genRandomFloat(seed, index, -1.0f, 1.0f) * Math::PI * 0.1; // +/- 18 degrees | |
| 466 | - const Vector3 position(genRandomFloat(seed, index, -0.1f, 0.1f), | |
| 467 | - genRandomFloat(seed, index, -0.1f, 0.1f), | |
| 468 | - 0.0f); | |
| 469 | - | |
| 470 | - Property::Index depthProperty = child.GetPropertyIndex(Demo::Cluster::CLUSTER_ACTOR_DEPTH); | |
| 471 | - float depthPropertyValue = child.GetProperty<float>( depthProperty ); | |
| 472 | - | |
| 473 | - Apply( child, | |
| 474 | - FirstOrderEquation( GetClusterSize(), Vector3(position.x, position.y, 0.0f), Vector3(0.0f, 0.0f, depthPropertyValue) ), | |
| 475 | - FirstOrderEquation( GetClusterSize(), Vector3::ONE * size), | |
| 476 | - Quaternion( Radian( rotation ), Vector3::ZAXIS ), | |
| 477 | - Vector3::ONE, | |
| 478 | - alpha, | |
| 479 | - durationSeconds); | |
| 480 | -} | |
| 481 | - | |
| 482 | -} // namespace Internal | |
| 483 | - | |
| 484 | -} // namespace Demo | |
| 485 | - | |
| 486 | -} // namespace Dali |
examples/cluster/cluster-style-impl.h deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2015 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 | -// EXTERNAL INCLUDES | |
| 19 | -#include <dali/public-api/object/ref-object.h> | |
| 20 | -#include <dali/public-api/common/dali-common.h> | |
| 21 | -#include <dali/public-api/math/vector3.h> | |
| 22 | -#include <dali/public-api/object/base-object.h> | |
| 23 | - | |
| 24 | -// INTERNAL INCLUDES | |
| 25 | -#include "cluster-style.h" | |
| 26 | - | |
| 27 | -namespace Dali | |
| 28 | -{ | |
| 29 | - | |
| 30 | -namespace Demo | |
| 31 | -{ | |
| 32 | - | |
| 33 | -namespace Internal | |
| 34 | -{ | |
| 35 | - | |
| 36 | -class ClusterStyle; | |
| 37 | - | |
| 38 | -typedef IntrusivePtr<ClusterStyle> ClusterStylePtr; | |
| 39 | - | |
| 40 | -/** | |
| 41 | - * ClusterStyle internal implementation | |
| 42 | - */ | |
| 43 | -class ClusterStyle : public Dali::BaseObject | |
| 44 | -{ | |
| 45 | -public: | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * @copydoc Demo::ClusterStyle::GetMaximumNumberOfChildren | |
| 49 | - */ | |
| 50 | - unsigned int GetMaximumNumberOfChildren() const; | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * @copydoc Demo::ClusterStyle::ApplyStyle | |
| 54 | - */ | |
| 55 | - virtual void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds) = 0; | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * @copydoc Demo::ClusterStyle::ApplyStyleToBackground | |
| 59 | - */ | |
| 60 | - virtual void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds); | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * @copydoc Demo::ClusterStyle::ApplyStyleToTitle | |
| 64 | - */ | |
| 65 | - virtual void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * Set the size of cluster | |
| 69 | - */ | |
| 70 | - void SetClusterSize( const Vector3& clusterSize ); | |
| 71 | - | |
| 72 | -protected: | |
| 73 | - | |
| 74 | - /** | |
| 75 | - * Set the maximum number of children this Style can handle. | |
| 76 | - * @param[in] The maximum number of children. | |
| 77 | - */ | |
| 78 | - void SetMaximumNumberOfChildren(unsigned int children); | |
| 79 | - | |
| 80 | - /** | |
| 81 | - * Set the title properties | |
| 82 | - * @param[in] relativePosition Relative position of the title | |
| 83 | - * @param[in] offsetPosition Offset position of the title | |
| 84 | - * @param[in] size The size of the title | |
| 85 | - */ | |
| 86 | - void SetTitleProperties(const Vector3& relativePosition, | |
| 87 | - const Vector3& offsetPosition, | |
| 88 | - const Vector3& size); | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * Set the background properties | |
| 92 | - * @param[in] relativePosition Relative position of the background | |
| 93 | - * @param[in] offsetPosition Offset position of the background | |
| 94 | - * @param[in] size The size of the title | |
| 95 | - */ | |
| 96 | - void SetBackgroundProperties(const Vector3& relativePosition, | |
| 97 | - const Vector3& offsetPosition, | |
| 98 | - const Vector3& size); | |
| 99 | - | |
| 100 | - /** | |
| 101 | - * Get the size of cluster. | |
| 102 | - * @return the cluster size | |
| 103 | - */ | |
| 104 | - Vector3 GetClusterSize() const; | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * Apply the given position & size to the actor | |
| 108 | - * @param[in] position The target position | |
| 109 | - * @param[in] size The target size | |
| 110 | - * @param[in] size The size to resize to | |
| 111 | - * @param[in] alpha The alpha function to use. | |
| 112 | - * @param[in] durationSeconds The time period to apply this style. | |
| 113 | - */ | |
| 114 | - void Apply( Actor actor, | |
| 115 | - const Vector3& position, | |
| 116 | - const Vector3& size, | |
| 117 | - AlphaFunction alpha, | |
| 118 | - const TimePeriod& durationSeconds); | |
| 119 | - /** | |
| 120 | - * Apply the given position & size to the actor | |
| 121 | - * @param[in] actor The actor to apply the changes | |
| 122 | - * @param[in] position The target position | |
| 123 | - * @param[in] size The target size | |
| 124 | - * @param[in] rotation The target Quaternion value | |
| 125 | - * @param[in] scale The target scale | |
| 126 | - * @param[in] alpha The alpha function to use. | |
| 127 | - * @param[in] durationSeconds The time period to apply this style. | |
| 128 | - */ | |
| 129 | - void Apply( Actor actor, | |
| 130 | - const Vector3& position, | |
| 131 | - const Vector3& size, | |
| 132 | - const Quaternion& rotation, | |
| 133 | - const Vector3& scale, | |
| 134 | - AlphaFunction alpha, | |
| 135 | - const TimePeriod& durationSeconds); | |
| 136 | - | |
| 137 | -protected: | |
| 138 | - | |
| 139 | - /** | |
| 140 | - * Protected constructor see ClusterStyle::New(). | |
| 141 | - */ | |
| 142 | - ClusterStyle(); | |
| 143 | - | |
| 144 | - /** | |
| 145 | - * A reference counted object may only be deleted by calling Unreference() | |
| 146 | - */ | |
| 147 | - virtual ~ClusterStyle(); | |
| 148 | - | |
| 149 | -protected: | |
| 150 | - | |
| 151 | - unsigned int mMaxChildren; ///< Maximum number of children that this style supports | |
| 152 | - Vector3 mTitlePositionRelative; ///< Title's position relative to size of cluster | |
| 153 | - Vector3 mTitlePositionOffset; ///< Title's position offset | |
| 154 | - Vector3 mTitleSize; ///< Title's size relative to size of cluster | |
| 155 | - Vector3 mBackgroundPositionRelative; ///< Background's position relative to size of cluster | |
| 156 | - Vector3 mBackgroundPositionOffset; ///< Background's position offset | |
| 157 | - Vector3 mBackgroundSize; ///< Background's size relative to size of cluster | |
| 158 | - Vector3 mClusterSize; ///< The size of cluster | |
| 159 | -}; | |
| 160 | - | |
| 161 | -/** | |
| 162 | - * ClusterStyleStandard internal implementation | |
| 163 | - */ | |
| 164 | -class ClusterStyleStandard : public ClusterStyle | |
| 165 | -{ | |
| 166 | -public: | |
| 167 | - | |
| 168 | - typedef Demo::ClusterStyleStandard::StyleType StyleType; | |
| 169 | - | |
| 170 | -public: | |
| 171 | - | |
| 172 | - /** | |
| 173 | - * Create a new cluster style. | |
| 174 | - * @param[in] style The style type to create. | |
| 175 | - * @return A smart-pointer to the newly allocated ClusterStyle. | |
| 176 | - */ | |
| 177 | - static ClusterStylePtr New(StyleType style); | |
| 178 | - | |
| 179 | -public: | |
| 180 | - | |
| 181 | - /** | |
| 182 | - * @copydoc Demo::ClusterStyle::ApplyStyle | |
| 183 | - */ | |
| 184 | - void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds); | |
| 185 | - | |
| 186 | -private: | |
| 187 | - | |
| 188 | - /** | |
| 189 | - * Set the relative sizes of the children | |
| 190 | - * @param[in] size The list of sizes for the children | |
| 191 | - */ | |
| 192 | - void SetSizes(const float *sizes); | |
| 193 | - | |
| 194 | - /** | |
| 195 | - * Set the relative positions of the children | |
| 196 | - * @param[in] positions The list of positions for the children | |
| 197 | - */ | |
| 198 | - void SetPositions(const Vector3 *positions); | |
| 199 | - | |
| 200 | -protected: | |
| 201 | - | |
| 202 | - /** | |
| 203 | - * Protected constructor see ClusterStyleRandom::New(). | |
| 204 | - */ | |
| 205 | - ClusterStyleStandard(StyleType style); | |
| 206 | - | |
| 207 | -private: | |
| 208 | - | |
| 209 | - const float *mSizes; ///< List of sizes | |
| 210 | - const Vector3 *mPositions; ///< List of positions | |
| 211 | - | |
| 212 | -}; | |
| 213 | - | |
| 214 | -/** | |
| 215 | - * ClusterStyleRandom internal implementation | |
| 216 | - */ | |
| 217 | -class ClusterStyleRandom : public ClusterStyle | |
| 218 | -{ | |
| 219 | -public: | |
| 220 | - | |
| 221 | - /** | |
| 222 | - * Create a new cluster style. | |
| 223 | - * @return A smart-pointer to the newly allocated ClusterStyle. | |
| 224 | - */ | |
| 225 | - static ClusterStylePtr New(); | |
| 226 | - | |
| 227 | -public: | |
| 228 | - | |
| 229 | - /** | |
| 230 | - * @copydoc Demo::ClusterStyle::ApplyStyle | |
| 231 | - */ | |
| 232 | - void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds); | |
| 233 | - | |
| 234 | -protected: | |
| 235 | - | |
| 236 | - /** | |
| 237 | - * Protected constructor see ClusterStyleRandom::New(). | |
| 238 | - */ | |
| 239 | - ClusterStyleRandom(); | |
| 240 | - | |
| 241 | -private: | |
| 242 | - | |
| 243 | -}; | |
| 244 | - | |
| 245 | -} // namespace Internal | |
| 246 | - | |
| 247 | -// Helpers for public-api forwarding methods | |
| 248 | - | |
| 249 | -inline Internal::ClusterStyle& GetImpl(Demo::ClusterStyle& pub) | |
| 250 | -{ | |
| 251 | - DALI_ASSERT_ALWAYS(pub); | |
| 252 | - | |
| 253 | - Dali::RefObject& handle = pub.GetBaseObject(); | |
| 254 | - | |
| 255 | - return static_cast<Internal::ClusterStyle&>(handle); | |
| 256 | -} | |
| 257 | - | |
| 258 | -inline const Internal::ClusterStyle& GetImpl(const Demo::ClusterStyle& pub) | |
| 259 | -{ | |
| 260 | - DALI_ASSERT_ALWAYS(pub); | |
| 261 | - | |
| 262 | - const Dali::RefObject& handle = pub.GetBaseObject(); | |
| 263 | - | |
| 264 | - return static_cast<const Internal::ClusterStyle&>(handle); | |
| 265 | -} | |
| 266 | - | |
| 267 | -} // namespace Demo | |
| 268 | - | |
| 269 | -} // namespace Dali |
examples/cluster/cluster-style.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2015 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 | -// CLASS HEADER | |
| 19 | -#include "cluster-style.h" | |
| 20 | - | |
| 21 | -// EXTERNAL INCLUDES | |
| 22 | -#include <limits> | |
| 23 | - | |
| 24 | -// INTERNAL INCLUDES | |
| 25 | -#include "cluster-style-impl.h" | |
| 26 | - | |
| 27 | -using namespace Dali; | |
| 28 | -using namespace Dali::Demo; | |
| 29 | - | |
| 30 | -namespace Dali | |
| 31 | -{ | |
| 32 | - | |
| 33 | -namespace Demo | |
| 34 | -{ | |
| 35 | - | |
| 36 | -// ClusterStyle /////////////////////////////////////////////////////////////// | |
| 37 | - | |
| 38 | -const unsigned int ClusterStyle::UNLIMITED_CHILDREN = std::numeric_limits<unsigned int>::max(); | |
| 39 | - | |
| 40 | -ClusterStyle::ClusterStyle() | |
| 41 | -{ | |
| 42 | -} | |
| 43 | - | |
| 44 | -ClusterStyle::~ClusterStyle() | |
| 45 | -{ | |
| 46 | -} | |
| 47 | - | |
| 48 | -ClusterStyle::ClusterStyle(Internal::ClusterStyle* internal) | |
| 49 | -: BaseHandle(internal) | |
| 50 | -{ | |
| 51 | -} | |
| 52 | - | |
| 53 | -unsigned int ClusterStyle::GetMaximumNumberOfChildren() const | |
| 54 | -{ | |
| 55 | - return GetImpl(*this).GetMaximumNumberOfChildren(); | |
| 56 | -} | |
| 57 | - | |
| 58 | -void ClusterStyle::ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds) | |
| 59 | -{ | |
| 60 | - GetImpl(*this).ApplyStyle(child, index, alpha, TimePeriod(durationSeconds)); | |
| 61 | -} | |
| 62 | - | |
| 63 | -void ClusterStyle::ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds) | |
| 64 | -{ | |
| 65 | - GetImpl(*this).ApplyStyleToBackground(background, alpha, TimePeriod(durationSeconds)); | |
| 66 | -} | |
| 67 | - | |
| 68 | -void ClusterStyle::ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds) | |
| 69 | -{ | |
| 70 | - GetImpl(*this).ApplyStyleToTitle(title, alpha, TimePeriod(durationSeconds)); | |
| 71 | -} | |
| 72 | - | |
| 73 | -// ClusterStyleStandard /////////////////////////////////////////////////////// | |
| 74 | - | |
| 75 | -ClusterStyleStandard ClusterStyleStandard::New(StyleType style) | |
| 76 | -{ | |
| 77 | - Internal::ClusterStylePtr internal = Internal::ClusterStyleStandard::New(style); | |
| 78 | - | |
| 79 | - return ClusterStyleStandard(internal.Get()); | |
| 80 | -} | |
| 81 | - | |
| 82 | -ClusterStyleStandard::ClusterStyleStandard(Internal::ClusterStyle* internal) | |
| 83 | -: ClusterStyle(internal) | |
| 84 | -{ | |
| 85 | -} | |
| 86 | - | |
| 87 | -// ClusterStyleRandom ///////////////////////////////////////////////////////// | |
| 88 | - | |
| 89 | -ClusterStyleRandom ClusterStyleRandom::New() | |
| 90 | -{ | |
| 91 | - Internal::ClusterStylePtr internal = Internal::ClusterStyleRandom::New(); | |
| 92 | - | |
| 93 | - return ClusterStyleRandom(internal.Get()); | |
| 94 | -} | |
| 95 | - | |
| 96 | -ClusterStyleRandom::ClusterStyleRandom(Internal::ClusterStyle* internal) | |
| 97 | -: ClusterStyle(internal) | |
| 98 | -{ | |
| 99 | -} | |
| 100 | - | |
| 101 | -} // namespace Demo | |
| 102 | - | |
| 103 | -} // namespace Dali |
examples/cluster/cluster-style.h deleted
| 1 | -#ifndef __DALI_DEMO_CLUSTER_STYLE_H__ | |
| 2 | -#define __DALI_DEMO_CLUSTER_STYLE_H__ | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2015 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 | - | |
| 21 | -// EXTERNAL INCLUDES | |
| 22 | -#include <dali/public-api/actors/actor.h> | |
| 23 | -#include <dali/public-api/animation/alpha-function.h> | |
| 24 | -#include <dali/public-api/animation/time-period.h> | |
| 25 | -#include <dali/public-api/common/dali-common.h> | |
| 26 | -#include <dali/public-api/object/base-handle.h> | |
| 27 | - | |
| 28 | -// INTERNAL INCLUDES | |
| 29 | -#include <dali-toolkit/public-api/enums.h> | |
| 30 | - | |
| 31 | -namespace Dali | |
| 32 | -{ | |
| 33 | - | |
| 34 | -class Actor; | |
| 35 | - | |
| 36 | -namespace Demo | |
| 37 | -{ | |
| 38 | - | |
| 39 | -namespace Internal DALI_INTERNAL | |
| 40 | -{ | |
| 41 | -class ClusterStyle; | |
| 42 | -class ClusterStyleRandom; | |
| 43 | -} | |
| 44 | - | |
| 45 | -class ClusterStyle; | |
| 46 | - | |
| 47 | -typedef IntrusivePtr<ClusterStyle> ClusterStylePtr; ///< Pointer to a Dali::Demo::ClusterStyle object | |
| 48 | - | |
| 49 | -/** | |
| 50 | - * @brief A ClusterStyle describes the constraints which are imposed on the child actors in the cluster. | |
| 51 | - */ | |
| 52 | -class ClusterStyle : public Dali::BaseHandle | |
| 53 | -{ | |
| 54 | -public: | |
| 55 | - | |
| 56 | - static const unsigned int UNLIMITED_CHILDREN; ///< Constant that represents an unlimited number of children. | |
| 57 | - | |
| 58 | -public: | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * @brief Destructor | |
| 62 | - * | |
| 63 | - * This is non-virtual since derived Handle types must not contain data or virtual methods. | |
| 64 | - */ | |
| 65 | - ~ClusterStyle(); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * @brief Query the maximum number of children this Style can handle. | |
| 69 | - * | |
| 70 | - * If return value is UNLIMITED_CHILDREN, then this style has no | |
| 71 | - * limit. | |
| 72 | - * @return The maximum number of children. | |
| 73 | - */ | |
| 74 | - unsigned int GetMaximumNumberOfChildren() const; | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * @brief Applies style (position) to child actor over a specified time duration. | |
| 78 | - * | |
| 79 | - * @param[in] child The child actor to apply | |
| 80 | - * @param[in] index The style position index for the actor to transform to. | |
| 81 | - * @param[in] alpha The alpha function to use. | |
| 82 | - * @param[in] durationSeconds The time period to apply this style. | |
| 83 | - */ | |
| 84 | - void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds); | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * @brief Applies style to background actor over a specified time duration. | |
| 88 | - * | |
| 89 | - * @param[in] background The background actor to apply | |
| 90 | - * @param[in] alpha The alpha function to use. | |
| 91 | - * @param[in] durationSeconds The time period to apply this style. | |
| 92 | - */ | |
| 93 | - void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds); | |
| 94 | - | |
| 95 | - /** | |
| 96 | - * @brief Applies style to title actor over a specified time duration. | |
| 97 | - * | |
| 98 | - * @param[in] title The title actor to apply | |
| 99 | - * @param[in] alpha The alpha function to use. | |
| 100 | - * @param[in] durationSeconds The time period to apply this style. | |
| 101 | - */ | |
| 102 | - void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds); | |
| 103 | - | |
| 104 | -protected: | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * @brief Create a new ClusterStyle; Only derived versions are instantiatable. | |
| 108 | - */ | |
| 109 | - ClusterStyle(); | |
| 110 | - | |
| 111 | -public: // Not intended for application developers | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * @brief This constructor is used by Dali New() methods. | |
| 115 | - * | |
| 116 | - * @param [in] internal A pointer to a newly allocated Dali resource | |
| 117 | - */ | |
| 118 | - explicit DALI_INTERNAL ClusterStyle(Internal::ClusterStyle* internal); | |
| 119 | -}; | |
| 120 | - | |
| 121 | -/** | |
| 122 | - * @brief A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster. | |
| 123 | - */ | |
| 124 | -class ClusterStyleStandard : public ClusterStyle | |
| 125 | -{ | |
| 126 | -public: | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * @brief Cluster Style type. | |
| 130 | - */ | |
| 131 | - enum StyleType | |
| 132 | - { | |
| 133 | - ClusterStyle1, ///< Style number 1 | |
| 134 | - ClusterStyle2, ///< Style number 2 | |
| 135 | - ClusterStyle3, ///< Style number 3 | |
| 136 | - ClusterStyle4, ///< Style number 4 | |
| 137 | - TotalClusterStyles ///< The number of styles | |
| 138 | - }; | |
| 139 | - | |
| 140 | -public: | |
| 141 | - | |
| 142 | - /** | |
| 143 | - * @brief Create an initialized style. | |
| 144 | - */ | |
| 145 | - static ClusterStyleStandard New(StyleType style); | |
| 146 | - | |
| 147 | -public: // Not intended for application developers | |
| 148 | - | |
| 149 | - /** | |
| 150 | - * @brief This constructor is used by Dali New() methods. | |
| 151 | - * | |
| 152 | - * @param [in] internal A pointer to a newly allocated Dali resource | |
| 153 | - */ | |
| 154 | - explicit DALI_INTERNAL ClusterStyleStandard(Internal::ClusterStyle* internal); | |
| 155 | -}; | |
| 156 | - | |
| 157 | -/** | |
| 158 | - * @brief A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster. | |
| 159 | - */ | |
| 160 | -class ClusterStyleRandom : public ClusterStyle | |
| 161 | -{ | |
| 162 | -public: | |
| 163 | - | |
| 164 | - /** | |
| 165 | - * @brief Create an initialized style. | |
| 166 | - */ | |
| 167 | - static ClusterStyleRandom New(); | |
| 168 | - | |
| 169 | -public: // Not intended for application developers | |
| 170 | - | |
| 171 | - /** | |
| 172 | - * @brief This constructor is used by Dali New() methods. | |
| 173 | - * | |
| 174 | - * @param [in] internal A pointer to a newly allocated Dali resource | |
| 175 | - */ | |
| 176 | - explicit DALI_INTERNAL ClusterStyleRandom(Internal::ClusterStyle* internal); | |
| 177 | -}; | |
| 178 | - | |
| 179 | -} // namespace Demo | |
| 180 | - | |
| 181 | -} // namespace Dali | |
| 182 | - | |
| 183 | -#endif // __DALI_TOOLKIT_CLUSTER_STYLE_H__ |
examples/cluster/cluster.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2015 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 | -// CLASS HEADER | |
| 19 | - | |
| 20 | -#include "cluster.h" | |
| 21 | - | |
| 22 | -// INTERNAL INCLUDES | |
| 23 | - | |
| 24 | -#include "cluster-impl.h" | |
| 25 | - | |
| 26 | -namespace Dali | |
| 27 | -{ | |
| 28 | - | |
| 29 | -namespace Demo | |
| 30 | -{ | |
| 31 | - | |
| 32 | -/////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 33 | -// Cluster | |
| 34 | -/////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 35 | - | |
| 36 | -const std::string Cluster::CLUSTER_ACTOR_DEPTH( "cluster-actor-depth" ); | |
| 37 | - | |
| 38 | -Cluster::Cluster() | |
| 39 | -{ | |
| 40 | -} | |
| 41 | - | |
| 42 | -Cluster::Cluster(const Cluster& cluster) | |
| 43 | -: Toolkit::Control(cluster) | |
| 44 | -{ | |
| 45 | -} | |
| 46 | - | |
| 47 | -Cluster& Cluster::operator =(const Cluster& cluster) | |
| 48 | -{ | |
| 49 | - if( &cluster != this ) | |
| 50 | - { | |
| 51 | - Toolkit::Control::operator=( cluster ); | |
| 52 | - } | |
| 53 | - return *this; | |
| 54 | -} | |
| 55 | - | |
| 56 | -Cluster::~Cluster() | |
| 57 | -{ | |
| 58 | -} | |
| 59 | - | |
| 60 | -Cluster Cluster::New( ClusterStyle& style ) | |
| 61 | -{ | |
| 62 | - return Internal::Cluster::New(style); | |
| 63 | -} | |
| 64 | - | |
| 65 | -Cluster Cluster::DownCast( BaseHandle handle ) | |
| 66 | -{ | |
| 67 | - return Toolkit::Control::DownCast<Cluster, Internal::Cluster>(handle); | |
| 68 | -} | |
| 69 | - | |
| 70 | -void Cluster::AddChild( Actor child ) | |
| 71 | -{ | |
| 72 | - GetImpl(*this).AddChild( child ); | |
| 73 | -} | |
| 74 | - | |
| 75 | -void Cluster::AddChild( Actor child, unsigned int positionIndex ) | |
| 76 | -{ | |
| 77 | - GetImpl(*this).AddChild( child, positionIndex); | |
| 78 | -} | |
| 79 | - | |
| 80 | -void Cluster::AddChildAt( Actor child, unsigned int index ) | |
| 81 | -{ | |
| 82 | - GetImpl(*this).AddChildAt( child, index ); | |
| 83 | -} | |
| 84 | - | |
| 85 | -void Cluster::AddChildAt( Actor child, unsigned int positionIndex, unsigned int index ) | |
| 86 | -{ | |
| 87 | - GetImpl(*this).AddChildAt( child, positionIndex, index ); | |
| 88 | -} | |
| 89 | - | |
| 90 | -Actor Cluster::GetChildAt( unsigned int index ) | |
| 91 | -{ | |
| 92 | - return GetImpl(*this).GetChildAt(index); | |
| 93 | -} | |
| 94 | - | |
| 95 | -Actor Cluster::RemoveChildAt( unsigned int index ) | |
| 96 | -{ | |
| 97 | - return GetImpl(*this).RemoveChildAt(index); | |
| 98 | -} | |
| 99 | - | |
| 100 | -void Cluster::ExpandChild( unsigned int index ) | |
| 101 | -{ | |
| 102 | - GetImpl(*this).ExpandChild(index); | |
| 103 | -} | |
| 104 | - | |
| 105 | -void Cluster::ExpandAllChildren() | |
| 106 | -{ | |
| 107 | - GetImpl(*this).ExpandAllChildren(); | |
| 108 | -} | |
| 109 | - | |
| 110 | -void Cluster::CollapseChild( unsigned int index, bool front ) | |
| 111 | -{ | |
| 112 | - GetImpl(*this).CollapseChild(index, front); | |
| 113 | -} | |
| 114 | - | |
| 115 | -void Cluster::CollapseAllChildren( bool front ) | |
| 116 | -{ | |
| 117 | - GetImpl(*this).CollapseAllChildren( front ); | |
| 118 | -} | |
| 119 | - | |
| 120 | -void Cluster::TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period ) | |
| 121 | -{ | |
| 122 | - GetImpl(*this).TransformChild( index, position, scale, rotation, alpha, period ); | |
| 123 | -} | |
| 124 | - | |
| 125 | -void Cluster::RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front ) | |
| 126 | -{ | |
| 127 | - GetImpl(*this).RestoreChild( index, alpha, period, front ); | |
| 128 | -} | |
| 129 | - | |
| 130 | -void Cluster::SetTitle( Actor text ) | |
| 131 | -{ | |
| 132 | - GetImpl(*this).SetTitle(text); | |
| 133 | -} | |
| 134 | - | |
| 135 | -void Cluster::SetStyle(ClusterStyle style) | |
| 136 | -{ | |
| 137 | - GetImpl(*this).SetStyle(style); | |
| 138 | -} | |
| 139 | - | |
| 140 | -ClusterStyle Cluster::GetStyle() const | |
| 141 | -{ | |
| 142 | - return GetImpl(*this).GetStyle(); | |
| 143 | -} | |
| 144 | - | |
| 145 | -unsigned int Cluster::GetExpandedCount() const | |
| 146 | -{ | |
| 147 | - return GetImpl(*this).GetExpandedCount(); | |
| 148 | -} | |
| 149 | - | |
| 150 | -unsigned int Cluster::GetTotalCount() const | |
| 151 | -{ | |
| 152 | - return GetImpl(*this).GetTotalCount(); | |
| 153 | -} | |
| 154 | - | |
| 155 | -Cluster::Cluster( Internal::Cluster& impl ) | |
| 156 | -: Toolkit::Control( impl ) | |
| 157 | -{ | |
| 158 | -} | |
| 159 | - | |
| 160 | -Cluster::Cluster( Dali::Internal::CustomActor* internal ) | |
| 161 | -: Toolkit::Control( internal ) | |
| 162 | -{ | |
| 163 | - VerifyCustomActorPointer<Internal::Cluster>(internal); | |
| 164 | -} | |
| 165 | - | |
| 166 | -} // namespace Demo | |
| 167 | - | |
| 168 | -} // namespace Dali |
examples/cluster/cluster.h deleted
| 1 | -#ifndef __DALI_DEMO_CLUSTER_H__ | |
| 2 | -#define __DALI_DEMO_CLUSTER_H__ | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2015 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 | - | |
| 21 | -// EXTERNAL INCLUDES | |
| 22 | -#include <dali/public-api/animation/alpha-function.h> | |
| 23 | -#include <dali/public-api/animation/time-period.h> | |
| 24 | - | |
| 25 | -// INTERNAL INCLUDES | |
| 26 | -#include <dali-toolkit/public-api/controls/control.h> | |
| 27 | - | |
| 28 | -namespace Dali | |
| 29 | -{ | |
| 30 | - | |
| 31 | -namespace Demo | |
| 32 | -{ | |
| 33 | - | |
| 34 | -namespace Internal DALI_INTERNAL | |
| 35 | -{ | |
| 36 | -class Cluster; | |
| 37 | -} | |
| 38 | - | |
| 39 | -class ClusterStyle; | |
| 40 | - | |
| 41 | -/** | |
| 42 | - * @brief Cluster is a container of grouped actors positioned in different cluster styles. | |
| 43 | - * | |
| 44 | - * Actions | |
| 45 | - * | %Action Name | Method | | |
| 46 | - * |---------------------------|---------------------------| | |
| 47 | - * | expand | DoExpandAction() | | |
| 48 | - * | collapse | DoCollapseAction() | | |
| 49 | - * | transform | DoTransformAction() | | |
| 50 | - */ | |
| 51 | -class Cluster : public Toolkit::Control | |
| 52 | -{ | |
| 53 | -public: | |
| 54 | - | |
| 55 | - // Custom properties | |
| 56 | - | |
| 57 | - static const std::string CLUSTER_ACTOR_DEPTH; ///< Property, name "cluster-actor-depth", type float | |
| 58 | - | |
| 59 | -public: | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * Create a Cluster handle; this can be initialised with Cluster::New() | |
| 63 | - * Calling member functions with an uninitialised handle is not allowed. | |
| 64 | - */ | |
| 65 | - Cluster(); | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * Copy Constructor. | |
| 69 | - */ | |
| 70 | - Cluster( const Cluster& cluster ); | |
| 71 | - | |
| 72 | - /** | |
| 73 | - * Assignment Operator. | |
| 74 | - */ | |
| 75 | - Cluster& operator=( const Cluster& cluster ); | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * @brief Destructor | |
| 79 | - * | |
| 80 | - * This is non-virtual since derived Handle types must not contain data or virtual methods. | |
| 81 | - */ | |
| 82 | - ~Cluster(); | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * Create the Cluster control with the given style. | |
| 86 | - * @param[in] style The style of the cluster | |
| 87 | - * @return A handle to the Cluster control. | |
| 88 | - */ | |
| 89 | - static Cluster New( ClusterStyle& style ); | |
| 90 | - | |
| 91 | - /** | |
| 92 | - * Downcast an Object handle to Cluster. If handle points to a Cluster the | |
| 93 | - * downcast produces valid handle. If not the returned handle is left uninitialized. | |
| 94 | - * @param[in] handle Handle to an object | |
| 95 | - * @return handle to a Cluster or an uninitialized handle | |
| 96 | - */ | |
| 97 | - static Cluster DownCast( BaseHandle handle ); | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * Adds a child to the Cluster | |
| 101 | - * Will automatically choose a position for the child. | |
| 102 | - * @pre The child actor has been initialized. | |
| 103 | - * @param[in] child The child to add | |
| 104 | - */ | |
| 105 | - void AddChild( Actor child ); | |
| 106 | - | |
| 107 | - /** | |
| 108 | - * Adds a child to the Cluster | |
| 109 | - * User specifies the position for the child. | |
| 110 | - * @pre The child actor has been initialized. | |
| 111 | - * @param[in] child The child to add | |
| 112 | - * @param[in] positionIndex The position for this child | |
| 113 | - */ | |
| 114 | - void AddChild( Actor child, unsigned int positionIndex ); | |
| 115 | - | |
| 116 | - /** | |
| 117 | - * Adds a child to the Cluster to be inserted at a specified | |
| 118 | - * depth index. | |
| 119 | - * Will automatically choose a position for the child. | |
| 120 | - * @pre The child actor has been initialized. | |
| 121 | - * @param[in] child The child to add | |
| 122 | - * @param[in] index The depth position for this child | |
| 123 | - */ | |
| 124 | - void AddChildAt( Actor child, unsigned int index ); | |
| 125 | - | |
| 126 | - /** | |
| 127 | - * Adds a child to the Cluster to be inserted at a specified | |
| 128 | - * depth index. | |
| 129 | - * User specifies the position for the child. | |
| 130 | - * @pre The child actor has been initialized. | |
| 131 | - * @param[in] child The child to add | |
| 132 | - * @param[in] positionIndex The position for this child | |
| 133 | - * @param[in] index The depth position for this child | |
| 134 | - */ | |
| 135 | - void AddChildAt( Actor child, unsigned int positionIndex, unsigned int index ); | |
| 136 | - | |
| 137 | - /** | |
| 138 | - * Returns a child from the given layout position | |
| 139 | - * Note! if there is no child in this layout position this method returns an uninitialized | |
| 140 | - * Actor handle | |
| 141 | - * @param[in] index The child index in the cluster | |
| 142 | - * @return The child that was in the layout position or an uninitialized handle | |
| 143 | - */ | |
| 144 | - Actor GetChildAt( unsigned int index ); | |
| 145 | - | |
| 146 | - /** | |
| 147 | - * Removes a child from the given layout position | |
| 148 | - * Note! if there is no child in this layout position this method does nothing | |
| 149 | - * @param[in] index The index of the child to remove | |
| 150 | - * @return The child that was removed or an uninitialized handle | |
| 151 | - */ | |
| 152 | - Actor RemoveChildAt( unsigned int index ); | |
| 153 | - | |
| 154 | - /** | |
| 155 | - * Expands a child | |
| 156 | - * A child will move away from the cluster. | |
| 157 | - * @param[in] index The child position index to expand | |
| 158 | - */ | |
| 159 | - void ExpandChild( unsigned int index ); | |
| 160 | - | |
| 161 | - /** | |
| 162 | - * Expands all children | |
| 163 | - * All children that have been collapsed will | |
| 164 | - * move away from the cluster | |
| 165 | - */ | |
| 166 | - void ExpandAllChildren(); | |
| 167 | - | |
| 168 | - /** | |
| 169 | - * Collapses a child | |
| 170 | - * A child that has been expanded will move | |
| 171 | - * back to its original positions. | |
| 172 | - * @param[in] index The child index to collapse | |
| 173 | - * @param[in] front Whether to move child to the front or | |
| 174 | - * back of cluster (depth). | |
| 175 | - */ | |
| 176 | - void CollapseChild( unsigned int index, bool front = false ); | |
| 177 | - | |
| 178 | - /** | |
| 179 | - * Collapses all children. | |
| 180 | - * All children that have been expanded will move | |
| 181 | - * back to their original positions. | |
| 182 | - * @param[in] front Whether to move child to the front or | |
| 183 | - * back of cluster (depth). | |
| 184 | - */ | |
| 185 | - void CollapseAllChildren( bool front = false ); | |
| 186 | - | |
| 187 | - /** | |
| 188 | - * Transforms Actor from default transform to new transform | |
| 189 | - * @param[in] index The child index to move | |
| 190 | - * @param[in] position The position to move to | |
| 191 | - * @param[in] scale The scale to change to | |
| 192 | - * @param[in] rotation The rotation to change to | |
| 193 | - * @param[in] alpha The alpha function to use to tween to this transform | |
| 194 | - * @param[in] period The duration for this transformation to take | |
| 195 | - */ | |
| 196 | - void TransformChild( unsigned int index, const Vector3& position, const Vector3& scale, const Quaternion& rotation, AlphaFunction alpha, const TimePeriod& period ); | |
| 197 | - | |
| 198 | - /** | |
| 199 | - * Restores Actor to the default transform (based on current style) | |
| 200 | - * @param[in] index The child index to move back | |
| 201 | - * @param[in] alpha The alpha function to use to tween to this transform | |
| 202 | - * @param[in] period The duration for this transformation to take | |
| 203 | - * @param[in] front Whether to move child to the front or | |
| 204 | - * back of cluster (depth). | |
| 205 | - */ | |
| 206 | - void RestoreChild( unsigned int index, AlphaFunction alpha, const TimePeriod& period, bool front = false ); | |
| 207 | - | |
| 208 | - /** | |
| 209 | - * Sets the title. | |
| 210 | - * | |
| 211 | - * @param[in] text Title text. | |
| 212 | - */ | |
| 213 | - void SetTitle( Actor text ); | |
| 214 | - | |
| 215 | - /** | |
| 216 | - * Sets the style of the cluster | |
| 217 | - * @param[in] style The style of the cluster | |
| 218 | - */ | |
| 219 | - void SetStyle(ClusterStyle style); | |
| 220 | - | |
| 221 | - /** | |
| 222 | - * Gets the style of the cluster | |
| 223 | - * @return style of the cluster | |
| 224 | - */ | |
| 225 | - ClusterStyle GetStyle() const; | |
| 226 | - | |
| 227 | - /** | |
| 228 | - * Gets the number of children that have been expanded in this cluster. | |
| 229 | - * @return the number of children expanded. | |
| 230 | - */ | |
| 231 | - unsigned int GetExpandedCount() const; | |
| 232 | - | |
| 233 | - /** | |
| 234 | - * Gets the number of children that have been added to this cluster. | |
| 235 | - * @return the total number of children. | |
| 236 | - */ | |
| 237 | - unsigned int GetTotalCount() const; | |
| 238 | - | |
| 239 | -public: // Not intended for application developers | |
| 240 | - | |
| 241 | - /** | |
| 242 | - * Creates a handle using the Toolkit::Internal implementation. | |
| 243 | - * @param[in] implementation The Control implementation. | |
| 244 | - */ | |
| 245 | - DALI_INTERNAL Cluster( Internal::Cluster& implementation ); | |
| 246 | - | |
| 247 | - /** | |
| 248 | - * Allows the creation of this Control from an Internal::CustomActor pointer. | |
| 249 | - * @param[in] internal A pointer to the internal CustomActor. | |
| 250 | - */ | |
| 251 | - explicit DALI_INTERNAL Cluster( Dali::Internal::CustomActor* internal ); | |
| 252 | -}; | |
| 253 | - | |
| 254 | -} // namespace Toolkit | |
| 255 | - | |
| 256 | -} // namespace Dali | |
| 257 | - | |
| 258 | -#endif // __DALI_DEMO_CLUSTER_H__ |
resources/scripts/animated-buttons.json
| ... | ... | @@ -208,12 +208,7 @@ |
| 208 | 208 | 1 |
| 209 | 209 | ], |
| 210 | 210 | "sizeAspectRatio": false, |
| 211 | - "background-color": [ | |
| 212 | - 1, | |
| 213 | - 1, | |
| 214 | - 1, | |
| 215 | - 1 | |
| 216 | - ], | |
| 211 | + "background": {"color": [ 1, 1, 1, 1 ]}, | |
| 217 | 212 | "color": [ |
| 218 | 213 | 1, |
| 219 | 214 | 1, |
| ... | ... | @@ -237,12 +232,7 @@ |
| 237 | 232 | 1 |
| 238 | 233 | ], |
| 239 | 234 | "sizeAspectRatio": false, |
| 240 | - "background-color": [ | |
| 241 | - 1, | |
| 242 | - 1, | |
| 243 | - 1, | |
| 244 | - 1 | |
| 245 | - ], | |
| 235 | + "background": {"color": [ 1, 1, 1, 1 ]}, | |
| 246 | 236 | "color": [ |
| 247 | 237 | 1, |
| 248 | 238 | 1, | ... | ... |
resources/scripts/animated-colors.json
| ... | ... | @@ -44,12 +44,7 @@ |
| 44 | 44 | 1 |
| 45 | 45 | ], |
| 46 | 46 | "sizeAspectRatio": false, |
| 47 | - "background-color": [ | |
| 48 | - 1, | |
| 49 | - 1, | |
| 50 | - 1, | |
| 51 | - 1 | |
| 52 | - ], | |
| 47 | + "background": { "color": [1,1,1,1] }, | |
| 53 | 48 | "color": [ |
| 54 | 49 | 0.5686274509803921, |
| 55 | 50 | 0.5294117647058824, |
| ... | ... | @@ -85,12 +80,7 @@ |
| 85 | 80 | 1 |
| 86 | 81 | ], |
| 87 | 82 | "sizeAspectRatio": false, |
| 88 | - "background-color": [ | |
| 89 | - 1, | |
| 90 | - 1, | |
| 91 | - 1, | |
| 92 | - 1 | |
| 93 | - ], | |
| 83 | + "background": { "color": [1,1,1,1] }, | |
| 94 | 84 | "color": [ |
| 95 | 85 | 0.17647058823529413, |
| 96 | 86 | 0.5686274509803921, |
| ... | ... | @@ -126,12 +116,7 @@ |
| 126 | 116 | 1 |
| 127 | 117 | ], |
| 128 | 118 | "sizeAspectRatio": false, |
| 129 | - "background-color": [ | |
| 130 | - 1, | |
| 131 | - 1, | |
| 132 | - 1, | |
| 133 | - 1 | |
| 134 | - ], | |
| 119 | + "background": { "color": [1,1,1,1] }, | |
| 135 | 120 | "color": [ |
| 136 | 121 | 0.7411764705882353, |
| 137 | 122 | 0, |
| ... | ... | @@ -163,12 +148,7 @@ |
| 163 | 148 | 1 |
| 164 | 149 | ], |
| 165 | 150 | "sizeAspectRatio": false, |
| 166 | - "background-color": [ | |
| 167 | - 1, | |
| 168 | - 1, | |
| 169 | - 1, | |
| 170 | - 1 | |
| 171 | - ], | |
| 151 | + "background": { "color": [1,1,1,1] }, | |
| 172 | 152 | "color": [ |
| 173 | 153 | 0.23137254901960785, |
| 174 | 154 | 0.09803921568627451, |
| ... | ... | @@ -204,12 +184,7 @@ |
| 204 | 184 | 1 |
| 205 | 185 | ], |
| 206 | 186 | "sizeAspectRatio": false, |
| 207 | - "background-color": [ | |
| 208 | - 1, | |
| 209 | - 1, | |
| 210 | - 1, | |
| 211 | - 1 | |
| 212 | - ], | |
| 187 | + "background": { "color": [1,1,1,1] }, | |
| 213 | 188 | "color": [ |
| 214 | 189 | 0.17647058823529413, |
| 215 | 190 | 0.24313725490196078, |
| ... | ... | @@ -245,12 +220,7 @@ |
| 245 | 220 | 1 |
| 246 | 221 | ], |
| 247 | 222 | "sizeAspectRatio": false, |
| 248 | - "background-color": [ | |
| 249 | - 1, | |
| 250 | - 1, | |
| 251 | - 1, | |
| 252 | - 1 | |
| 253 | - ], | |
| 223 | + "background": { "color": [1,1,1,1] }, | |
| 254 | 224 | "color": [ |
| 255 | 225 | 0.396078431372549, |
| 256 | 226 | 0.29411764705882354, |
| ... | ... | @@ -282,12 +252,7 @@ |
| 282 | 252 | 1 |
| 283 | 253 | ], |
| 284 | 254 | "sizeAspectRatio": false, |
| 285 | - "background-color": [ | |
| 286 | - 1, | |
| 287 | - 1, | |
| 288 | - 1, | |
| 289 | - 1 | |
| 290 | - ], | |
| 255 | + "background": { "color": [1,1,1,1] }, | |
| 291 | 256 | "color": [ |
| 292 | 257 | 0, |
| 293 | 258 | 0.6901960784313725, |
| ... | ... | @@ -323,12 +288,7 @@ |
| 323 | 288 | 1 |
| 324 | 289 | ], |
| 325 | 290 | "sizeAspectRatio": false, |
| 326 | - "background-color": [ | |
| 327 | - 1, | |
| 328 | - 1, | |
| 329 | - 1, | |
| 330 | - 1 | |
| 331 | - ], | |
| 291 | + "background": { "color": [1,1,1,1] }, | |
| 332 | 292 | "color": [ |
| 333 | 293 | 0.20784313725490197, |
| 334 | 294 | 0.5686274509803921, |
| ... | ... | @@ -364,12 +324,7 @@ |
| 364 | 324 | 1 |
| 365 | 325 | ], |
| 366 | 326 | "sizeAspectRatio": false, |
| 367 | - "background-color": [ | |
| 368 | - 1, | |
| 369 | - 1, | |
| 370 | - 1, | |
| 371 | - 1 | |
| 372 | - ], | |
| 327 | + "background": { "color": [1,1,1,1] }, | |
| 373 | 328 | "color": [ |
| 374 | 329 | 0.4196078431372549, |
| 375 | 330 | 0.047058823529411764, |
| ... | ... | @@ -401,12 +356,7 @@ |
| 401 | 356 | 1 |
| 402 | 357 | ], |
| 403 | 358 | "sizeAspectRatio": false, |
| 404 | - "background-color": [ | |
| 405 | - 1, | |
| 406 | - 1, | |
| 407 | - 1, | |
| 408 | - 1 | |
| 409 | - ], | |
| 359 | + "background": { "color": [1,1,1,1] }, | |
| 410 | 360 | "color": [ |
| 411 | 361 | 0.47843137254901963, |
| 412 | 362 | 0.42745098039215684, |
| ... | ... | @@ -438,12 +388,7 @@ |
| 438 | 388 | 1 |
| 439 | 389 | ], |
| 440 | 390 | "sizeAspectRatio": false, |
| 441 | - "background-color": [ | |
| 442 | - 1, | |
| 443 | - 1, | |
| 444 | - 1, | |
| 445 | - 1 | |
| 446 | - ], | |
| 391 | + "background": { "color": [1,1,1,1] }, | |
| 447 | 392 | "color": [ |
| 448 | 393 | 0.4470588235294118, |
| 449 | 394 | 0.45098039215686275, |
| ... | ... | @@ -475,12 +420,7 @@ |
| 475 | 420 | 1 |
| 476 | 421 | ], |
| 477 | 422 | "sizeAspectRatio": false, |
| 478 | - "background-color": [ | |
| 479 | - 1, | |
| 480 | - 1, | |
| 481 | - 1, | |
| 482 | - 1 | |
| 483 | - ], | |
| 423 | + "background": { "color": [1,1,1,1] }, | |
| 484 | 424 | "color": [ |
| 485 | 425 | 1, |
| 486 | 426 | 0.4823529411764706, |
| ... | ... | @@ -512,12 +452,7 @@ |
| 512 | 452 | 1 |
| 513 | 453 | ], |
| 514 | 454 | "sizeAspectRatio": false, |
| 515 | - "background-color": [ | |
| 516 | - 1, | |
| 517 | - 1, | |
| 518 | - 1, | |
| 519 | - 1 | |
| 520 | - ], | |
| 455 | + "background": { "color": [1,1,1,1] }, | |
| 521 | 456 | "color": [ |
| 522 | 457 | 0.43137254901960786, |
| 523 | 458 | 0, |
| ... | ... | @@ -553,12 +488,7 @@ |
| 553 | 488 | 1 |
| 554 | 489 | ], |
| 555 | 490 | "sizeAspectRatio": false, |
| 556 | - "background-color": [ | |
| 557 | - 1, | |
| 558 | - 1, | |
| 559 | - 1, | |
| 560 | - 1 | |
| 561 | - ], | |
| 491 | + "background": { "color": [1,1,1,1] }, | |
| 562 | 492 | "color": [ |
| 563 | 493 | 0.8196078431372549, |
| 564 | 494 | 0.5803921568627451, |
| ... | ... | @@ -590,12 +520,7 @@ |
| 590 | 520 | 1 |
| 591 | 521 | ], |
| 592 | 522 | "sizeAspectRatio": false, |
| 593 | - "background-color": [ | |
| 594 | - 1, | |
| 595 | - 1, | |
| 596 | - 1, | |
| 597 | - 1 | |
| 598 | - ], | |
| 523 | + "background": { "color": [1,1,1,1] }, | |
| 599 | 524 | "color": [ |
| 600 | 525 | 0.6313725490196078, |
| 601 | 526 | 0.6274509803921569, |
| ... | ... | @@ -634,12 +559,7 @@ |
| 634 | 559 | 1 |
| 635 | 560 | ], |
| 636 | 561 | "sizeAspectRatio": false, |
| 637 | - "background-color": [ | |
| 638 | - 1, | |
| 639 | - 1, | |
| 640 | - 1, | |
| 641 | - 1 | |
| 642 | - ], | |
| 562 | + "background": { "color": [1,1,1,1] }, | |
| 643 | 563 | "color": [ |
| 644 | 564 | 0.9176470588235294, |
| 645 | 565 | 0, |
| ... | ... | @@ -671,12 +591,7 @@ |
| 671 | 591 | 1 |
| 672 | 592 | ], |
| 673 | 593 | "sizeAspectRatio": false, |
| 674 | - "background-color": [ | |
| 675 | - 1, | |
| 676 | - 1, | |
| 677 | - 1, | |
| 678 | - 1 | |
| 679 | - ], | |
| 594 | + "background": { "color": [1,1,1,1] }, | |
| 680 | 595 | "color": [ |
| 681 | 596 | 0.24313725490196078, |
| 682 | 597 | 0.25882352941176473, |
| ... | ... | @@ -709,12 +624,7 @@ |
| 709 | 624 | 1 |
| 710 | 625 | ], |
| 711 | 626 | "sizeAspectRatio": false, |
| 712 | - "background-color": [ | |
| 713 | - 1, | |
| 714 | - 1, | |
| 715 | - 1, | |
| 716 | - 1 | |
| 717 | - ], | |
| 627 | + "background": { "color": [1,1,1,1] }, | |
| 718 | 628 | "color": [ |
| 719 | 629 | 0, |
| 720 | 630 | 1, |
| ... | ... | @@ -753,12 +663,7 @@ |
| 753 | 663 | 1 |
| 754 | 664 | ], |
| 755 | 665 | "sizeAspectRatio": false, |
| 756 | - "background-color": [ | |
| 757 | - 1, | |
| 758 | - 1, | |
| 759 | - 1, | |
| 760 | - 1 | |
| 761 | - ], | |
| 666 | + "background": { "color": [1,1,1,1] }, | |
| 762 | 667 | "color": [ |
| 763 | 668 | 1, |
| 764 | 669 | 0.8980392156862745, |
| ... | ... | @@ -790,12 +695,7 @@ |
| 790 | 695 | 1 |
| 791 | 696 | ], |
| 792 | 697 | "sizeAspectRatio": false, |
| 793 | - "background-color": [ | |
| 794 | - 1, | |
| 795 | - 1, | |
| 796 | - 1, | |
| 797 | - 1 | |
| 798 | - ], | |
| 698 | + "background": { "color": [1,1,1,1] }, | |
| 799 | 699 | "color": [ |
| 800 | 700 | 0, |
| 801 | 701 | 0.6, |
| ... | ... | @@ -828,12 +728,7 @@ |
| 828 | 728 | 1 |
| 829 | 729 | ], |
| 830 | 730 | "sizeAspectRatio": false, |
| 831 | - "background-color": [ | |
| 832 | - 1, | |
| 833 | - 1, | |
| 834 | - 1, | |
| 835 | - 1 | |
| 836 | - ], | |
| 731 | + "background": { "color": [1,1,1,1] }, | |
| 837 | 732 | "color": [ |
| 838 | 733 | 1, |
| 839 | 734 | 0, |
| ... | ... | @@ -865,12 +760,7 @@ |
| 865 | 760 | 1 |
| 866 | 761 | ], |
| 867 | 762 | "sizeAspectRatio": false, |
| 868 | - "background-color": [ | |
| 869 | - 1, | |
| 870 | - 1, | |
| 871 | - 1, | |
| 872 | - 1 | |
| 873 | - ], | |
| 763 | + "background": { "color": [1,1,1,1] }, | |
| 874 | 764 | "color": [ |
| 875 | 765 | 0.01568627450980392, |
| 876 | 766 | 0, |
| ... | ... | @@ -902,12 +792,7 @@ |
| 902 | 792 | 1 |
| 903 | 793 | ], |
| 904 | 794 | "sizeAspectRatio": false, |
| 905 | - "background-color": [ | |
| 906 | - 1, | |
| 907 | - 1, | |
| 908 | - 1, | |
| 909 | - 1 | |
| 910 | - ], | |
| 795 | + "background": { "color": [1,1,1,1] }, | |
| 911 | 796 | "color": [ |
| 912 | 797 | 0.2784313725490196, |
| 913 | 798 | 0.1803921568627451, |
| ... | ... | @@ -959,12 +844,7 @@ |
| 959 | 844 | 1 |
| 960 | 845 | ], |
| 961 | 846 | "sizeAspectRatio": false, |
| 962 | - "background-color": [ | |
| 963 | - 1, | |
| 964 | - 1, | |
| 965 | - 1, | |
| 966 | - 1 | |
| 967 | - ], | |
| 847 | + "background": { "color": [1,1,1,1] }, | |
| 968 | 848 | "color": [ |
| 969 | 849 | 0.1568627450980392, |
| 970 | 850 | 0.9215686274509803, | ... | ... |
resources/scripts/background-color.json
| ... | ... | @@ -23,10 +23,12 @@ |
| 23 | 23 | "text": "Hello World", |
| 24 | 24 | "parent-origin": "TOP_CENTER", |
| 25 | 25 | "anchor-point": "TOP_CENTER", |
| 26 | - "background-color": [1, 0, 0, 1], | |
| 27 | 26 | "position": [0, 50, 0], |
| 28 | 27 | "point-size": 40, |
| 29 | - "size": [400, 150, 1] | |
| 28 | + "size": [400, 150, 1], | |
| 29 | + "background":{ | |
| 30 | + "color": [1, 0, 0, 1] | |
| 31 | + } | |
| 30 | 32 | }, |
| 31 | 33 | |
| 32 | 34 | // A container with a yellow background |
| ... | ... | @@ -35,8 +37,10 @@ |
| 35 | 37 | "relayout-enabled": false, |
| 36 | 38 | "parent-origin": "CENTER", |
| 37 | 39 | "anchor-point": "BOTTOM_CENTER", |
| 38 | - "background-color": [1, 1, 0, 1], | |
| 39 | - "size": [400, 150, 1] | |
| 40 | + "size": [400, 150, 1], | |
| 41 | + "background":{ | |
| 42 | + "color": [1, 1, 0, 1] | |
| 43 | + } | |
| 40 | 44 | }, |
| 41 | 45 | |
| 42 | 46 | // A container with an image |
| ... | ... | @@ -46,7 +50,7 @@ |
| 46 | 50 | "parent-origin": "CENTER", |
| 47 | 51 | "anchor-point": "TOP_CENTER", |
| 48 | 52 | "size": [400, 150, 1], |
| 49 | - "background-image": { | |
| 53 | + "background": { | |
| 50 | 54 | "filename": "{DALI_IMAGE_DIR}button-background.png" |
| 51 | 55 | } |
| 52 | 56 | }, |
| ... | ... | @@ -58,8 +62,7 @@ |
| 58 | 62 | "parent-origin": "BOTTOM_CENTER", |
| 59 | 63 | "anchor-point": "BOTTOM_CENTER", |
| 60 | 64 | "size": [400, 150, 1], |
| 61 | - "background-color": [0, 0, 1, 1], | |
| 62 | - "background-image": { | |
| 65 | + "background": { | |
| 63 | 66 | "filename": "{DALI_IMAGE_DIR}button-background.png" |
| 64 | 67 | } |
| 65 | 68 | } | ... | ... |
resources/scripts/choreography.json
| ... | ... | @@ -28,12 +28,7 @@ |
| 28 | 28 | 60, |
| 29 | 29 | 1 |
| 30 | 30 | ], |
| 31 | - "background-color": [ | |
| 32 | - 0.95, | |
| 33 | - 0.41, | |
| 34 | - 0.18, | |
| 35 | - 1 | |
| 36 | - ], | |
| 31 | + "background": {"color": [0.95, 0.41, 0.18, 1] }, | |
| 37 | 32 | "color-alpha": 0 |
| 38 | 33 | } |
| 39 | 34 | }, |
| ... | ... | @@ -54,12 +49,7 @@ |
| 54 | 49 | 1 |
| 55 | 50 | ], |
| 56 | 51 | "sizeAspectRatio": false, |
| 57 | - "background-color": [ | |
| 58 | - 0.85, | |
| 59 | - 0.75, | |
| 60 | - 0.45, | |
| 61 | - 1 | |
| 62 | - ], | |
| 52 | + "background": { "color": [0.85, 0.75, 0.45, 1] }, | |
| 63 | 53 | "color-alpha": 0 |
| 64 | 54 | }, |
| 65 | 55 | { | ... | ... |
resources/scripts/contacts.json
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | "stage": [ |
| 3 | 3 | { |
| 4 | 4 | "type": "Control", |
| 5 | - "background-color": [ 1, 1, 1, 1 ], | |
| 5 | + "background": {"color": [ 1, 1, 1, 1 ]}, | |
| 6 | 6 | "parent-origin": "TOP_LEFT", |
| 7 | 7 | "anchor-point": "TOP_LEFT", |
| 8 | 8 | "draw-mode": "STENCIL", |
| ... | ... | @@ -79,12 +79,7 @@ |
| 79 | 79 | 1 |
| 80 | 80 | ], |
| 81 | 81 | "sizeAspectRatio": false, |
| 82 | - "background-color": [ | |
| 83 | - 1, | |
| 84 | - 1, | |
| 85 | - 1, | |
| 86 | - 1 | |
| 87 | - ], | |
| 82 | + "background": {"color": [ 1, 1, 1, 1 ]}, | |
| 88 | 83 | "color": [ |
| 89 | 84 | 1, |
| 90 | 85 | 1, |
| ... | ... | @@ -327,12 +322,12 @@ |
| 327 | 322 | 1 |
| 328 | 323 | ], |
| 329 | 324 | "sizeAspectRatio": false, |
| 330 | - "background-color": [ | |
| 325 | + "background": {"color": [ | |
| 331 | 326 | 0.788235294117647, |
| 332 | 327 | 0.7647058823529411, |
| 333 | 328 | 0.7647058823529411, |
| 334 | 329 | 1 |
| 335 | - ], | |
| 330 | + ] }, | |
| 336 | 331 | "color": [ |
| 337 | 332 | 0.788235294117647, |
| 338 | 333 | 0.7647058823529411, | ... | ... |
resources/scripts/gallery.json
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | "selection-type": |
| 5 | 5 | { |
| 6 | 6 | "type": "Control", |
| 7 | - "background-color": [ 1, 0.5, 0, 0.6 ], | |
| 7 | + "background": {"color": [ 1, 0.5, 0, 0.6 ]}, | |
| 8 | 8 | "color-alpha": 0.05, |
| 9 | 9 | "parent-origin": "CENTER", |
| 10 | 10 | "anchor-point": "CENTER", |
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | { |
| 38 | 38 | "type": "Control", |
| 39 | 39 | "name": "stencil", |
| 40 | - "background-color": [ 1, 1, 1, 1 ], | |
| 40 | + "background": {"color": [ 1, 1, 1, 1 ]}, | |
| 41 | 41 | "parent-origin": "CENTER", |
| 42 | 42 | "anchor-point": "CENTER", |
| 43 | 43 | "draw-mode": "STENCIL", | ... | ... |
resources/scripts/music-library.json
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | "stage": [ |
| 3 | 3 | { |
| 4 | 4 | "type": "Control", |
| 5 | - "background-color": [ 1, 1, 1, 1 ], | |
| 5 | + "background": {"color": [ 1, 1, 1, 1 ]}, | |
| 6 | 6 | "parent-origin": "TOP_LEFT", |
| 7 | 7 | "anchor-point": "TOP_LEFT", |
| 8 | 8 | "draw-mode": "STENCIL", |
| ... | ... | @@ -121,12 +121,12 @@ |
| 121 | 121 | 1 |
| 122 | 122 | ], |
| 123 | 123 | "sizeAspectRatio": false, |
| 124 | - "background-color": [ | |
| 124 | + "background":{"color": [ | |
| 125 | 125 | 0, |
| 126 | 126 | 0, |
| 127 | 127 | 0, |
| 128 | 128 | 1 |
| 129 | - ] | |
| 129 | + ]} | |
| 130 | 130 | }, |
| 131 | 131 | { |
| 132 | 132 | "type": "Control", |
| ... | ... | @@ -164,12 +164,12 @@ |
| 164 | 164 | 1 |
| 165 | 165 | ], |
| 166 | 166 | "sizeAspectRatio": false, |
| 167 | - "background-color": [ | |
| 167 | + "background":{ "color": [ | |
| 168 | 168 | 0.33725490196078434, |
| 169 | 169 | 0.7568627450980392, |
| 170 | 170 | 0.6509803921568628, |
| 171 | 171 | 1 |
| 172 | - ], | |
| 172 | + ]}, | |
| 173 | 173 | "color": [ |
| 174 | 174 | 0.33725490196078434, |
| 175 | 175 | 0.7568627450980392, |
| ... | ... | @@ -218,12 +218,12 @@ |
| 218 | 218 | 1 |
| 219 | 219 | ], |
| 220 | 220 | "sizeAspectRatio": false, |
| 221 | - "background-color": [ | |
| 221 | + "background": {"color": [ | |
| 222 | 222 | 1, |
| 223 | 223 | 1, |
| 224 | 224 | 1, |
| 225 | 225 | 1 |
| 226 | - ], | |
| 226 | + ]}, | |
| 227 | 227 | "color": [ |
| 228 | 228 | 1, |
| 229 | 229 | 1, |
| ... | ... | @@ -274,12 +274,12 @@ |
| 274 | 274 | 1 |
| 275 | 275 | ], |
| 276 | 276 | "sizeAspectRatio": false, |
| 277 | - "background-color": [ | |
| 277 | + "background":{ "color": [ | |
| 278 | 278 | 0.18823529411764706, |
| 279 | 279 | 0.3411764705882353, |
| 280 | 280 | 0.403921568627451, |
| 281 | 281 | 1 |
| 282 | - ] | |
| 282 | + ]} | |
| 283 | 283 | }, |
| 284 | 284 | { |
| 285 | 285 | "type": "ImageActor", | ... | ... |
resources/scripts/table-view.json
resources/scripts/timing.json
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | "size": [ 100, 100, 1 ], |
| 10 | 10 | "scale": [ 0.1, 0.1, 1 ], |
| 11 | 11 | "color-alpha": 0, |
| 12 | - "background-color": [ 0.95, 0.65, 0.1, 1 ] | |
| 12 | + "background":{ "color": [ 0.95, 0.65, 0.1, 1 ] } | |
| 13 | 13 | } |
| 14 | 14 | }, |
| 15 | 15 | "stage": [ |
| ... | ... | @@ -103,12 +103,12 @@ |
| 103 | 103 | 0, |
| 104 | 104 | -1 |
| 105 | 105 | ], |
| 106 | - "background-color": [ | |
| 106 | + "background": {"color": [ | |
| 107 | 107 | 1, |
| 108 | 108 | 1, |
| 109 | 109 | 1, |
| 110 | 110 | 1 |
| 111 | - ], | |
| 111 | + ]}, | |
| 112 | 112 | "signals": [ |
| 113 | 113 | { |
| 114 | 114 | "name": "tapped", | ... | ... |
shared/dali-demo-strings.h
| ... | ... | @@ -34,7 +34,6 @@ extern "C" |
| 34 | 34 | |
| 35 | 35 | #define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES") |
| 36 | 36 | #define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS") |
| 37 | -#define DALI_DEMO_STR_TITLE_CLUSTER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLUSTER") | |
| 38 | 37 | #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION") |
| 39 | 38 | #define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION") |
| 40 | 39 | #define DALI_DEMO_STR_TITLE_ITEM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_ITEM_VIEW") |
| ... | ... | @@ -66,7 +65,6 @@ extern "C" |
| 66 | 65 | |
| 67 | 66 | #define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles" |
| 68 | 67 | #define DALI_DEMO_STR_TITLE_BLOCKS "Blocks" |
| 69 | -#define DALI_DEMO_STR_TITLE_CLUSTER "Cluster" | |
| 70 | 68 | #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect" |
| 71 | 69 | #define DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION "Dissolve Effect" |
| 72 | 70 | #define DALI_DEMO_STR_TITLE_ITEM_VIEW "Item View" | ... | ... |