Commit 7acc69bd1dd3f854c264ef024aab47d898e9d663
1 parent
e7a3178c
Removing native Layouting demos
Change-Id: Ibd44ae369a7f6d32b378cba80485b541c6ff0e3c
Showing
28 changed files
with
15 additions
and
2855 deletions
examples-reel/dali-examples-reel.cpp
| ... | ... | @@ -61,7 +61,6 @@ int DALI_EXPORT_API main(int argc, char **argv) |
| 61 | 61 | demo.AddExample(Example("image-view-pixel-area.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA)); |
| 62 | 62 | demo.AddExample(Example("image-view-svg.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG)); |
| 63 | 63 | demo.AddExample(Example("image-view-url.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW_URL)); |
| 64 | - demo.AddExample(Example("layouting.example", DALI_DEMO_STR_TITLE_LAYOUTING)); | |
| 65 | 64 | demo.AddExample(Example("line-mesh.example", DALI_DEMO_STR_TITLE_LINE_MESH)); |
| 66 | 65 | demo.AddExample(Example("magnifier.example", DALI_DEMO_STR_TITLE_MAGNIFIER)); |
| 67 | 66 | demo.AddExample(Example("mesh-morph.example", DALI_DEMO_STR_TITLE_MESH_MORPH)); | ... | ... |
examples/layouting/absolute-example.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2017 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 <string> | |
| 19 | -#include "absolute-example.h" | |
| 20 | -#include "layout-utilities.h" | |
| 21 | -#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h> | |
| 22 | -#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 23 | -#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 24 | -#include <dali-toolkit/devel-api/layouting/absolute-layout.h> | |
| 25 | - | |
| 26 | -using namespace Dali; | |
| 27 | -using namespace Dali::Toolkit; | |
| 28 | - | |
| 29 | - | |
| 30 | -namespace | |
| 31 | -{ | |
| 32 | -const char* const TITLE = "Absolute Example"; | |
| 33 | - | |
| 34 | -struct ImageDetails | |
| 35 | -{ | |
| 36 | - const char * name; | |
| 37 | - Vector2 position; | |
| 38 | - Size size; | |
| 39 | -}; | |
| 40 | - | |
| 41 | -ImageDetails IMAGES[] = | |
| 42 | -{ | |
| 43 | - { DEMO_IMAGE_DIR "gallery-small-23.jpg", Vector2( 0.0f, 0.0f ), Size( 100.0f, 100.0f ) }, | |
| 44 | - { DEMO_IMAGE_DIR "gallery-small-23.jpg", Vector2( 100.0f, 0.0f ), Size( 100.0f, 100.0f ) }, | |
| 45 | - { DEMO_IMAGE_DIR "gallery-small-23.jpg", Vector2( 0.0f, 100.0f ), Size( 100.0f, 100.0f ) }, | |
| 46 | - { DEMO_IMAGE_DIR "gallery-small-23.jpg", Vector2( 200.0f, 200.0f ), Size( 100.0f, 100.0f ) }, | |
| 47 | -}; | |
| 48 | -unsigned int IMAGE_COUNT=sizeof(IMAGES)/sizeof(IMAGES[0]); | |
| 49 | - | |
| 50 | -// Helper function to create ImageViews with given filename and size. | |
| 51 | -void CreateChildImageView( ImageView& imageView, unsigned imageIndex ) | |
| 52 | -{ | |
| 53 | - imageView = ImageView::New(); | |
| 54 | - Property::Map imagePropertyMap; | |
| 55 | - imagePropertyMap[ Visual::Property::TYPE ] = Toolkit::Visual::IMAGE; | |
| 56 | - imagePropertyMap[ ImageVisual::Property::URL ] = IMAGES[imageIndex].name; | |
| 57 | - imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = IMAGES[imageIndex].size.width ; | |
| 58 | - imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = IMAGES[imageIndex].size.height; | |
| 59 | - imageView.SetProperty( ImageView::Property::IMAGE , imagePropertyMap ); | |
| 60 | - imageView.SetName("ImageView"); | |
| 61 | - imageView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 62 | - imageView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 63 | - imageView.SetProperty( Dali::Actor::Property::POSITION, Vector3( IMAGES[imageIndex].position ) ); | |
| 64 | -} | |
| 65 | - | |
| 66 | -} // namespace | |
| 67 | - | |
| 68 | -namespace Demo | |
| 69 | -{ | |
| 70 | - | |
| 71 | -AbsoluteExample::AbsoluteExample() | |
| 72 | -: Example( TITLE ), | |
| 73 | - mRootLayoutControl(), | |
| 74 | - mAbsoluteLayoutContainer(), | |
| 75 | - mLayoutSizeToggleStatus( true ), | |
| 76 | - mToggleButton() | |
| 77 | -{ | |
| 78 | - | |
| 79 | -} | |
| 80 | - | |
| 81 | -void AbsoluteExample::Create() | |
| 82 | -{ | |
| 83 | - auto stage = Stage::GetCurrent(); | |
| 84 | - // This layout will be the size of the stage but allows subsequent layouts to be any size. | |
| 85 | - mRootLayoutControl = LayoutUtilities::CreateRootContainer(); | |
| 86 | - stage.Add( mRootLayoutControl ); | |
| 87 | - | |
| 88 | - // Create an Absolute Layout to show ImageViews at explictly provided positions. | |
| 89 | - mAbsoluteLayoutContainer = Control::New(); | |
| 90 | - mAbsoluteLayoutContainer.SetBackgroundColor( Color::WHITE ); | |
| 91 | - auto absoluteLayout = AbsoluteLayout::New(); | |
| 92 | - DevelControl::SetLayout( mAbsoluteLayoutContainer, absoluteLayout ); | |
| 93 | - mAbsoluteLayoutContainer.SetName("AbsoluteLayout"); | |
| 94 | - | |
| 95 | - mAbsoluteLayoutContainer.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 96 | - mAbsoluteLayoutContainer.SetParentOrigin( ParentOrigin::CENTER ); | |
| 97 | - | |
| 98 | - // Initially absolute layout to use these specifications, toggle button will alter them. | |
| 99 | - mAbsoluteLayoutContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); | |
| 100 | - mAbsoluteLayoutContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); | |
| 101 | - | |
| 102 | - mRootLayoutControl.Add( mAbsoluteLayoutContainer ); | |
| 103 | - | |
| 104 | - for( unsigned int x = 0; x < NUMBER_OF_IMAGE_VIEWS; x++ ) | |
| 105 | - { | |
| 106 | - CreateChildImageView( mImageViews[x], x%IMAGE_COUNT ); | |
| 107 | - mAbsoluteLayoutContainer.Add( mImageViews[x] ); | |
| 108 | - } | |
| 109 | - | |
| 110 | - // Button toggles the size of the layout | |
| 111 | - mToggleButton = PushButton::New(); | |
| 112 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Change layout size" ); | |
| 113 | - mToggleButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | |
| 114 | - mToggleButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 115 | - mToggleButton.ClickedSignal().Connect( this, &Demo::AbsoluteExample::ChangeSizeClicked ); | |
| 116 | - mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 117 | - mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 118 | - | |
| 119 | - stage.Add( mToggleButton ); | |
| 120 | - | |
| 121 | -} | |
| 122 | - | |
| 123 | -void AbsoluteExample::Remove() | |
| 124 | -{ | |
| 125 | - UnparentAndReset( mAbsoluteLayoutContainer ); | |
| 126 | - UnparentAndReset( mToggleButton ); | |
| 127 | - UnparentAndReset( mRootLayoutControl ); | |
| 128 | -} | |
| 129 | - | |
| 130 | -bool AbsoluteExample::ChangeSizeClicked( Toolkit::Button button ) | |
| 131 | -{ | |
| 132 | - if ( true == mLayoutSizeToggleStatus ) | |
| 133 | - { | |
| 134 | - mAbsoluteLayoutContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 480 ); | |
| 135 | - mAbsoluteLayoutContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 700 ); | |
| 136 | - mLayoutSizeToggleStatus = false; | |
| 137 | - } | |
| 138 | - else | |
| 139 | - { | |
| 140 | - mAbsoluteLayoutContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); | |
| 141 | - mAbsoluteLayoutContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); | |
| 142 | - mLayoutSizeToggleStatus = true; | |
| 143 | - } | |
| 144 | - | |
| 145 | - return true; | |
| 146 | -} | |
| 147 | - | |
| 148 | -} // namespace Demo | |
| 149 | 0 | \ No newline at end of file |
examples/layouting/absolute-example.h deleted
| 1 | -#ifndef DALI_DEMO_ABSOLUTE_EXAMPLE_H | |
| 2 | -#define DALI_DEMO_ABSOLUTE_EXAMPLE_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2017 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 | -#include <string> | |
| 22 | -#include <dali/dali.h> | |
| 23 | -#include <dali-toolkit/dali-toolkit.h> | |
| 24 | -#include "example.h" | |
| 25 | - | |
| 26 | -using namespace Dali; | |
| 27 | -using namespace Dali::Toolkit; | |
| 28 | - | |
| 29 | -namespace Demo | |
| 30 | -{ | |
| 31 | - | |
| 32 | -/** | |
| 33 | - * @file absolute-example.hcpp | |
| 34 | - * @brief Example of a Linear Layout with padding applied, enables updating of padding values for | |
| 35 | - * one of the children. | |
| 36 | - */ | |
| 37 | -class AbsoluteExample final: public ConnectionTracker, public Example | |
| 38 | -{ | |
| 39 | -public: | |
| 40 | - static const unsigned int NUMBER_OF_IMAGE_VIEWS = 4; | |
| 41 | - | |
| 42 | - // Constructor | |
| 43 | - AbsoluteExample(); | |
| 44 | - | |
| 45 | - // Creates a Absolute Layout Example and displays it. | |
| 46 | - virtual void Create() override; | |
| 47 | - | |
| 48 | - // Remove and destroy this layout | |
| 49 | - virtual void Remove() override; | |
| 50 | - | |
| 51 | -private: | |
| 52 | - | |
| 53 | - // Callback when change size button is pressed | |
| 54 | - bool ChangeSizeClicked( Toolkit::Button button ); | |
| 55 | - | |
| 56 | -private: | |
| 57 | - | |
| 58 | - Toolkit::Control mRootLayoutControl; | |
| 59 | - Toolkit::Control mAbsoluteLayoutContainer; | |
| 60 | - Toolkit::ImageView mImageViews[ NUMBER_OF_IMAGE_VIEWS ]; | |
| 61 | - bool mLayoutSizeToggleStatus; | |
| 62 | - Toolkit::PushButton mToggleButton; | |
| 63 | -}; | |
| 64 | - | |
| 65 | -} // namespace Demo | |
| 66 | - | |
| 67 | -#endif // DALI_DEMO_ABSOLUTE_EXAMPLE_H |
examples/layouting/animation-example.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 <string> | |
| 19 | -#include "animation-example.h" | |
| 20 | -#include <dali/devel-api/actors/actor-devel.h> | |
| 21 | -#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h> | |
| 22 | -#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 23 | -#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 24 | -#include <dali-toolkit/devel-api/layouting/linear-layout.h> | |
| 25 | -#include <dali-toolkit/devel-api/layouting/grid.h> | |
| 26 | -#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h> | |
| 27 | - | |
| 28 | -#include <dali/integration-api/debug.h> | |
| 29 | - | |
| 30 | -using namespace Dali; | |
| 31 | -using namespace Dali::Toolkit; | |
| 32 | - | |
| 33 | -namespace | |
| 34 | -{ | |
| 35 | -const char* const TITLE = "Animation Example"; | |
| 36 | - | |
| 37 | -// Button file names | |
| 38 | -const char* LTR_IMAGE( DEMO_IMAGE_DIR "icon-play.png" ); | |
| 39 | -const char* LTR_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-play-selected.png" ); | |
| 40 | - | |
| 41 | -const char* RTL_IMAGE( DEMO_IMAGE_DIR "icon-reverse.png" ); | |
| 42 | -const char* RTL_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-reverse-selected.png" ); | |
| 43 | - | |
| 44 | -const char* ROTATE_CLOCKWISE_IMAGE( DEMO_IMAGE_DIR "icon-reset.png" ); | |
| 45 | -const char* ROTATE_CLOCKWISE_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-reset-selected.png" ); | |
| 46 | - | |
| 47 | -const char* GRID_IMAGE( DEMO_IMAGE_DIR "icon-item-view-layout-grid.png" ); | |
| 48 | -const char* GRID_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-item-view-layout-grid-selected.png" ); | |
| 49 | - | |
| 50 | -// Child image filenames | |
| 51 | -const char* IMAGE_PATH[] = { | |
| 52 | - DEMO_IMAGE_DIR "application-icon-101.png", | |
| 53 | - DEMO_IMAGE_DIR "application-icon-102.png", | |
| 54 | - DEMO_IMAGE_DIR "application-icon-103.png", | |
| 55 | - DEMO_IMAGE_DIR "application-icon-104.png" | |
| 56 | -}; | |
| 57 | - | |
| 58 | -#if defined(DEBUG_ENABLED) | |
| 59 | -Debug::Filter* gLayoutFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_LAYOUT" ); | |
| 60 | -#endif | |
| 61 | - | |
| 62 | -const unsigned int NUMBER_OF_RESOURCES = sizeof(IMAGE_PATH) / sizeof(char*); | |
| 63 | - | |
| 64 | -// Helper function | |
| 65 | -void CreateChild( ImageView& child, int index, Size size ) | |
| 66 | -{ | |
| 67 | - child = ImageView::New(); | |
| 68 | - Property::Map imagePropertyMap; | |
| 69 | - imagePropertyMap[ Visual::Property::TYPE ] = Toolkit::Visual::IMAGE; | |
| 70 | - imagePropertyMap[ ImageVisual::Property::URL ] = IMAGE_PATH[ index ]; | |
| 71 | - imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = size.width; | |
| 72 | - imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = size.height; | |
| 73 | - imagePropertyMap[ ImageVisual::Property::FITTING_MODE ] = FittingMode::SCALE_TO_FILL; | |
| 74 | - child.SetProperty( Toolkit::ImageView::Property::IMAGE, imagePropertyMap ); | |
| 75 | - std::string name = "ImageView"; | |
| 76 | - name.append( 1, '0' + index ); | |
| 77 | - child.SetName( name ); | |
| 78 | - child.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 79 | - child.SetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT, false ); | |
| 80 | -} | |
| 81 | - | |
| 82 | -// Create set layout transition. A parent opacity increases 'ease in out' from semi-transparent to fully opaque and children pulse in order | |
| 83 | -LayoutTransitionData CreateOnSetLayoutTransition( Control& container ) | |
| 84 | -{ | |
| 85 | - auto layoutTransitionData = LayoutTransitionData::New(); | |
| 86 | - Property::Map map; | |
| 87 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::COLOR_ALPHA; | |
| 88 | - map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = 0.5f; | |
| 89 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 1.0f; | |
| 90 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 91 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::EASE_IN_OUT ) | |
| 92 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 93 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.25f ) | |
| 94 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 95 | - | |
| 96 | - // Apply to parent only | |
| 97 | - layoutTransitionData.AddPropertyAnimator( container, map ); | |
| 98 | - | |
| 99 | - // Reset scale after possible focus animation | |
| 100 | - { | |
| 101 | - Property::Map map; | |
| 102 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE; | |
| 103 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3::ONE; | |
| 104 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 105 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 106 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) | |
| 107 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f)); | |
| 108 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 109 | - } | |
| 110 | - | |
| 111 | - // Children pulses in/out | |
| 112 | - for( size_t i = 0; i < container.GetChildCount(); i++ ) | |
| 113 | - { | |
| 114 | - Property::Map map; | |
| 115 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; | |
| 116 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 100.0f * 1.2f, 100.0f * 1.2f, 0 ); | |
| 117 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 118 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::SIN ) | |
| 119 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 120 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.5f + 0.1f * i) | |
| 121 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.25f ) ); | |
| 122 | - layoutTransitionData.AddPropertyAnimator( container.GetChildAt( i ), map ); | |
| 123 | - } | |
| 124 | - | |
| 125 | - // Children move | |
| 126 | - { | |
| 127 | - Property::Map map; | |
| 128 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; | |
| 129 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 130 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) | |
| 131 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 132 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 133 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 134 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 135 | - } | |
| 136 | - | |
| 137 | - return layoutTransitionData; | |
| 138 | -} | |
| 139 | - | |
| 140 | -// Create add child transition. An added child grows from (0, 0) to its full size and instantly appears in its position | |
| 141 | -LayoutTransitionData CreateOnChildAddTransition( Control& parent ) | |
| 142 | -{ | |
| 143 | - auto layoutTransitionData = LayoutTransitionData::New(); | |
| 144 | - | |
| 145 | - // Want the parent to resize itself instantly so children will position themselves correctly when the parent is added to stage first time | |
| 146 | - Property::Map map; | |
| 147 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; | |
| 148 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 149 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) | |
| 150 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 151 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 152 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); | |
| 153 | - layoutTransitionData.AddPropertyAnimator( parent, map ); | |
| 154 | - | |
| 155 | - // Reset scale after possible focus animation | |
| 156 | - { | |
| 157 | - Property::Map map; | |
| 158 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE; | |
| 159 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3::ONE; | |
| 160 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 161 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 162 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) | |
| 163 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); | |
| 164 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 165 | - } | |
| 166 | - | |
| 167 | - // New child is growing | |
| 168 | - { | |
| 169 | - Property::Map map; | |
| 170 | - map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_ADD; | |
| 171 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE; | |
| 172 | - map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = Vector3::ZERO; | |
| 173 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3::ONE; | |
| 174 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 175 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) | |
| 176 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 177 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 178 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 179 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 180 | - } | |
| 181 | - | |
| 182 | - // Want new children instantly appear in their positions | |
| 183 | - { | |
| 184 | - Property::Map map; | |
| 185 | - map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_ADD; | |
| 186 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; | |
| 187 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 188 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) | |
| 189 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 190 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 191 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); | |
| 192 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 193 | - } | |
| 194 | - | |
| 195 | - // Other just move | |
| 196 | - { | |
| 197 | - Property::Map map; | |
| 198 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; | |
| 199 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 200 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) | |
| 201 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 202 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 203 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 204 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 205 | - } | |
| 206 | - | |
| 207 | - return layoutTransitionData; | |
| 208 | -} | |
| 209 | - | |
| 210 | -// Create remove child transition. Remaining children shake around their positions | |
| 211 | -LayoutTransitionData CreateOnChildRemoveTransition( Control& container ) | |
| 212 | -{ | |
| 213 | - auto layoutTransitionData = LayoutTransitionData::New(); | |
| 214 | - | |
| 215 | - // Reset scale after possible focus animation | |
| 216 | - { | |
| 217 | - Property::Map map; | |
| 218 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE; | |
| 219 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3::ONE; | |
| 220 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 221 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 222 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) | |
| 223 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f)); | |
| 224 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 225 | - } | |
| 226 | - | |
| 227 | - // Apply animation to remaining children - sin shaking | |
| 228 | - { | |
| 229 | - Property::Map map; | |
| 230 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; | |
| 231 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 232 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::SIN ) | |
| 233 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 234 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) | |
| 235 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); | |
| 236 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 237 | - } | |
| 238 | - | |
| 239 | - // Add a linear to reduce a linear to half | |
| 240 | - { | |
| 241 | - Property::Map map; | |
| 242 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; | |
| 243 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 244 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR ) | |
| 245 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 246 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f) | |
| 247 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f)); | |
| 248 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 249 | - } | |
| 250 | - | |
| 251 | - return layoutTransitionData; | |
| 252 | -} | |
| 253 | - | |
| 254 | -// Create child focus transition. A focus gained child grows 120% and focus lost child gets its original size back | |
| 255 | -LayoutTransitionData CreateOnChildFocusTransition( Control& parent, bool affectsSiblings ) | |
| 256 | -{ | |
| 257 | - auto layoutTransitionData = LayoutTransitionData::New(); | |
| 258 | - | |
| 259 | - // Focus gain child animation | |
| 260 | - { | |
| 261 | - Property::Map map; | |
| 262 | - map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED; | |
| 263 | - map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = affectsSiblings; | |
| 264 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE; | |
| 265 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 1.2f, 1.2f, 1.0f ); | |
| 266 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 267 | - .Add( LayoutTransitionData::AnimatorKey::TYPE, LayoutTransitionData::Animator::ANIMATE_TO ) | |
| 268 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 269 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 270 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 271 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 272 | - } | |
| 273 | - | |
| 274 | - // Focus lost child animation | |
| 275 | - { | |
| 276 | - Property::Map map; | |
| 277 | - map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST; | |
| 278 | - map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = affectsSiblings; | |
| 279 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE; | |
| 280 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 1.0f, 1.0f, 1.0f ); | |
| 281 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 282 | - .Add( LayoutTransitionData::AnimatorKey::TYPE, LayoutTransitionData::Animator::ANIMATE_TO ) | |
| 283 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 284 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 285 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 286 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 287 | - } | |
| 288 | - | |
| 289 | - // Linear children positioning | |
| 290 | - { | |
| 291 | - Property::Map map; | |
| 292 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; | |
| 293 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); | |
| 294 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 295 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 296 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 297 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 298 | - layoutTransitionData.AddPropertyAnimator( Actor(), map ); | |
| 299 | - } | |
| 300 | - | |
| 301 | - return layoutTransitionData; | |
| 302 | -} | |
| 303 | - | |
| 304 | -// An example of custom default transition, ease in for position animation, ease out for size animation | |
| 305 | -LayoutTransitionData CreateCustomDefaultTransition( Control& control ) | |
| 306 | -{ | |
| 307 | - auto layoutTransitionData = LayoutTransitionData::New(); | |
| 308 | - // Resets control scale after possible focus animation | |
| 309 | - { | |
| 310 | - Property::Map map; | |
| 311 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE; | |
| 312 | - map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3::ONE; | |
| 313 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 314 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 315 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 316 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) ); | |
| 317 | - layoutTransitionData.AddPropertyAnimator( control, map ); | |
| 318 | - } | |
| 319 | - | |
| 320 | - // Moves control ease in | |
| 321 | - { | |
| 322 | - Property::Map map; | |
| 323 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION; | |
| 324 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 325 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::EASE_IN ) | |
| 326 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 327 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 328 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 329 | - layoutTransitionData.AddPropertyAnimator( control, map ); | |
| 330 | - } | |
| 331 | - | |
| 332 | - // Sizes control ease out | |
| 333 | - { | |
| 334 | - Property::Map map; | |
| 335 | - map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE; | |
| 336 | - map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map() | |
| 337 | - .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::EASE_OUT ) | |
| 338 | - .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map() | |
| 339 | - .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f ) | |
| 340 | - .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) ); | |
| 341 | - layoutTransitionData.AddPropertyAnimator( control, map ); | |
| 342 | - } | |
| 343 | - | |
| 344 | - return layoutTransitionData; | |
| 345 | -} | |
| 346 | - | |
| 347 | -bool OnImageTouchCallback( Actor actor, const TouchData& event ) | |
| 348 | -{ | |
| 349 | - KeyInputFocusManager manager = KeyInputFocusManager::Get(); | |
| 350 | - manager.SetFocus( Control::DownCast( actor ) ); | |
| 351 | - return true; | |
| 352 | -} | |
| 353 | - | |
| 354 | -void CreateChildAndAdd( Demo::AnimationExample& animationExample, Control& container ) | |
| 355 | -{ | |
| 356 | - Toolkit::ImageView imageView; | |
| 357 | - CreateChild( imageView, container.GetChildCount(), Size( 100.0f, 100.0f ) ); | |
| 358 | - imageView.TouchSignal().Connect( &animationExample, &OnImageTouchCallback ); | |
| 359 | - container.Add( imageView ); | |
| 360 | - | |
| 361 | - DevelControl::GetLayout( imageView ).SetTransitionData( Toolkit::LayoutTransitionData::ON_LAYOUT_CHANGE, CreateCustomDefaultTransition( imageView ) ); | |
| 362 | -} | |
| 363 | - | |
| 364 | -} // namespace | |
| 365 | - | |
| 366 | -namespace Demo | |
| 367 | -{ | |
| 368 | - | |
| 369 | -AnimationExample::AnimationExample() | |
| 370 | -: Example( TITLE ), | |
| 371 | - mGridSet( false ) | |
| 372 | -{ | |
| 373 | -} | |
| 374 | - | |
| 375 | -void AnimationExample::Create() | |
| 376 | -{ | |
| 377 | - DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "AnimationExample::Create\n"); | |
| 378 | - auto stage = Stage::GetCurrent(); | |
| 379 | - | |
| 380 | - mRemoveButton = PushButton::New(); | |
| 381 | - mRemoveButton.SetProperty( PushButton::Property::UNSELECTED_ICON, RTL_IMAGE ); | |
| 382 | - mRemoveButton.SetProperty( PushButton::Property::SELECTED_ICON, RTL_SELECTED_IMAGE ); | |
| 383 | - mRemoveButton.ClickedSignal().Connect( this, &AnimationExample::OnRemoveClicked ); | |
| 384 | - mRemoveButton.SetParentOrigin( Vector3( 0.2f, 1.0f, 0.5f ) ); | |
| 385 | - mRemoveButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 386 | - mRemoveButton.SetSize( 75, 75 ); | |
| 387 | - stage.Add( mRemoveButton ); | |
| 388 | - | |
| 389 | - mAddButton = PushButton::New(); | |
| 390 | - mAddButton.SetProperty( PushButton::Property::UNSELECTED_ICON, LTR_IMAGE ); | |
| 391 | - mAddButton.SetProperty( PushButton::Property::SELECTED_ICON, LTR_SELECTED_IMAGE ); | |
| 392 | - mAddButton.ClickedSignal().Connect( this, &AnimationExample::OnAddClicked ); | |
| 393 | - mAddButton.SetParentOrigin( Vector3( 0.4f, 1.0f, 0.5f ) ); | |
| 394 | - mAddButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 395 | - mAddButton.SetSize( 75, 75 ); | |
| 396 | - stage.Add( mAddButton ); | |
| 397 | - | |
| 398 | - mSelectGridButton = Toolkit::PushButton::New(); | |
| 399 | - mSelectGridButton.SetProperty( PushButton::Property::UNSELECTED_ICON, GRID_IMAGE ); | |
| 400 | - mSelectGridButton.SetProperty( PushButton::Property::SELECTED_ICON, GRID_SELECTED_IMAGE ); | |
| 401 | - mSelectGridButton.ClickedSignal().Connect( this, &AnimationExample::OnSelectGridClicked ); | |
| 402 | - mSelectGridButton.SetParentOrigin( Vector3( 0.6f, 1.0f, 0.5f ) ); | |
| 403 | - mSelectGridButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 404 | - mSelectGridButton.SetSize( 75, 75 ); | |
| 405 | - stage.Add( mSelectGridButton ); | |
| 406 | - | |
| 407 | - mShakeButton = PushButton::New(); | |
| 408 | - mShakeButton.SetProperty( PushButton::Property::UNSELECTED_ICON, ROTATE_CLOCKWISE_IMAGE ); | |
| 409 | - mShakeButton.SetProperty( PushButton::Property::SELECTED_ICON, ROTATE_CLOCKWISE_SELECTED_IMAGE ); | |
| 410 | - mShakeButton.ClickedSignal().Connect( this, &AnimationExample::OnChangeClicked ); | |
| 411 | - mShakeButton.SetParentOrigin( Vector3( 0.8f, 1.0f, 0.5f ) ); | |
| 412 | - mShakeButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 413 | - mShakeButton.SetSize( 75, 75 ); | |
| 414 | - stage.Add( mShakeButton ); | |
| 415 | - | |
| 416 | - // Create a linear layout | |
| 417 | - mAnimationContainer = Control::New(); | |
| 418 | - mAnimationContainer.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT ); | |
| 419 | - mAnimationContainer.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT ); | |
| 420 | - mAnimationContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); | |
| 421 | - mAnimationContainer.SetParentOrigin( ParentOrigin::CENTER ); | |
| 422 | - mAnimationContainer.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 423 | - mAnimationContainer.SetName( "AnimationExample" ); | |
| 424 | - mAnimationContainer.SetProperty( Toolkit::Control::Property::PADDING, Extents( 0.0f, 0.0f, 45.0f, 75.0f) ); | |
| 425 | - | |
| 426 | - mHorizontalLayout = LinearLayout::New(); | |
| 427 | - mHorizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); | |
| 428 | - mHorizontalLayout.SetAlignment( LinearLayout::Alignment::CENTER_HORIZONTAL | LinearLayout::Alignment::CENTER_VERTICAL ); | |
| 429 | - mHorizontalLayout.SetAnimateLayout(true); | |
| 430 | - mHorizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, CreateOnChildFocusTransition( mAnimationContainer, true ) ); | |
| 431 | - mHorizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, CreateOnChildRemoveTransition( mAnimationContainer ) ); | |
| 432 | - mHorizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, CreateOnChildAddTransition( mAnimationContainer ) ); | |
| 433 | - | |
| 434 | - DevelControl::SetLayout( mAnimationContainer, mHorizontalLayout ); | |
| 435 | - | |
| 436 | - mGridLayout = Grid::New(); | |
| 437 | - mGridLayout.SetAnimateLayout( true ); | |
| 438 | - mGridLayout.SetNumberOfColumns( 2 ); | |
| 439 | - mGridLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, CreateOnChildFocusTransition( mAnimationContainer, false ) ); | |
| 440 | - mGridLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, CreateOnChildRemoveTransition( mAnimationContainer ) ); | |
| 441 | - mGridLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, CreateOnChildAddTransition( mAnimationContainer ) ); | |
| 442 | - | |
| 443 | - CreateChildAndAdd( *this, mAnimationContainer ); | |
| 444 | - stage.Add( mAnimationContainer ); | |
| 445 | -} | |
| 446 | - | |
| 447 | -// Remove controls added by this example from stage | |
| 448 | -void AnimationExample::Remove() | |
| 449 | -{ | |
| 450 | - if ( mAnimationContainer ) | |
| 451 | - { | |
| 452 | - UnparentAndReset( mRemoveButton ); | |
| 453 | - UnparentAndReset( mAddButton ); | |
| 454 | - UnparentAndReset( mSelectGridButton ); | |
| 455 | - UnparentAndReset( mShakeButton ); | |
| 456 | - UnparentAndReset( mAnimationContainer); | |
| 457 | - } | |
| 458 | -} | |
| 459 | - | |
| 460 | -bool AnimationExample::OnRemoveClicked( Button button ) | |
| 461 | -{ | |
| 462 | - DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "AnimationExample::OnRemoveClicked\n"); | |
| 463 | - | |
| 464 | - if ( mAnimationContainer.GetChildCount() > 0 ) | |
| 465 | - { | |
| 466 | - mAnimationContainer.Remove( mAnimationContainer.GetChildAt( mAnimationContainer.GetChildCount() - 1 ) ); | |
| 467 | - } | |
| 468 | - return true; | |
| 469 | -} | |
| 470 | - | |
| 471 | -// Change layout by setting new layout, triggers set layout transition | |
| 472 | -bool AnimationExample::OnSelectGridClicked( Button button ) | |
| 473 | -{ | |
| 474 | - DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "AnimationExample::OnRotateClicked\n"); | |
| 475 | - | |
| 476 | - if ( !mGridSet ) | |
| 477 | - { | |
| 478 | - mGridLayout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, CreateOnSetLayoutTransition( mAnimationContainer ) ); | |
| 479 | - DevelControl::SetLayout( mAnimationContainer, mGridLayout ); | |
| 480 | - } | |
| 481 | - else | |
| 482 | - { | |
| 483 | - mHorizontalLayout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, CreateOnSetLayoutTransition( mAnimationContainer ) ); | |
| 484 | - DevelControl::SetLayout( mAnimationContainer, mHorizontalLayout ); | |
| 485 | - } | |
| 486 | - | |
| 487 | - mGridSet = !mGridSet; | |
| 488 | - return true; | |
| 489 | -} | |
| 490 | - | |
| 491 | -bool AnimationExample::OnAddClicked( Button button ) | |
| 492 | -{ | |
| 493 | - if( mAnimationContainer.GetChildCount() < 4 ) | |
| 494 | - { | |
| 495 | - CreateChildAndAdd( *this, mAnimationContainer ); | |
| 496 | - } | |
| 497 | - return true; | |
| 498 | -} | |
| 499 | - | |
| 500 | -bool AnimationExample::OnChangeClicked( Button button ) | |
| 501 | -{ | |
| 502 | - if ( !mGridSet ) | |
| 503 | - { | |
| 504 | - auto layout = LinearLayout::DownCast( DevelControl::GetLayout( mAnimationContainer ) ); | |
| 505 | - layout.SetAlignment( LinearLayout::Alignment::CENTER_HORIZONTAL | LinearLayout::Alignment::CENTER_VERTICAL ); | |
| 506 | - if ( layout.GetOrientation() == LinearLayout::Orientation::VERTICAL ) | |
| 507 | - { | |
| 508 | - layout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); | |
| 509 | - } | |
| 510 | - else | |
| 511 | - { | |
| 512 | - layout.SetOrientation( LinearLayout::Orientation::VERTICAL ); | |
| 513 | - } | |
| 514 | - } | |
| 515 | - else | |
| 516 | - { | |
| 517 | - auto layout = Grid::DownCast( DevelControl::GetLayout( mAnimationContainer ) ); | |
| 518 | - if ( layout.GetNumberOfColumns() == 2 ) | |
| 519 | - { | |
| 520 | - layout.SetNumberOfColumns(3); | |
| 521 | - } | |
| 522 | - else | |
| 523 | - { | |
| 524 | - layout.SetNumberOfColumns(2); | |
| 525 | - } | |
| 526 | - } | |
| 527 | - return true; | |
| 528 | -} | |
| 529 | - | |
| 530 | -} // namespace Demo |
examples/layouting/animation-example.h deleted
| 1 | -#ifndef DALI_DEMO_ANIMATION_EXAMPLE_H | |
| 2 | -#define DALI_DEMO_ANIMATION_EXAMPLE_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2018 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 | -#include <dali/dali.h> | |
| 22 | -#include <dali-toolkit/dali-toolkit.h> | |
| 23 | -#include <dali-toolkit/devel-api/layouting/linear-layout.h> | |
| 24 | -#include <dali-toolkit/devel-api/layouting/grid.h> | |
| 25 | - | |
| 26 | -#include "example.h" | |
| 27 | - | |
| 28 | -using namespace Dali; | |
| 29 | -using namespace Dali::Toolkit; | |
| 30 | - | |
| 31 | -namespace Demo | |
| 32 | -{ | |
| 33 | - | |
| 34 | -/** | |
| 35 | - * @file animation-example.hcpp | |
| 36 | - * @brief Example of a layout complex animation. | |
| 37 | - */ | |
| 38 | -class AnimationExample final: public ConnectionTracker, public Example | |
| 39 | -{ | |
| 40 | -public: | |
| 41 | - AnimationExample(); | |
| 42 | - | |
| 43 | - // Creates a Animation Layout Example and displays it. | |
| 44 | - virtual void Create() override; | |
| 45 | - | |
| 46 | - // Remove and destroy this layout | |
| 47 | - virtual void Remove() override; | |
| 48 | - | |
| 49 | -private: | |
| 50 | - | |
| 51 | - bool OnRemoveClicked( Button button ); | |
| 52 | - | |
| 53 | - bool OnSelectGridClicked( Button button ); | |
| 54 | - | |
| 55 | - bool OnAddClicked( Button button ); | |
| 56 | - | |
| 57 | - bool OnChangeClicked( Button button ); | |
| 58 | - | |
| 59 | -private: | |
| 60 | - PushButton mRemoveButton; | |
| 61 | - PushButton mAddButton; | |
| 62 | - PushButton mSelectGridButton; | |
| 63 | - PushButton mShakeButton; | |
| 64 | - Control mAnimationContainer; | |
| 65 | - Grid mGridLayout; | |
| 66 | - LinearLayout mHorizontalLayout; | |
| 67 | - bool mGridSet; | |
| 68 | -}; // class AnimationContainer | |
| 69 | - | |
| 70 | -} // namespace Demo | |
| 71 | - | |
| 72 | -#endif //DALI_DEMO_ANIMATION_CONTAINER_H |
examples/layouting/example.h deleted
| 1 | -#ifndef DALI_DEMO_LAYOUTING_EXAMPLE_H | |
| 2 | -#define DALI_DEMO_LAYOUTING_EXAMPLE_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2018 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 <string> | |
| 23 | - | |
| 24 | -namespace Demo | |
| 25 | -{ | |
| 26 | - | |
| 27 | -/** | |
| 28 | - * @brief Abstract base class for layouting examples. | |
| 29 | - */ | |
| 30 | -class Example | |
| 31 | -{ | |
| 32 | -public: | |
| 33 | - /// Should be overridden by deriving classes to create the required Layouting example | |
| 34 | - virtual void Create() = 0; | |
| 35 | - | |
| 36 | - /// Should be overridden by deriving classes to remove their layouting example from stage | |
| 37 | - virtual void Remove() = 0; | |
| 38 | - | |
| 39 | - /// Virtual destructor | |
| 40 | - virtual ~Example() = default; | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * Gets the title set for this example | |
| 44 | - * @return title | |
| 45 | - */ | |
| 46 | - const std::string& GetExampleTitle() const | |
| 47 | - { | |
| 48 | - return mTitle; | |
| 49 | - } | |
| 50 | - | |
| 51 | -protected: | |
| 52 | - /** | |
| 53 | - * Constructor for Example | |
| 54 | - * @param[in] title Title to be used for the example | |
| 55 | - */ | |
| 56 | - Example( const std::string& title ) | |
| 57 | - : mTitle( title ) | |
| 58 | - { | |
| 59 | - } | |
| 60 | - | |
| 61 | -private: | |
| 62 | - const std::string mTitle; | |
| 63 | -}; | |
| 64 | - | |
| 65 | -} // namespace Demo | |
| 66 | - | |
| 67 | -#endif // DALI_DEMO_LAYOUTING_EXAMPLE_H |
examples/layouting/flex-example.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 "flex-example.h" | |
| 19 | -#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h> | |
| 20 | -#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 21 | -#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 22 | -#include <dali-toolkit/devel-api/layouting/flex-layout.h> | |
| 23 | - | |
| 24 | -using namespace Dali; | |
| 25 | -using namespace Dali::Toolkit; | |
| 26 | - | |
| 27 | -namespace | |
| 28 | -{ | |
| 29 | -const char* const TITLE = "Flex Example"; | |
| 30 | - | |
| 31 | -// Button file names | |
| 32 | -const char* LTR_IMAGE( DEMO_IMAGE_DIR "icon-play.png" ); | |
| 33 | -const char* LTR_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-play-selected.png" ); | |
| 34 | - | |
| 35 | -const char* RTL_IMAGE( DEMO_IMAGE_DIR "icon-reverse.png" ); | |
| 36 | -const char* RTL_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-reverse-selected.png" ); | |
| 37 | - | |
| 38 | -const char* ROTATE_CLOCKWISE_IMAGE( DEMO_IMAGE_DIR "icon-reset.png" ); | |
| 39 | -const char* ROTATE_CLOCKWISE_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-reset-selected.png" ); | |
| 40 | - | |
| 41 | -const char* WRAP_IMAGE( DEMO_IMAGE_DIR "icon-replace.png" ); | |
| 42 | -const char* WRAP_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-replace-selected.png" ); | |
| 43 | - | |
| 44 | -const char* JUSTIFY_IMAGE( DEMO_IMAGE_DIR "icon-item-view-layout-grid.png" ); | |
| 45 | -const char* JUSTIFY_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-item-view-layout-grid-selected.png" ); | |
| 46 | - | |
| 47 | -// Child image filenames | |
| 48 | -const char* IMAGE_PATH[] = { | |
| 49 | - DEMO_IMAGE_DIR "application-icon-101.png", | |
| 50 | - DEMO_IMAGE_DIR "application-icon-102.png", | |
| 51 | - DEMO_IMAGE_DIR "application-icon-103.png", | |
| 52 | - DEMO_IMAGE_DIR "application-icon-104.png", | |
| 53 | - DEMO_IMAGE_DIR "application-icon-105.png", | |
| 54 | - DEMO_IMAGE_DIR "application-icon-106.png", | |
| 55 | - DEMO_IMAGE_DIR "application-icon-107.png", | |
| 56 | - DEMO_IMAGE_DIR "application-icon-108.png", | |
| 57 | - DEMO_IMAGE_DIR "application-icon-109.png", | |
| 58 | - DEMO_IMAGE_DIR "application-icon-110.png" | |
| 59 | - | |
| 60 | -}; | |
| 61 | - | |
| 62 | -const unsigned int NUMBER_OF_RESOURCES = sizeof(IMAGE_PATH) / sizeof(char*); | |
| 63 | - | |
| 64 | -// Helper function to create ImageViews with given filename and size. | |
| 65 | -void CreateChildImageView( ImageView& imageView, const char* filename, Size size ) | |
| 66 | -{ | |
| 67 | - imageView = ImageView::New(); | |
| 68 | - Property::Map imagePropertyMap; | |
| 69 | - imagePropertyMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE; | |
| 70 | - imagePropertyMap[ Toolkit::ImageVisual::Property::URL ] = filename; | |
| 71 | - imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = size.width; | |
| 72 | - imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = size.height; | |
| 73 | - imageView.SetProperty( Toolkit::ImageView::Property::IMAGE , imagePropertyMap ); | |
| 74 | - imageView.SetName("ImageView"); | |
| 75 | - imageView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 76 | - imageView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 77 | -} | |
| 78 | - | |
| 79 | -} // namespace | |
| 80 | - | |
| 81 | -namespace Demo | |
| 82 | -{ | |
| 83 | - | |
| 84 | -FlexExample::FlexExample() | |
| 85 | -: Example( TITLE ), | |
| 86 | - mLTRDirection(true) | |
| 87 | -{ | |
| 88 | - | |
| 89 | -} | |
| 90 | - | |
| 91 | -void FlexExample::Create() | |
| 92 | -{ | |
| 93 | - // The Init signal is received once (only) during the Application lifetime | |
| 94 | - auto stage = Stage::GetCurrent(); | |
| 95 | - | |
| 96 | - mDirectionButton = PushButton::New(); | |
| 97 | - mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, RTL_IMAGE ); | |
| 98 | - mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, RTL_SELECTED_IMAGE ); | |
| 99 | - mDirectionButton.ClickedSignal().Connect( this, &FlexExample::OnDirectionClicked ); | |
| 100 | - mDirectionButton.SetParentOrigin( Vector3(0.2f, 1.0f, 0.5f ) ); | |
| 101 | - mDirectionButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 102 | - mDirectionButton.SetSize(75, 75); | |
| 103 | - stage.Add( mDirectionButton ); | |
| 104 | - | |
| 105 | - mWrapButton = Toolkit::PushButton::New(); | |
| 106 | - mWrapButton.SetProperty( PushButton::Property::UNSELECTED_ICON, WRAP_IMAGE ); | |
| 107 | - mWrapButton.SetProperty( PushButton::Property::SELECTED_ICON, WRAP_SELECTED_IMAGE ); | |
| 108 | - mWrapButton.ClickedSignal().Connect( this, &FlexExample::OnWrapClicked ); | |
| 109 | - mWrapButton.SetParentOrigin( Vector3(0.4f, 1.0f, 0.5f )); | |
| 110 | - mWrapButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 111 | - mWrapButton.SetSize(75, 75); | |
| 112 | - stage.Add( mWrapButton ); | |
| 113 | - | |
| 114 | - mJustifyButton = Toolkit::PushButton::New(); | |
| 115 | - mJustifyButton.SetProperty( PushButton::Property::UNSELECTED_ICON, JUSTIFY_IMAGE ); | |
| 116 | - mJustifyButton.SetProperty( PushButton::Property::SELECTED_ICON, JUSTIFY_SELECTED_IMAGE ); | |
| 117 | - mJustifyButton.ClickedSignal().Connect( this, &FlexExample::OnJustifyClicked ); | |
| 118 | - mJustifyButton.SetParentOrigin( Vector3(0.6f, 1.0f, 0.5f )); | |
| 119 | - mJustifyButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 120 | - mJustifyButton.SetSize(75, 75); | |
| 121 | - stage.Add( mJustifyButton ); | |
| 122 | - | |
| 123 | - mRotateButton = PushButton::New(); | |
| 124 | - mRotateButton.SetProperty( PushButton::Property::UNSELECTED_ICON, ROTATE_CLOCKWISE_IMAGE ); | |
| 125 | - mRotateButton.SetProperty( PushButton::Property::SELECTED_ICON, ROTATE_CLOCKWISE_SELECTED_IMAGE ); | |
| 126 | - mRotateButton.ClickedSignal().Connect( this, &FlexExample::OnRotateClicked ); | |
| 127 | - mRotateButton.SetParentOrigin( Vector3(0.8f, 1.0f, 0.5f )); | |
| 128 | - mRotateButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 129 | - mRotateButton.SetSize(75, 75); | |
| 130 | - stage.Add( mRotateButton ); | |
| 131 | - | |
| 132 | - // Create a flex container | |
| 133 | - mFlexContainer = Control::New(); | |
| 134 | - | |
| 135 | - auto layout = FlexLayout::New(); | |
| 136 | - layout.SetAnimateLayout( true ); | |
| 137 | - layout.SetFlexDirection( Toolkit::FlexLayout::FlexDirection::ROW ); | |
| 138 | - layout.SetFlexWrap( Toolkit::FlexLayout::WrapType::NO_WRAP ); | |
| 139 | - layout.SetFlexJustification( Toolkit::FlexLayout::Justification::FLEX_START ); | |
| 140 | - layout.SetFlexAlignment( Toolkit::FlexLayout::Alignment::FLEX_START ); | |
| 141 | - | |
| 142 | - DevelControl::SetLayout( mFlexContainer, layout ); | |
| 143 | - | |
| 144 | - mFlexContainer.SetParentOrigin( ParentOrigin::CENTER ); | |
| 145 | - mFlexContainer.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 146 | - mFlexContainer.SetName( "FlexExample" ); | |
| 147 | - mFlexContainer.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT ); | |
| 148 | - mFlexContainer.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT ); | |
| 149 | - mFlexContainer.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 150 | - mFlexContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); | |
| 151 | - | |
| 152 | - for( unsigned int x = 0; x < NUMBER_OF_RESOURCES; ++x ) | |
| 153 | - { | |
| 154 | - Toolkit::ImageView imageView; | |
| 155 | - CreateChildImageView( imageView, IMAGE_PATH[ x ], Size(100.0f, 100.0f) ); | |
| 156 | - imageView.SetProperty( Toolkit::Control::Property::PADDING, Extents(0.f, 0.f, 0.f, 0.f) ); | |
| 157 | - imageView.SetProperty( Toolkit::Control::Property::MARGIN, Extents(2.0f, 2.0f, 2.0f, 2.0f) ); | |
| 158 | - imageView.SetProperty( Toolkit::FlexLayout::ChildProperty::ALIGN_SELF, Toolkit::FlexLayout::Alignment::CENTER ); | |
| 159 | - imageView.SetProperty( Toolkit::FlexLayout::ChildProperty::FLEX, 0.f ); | |
| 160 | - mFlexContainer.Add( imageView ); | |
| 161 | - } | |
| 162 | - stage.Add( mFlexContainer ); | |
| 163 | -} | |
| 164 | - | |
| 165 | -// Remove controls added by this example from stage | |
| 166 | -void FlexExample::Remove() | |
| 167 | -{ | |
| 168 | - if ( mFlexContainer ) | |
| 169 | - { | |
| 170 | - UnparentAndReset( mDirectionButton ); | |
| 171 | - UnparentAndReset( mWrapButton ); | |
| 172 | - UnparentAndReset( mJustifyButton ); | |
| 173 | - UnparentAndReset( mRotateButton ); | |
| 174 | - UnparentAndReset( mFlexContainer); | |
| 175 | - } | |
| 176 | -} | |
| 177 | - | |
| 178 | -// Mirror items in layout | |
| 179 | -bool FlexExample::OnDirectionClicked( Button button ) | |
| 180 | -{ | |
| 181 | - mLTRDirection = !mLTRDirection; | |
| 182 | - if( mLTRDirection ) | |
| 183 | - { | |
| 184 | - mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, LTR_IMAGE ); | |
| 185 | - mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, LTR_SELECTED_IMAGE ); | |
| 186 | - mFlexContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); | |
| 187 | - } | |
| 188 | - else | |
| 189 | - { | |
| 190 | - mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, RTL_IMAGE ); | |
| 191 | - mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, RTL_SELECTED_IMAGE ); | |
| 192 | - mFlexContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); | |
| 193 | - } | |
| 194 | - return true; | |
| 195 | -} | |
| 196 | - | |
| 197 | -// Rotate layout by changing layout | |
| 198 | -bool FlexExample::OnRotateClicked( Button button ) | |
| 199 | -{ | |
| 200 | - auto layout = FlexLayout::DownCast(DevelControl::GetLayout( mFlexContainer )); | |
| 201 | - if( layout.GetFlexDirection() == Toolkit::FlexLayout::FlexDirection::COLUMN ) | |
| 202 | - { | |
| 203 | - layout.SetFlexDirection( Toolkit::FlexLayout::FlexDirection::ROW ); | |
| 204 | - } | |
| 205 | - else | |
| 206 | - { | |
| 207 | - layout.SetFlexDirection( Toolkit::FlexLayout::FlexDirection::COLUMN ); | |
| 208 | - } | |
| 209 | - return true; | |
| 210 | -} | |
| 211 | - | |
| 212 | -// Alternates the layout wrapping from wrapping to none | |
| 213 | -bool FlexExample::OnWrapClicked( Button button ) | |
| 214 | -{ | |
| 215 | - auto layout = FlexLayout::DownCast(DevelControl::GetLayout( mFlexContainer )); | |
| 216 | - if ( layout.GetFlexWrap() == Toolkit::FlexLayout::WrapType::NO_WRAP ) | |
| 217 | - { | |
| 218 | - layout.SetFlexWrap( Toolkit::FlexLayout::WrapType::WRAP ); | |
| 219 | - layout.SetFlexAlignment( Toolkit::FlexLayout::Alignment::CENTER ); | |
| 220 | - mFlexContainer.SetProperty( Toolkit::Control::Property::PADDING, Extents(0.0f, 0.0f, 45.0f, 75.0f) ); | |
| 221 | - } | |
| 222 | - else | |
| 223 | - { | |
| 224 | - layout.SetFlexWrap( Toolkit::FlexLayout::WrapType::NO_WRAP ); | |
| 225 | - layout.SetFlexAlignment( Toolkit::FlexLayout::Alignment::FLEX_START ); | |
| 226 | - mFlexContainer.SetProperty( Toolkit::Control::Property::PADDING, Extents(0.0f, 0.0f, 0.0f, 0.0f) ); | |
| 227 | - } | |
| 228 | - return true; | |
| 229 | -} | |
| 230 | - | |
| 231 | -// Alternates the layout to justify space between items or not | |
| 232 | -bool FlexExample::OnJustifyClicked( Button button ) | |
| 233 | -{ | |
| 234 | - auto layout = FlexLayout::DownCast(DevelControl::GetLayout( mFlexContainer )); | |
| 235 | - if ( layout.GetFlexJustification() == Toolkit::FlexLayout::Justification::FLEX_START ) | |
| 236 | - { | |
| 237 | - layout.SetFlexJustification( Toolkit::FlexLayout::Justification::SPACE_BETWEEN); | |
| 238 | - } | |
| 239 | - else | |
| 240 | - { | |
| 241 | - layout.SetFlexJustification( Toolkit::FlexLayout::Justification::FLEX_START ); | |
| 242 | - } | |
| 243 | - return true; | |
| 244 | -} | |
| 245 | - | |
| 246 | -} // namespace Demo |
examples/layouting/flex-example.h deleted
| 1 | -#ifndef DALI_DEMO_FLEX_EXAMPLE_H | |
| 2 | -#define DALI_DEMO_FLEX_EXAMPLE_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2018 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 | -#include <dali/dali.h> | |
| 22 | -#include <dali-toolkit/dali-toolkit.h> | |
| 23 | - | |
| 24 | -#include "example.h" | |
| 25 | - | |
| 26 | -using namespace Dali; | |
| 27 | -using namespace Dali::Toolkit; | |
| 28 | - | |
| 29 | -namespace Demo | |
| 30 | -{ | |
| 31 | - | |
| 32 | -/** | |
| 33 | - * @file flex-example.hcpp | |
| 34 | - * @brief Example of a Flex Layout with mirror feature and | |
| 35 | - * transition from horizontal to vertical. | |
| 36 | - */ | |
| 37 | -class FlexExample final: public ConnectionTracker, public Example | |
| 38 | -{ | |
| 39 | -public: | |
| 40 | - | |
| 41 | - // Constructor | |
| 42 | - FlexExample(); | |
| 43 | - | |
| 44 | - // Creates a Flex Layout Example and displays it. | |
| 45 | - virtual void Create() override; | |
| 46 | - | |
| 47 | - // Remove and destroy this layout | |
| 48 | - virtual void Remove() override; | |
| 49 | - | |
| 50 | -private: | |
| 51 | - | |
| 52 | - // Changes the direction of the items. | |
| 53 | - bool OnDirectionClicked( Button button ); | |
| 54 | - | |
| 55 | - // Alternates the layout from horizontal to vertical | |
| 56 | - bool OnRotateClicked( Button button ); | |
| 57 | - | |
| 58 | - // Alternates the layout wrapping from wrapping to none | |
| 59 | - bool OnWrapClicked( Button button ); | |
| 60 | - | |
| 61 | - // Alternates the layout to justify space between items or not | |
| 62 | - bool OnJustifyClicked( Button button ); | |
| 63 | - | |
| 64 | -private: | |
| 65 | - PushButton mDirectionButton; | |
| 66 | - PushButton mRotateButton; | |
| 67 | - PushButton mWrapButton; | |
| 68 | - PushButton mJustifyButton; | |
| 69 | - Control mFlexContainer; | |
| 70 | - bool mLTRDirection; | |
| 71 | -}; // class FlexExample | |
| 72 | - | |
| 73 | -} // namespace Demo | |
| 74 | - | |
| 75 | -#endif //DALI_DEMO_FLEX_EXAMPLE_H |
examples/layouting/grid-example.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 <string> | |
| 19 | -#include "grid-example.h" | |
| 20 | -#include "layout-utilities.h" | |
| 21 | -#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h> | |
| 22 | -#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 23 | -#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 24 | -#include <dali-toolkit/devel-api/layouting/absolute-layout.h> | |
| 25 | -#include <dali-toolkit/devel-api/layouting/grid.h> | |
| 26 | - | |
| 27 | -using namespace Dali; | |
| 28 | -using namespace Dali::Toolkit; | |
| 29 | - | |
| 30 | -namespace | |
| 31 | -{ | |
| 32 | -const char* const TITLE = "Grid Example"; | |
| 33 | - | |
| 34 | -// Helper function to create ImageViews with given filename and size. | |
| 35 | -void CreateChildImageView( ImageView& imageView, const char* filename, Size size ) | |
| 36 | -{ | |
| 37 | - imageView = ImageView::New(); | |
| 38 | - Property::Map imagePropertyMap; | |
| 39 | - imagePropertyMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE; | |
| 40 | - imagePropertyMap[ Toolkit::ImageVisual::Property::URL ] = filename; | |
| 41 | - imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = size.width; | |
| 42 | - imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = size.height; | |
| 43 | - imageView.SetProperty(Toolkit::ImageView::Property::IMAGE , imagePropertyMap ); | |
| 44 | - imageView.SetName("ImageView"); | |
| 45 | - imageView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 46 | - imageView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 47 | -} | |
| 48 | - | |
| 49 | -enum CurrentExample | |
| 50 | -{ | |
| 51 | - GRID_EXACT_WIDTH = 0, | |
| 52 | - ITEMS_WITH_MARGINS, | |
| 53 | - GRID_MATCH_PARENT, | |
| 54 | - GRID_WRAP_CONTENT, | |
| 55 | - ADD_ITEMS, | |
| 56 | - CHANGE_TO_3_COLUMNS | |
| 57 | -}; | |
| 58 | - | |
| 59 | -} | |
| 60 | - | |
| 61 | -namespace Demo | |
| 62 | -{ | |
| 63 | - | |
| 64 | -GridExample::GridExample() | |
| 65 | -: Example( TITLE ), | |
| 66 | - mToggleStatus( GRID_EXACT_WIDTH ) | |
| 67 | -{ | |
| 68 | -} | |
| 69 | - | |
| 70 | -void GridExample::Create() | |
| 71 | -{ | |
| 72 | - // The Init signal is received once (only) during the Application lifetime | |
| 73 | - mToggleStatus = 0; | |
| 74 | - auto stage = Stage::GetCurrent(); | |
| 75 | - | |
| 76 | - // This layout will be the size of the stage but allow the Grid layout to be any size. | |
| 77 | - mRootLayoutControl = LayoutUtilities::CreateRootContainer(); | |
| 78 | - stage.Add( mRootLayoutControl ); | |
| 79 | - | |
| 80 | - // Create a table view to show a pair of buttons above each image. | |
| 81 | - mGridContainer = Control::New(); | |
| 82 | - | |
| 83 | - // Create LinearLayout for this control. | |
| 84 | - auto gridLayout = Grid::New(); | |
| 85 | - gridLayout.SetAnimateLayout(true); | |
| 86 | - gridLayout.SetNumberOfColumns( 2 ); | |
| 87 | - DevelControl::SetLayout( mGridContainer, gridLayout ); | |
| 88 | - mGridContainer.SetName("GridContainer"); | |
| 89 | - mGridContainer.SetBackgroundColor( Color::WHITE ); | |
| 90 | - mGridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); | |
| 91 | - mGridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); | |
| 92 | - mGridContainer.SetProperty( Toolkit::Control::Property::PADDING, Extents( 20,20,20,20 ) ); | |
| 93 | - mGridContainer.SetParentOrigin( ParentOrigin::CENTER ); | |
| 94 | - | |
| 95 | - mRootLayoutControl.Add( mGridContainer ); | |
| 96 | - | |
| 97 | - for( unsigned int x = 0; x < INITIAL_NUMBER_OF_IMAGE_VIEWS; x++ ) | |
| 98 | - { | |
| 99 | - ImageView imageView; | |
| 100 | - CreateChildImageView( imageView, DEMO_IMAGE_DIR "gallery-small-23.jpg" , Size(100.0f, 100.0f) ); | |
| 101 | - mImageViews.push_back( imageView ); | |
| 102 | - mGridContainer.Add( mImageViews[x] ); | |
| 103 | - } | |
| 104 | - | |
| 105 | - // Button toggles the size of the layout | |
| 106 | - mToggleButton = PushButton::New(); | |
| 107 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Set Width 300" ); | |
| 108 | - mToggleButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | |
| 109 | - mToggleButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 110 | - mToggleButton.ClickedSignal().Connect( this, &Demo::GridExample::ToggleButtonClicked ); | |
| 111 | - mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 112 | - mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 113 | - | |
| 114 | - stage.Add( mToggleButton ); | |
| 115 | -} | |
| 116 | - | |
| 117 | -void GridExample::Remove() | |
| 118 | -{ | |
| 119 | - mImageViews.clear(); | |
| 120 | - UnparentAndReset( mGridContainer ); | |
| 121 | - UnparentAndReset( mRootLayoutControl ); | |
| 122 | - UnparentAndReset( mToggleButton ); | |
| 123 | -} | |
| 124 | - | |
| 125 | -void GridExample::ChangeTo3Columns() | |
| 126 | -{ | |
| 127 | - Grid gridLayout = Grid::DownCast( DevelControl::GetLayout(mGridContainer) ); | |
| 128 | - if ( gridLayout ) | |
| 129 | - { | |
| 130 | - gridLayout.SetNumberOfColumns( 3 ); | |
| 131 | - } | |
| 132 | -} | |
| 133 | - | |
| 134 | -void GridExample::AddItemsInteractively() | |
| 135 | -{ | |
| 136 | - if( mImageViews.size() < MAX_NUMBER_OF_IMAGE_VIEWS ) | |
| 137 | - { | |
| 138 | - ImageView imageView; | |
| 139 | - CreateChildImageView( imageView, DEMO_IMAGE_DIR "gallery-small-23.jpg" , Size(100.0f, 100.0f) ); | |
| 140 | - mImageViews.push_back( imageView ); | |
| 141 | - mGridContainer.Add( imageView); | |
| 142 | - | |
| 143 | - // Add item button shows how many items left to add. | |
| 144 | - unsigned int numberOfAdditonalImageViews = MAX_NUMBER_OF_IMAGE_VIEWS-INITIAL_NUMBER_OF_IMAGE_VIEWS; | |
| 145 | - unsigned int remainingImageViews = numberOfAdditonalImageViews - ( ( mImageViews.size() - INITIAL_NUMBER_OF_IMAGE_VIEWS) ); | |
| 146 | - std::string buttonLabel( "Add item["+ std::to_string( numberOfAdditonalImageViews-remainingImageViews ) +"/"+ | |
| 147 | - std::to_string( numberOfAdditonalImageViews)+"]" ); | |
| 148 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, buttonLabel ); | |
| 149 | - } | |
| 150 | -} | |
| 151 | - | |
| 152 | -void GridExample::AddMarginToItems() | |
| 153 | -{ | |
| 154 | - for( unsigned int x = 0; x < INITIAL_NUMBER_OF_IMAGE_VIEWS; x++ ) | |
| 155 | - { | |
| 156 | - mImageViews[x].SetProperty(Toolkit::Control::Property::MARGIN, Extents( 20,20,20,10)); | |
| 157 | - } | |
| 158 | -} | |
| 159 | - | |
| 160 | -void GridExample::RemoveMarginsFromItems() | |
| 161 | -{ | |
| 162 | - for( unsigned int x = 0; x < INITIAL_NUMBER_OF_IMAGE_VIEWS; x++ ) | |
| 163 | - { | |
| 164 | - mImageViews[x].SetProperty(Toolkit::Control::Property::MARGIN, Extents()); | |
| 165 | - } | |
| 166 | -} | |
| 167 | - | |
| 168 | -void GridExample::MatchParentOnWidth() | |
| 169 | -{ | |
| 170 | - mGridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION,ChildLayoutData::MATCH_PARENT ); | |
| 171 | -} | |
| 172 | - | |
| 173 | -void GridExample::WrapContentOnWidth() | |
| 174 | -{ | |
| 175 | - mGridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT ); | |
| 176 | -} | |
| 177 | - | |
| 178 | -void GridExample::SetExactWidth() | |
| 179 | -{ | |
| 180 | - mGridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 300 ); | |
| 181 | -} | |
| 182 | - | |
| 183 | -bool GridExample::ToggleButtonClicked( Toolkit::Button button ) | |
| 184 | -{ | |
| 185 | - switch( mToggleStatus ) | |
| 186 | - { | |
| 187 | - case GRID_EXACT_WIDTH : | |
| 188 | - { | |
| 189 | - SetExactWidth(); | |
| 190 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Set Child Margin" ); | |
| 191 | - mToggleStatus = ITEMS_WITH_MARGINS; | |
| 192 | - break; | |
| 193 | - } | |
| 194 | - case ITEMS_WITH_MARGINS : | |
| 195 | - { | |
| 196 | - AddMarginToItems(); | |
| 197 | - mToggleStatus = GRID_MATCH_PARENT; | |
| 198 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Set width MATCH_PARENT" ); | |
| 199 | - break; | |
| 200 | - } | |
| 201 | - case GRID_MATCH_PARENT : | |
| 202 | - { | |
| 203 | - RemoveMarginsFromItems(); | |
| 204 | - MatchParentOnWidth(); | |
| 205 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Set width WRAP_CONTENT" ); | |
| 206 | - mToggleStatus = GRID_WRAP_CONTENT; | |
| 207 | - break; | |
| 208 | - } | |
| 209 | - case GRID_WRAP_CONTENT : | |
| 210 | - { | |
| 211 | - WrapContentOnWidth(); | |
| 212 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Add item" ); | |
| 213 | - mToggleStatus = ADD_ITEMS; | |
| 214 | - break; | |
| 215 | - } | |
| 216 | - case ADD_ITEMS : | |
| 217 | - { | |
| 218 | - if( mGridContainer.GetChildCount() < MAX_NUMBER_OF_IMAGE_VIEWS ) | |
| 219 | - { | |
| 220 | - AddItemsInteractively(); | |
| 221 | - } | |
| 222 | - | |
| 223 | - if( mGridContainer.GetChildCount() == MAX_NUMBER_OF_IMAGE_VIEWS ) | |
| 224 | - { | |
| 225 | - // Remove button when no more items to add | |
| 226 | - mToggleStatus= CHANGE_TO_3_COLUMNS; | |
| 227 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Columns" ); | |
| 228 | - } | |
| 229 | - break; | |
| 230 | - } | |
| 231 | - case CHANGE_TO_3_COLUMNS : | |
| 232 | - { | |
| 233 | - ChangeTo3Columns(); | |
| 234 | - mToggleStatus = GRID_EXACT_WIDTH; | |
| 235 | - UnparentAndReset( mToggleButton ); | |
| 236 | - break; | |
| 237 | - } | |
| 238 | - default : | |
| 239 | - { | |
| 240 | - mToggleStatus = GRID_EXACT_WIDTH; | |
| 241 | - } | |
| 242 | - } | |
| 243 | - return true; | |
| 244 | -} | |
| 245 | - | |
| 246 | -} // namespace Demo |
examples/layouting/grid-example.h deleted
| 1 | -#ifndef DALI_DEMO_GRID_EXAMPLE_H | |
| 2 | -#define DALI_DEMO_GRID_EXAMPLE_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2018 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 | -#include <string> | |
| 22 | -#include <dali/dali.h> | |
| 23 | -#include <dali-toolkit/dali-toolkit.h> | |
| 24 | - | |
| 25 | -#include "example.h" | |
| 26 | - | |
| 27 | -using namespace Dali; | |
| 28 | -using namespace Dali::Toolkit; | |
| 29 | - | |
| 30 | -namespace Demo | |
| 31 | -{ | |
| 32 | - | |
| 33 | -/** | |
| 34 | - * @file grid-example.hcpp | |
| 35 | - * @brief Example of a Grid Layout | |
| 36 | - */ | |
| 37 | -class GridExample final: public ConnectionTracker, public Example | |
| 38 | -{ | |
| 39 | -public: | |
| 40 | - | |
| 41 | - // Constructor | |
| 42 | - GridExample(); | |
| 43 | - | |
| 44 | - static const unsigned int MAX_NUMBER_OF_IMAGE_VIEWS = 9; | |
| 45 | - static const unsigned int INITIAL_NUMBER_OF_IMAGE_VIEWS = 5; | |
| 46 | - | |
| 47 | - // Create a Grid layout of ImagesViews | |
| 48 | - void Create() override; | |
| 49 | - | |
| 50 | - // Remove created Layout | |
| 51 | - void Remove() override; | |
| 52 | - | |
| 53 | -private: | |
| 54 | - | |
| 55 | - // Callback for button pressed | |
| 56 | - bool ToggleButtonClicked( Toolkit::Button button ); | |
| 57 | - | |
| 58 | - // Actions to perform in this example | |
| 59 | - void ChangeTo3Columns(); | |
| 60 | - void AddItemsInteractively(); | |
| 61 | - void AddMarginToItems(); | |
| 62 | - void RemoveMarginsFromItems(); | |
| 63 | - void MatchParentOnWidth(); | |
| 64 | - void WrapContentOnWidth(); | |
| 65 | - void SetExactWidth(); | |
| 66 | - | |
| 67 | -private: | |
| 68 | - | |
| 69 | - Toolkit::Control mRootLayoutControl; | |
| 70 | - Toolkit::Control mGridContainer; | |
| 71 | - std::vector<Toolkit::ImageView> mImageViews; | |
| 72 | - Toolkit::PushButton mToggleButton; | |
| 73 | - unsigned int mToggleStatus; | |
| 74 | -}; | |
| 75 | - | |
| 76 | -} // namespace Demo | |
| 77 | - | |
| 78 | -#endif // DALI_DEMO_GRID_EXAMPLE_H |
examples/layouting/layout-utilities.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 <dali-toolkit/devel-api/controls/control-devel.h> | |
| 19 | -#include <dali-toolkit/devel-api/layouting/absolute-layout.h> | |
| 20 | - | |
| 21 | -using namespace Dali; | |
| 22 | -using namespace Dali::Toolkit; | |
| 23 | - | |
| 24 | -namespace LayoutUtilities | |
| 25 | -{ | |
| 26 | -Toolkit::Control CreateRootContainer() | |
| 27 | -{ | |
| 28 | - Control rootLayoutControl = Control::New(); | |
| 29 | - rootLayoutControl.SetName( "AbsoluteLayout"); | |
| 30 | - auto rootLayout = AbsoluteLayout::New(); | |
| 31 | - DevelControl::SetLayout( rootLayoutControl, rootLayout ); | |
| 32 | - rootLayoutControl.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 33 | - rootLayoutControl.SetParentOrigin( ParentOrigin::CENTER ); | |
| 34 | - | |
| 35 | - return rootLayoutControl; | |
| 36 | -} | |
| 37 | - | |
| 38 | -} // namespace LayoutUtilities | |
| 39 | 0 | \ No newline at end of file |
examples/layouting/layout-utilities.h deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 | -#ifndef DALI_DEMO_LAYOUT_UTILITIES_H | |
| 19 | -#define DALI_DEMO_LAYOUT_UTILITIES_H | |
| 20 | - | |
| 21 | -#include <dali-toolkit/public-api/controls/control.h> | |
| 22 | - | |
| 23 | -namespace LayoutUtilities | |
| 24 | -{ | |
| 25 | -/** | |
| 26 | - * @brief | |
| 27 | - * Create a root layout, ideally Dali would have a default layout in the root layer. | |
| 28 | - * Without this root layer the mAbsoluteLayout (or any other layout) will not | |
| 29 | - * honour WIDTH_SPECIFICATION or HEIGHT_SPECIFICATION settings. | |
| 30 | - * It uses the default stage size and ideally should have a layout added to it. | |
| 31 | - * @return resulting root layout | |
| 32 | - */ | |
| 33 | -Dali::Toolkit::Control CreateRootContainer(); | |
| 34 | -} // namespace LayoutUtilities | |
| 35 | - | |
| 36 | -#endif // DALI_DEMO_LAYOUT_UTILITIES_H | |
| 37 | 0 | \ No newline at end of file |
examples/layouting/layouting-examples.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2019 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 <memory> | |
| 20 | -#include <string> | |
| 21 | -#include <dali/dali.h> | |
| 22 | -#include <dali-toolkit/dali-toolkit.h> | |
| 23 | -#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 24 | - | |
| 25 | -// INTERNAL INCLUDES | |
| 26 | -#include "shared/view.h" | |
| 27 | -#include "animation-example.h" | |
| 28 | -#include "linear-example.h" | |
| 29 | -#include "padding-example.h" | |
| 30 | -#include "flex-example.h" | |
| 31 | -#include "grid-example.h" | |
| 32 | -#include "example.h" | |
| 33 | -#include "absolute-example.h" | |
| 34 | - | |
| 35 | -using namespace Dali; | |
| 36 | -using namespace Dali::Toolkit; | |
| 37 | - | |
| 38 | -namespace | |
| 39 | -{ | |
| 40 | -const Property::Value BACKGROUND | |
| 41 | -{ | |
| 42 | - { Toolkit::Visual::Property::TYPE, Visual::GRADIENT }, | |
| 43 | - { GradientVisual::Property::STOP_COLOR, Property::Array{ Vector4( 0.0f, 0.352941176f, 0.654901961f, 1.0f ), | |
| 44 | - Vector4( 1.0f, 0.992156863f, 0.894117647f, 1.0f ) } }, | |
| 45 | - { GradientVisual::Property::START_POSITION, Vector2( 0.0f, -0.5f ) }, | |
| 46 | - { GradientVisual::Property::END_POSITION, Vector2( 0.0f, 0.5f ) } | |
| 47 | -}; | |
| 48 | - | |
| 49 | -const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); | |
| 50 | - | |
| 51 | -typedef std::unique_ptr< Demo::Example > ExamplePointer; | |
| 52 | - | |
| 53 | -typedef std::vector< ExamplePointer > ExampleContainer; | |
| 54 | - | |
| 55 | -/// All layouting examples to be shown should be added to this method | |
| 56 | -void CreateExamples( ExampleContainer& container ) | |
| 57 | -{ | |
| 58 | - container.push_back( ExamplePointer(new Demo::AnimationExample) ); | |
| 59 | - container.push_back( ExamplePointer(new Demo::LinearExample) ); | |
| 60 | - container.push_back( ExamplePointer(new Demo::PaddingExample) ); | |
| 61 | - container.push_back( ExamplePointer(new Demo::AbsoluteExample) ); | |
| 62 | - container.push_back( ExamplePointer(new Demo::FlexExample) ) ; | |
| 63 | - container.push_back( ExamplePointer(new Demo::GridExample) ) ; | |
| 64 | -} | |
| 65 | - | |
| 66 | -} // anonymous namespace | |
| 67 | - | |
| 68 | -class LayoutingExample: public ConnectionTracker | |
| 69 | -{ | |
| 70 | - public: | |
| 71 | - | |
| 72 | - LayoutingExample( Application& application ) | |
| 73 | - : mApplication( application ), | |
| 74 | - mLayoutingExamples(), | |
| 75 | - mLayoutIndex( 0 ) | |
| 76 | - { | |
| 77 | - // Connect to the Application's Init signal | |
| 78 | - mApplication.InitSignal().Connect( this, &LayoutingExample::Create ); | |
| 79 | - } | |
| 80 | - | |
| 81 | -private: | |
| 82 | - | |
| 83 | - void Create( Application& application ) | |
| 84 | - { | |
| 85 | - auto stage = Stage::GetCurrent(); | |
| 86 | - stage.KeyEventSignal().Connect( this, &LayoutingExample::OnKeyEvent ); | |
| 87 | - | |
| 88 | - auto bg = Control::New(); | |
| 89 | - bg.SetParentOrigin( ParentOrigin::CENTER ); | |
| 90 | - bg.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 91 | - bg.SetProperty( Control::Property::BACKGROUND, BACKGROUND ); | |
| 92 | - stage.Add( bg ); | |
| 93 | - auto toolbar = ImageView::New( TOOLBAR_IMAGE ); | |
| 94 | - toolbar.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 95 | - toolbar.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 96 | - toolbar.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 97 | - toolbar.SetProperty( Actor::Property::SIZE_HEIGHT, 50.0f); | |
| 98 | - | |
| 99 | - stage.Add( toolbar ); | |
| 100 | - | |
| 101 | - mToolbarTitle = TextLabel::New( ""); | |
| 102 | - mToolbarTitle.SetParentOrigin( ParentOrigin::CENTER ); | |
| 103 | - mToolbarTitle.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 104 | - mToolbarTitle.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE ); | |
| 105 | - mToolbarTitle.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::LEFT ); | |
| 106 | - toolbar.Add( mToolbarTitle ); | |
| 107 | - | |
| 108 | - mNextLayout = PushButton::New(); | |
| 109 | - mNextLayout.SetStyleName( "ChangeLayoutButton" ); | |
| 110 | - mNextLayout.SetProperty( Toolkit::Button::Property::LABEL, "Change Layout" ); | |
| 111 | - mNextLayout.ClickedSignal().Connect( this, &LayoutingExample::ChangeLayout ); | |
| 112 | - mNextLayout.SetParentOrigin( ParentOrigin::TOP_RIGHT ); | |
| 113 | - mNextLayout.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); | |
| 114 | - mNextLayout.SetSize(175, 50); | |
| 115 | - toolbar.Add( mNextLayout ); | |
| 116 | - | |
| 117 | - CreateExamples( mLayoutingExamples ); | |
| 118 | - if( ! mLayoutingExamples.empty() ) | |
| 119 | - { | |
| 120 | - mLayoutingExamples[ mLayoutIndex ]->Create(); | |
| 121 | - mToolbarTitle.SetProperty(Toolkit::TextLabel::Property::TEXT, mLayoutingExamples[ mLayoutIndex ]->GetExampleTitle() ); | |
| 122 | - } | |
| 123 | - } | |
| 124 | - | |
| 125 | - bool ChangeLayout( Button button ) | |
| 126 | - { | |
| 127 | - if( ! mLayoutingExamples.empty() ) | |
| 128 | - { | |
| 129 | - mLayoutingExamples[ mLayoutIndex ]->Remove(); | |
| 130 | - mLayoutIndex = ( mLayoutIndex + 1 ) % mLayoutingExamples.size(); | |
| 131 | - mLayoutingExamples[ mLayoutIndex ]->Create(); | |
| 132 | - mToolbarTitle.SetProperty(Toolkit::TextLabel::Property::TEXT, mLayoutingExamples[ mLayoutIndex ]->Example::GetExampleTitle() ); | |
| 133 | - } | |
| 134 | - return true; | |
| 135 | - } | |
| 136 | - | |
| 137 | - /** | |
| 138 | - * Main key event handler | |
| 139 | - */ | |
| 140 | - void OnKeyEvent(const KeyEvent& event) | |
| 141 | - { | |
| 142 | - if(event.state == KeyEvent::Down) | |
| 143 | - { | |
| 144 | - if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | |
| 145 | - { | |
| 146 | - mApplication.Quit(); | |
| 147 | - } | |
| 148 | - } | |
| 149 | - } | |
| 150 | - | |
| 151 | - | |
| 152 | -private: | |
| 153 | - Application& mApplication; | |
| 154 | - ExampleContainer mLayoutingExamples; | |
| 155 | - PushButton mNextLayout; | |
| 156 | - unsigned int mLayoutIndex; | |
| 157 | - TextLabel mToolbarTitle; | |
| 158 | -}; | |
| 159 | - | |
| 160 | -int DALI_EXPORT_API main( int argc, char **argv ) | |
| 161 | -{ | |
| 162 | - Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | |
| 163 | - LayoutingExample test( application ); | |
| 164 | - application.MainLoop(); | |
| 165 | - return 0; | |
| 166 | -}; |
examples/layouting/linear-example.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 <string> | |
| 19 | -#include "linear-example.h" | |
| 20 | -#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h> | |
| 21 | -#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 22 | -#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 23 | -#include <dali-toolkit/devel-api/layouting/linear-layout.h> | |
| 24 | - | |
| 25 | -using namespace Dali; | |
| 26 | -using namespace Dali::Toolkit; | |
| 27 | - | |
| 28 | -namespace | |
| 29 | -{ | |
| 30 | -const char* const TITLE = "Linear Example"; | |
| 31 | - | |
| 32 | -// Button file names | |
| 33 | -const char* LTR_IMAGE( DEMO_IMAGE_DIR "icon-play.png" ); | |
| 34 | -const char* LTR_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-play-selected.png" ); | |
| 35 | - | |
| 36 | -const char* RTL_IMAGE( DEMO_IMAGE_DIR "icon-reverse.png" ); | |
| 37 | -const char* RTL_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-reverse-selected.png" ); | |
| 38 | - | |
| 39 | -const char* ROTATE_CLOCKWISE_IMAGE( DEMO_IMAGE_DIR "icon-reset.png" ); | |
| 40 | -const char* ROTATE_CLOCKWISE_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-reset-selected.png" ); | |
| 41 | - | |
| 42 | -const char* ALIGN_IMAGE( DEMO_IMAGE_DIR "icon-replace.png" ); | |
| 43 | -const char* ALIGN_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-replace-selected.png" ); | |
| 44 | - | |
| 45 | -const char* WEIGHT_IMAGE( DEMO_IMAGE_DIR "icon-item-view-layout-grid.png" ); | |
| 46 | -const char* WEIGHT_SELECTED_IMAGE( DEMO_IMAGE_DIR "icon-item-view-layout-grid-selected.png" ); | |
| 47 | - | |
| 48 | -// Child image filenames | |
| 49 | -const char* IMAGE_PATH[] = { | |
| 50 | - DEMO_IMAGE_DIR "application-icon-101.png", | |
| 51 | - DEMO_IMAGE_DIR "application-icon-102.png", | |
| 52 | - DEMO_IMAGE_DIR "application-icon-103.png", | |
| 53 | - DEMO_IMAGE_DIR "application-icon-104.png" | |
| 54 | -}; | |
| 55 | - | |
| 56 | -const unsigned int NUMBER_OF_RESOURCES = sizeof(IMAGE_PATH) / sizeof(char*); | |
| 57 | - | |
| 58 | -// Helper function to create ImageViews with given filename and size. | |
| 59 | -void CreateChildImageView( ImageView& imageView, const char* filename, Size size ) | |
| 60 | -{ | |
| 61 | - imageView = ImageView::New(); | |
| 62 | - Property::Map imagePropertyMap; | |
| 63 | - imagePropertyMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE; | |
| 64 | - imagePropertyMap[ Toolkit::ImageVisual::Property::URL ] = filename; | |
| 65 | - imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = size.width; | |
| 66 | - imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = size.height; | |
| 67 | - imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, imagePropertyMap ); | |
| 68 | - imageView.SetName( "ImageView" ); | |
| 69 | - imageView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 70 | - imageView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 71 | -} | |
| 72 | - | |
| 73 | -} // namespace | |
| 74 | - | |
| 75 | -namespace Demo | |
| 76 | -{ | |
| 77 | - | |
| 78 | -LinearExample::LinearExample() | |
| 79 | -: Example( TITLE ), | |
| 80 | - mLTRDirection(true), | |
| 81 | - mImagesWeighted (false ) | |
| 82 | -{ | |
| 83 | -} | |
| 84 | - | |
| 85 | -void LinearExample::Create() | |
| 86 | -{ | |
| 87 | - auto stage = Stage::GetCurrent(); | |
| 88 | - | |
| 89 | - mDirectionButton = PushButton::New(); | |
| 90 | - mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, RTL_IMAGE ); | |
| 91 | - mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, RTL_SELECTED_IMAGE ); | |
| 92 | - mDirectionButton.ClickedSignal().Connect( this, &LinearExample::OnDirectionClicked ); | |
| 93 | - mDirectionButton.SetParentOrigin( Vector3( 0.2f, 1.0f, 0.5f ) ); | |
| 94 | - mDirectionButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 95 | - mDirectionButton.SetSize( 75, 75 ); | |
| 96 | - stage.Add( mDirectionButton ); | |
| 97 | - | |
| 98 | - mAlignmentButton = PushButton::New(); | |
| 99 | - mAlignmentButton.SetProperty( PushButton::Property::UNSELECTED_ICON, ALIGN_IMAGE ); | |
| 100 | - mAlignmentButton.SetProperty( PushButton::Property::SELECTED_ICON, ALIGN_SELECTED_IMAGE ); | |
| 101 | - mAlignmentButton.ClickedSignal().Connect( this, &LinearExample::OnAlignmentClicked ); | |
| 102 | - mAlignmentButton.SetParentOrigin( Vector3( 0.4f, 1.0f, 0.5f ) ); | |
| 103 | - mAlignmentButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 104 | - mAlignmentButton.SetSize( 75, 75 ); | |
| 105 | - stage.Add( mAlignmentButton ); | |
| 106 | - | |
| 107 | - mWeightButton = Toolkit::PushButton::New(); | |
| 108 | - mWeightButton.SetProperty( PushButton::Property::UNSELECTED_ICON, WEIGHT_IMAGE ); | |
| 109 | - mWeightButton.SetProperty( PushButton::Property::SELECTED_ICON, WEIGHT_SELECTED_IMAGE ); | |
| 110 | - mWeightButton.ClickedSignal().Connect( this, &LinearExample::OnWeightClicked ); | |
| 111 | - mWeightButton.SetParentOrigin( Vector3( 0.6f, 1.0f, 0.5f ) ); | |
| 112 | - mWeightButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 113 | - mWeightButton.SetSize( 75, 75 ); | |
| 114 | - stage.Add( mWeightButton ); | |
| 115 | - | |
| 116 | - mRotateButton = PushButton::New(); | |
| 117 | - mRotateButton.SetProperty( PushButton::Property::UNSELECTED_ICON, ROTATE_CLOCKWISE_IMAGE ); | |
| 118 | - mRotateButton.SetProperty( PushButton::Property::SELECTED_ICON, ROTATE_CLOCKWISE_SELECTED_IMAGE ); | |
| 119 | - mRotateButton.ClickedSignal().Connect( this, &LinearExample::OnRotateClicked ); | |
| 120 | - mRotateButton.SetParentOrigin( Vector3( 0.8f, 1.0f, 0.5f ) ); | |
| 121 | - mRotateButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 122 | - mRotateButton.SetSize( 75, 75 ); | |
| 123 | - stage.Add( mRotateButton ); | |
| 124 | - | |
| 125 | - // Create a linear layout | |
| 126 | - mLinearContainer = Control::New(); | |
| 127 | - auto layout = LinearLayout::New(); | |
| 128 | - layout.SetAnimateLayout(true); | |
| 129 | - layout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); | |
| 130 | - layout.SetAlignment( LinearLayout::Alignment::CENTER_VERTICAL ); | |
| 131 | - DevelControl::SetLayout( mLinearContainer, layout ); | |
| 132 | - | |
| 133 | - mLinearContainer.SetParentOrigin( ParentOrigin::CENTER ); | |
| 134 | - mLinearContainer.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 135 | - mLinearContainer.SetName( "LinearExample" ); | |
| 136 | - stage.Add( mLinearContainer ); | |
| 137 | - mLinearContainer.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT ); | |
| 138 | - mLinearContainer.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT ); | |
| 139 | - mLinearContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); | |
| 140 | - | |
| 141 | - for( unsigned int x = 0; x < NUMBER_OF_RESOURCES; ++x ) | |
| 142 | - { | |
| 143 | - Toolkit::ImageView imageView; | |
| 144 | - CreateChildImageView( imageView, IMAGE_PATH[ x ], Size( 100.0f, 100.0f ) ); | |
| 145 | - mLinearContainer.Add( imageView ); | |
| 146 | - mImages.push_back( imageView ); | |
| 147 | - } | |
| 148 | -} | |
| 149 | - | |
| 150 | -// Remove controls added by this example from stage | |
| 151 | -void LinearExample::Remove() | |
| 152 | -{ | |
| 153 | - if ( mLinearContainer ) | |
| 154 | - { | |
| 155 | - UnparentAndReset( mDirectionButton ); | |
| 156 | - UnparentAndReset( mAlignmentButton ); | |
| 157 | - UnparentAndReset( mWeightButton ); | |
| 158 | - UnparentAndReset( mRotateButton ); | |
| 159 | - UnparentAndReset( mLinearContainer); | |
| 160 | - } | |
| 161 | -} | |
| 162 | - | |
| 163 | -// Mirror items in layout | |
| 164 | -bool LinearExample::OnDirectionClicked( Button button ) | |
| 165 | -{ | |
| 166 | - auto layout = LinearLayout::DownCast( DevelControl::GetLayout( mLinearContainer ) ); | |
| 167 | - layout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); | |
| 168 | - if( !mLTRDirection ) | |
| 169 | - { | |
| 170 | - mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, LTR_IMAGE ); | |
| 171 | - mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, LTR_SELECTED_IMAGE ); | |
| 172 | - mLinearContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT ); | |
| 173 | - } | |
| 174 | - else | |
| 175 | - { | |
| 176 | - mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, RTL_IMAGE ); | |
| 177 | - mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, RTL_SELECTED_IMAGE ); | |
| 178 | - mLinearContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); | |
| 179 | - } | |
| 180 | - mLTRDirection = !mLTRDirection; | |
| 181 | - return true; | |
| 182 | -} | |
| 183 | - | |
| 184 | -// Rotate layout by changing layout | |
| 185 | -bool LinearExample::OnRotateClicked( Button button ) | |
| 186 | -{ | |
| 187 | - auto layout = LinearLayout::DownCast( DevelControl::GetLayout( mLinearContainer ) ); | |
| 188 | - if( layout.GetOrientation() == LinearLayout::Orientation::VERTICAL ) | |
| 189 | - { | |
| 190 | - layout.SetOrientation( LinearLayout::Orientation::HORIZONTAL ); | |
| 191 | - layout.SetAlignment(LinearLayout::Alignment::CENTER_VERTICAL ); | |
| 192 | - } | |
| 193 | - else | |
| 194 | - { | |
| 195 | - layout.SetOrientation( LinearLayout::Orientation::VERTICAL ); | |
| 196 | - layout.SetAlignment( LinearLayout::Alignment::CENTER_HORIZONTAL ); | |
| 197 | - } | |
| 198 | - return true; | |
| 199 | -} | |
| 200 | - | |
| 201 | -bool LinearExample::OnAlignmentClicked( Button button ) | |
| 202 | -{ | |
| 203 | - auto layout = LinearLayout::DownCast( DevelControl::GetLayout( mLinearContainer ) ); | |
| 204 | - if ( layout.GetAlignment() == LinearLayout::Alignment::CENTER_VERTICAL ) { | |
| 205 | - layout.SetAlignment( LinearLayout::Alignment::BEGIN ); | |
| 206 | - } | |
| 207 | - else if ( layout.GetAlignment() == LinearLayout::Alignment::BEGIN ) | |
| 208 | - { | |
| 209 | - layout.SetAlignment( LinearLayout::Alignment::END ); | |
| 210 | - } | |
| 211 | - else if ( layout.GetAlignment() == LinearLayout::Alignment::END ) | |
| 212 | - { | |
| 213 | - layout.SetAlignment( LinearLayout::Alignment::CENTER_HORIZONTAL); | |
| 214 | - } | |
| 215 | - else if ( layout.GetAlignment() == LinearLayout::Alignment::CENTER_HORIZONTAL ) | |
| 216 | - { | |
| 217 | - layout.SetAlignment( LinearLayout::Alignment::TOP ); | |
| 218 | - } | |
| 219 | - else if ( layout.GetAlignment() == LinearLayout::Alignment::TOP ) | |
| 220 | - { | |
| 221 | - layout.SetAlignment( LinearLayout::Alignment::BOTTOM ); | |
| 222 | - } | |
| 223 | - else if ( layout.GetAlignment() == LinearLayout::Alignment::BOTTOM ) | |
| 224 | - { | |
| 225 | - layout.SetAlignment( LinearLayout::Alignment::CENTER_VERTICAL ); | |
| 226 | - } | |
| 227 | - return true; | |
| 228 | -} | |
| 229 | - | |
| 230 | -bool LinearExample::OnWeightClicked( Button button ) | |
| 231 | -{ | |
| 232 | - if( !mImagesWeighted ) | |
| 233 | - { | |
| 234 | - for( auto&& iter : mImages ) | |
| 235 | - { | |
| 236 | - iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f ); | |
| 237 | - } | |
| 238 | - } | |
| 239 | - else | |
| 240 | - { | |
| 241 | - for( auto&& iter : mImages ) | |
| 242 | - { | |
| 243 | - iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.0f ); | |
| 244 | - } | |
| 245 | - } | |
| 246 | - | |
| 247 | - mImagesWeighted = !mImagesWeighted; | |
| 248 | - return true; | |
| 249 | -} | |
| 250 | - | |
| 251 | -} // namespace Demo |
examples/layouting/linear-example.h deleted
| 1 | -#ifndef DALI_DEMO_LINEAR_EXAMPLE_H | |
| 2 | -#define DALI_DEMO_LINEAR_EXAMPLE_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2018 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 | -#include <dali/dali.h> | |
| 22 | -#include <dali-toolkit/dali-toolkit.h> | |
| 23 | - | |
| 24 | -#include "example.h" | |
| 25 | - | |
| 26 | -using namespace Dali; | |
| 27 | -using namespace Dali::Toolkit; | |
| 28 | - | |
| 29 | -namespace Demo | |
| 30 | -{ | |
| 31 | - | |
| 32 | -/** | |
| 33 | - * @file linear-example.hcpp | |
| 34 | - * @brief Example of a Linear Layout with mirror feature and | |
| 35 | - * transition from horizontal to vertical. | |
| 36 | - */ | |
| 37 | -class LinearExample final: public ConnectionTracker, public Example | |
| 38 | -{ | |
| 39 | -public: | |
| 40 | - LinearExample(); | |
| 41 | - | |
| 42 | - // Creates a Linear Layout Example and displays it. | |
| 43 | - virtual void Create() override; | |
| 44 | - | |
| 45 | - // Remove and destroy this layout | |
| 46 | - virtual void Remove() override; | |
| 47 | - | |
| 48 | -private: | |
| 49 | - | |
| 50 | - // Changes the direction of the items. | |
| 51 | - bool OnDirectionClicked( Button button ); | |
| 52 | - | |
| 53 | - // Alternates the linear layout from horizontal to vertical | |
| 54 | - bool OnRotateClicked( Button button ); | |
| 55 | - | |
| 56 | - // Cycles through alignment options | |
| 57 | - bool OnAlignmentClicked( Button button ); | |
| 58 | - | |
| 59 | - // Justifies linear layout children using weight property | |
| 60 | - bool OnWeightClicked( Button button ); | |
| 61 | - | |
| 62 | -private: | |
| 63 | - PushButton mDirectionButton; | |
| 64 | - PushButton mAlignmentButton; | |
| 65 | - PushButton mWeightButton; | |
| 66 | - PushButton mRotateButton; | |
| 67 | - std::vector< Toolkit::ImageView > mImages; | |
| 68 | - Control mLinearContainer; | |
| 69 | - bool mLTRDirection; | |
| 70 | - bool mImagesWeighted; | |
| 71 | -}; // class LinearContainer | |
| 72 | - | |
| 73 | -} // namespace Demo | |
| 74 | - | |
| 75 | -#endif //DALI_DEMO_LINEAR_CONTAINER_H |
examples/layouting/padding-example.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 <string> | |
| 19 | -#include "padding-example.h" | |
| 20 | -#include "layout-utilities.h" | |
| 21 | -#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h> | |
| 22 | -#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | |
| 23 | -#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 24 | -#include <dali-toolkit/devel-api/layouting/absolute-layout.h> | |
| 25 | -#include <dali-toolkit/devel-api/layouting/linear-layout.h> | |
| 26 | - | |
| 27 | -using namespace Dali; | |
| 28 | -using namespace Dali::Toolkit; | |
| 29 | - | |
| 30 | - | |
| 31 | -namespace | |
| 32 | -{ | |
| 33 | -const char* const TITLE = "Padding Example"; | |
| 34 | - | |
| 35 | -// Helper function to create ImageViews with given filename and size. | |
| 36 | -void CreateChildImageView( ImageView& imageView, const char* filename, Size size ) | |
| 37 | -{ | |
| 38 | - imageView = ImageView::New(); | |
| 39 | - Property::Map imagePropertyMap; | |
| 40 | - imagePropertyMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE; | |
| 41 | - imagePropertyMap[ Toolkit::ImageVisual::Property::URL ] = filename; | |
| 42 | - imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = size.width; | |
| 43 | - imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = size.height; | |
| 44 | - imageView.SetProperty(Toolkit::ImageView::Property::IMAGE , imagePropertyMap ); | |
| 45 | - imageView.SetName("ImageView"); | |
| 46 | - imageView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 47 | - imageView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 48 | -} | |
| 49 | - | |
| 50 | -} | |
| 51 | - | |
| 52 | -namespace Demo | |
| 53 | -{ | |
| 54 | - | |
| 55 | -PaddingExample::PaddingExample() | |
| 56 | -: Example( TITLE ) | |
| 57 | -{} | |
| 58 | - | |
| 59 | -void PaddingExample::Create() | |
| 60 | -{ | |
| 61 | - // The Init signal is received once (only) during the Application lifetime | |
| 62 | - | |
| 63 | - auto stage = Stage::GetCurrent(); | |
| 64 | - | |
| 65 | - Control rootLayoutControl = LayoutUtilities::CreateRootContainer(); | |
| 66 | - stage.Add( rootLayoutControl ); | |
| 67 | - | |
| 68 | - // Create a table view to show a pair of buttons above each image. | |
| 69 | - mHorizontalBox = Control::New(); | |
| 70 | - | |
| 71 | - // Create LinearLayout for this control. | |
| 72 | - auto hboxLayout = LinearLayout::New(); | |
| 73 | - DevelControl::SetLayout( mHorizontalBox, hboxLayout ); | |
| 74 | - mHorizontalBox.SetName("HBox"); | |
| 75 | - mHorizontalBox.SetBackgroundColor( Color::WHITE ); | |
| 76 | - mHorizontalBox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 480 ); | |
| 77 | - mHorizontalBox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 700 ); | |
| 78 | - mHorizontalBox.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 79 | - mHorizontalBox.SetParentOrigin( ParentOrigin::CENTER ); | |
| 80 | - | |
| 81 | - rootLayoutControl.Add( mHorizontalBox ); | |
| 82 | - | |
| 83 | - mToggleButton = Toolkit::PushButton::New(); | |
| 84 | - mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Toggle Padding on #2" ); | |
| 85 | - mToggleButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | |
| 86 | - mToggleButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 87 | - mToggleButton.ClickedSignal().Connect( this, &Demo::PaddingExample::ChangePaddingClicked ); | |
| 88 | - mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 89 | - mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 90 | - | |
| 91 | - stage.Add( mToggleButton ); | |
| 92 | - | |
| 93 | - for( unsigned int x = 0; x < NUMBER_OF_IMAGE_VIEWS; x++ ) | |
| 94 | - { | |
| 95 | - CreateChildImageView( mImageViews[x], DEMO_IMAGE_DIR "gallery-small-23.jpg" , Size(100.0f, 100.0f) ); | |
| 96 | - | |
| 97 | - // Set Padding for second ImageView | |
| 98 | - if( 1 == x ) | |
| 99 | - { | |
| 100 | - mImageViews[x].SetProperty(Toolkit::Control::Property::PADDING, Extents( 10.0f,10.0f,5.0f, 5.0f)); | |
| 101 | - } | |
| 102 | - | |
| 103 | - // Set margin for first ImageView | |
| 104 | - if( 0 == x ) | |
| 105 | - { | |
| 106 | - mImageViews[x].SetProperty(Toolkit::Control::Property::MARGIN, Extents( 10.0f,10.0f,0.0f, 0.0f)); | |
| 107 | - } | |
| 108 | - | |
| 109 | - mHorizontalBox.Add( mImageViews[x] ); | |
| 110 | - | |
| 111 | - mImageViewToggleStatus[ x ] = true; | |
| 112 | - } | |
| 113 | -} | |
| 114 | - | |
| 115 | -void PaddingExample::Remove() | |
| 116 | -{ | |
| 117 | - UnparentAndReset( mToggleButton ); | |
| 118 | - UnparentAndReset( mHorizontalBox ); | |
| 119 | -} | |
| 120 | - | |
| 121 | -bool PaddingExample::ChangePaddingClicked( Toolkit::Button button ) | |
| 122 | -{ | |
| 123 | - if ( true == mImageViewToggleStatus[ 1 ] ) | |
| 124 | - { | |
| 125 | - mImageViews[1].SetProperty(Toolkit::Control::Property::PADDING, Extents( .0f, .0f, .0f, .0f)); | |
| 126 | - mImageViews[1].SetProperty(Actor::Property::COLOR_ALPHA, 0.5f); | |
| 127 | - mImageViewToggleStatus[ 1 ] = false; | |
| 128 | - } | |
| 129 | - else | |
| 130 | - { | |
| 131 | - mImageViews[1].SetProperty(Toolkit::Control::Property::PADDING, Extents( 10.0f, 10.0f, 5.0f, 5.0f)); | |
| 132 | - mImageViews[1].SetProperty(Actor::Property::COLOR_ALPHA, 1.0f); | |
| 133 | - mImageViewToggleStatus[ 1 ] = true; | |
| 134 | - } | |
| 135 | - | |
| 136 | - return true; | |
| 137 | -} | |
| 138 | - | |
| 139 | -} // namespace Demo |
examples/layouting/padding-example.h deleted
| 1 | -#ifndef DALI_DEMO_PADDING_EXAMPLE_H | |
| 2 | -#define DALI_DEMO_PADDING_EXAMPLE_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2018 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 | -#include <string> | |
| 22 | -#include <dali/dali.h> | |
| 23 | -#include <dali-toolkit/dali-toolkit.h> | |
| 24 | - | |
| 25 | -#include "example.h" | |
| 26 | - | |
| 27 | -using namespace Dali; | |
| 28 | -using namespace Dali::Toolkit; | |
| 29 | - | |
| 30 | -namespace Demo | |
| 31 | -{ | |
| 32 | - | |
| 33 | -/** | |
| 34 | - * @file padding-example.hcpp | |
| 35 | - * @brief Example of a Linear Layout with padding applied, enables updating of padding values for | |
| 36 | - * one of the children. | |
| 37 | - */ | |
| 38 | -class PaddingExample final: public ConnectionTracker, public Example | |
| 39 | -{ | |
| 40 | -public: | |
| 41 | - | |
| 42 | - static const unsigned int NUMBER_OF_IMAGE_VIEWS = 3; | |
| 43 | - | |
| 44 | - // Constructor | |
| 45 | - PaddingExample(); | |
| 46 | - | |
| 47 | - // Create a Linear layout of ImagesViews, one with a Margin, One with padding. | |
| 48 | - void Create() override; | |
| 49 | - | |
| 50 | - // Remove created Layout | |
| 51 | - void Remove() override; | |
| 52 | - | |
| 53 | -private: | |
| 54 | - | |
| 55 | - // Change Paddding callback | |
| 56 | - bool ChangePaddingClicked( Toolkit::Button button ); | |
| 57 | - | |
| 58 | -private: | |
| 59 | - | |
| 60 | - Toolkit::Control mHorizontalBox; | |
| 61 | - Toolkit::ImageView mImageViews[ NUMBER_OF_IMAGE_VIEWS ]; | |
| 62 | - bool mImageViewToggleStatus[ NUMBER_OF_IMAGE_VIEWS ]; | |
| 63 | - Toolkit::PushButton mToggleButton; | |
| 64 | - | |
| 65 | -}; | |
| 66 | - | |
| 67 | -} // namespace Demo | |
| 68 | - | |
| 69 | -#endif // DALI_DEMO_PADDING_EXAMPLE_H |
examples/pre-render-callback/pre-render-callback-example.cpp
| ... | ... | @@ -17,7 +17,6 @@ |
| 17 | 17 | #include <dali-toolkit/dali-toolkit.h> |
| 18 | 18 | #include <dali/integration-api/adaptors/adaptor.h> |
| 19 | 19 | #include <dali/devel-api/adaptor-framework/application-devel.h> |
| 20 | -#include <dali-toolkit/devel-api/layouting/linear-layout.h> | |
| 21 | 20 | #include <dali-toolkit/devel-api/controls/control-devel.h> |
| 22 | 21 | |
| 23 | 22 | using namespace Dali::Toolkit; |
| ... | ... | @@ -28,12 +27,16 @@ const char* SCENE_IMAGE_1( DEMO_IMAGE_DIR "gallery-small-10.jpg"); |
| 28 | 27 | const char* SCENE_IMAGE_2( DEMO_IMAGE_DIR "gallery-small-42.jpg"); |
| 29 | 28 | const char* SCENE_IMAGE_3( DEMO_IMAGE_DIR "gallery-small-48.jpg"); |
| 30 | 29 | const char* ROTATE_TEXT("-\\|/"); |
| 30 | +const float TEXT_HEIGHT = 40.0f; | |
| 31 | 31 | |
| 32 | -void AddText( Control textContainer, std::string text ) | |
| 32 | +void AddText( Control textContainer, std::string text, unsigned int yIndex ) | |
| 33 | 33 | { |
| 34 | 34 | auto label = TextLabel::New(text); |
| 35 | + label.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 35 | 36 | label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 36 | - textContainer.Add(label); | |
| 37 | + label.SetSize( 300,TEXT_HEIGHT ); | |
| 38 | + label.SetY( yIndex*TEXT_HEIGHT ); | |
| 39 | + textContainer.Add( label ); | |
| 37 | 40 | } |
| 38 | 41 | |
| 39 | 42 | class PreRenderCallbackController : public ConnectionTracker |
| ... | ... | @@ -100,29 +103,21 @@ private: |
| 100 | 103 | |
| 101 | 104 | CreateAnimatingScene(); |
| 102 | 105 | |
| 103 | - auto vbox = LinearLayout::New(); | |
| 104 | - vbox.SetOrientation(LinearLayout::Orientation::VERTICAL); | |
| 105 | - vbox.SetAlignment( LinearLayout::Alignment::TOP | LinearLayout::Alignment::CENTER_HORIZONTAL ); | |
| 106 | 106 | auto textContainer = Control::New(); |
| 107 | 107 | textContainer.SetAnchorPoint(AnchorPoint::TOP_LEFT); |
| 108 | - DevelControl::SetLayout( textContainer, vbox ); | |
| 109 | - AddText(textContainer, "Click to add callback"); | |
| 110 | - AddText(textContainer, "Press 1 to add callback"); | |
| 111 | - AddText(textContainer, "Press 2 to clear callback"); | |
| 112 | - AddText(textContainer, "Press 3 to toggle keep alive"); | |
| 113 | - | |
| 114 | - auto vbox2 = LinearLayout::New(); | |
| 115 | - vbox2.SetOrientation(LinearLayout::Orientation::VERTICAL); | |
| 116 | - vbox2.SetAlignment( LinearLayout::Alignment::BOTTOM | LinearLayout::Alignment::CENTER_HORIZONTAL ); | |
| 117 | - auto textContainer2 = Control::New(); | |
| 118 | - textContainer2.SetAnchorPoint(AnchorPoint::TOP_LEFT); | |
| 119 | - DevelControl::SetLayout( textContainer2, vbox2 ); | |
| 108 | + AddText(textContainer, "Click to add callback", 1 ); | |
| 109 | + AddText(textContainer, "Press 1 to add callback", 2 ); | |
| 110 | + AddText(textContainer, "Press 2 to clear callback", 3 ); | |
| 111 | + AddText(textContainer, "Press 3 to toggle keep alive", 4 ); | |
| 112 | + | |
| 113 | + | |
| 120 | 114 | mSpinner = TextLabel::New(""); |
| 121 | 115 | mSpinner.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 122 | - textContainer2.Add(mSpinner); | |
| 116 | + mSpinner.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 117 | + mSpinner.SetSize(100,100); | |
| 123 | 118 | |
| 119 | + mStage.Add(mSpinner); | |
| 124 | 120 | mStage.Add(textContainer); |
| 125 | - mStage.Add(textContainer2); | |
| 126 | 121 | |
| 127 | 122 | DevelApplication::AddIdleWithReturnValue( application, MakeCallback( this, &PreRenderCallbackController::OnIdle ) ); |
| 128 | 123 | } | ... | ... |
examples/simple-layout/custom-layout-impl.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 | -// CLASS HEADER | |
| 18 | -#include "custom-layout-impl.h" | |
| 19 | - | |
| 20 | -// EXTERNAL INCLUDES | |
| 21 | -#include <dali/public-api/actors/actor.h> | |
| 22 | - | |
| 23 | -namespace Demo | |
| 24 | -{ | |
| 25 | - | |
| 26 | -namespace Internal | |
| 27 | -{ | |
| 28 | - | |
| 29 | -using Dali::Actor; | |
| 30 | -using Dali::Toolkit::MeasuredSize; | |
| 31 | - | |
| 32 | -CustomLayoutPtr CustomLayout::New() | |
| 33 | -{ | |
| 34 | - CustomLayoutPtr layout( new CustomLayout() ); | |
| 35 | - return layout; | |
| 36 | -} | |
| 37 | - | |
| 38 | -void CustomLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec ) | |
| 39 | -{ | |
| 40 | - LayoutLength accumulatedWidth = 0; | |
| 41 | - LayoutLength maxHeight = 0; | |
| 42 | - | |
| 43 | - // In this layout we will: | |
| 44 | - // Measuring the layout with the children in a horizontal configuration, one after another | |
| 45 | - // Set the required width to be the accumulated width of our children | |
| 46 | - // Set the required height to be the maximum height of any of our children | |
| 47 | - | |
| 48 | - for( unsigned int i=0; i<GetChildCount(); ++i ) | |
| 49 | - { | |
| 50 | - auto childLayout = GetChildAt( i ); | |
| 51 | - if( childLayout ) | |
| 52 | - { | |
| 53 | - MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec ); | |
| 54 | - accumulatedWidth += childLayout->GetMeasuredWidth(); | |
| 55 | - std::max( childLayout->GetMeasuredHeight(), maxHeight ); | |
| 56 | - } | |
| 57 | - } | |
| 58 | - | |
| 59 | - // Finally, call this method to set the dimensions we would like | |
| 60 | - SetMeasuredDimensions( MeasuredSize( accumulatedWidth ), MeasuredSize( maxHeight ) ); | |
| 61 | -} | |
| 62 | - | |
| 63 | -void CustomLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom ) | |
| 64 | -{ | |
| 65 | - LayoutLength childTop( 0 ); | |
| 66 | - LayoutLength childLeft( 0 ); | |
| 67 | - | |
| 68 | - // We want to vertically align the children to the middle | |
| 69 | - LayoutLength middle = (bottom - top) / 2; | |
| 70 | - | |
| 71 | - // Horizontally align the children to the middle of the space they are given too | |
| 72 | - LayoutLength width = right - left; | |
| 73 | - int count = GetChildCount(); | |
| 74 | - LayoutLength childIncrement = width / count; | |
| 75 | - LayoutLength center = childIncrement / 2; | |
| 76 | - | |
| 77 | - // Check layout direction | |
| 78 | - auto owner = GetOwner(); | |
| 79 | - auto actor = Actor::DownCast(owner); | |
| 80 | - const bool isLayoutRtl = actor ? actor.GetProperty< bool >( Actor::Property::LAYOUT_DIRECTION ) : false; | |
| 81 | - | |
| 82 | - for( int i = 0; i < count; i++) | |
| 83 | - { | |
| 84 | - auto itemIndex = isLayoutRtl ? count - 1 - i : i; // If RTL, then layout the last item first | |
| 85 | - | |
| 86 | - Dali::Toolkit::Internal::LayoutItemPtr childLayout = GetChildAt( itemIndex ); | |
| 87 | - if( childLayout != nullptr ) | |
| 88 | - { | |
| 89 | - LayoutLength childWidth = childLayout->GetMeasuredWidth(); | |
| 90 | - LayoutLength childHeight = childLayout->GetMeasuredHeight(); | |
| 91 | - | |
| 92 | - childTop = middle - childHeight / 2; | |
| 93 | - | |
| 94 | - LayoutLength left = childLeft + center - childWidth / 2; | |
| 95 | - | |
| 96 | - childLayout->Layout( left, childTop, left + childWidth, childTop + childHeight ); | |
| 97 | - childLeft += childIncrement; | |
| 98 | - } | |
| 99 | - } | |
| 100 | -} | |
| 101 | - | |
| 102 | -} // namespace Internal | |
| 103 | - | |
| 104 | -} // namespace Demo |
examples/simple-layout/custom-layout-impl.h deleted
| 1 | -#ifndef DEMO_INTERNAL_CUSTOM_LAYOUT_H | |
| 2 | -#define DEMO_INTERNAL_CUSTOM_LAYOUT_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2018 Samsung Electronics Co., Ltd. | |
| 6 | - * | |
| 7 | - * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | - * you may not use this file except in compliance with the License. | |
| 9 | - * You may obtain a copy of the License at | |
| 10 | - * | |
| 11 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | - * | |
| 13 | - * Unless required by applicable law or agreed to in writing, software | |
| 14 | - * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | - * See the License for the specific language governing permissions and | |
| 17 | - * limitations under the License. | |
| 18 | - */ | |
| 19 | - | |
| 20 | -// EXTERNAL INCLUDES | |
| 21 | -#include <dali/public-api/common/intrusive-ptr.h> | |
| 22 | -#include <dali-toolkit/devel-api/layouting/layout-group-impl.h> | |
| 23 | - | |
| 24 | -// INTERNAL INCLUDES | |
| 25 | -#include "custom-layout.h" | |
| 26 | - | |
| 27 | -namespace Demo | |
| 28 | -{ | |
| 29 | - | |
| 30 | -namespace Internal | |
| 31 | -{ | |
| 32 | - | |
| 33 | -using Dali::Toolkit::MeasureSpec; | |
| 34 | -using Dali::Toolkit::LayoutLength; | |
| 35 | - | |
| 36 | -class CustomLayout; | |
| 37 | -using CustomLayoutPtr = Dali::IntrusivePtr< CustomLayout >; | |
| 38 | - | |
| 39 | -/** | |
| 40 | - * @brief The implementation of our custom layout. | |
| 41 | - * | |
| 42 | - * Here we will override the methods that we require to mimic a very simple horizontal layout. | |
| 43 | - */ | |
| 44 | -class CustomLayout final : public Dali::Toolkit::Internal::LayoutGroup | |
| 45 | -{ | |
| 46 | -public: | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * @brief Create a new CustomLayout object. | |
| 50 | - * @return An intrusive pointer to the created CustomLayout object | |
| 51 | - */ | |
| 52 | - static CustomLayoutPtr New(); | |
| 53 | - | |
| 54 | - // Movable but not copyable | |
| 55 | - CustomLayout( const CustomLayout& other ) = delete; | |
| 56 | - CustomLayout& operator=( const CustomLayout& ) = delete; | |
| 57 | - CustomLayout( CustomLayout&& other ) = default; | |
| 58 | - CustomLayout& operator=( CustomLayout&& other ) = default; | |
| 59 | - | |
| 60 | -private: | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * @brief Default Constructor | |
| 64 | - */ | |
| 65 | - CustomLayout() = default; | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * Virtual Destructor | |
| 69 | - */ | |
| 70 | - virtual ~CustomLayout() = default; | |
| 71 | - | |
| 72 | - /** | |
| 73 | - * @copydoc LayoutItem::OnMeasure | |
| 74 | - * | |
| 75 | - * Overriding this method so that we can calculate the size we require using our children's sizes | |
| 76 | - */ | |
| 77 | - virtual void OnMeasure( MeasureSpec widthMeasureSpec, Dali::Toolkit::MeasureSpec heightMeasureSpec ) override; | |
| 78 | - | |
| 79 | - /** | |
| 80 | - * @copydoc LayoutItem::OnLayout | |
| 81 | - * | |
| 82 | - * Overriding this method so that we can layout our children as required. | |
| 83 | - */ | |
| 84 | - virtual void OnLayout( bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom ) override; | |
| 85 | - | |
| 86 | -}; | |
| 87 | - | |
| 88 | -} // namespace Internal | |
| 89 | - | |
| 90 | -inline Internal::CustomLayout& GetImplementation( Demo::CustomLayout& handle ) | |
| 91 | -{ | |
| 92 | - DALI_ASSERT_ALWAYS( handle && "CustomLayout handle is empty" ); | |
| 93 | - Dali::BaseObject& object = handle.GetBaseObject(); | |
| 94 | - return static_cast<Internal::CustomLayout&>( object ); | |
| 95 | -} | |
| 96 | - | |
| 97 | -inline const Internal::CustomLayout& GetImplementation( const Demo::CustomLayout& handle ) | |
| 98 | -{ | |
| 99 | - DALI_ASSERT_ALWAYS( handle && "CustomLayout handle is empty" ); | |
| 100 | - const Dali::BaseObject& object = handle.GetBaseObject(); | |
| 101 | - return static_cast<const Internal::CustomLayout&>( object ); | |
| 102 | -} | |
| 103 | - | |
| 104 | -} // namespace Demo | |
| 105 | - | |
| 106 | -#endif // DEMO_INTERNAL_CUSTOM_LAYOUT_H |
examples/simple-layout/custom-layout.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 | -// CLASS HEADER | |
| 18 | -#include "custom-layout.h" | |
| 19 | - | |
| 20 | -// INTERNAL HEADERS | |
| 21 | -#include "custom-layout-impl.h" | |
| 22 | - | |
| 23 | -namespace Demo | |
| 24 | -{ | |
| 25 | - | |
| 26 | -CustomLayout CustomLayout::New() | |
| 27 | -{ | |
| 28 | - Internal::CustomLayoutPtr internal = Internal::CustomLayout::New(); | |
| 29 | - return CustomLayout( internal.Get() ); | |
| 30 | -} | |
| 31 | - | |
| 32 | -CustomLayout CustomLayout::DownCast( BaseHandle handle ) | |
| 33 | -{ | |
| 34 | - return CustomLayout( dynamic_cast< Demo::Internal::CustomLayout* >( handle.GetObjectPtr() ) ); | |
| 35 | -} | |
| 36 | - | |
| 37 | -CustomLayout::CustomLayout( Internal::CustomLayout* object ) | |
| 38 | -: Dali::Toolkit::LayoutGroup( object ) | |
| 39 | -{ | |
| 40 | -} | |
| 41 | - | |
| 42 | -} // namespace Demo |
examples/simple-layout/custom-layout.h deleted
| 1 | -#ifndef DEMO_CUSTOM_LAYOUT_H | |
| 2 | -#define DEMO_CUSTOM_LAYOUT_H | |
| 3 | - | |
| 4 | -/* | |
| 5 | - * Copyright (c) 2018 Samsung Electronics Co., Ltd. | |
| 6 | - * | |
| 7 | - * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | - * you may not use this file except in compliance with the License. | |
| 9 | - * You may obtain a copy of the License at | |
| 10 | - * | |
| 11 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | - * | |
| 13 | - * Unless required by applicable law or agreed to in writing, software | |
| 14 | - * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | - * See the License for the specific language governing permissions and | |
| 17 | - * limitations under the License. | |
| 18 | - */ | |
| 19 | - | |
| 20 | -// EXTERNAL INCLUDES | |
| 21 | -#include <dali/public-api/object/base-handle.h> | |
| 22 | -#include <dali-toolkit/devel-api/layouting/layout-group.h> | |
| 23 | - | |
| 24 | -namespace Demo | |
| 25 | -{ | |
| 26 | - | |
| 27 | -namespace Internal | |
| 28 | -{ | |
| 29 | -class CustomLayout; | |
| 30 | -} | |
| 31 | - | |
| 32 | -/** | |
| 33 | - * @brief This is the handle class to a very simple Custom Layout. | |
| 34 | - * | |
| 35 | - * This class lays out its children horizontally in a very simple manner. | |
| 36 | - */ | |
| 37 | -class CustomLayout : public Dali::Toolkit::LayoutGroup | |
| 38 | -{ | |
| 39 | -public: | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * @brief Creates an uninitialized CustomLayout handle. | |
| 43 | - * | |
| 44 | - * Initialize it using CustomLayout::New(). | |
| 45 | - * Calling member functions with an uninitialized handle is not allowed. | |
| 46 | - */ | |
| 47 | - CustomLayout() = default; | |
| 48 | - | |
| 49 | - /** | |
| 50 | - * @brief Creates a CustomLayout object. | |
| 51 | - */ | |
| 52 | - static CustomLayout New(); | |
| 53 | - | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * @brief Default destructor. | |
| 57 | - * | |
| 58 | - * This is non-virtual, since derived Handle types must not contain data or virtual methods | |
| 59 | - */ | |
| 60 | - ~CustomLayout() = default; | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * @brief Copy constructor | |
| 64 | - */ | |
| 65 | - CustomLayout( const CustomLayout& ) = default; | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * @brief Assigment operator | |
| 69 | - */ | |
| 70 | - CustomLayout& operator=( const CustomLayout& ) = default; | |
| 71 | - | |
| 72 | - /** | |
| 73 | - * @brief Move constructor | |
| 74 | - */ | |
| 75 | - CustomLayout( CustomLayout&& ) = default; | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * @brief Movable assignment operator | |
| 79 | - */ | |
| 80 | - CustomLayout& operator=( CustomLayout&& ) = default; | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * @brief Downcasts a handle to a CustomLayout handle. | |
| 84 | - * | |
| 85 | - * If handle points to a CustomLayout, the downcast produces a valid handle. | |
| 86 | - * If not, the returned handle is left uninitialized. | |
| 87 | - | |
| 88 | - * @param[in] handle to an object | |
| 89 | - * @return Handle to a CustomLayout or an uninitialized handle | |
| 90 | - */ | |
| 91 | - static CustomLayout DownCast( BaseHandle handle ); | |
| 92 | - | |
| 93 | -public: // Not intended for application developers | |
| 94 | - | |
| 95 | - /// @cond internal | |
| 96 | - /** | |
| 97 | - * @brief This constructor is used by CustomLayout::New() methods. | |
| 98 | - * | |
| 99 | - * @param[in] actor A pointer to a newly allocated Dali resource | |
| 100 | - */ | |
| 101 | - explicit CustomLayout( Internal::CustomLayout* body ); | |
| 102 | - /// @endcond | |
| 103 | -}; | |
| 104 | - | |
| 105 | -} // namespace Demo | |
| 106 | - | |
| 107 | -#endif // DEMO_CUSTOM_LAYOUT_H |
examples/simple-layout/simple-layout-example.cpp deleted
| 1 | -/* | |
| 2 | - * Copyright (c) 2018 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 <dali-toolkit/dali-toolkit.h> | |
| 19 | - | |
| 20 | -#include <dali-toolkit/devel-api/controls/control-devel.h> | |
| 21 | -#include <dali-toolkit/devel-api/layouting/layout-item-impl.h> | |
| 22 | - | |
| 23 | -#include "custom-layout.h" | |
| 24 | - | |
| 25 | -using namespace Dali; | |
| 26 | -using namespace Dali::Toolkit; | |
| 27 | - | |
| 28 | -namespace | |
| 29 | -{ | |
| 30 | - | |
| 31 | -/// Child image filenames | |
| 32 | -const char* IMAGE_PATH[] = { | |
| 33 | - DEMO_IMAGE_DIR "application-icon-101.png", | |
| 34 | - DEMO_IMAGE_DIR "application-icon-102.png", | |
| 35 | - DEMO_IMAGE_DIR "application-icon-103.png", | |
| 36 | - DEMO_IMAGE_DIR "application-icon-104.png", | |
| 37 | -}; | |
| 38 | -const unsigned int NUMBER_OF_IMAGES = sizeof( IMAGE_PATH ) / sizeof( char* ); | |
| 39 | - | |
| 40 | -/** | |
| 41 | - * @brief Helper function to create ImageViews with given filename and size. | |
| 42 | - * @param[in] filename The filename of the image to use | |
| 43 | - * @param[in] size The size that the image should be loaded at | |
| 44 | - * @return The created ImageView | |
| 45 | - */ | |
| 46 | -ImageView CreateChildImageView( const char* filename, Size size ) | |
| 47 | -{ | |
| 48 | - ImageView imageView = ImageView::New(); | |
| 49 | - Property::Map imagePropertyMap; | |
| 50 | - imagePropertyMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE; | |
| 51 | - imagePropertyMap[ Toolkit::ImageVisual::Property::URL ] = filename; | |
| 52 | - imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = size.width; | |
| 53 | - imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = size.height; | |
| 54 | - imageView.SetProperty(Toolkit::ImageView::Property::IMAGE , imagePropertyMap ); | |
| 55 | - imageView.SetName("ImageView"); | |
| 56 | - imageView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 57 | - imageView.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 58 | - return imageView; | |
| 59 | -} | |
| 60 | - | |
| 61 | -} // unnamed namespace | |
| 62 | - | |
| 63 | -/** | |
| 64 | - * @brief Demonstrates how to create a very simple layout and apply that to any Control. | |
| 65 | - */ | |
| 66 | -class SimpleLayoutExample : public ConnectionTracker | |
| 67 | -{ | |
| 68 | -public: | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * @brief Constructor. | |
| 72 | - * @param[in] application A reference to the Application class. | |
| 73 | - */ | |
| 74 | - SimpleLayoutExample( Application& application ) | |
| 75 | - : mApplication( application ) | |
| 76 | - { | |
| 77 | - // Connect to the Application's Init signal | |
| 78 | - mApplication.InitSignal().Connect( this, &SimpleLayoutExample::Create ); | |
| 79 | - } | |
| 80 | - | |
| 81 | -private: | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * @brief Called to initialise the application content | |
| 85 | - * @param[in] application A reference to the Application class. | |
| 86 | - */ | |
| 87 | - void Create( Application& application ) | |
| 88 | - { | |
| 89 | - // Get a handle to the stage, change the background color and connect to the Touch & Key signals | |
| 90 | - Stage stage = Stage::GetCurrent(); | |
| 91 | - stage.SetBackgroundColor( Color::WHITE ); | |
| 92 | - stage.GetRootLayer().TouchSignal().Connect( this, &SimpleLayoutExample::OnTouch ); | |
| 93 | - stage.KeyEventSignal().Connect( this, &SimpleLayoutExample::OnKeyEvent ); | |
| 94 | - stage.KeepRendering(0.5f); // TODO: Should remove after bugfix, but currently required to ensure renders are done after resources are loaded | |
| 95 | - | |
| 96 | - | |
| 97 | - // Create a new control | |
| 98 | - Control control = Control::New(); | |
| 99 | - control.SetParentOrigin( ParentOrigin::CENTER ); | |
| 100 | - control.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 101 | - stage.Add( control); | |
| 102 | - | |
| 103 | - // Set our Custom Layout on the control | |
| 104 | - auto layout = Demo::CustomLayout::New(); | |
| 105 | - DevelControl::SetLayout( control, layout ); | |
| 106 | - | |
| 107 | - // Add child image-views to the created control | |
| 108 | - for( auto i = 0u; i < NUMBER_OF_IMAGES; ++i ) | |
| 109 | - { | |
| 110 | - control.Add( CreateChildImageView( IMAGE_PATH[ i ], Size( 100.0f, 100.0f ) ) ); | |
| 111 | - } | |
| 112 | - } | |
| 113 | - | |
| 114 | - /** | |
| 115 | - * @brief Called when the stage is touched. | |
| 116 | - * | |
| 117 | - * We will use this to quit the application. | |
| 118 | - */ | |
| 119 | - bool OnTouch( Actor /* actor */, const TouchData& /* touch */ ) | |
| 120 | - { | |
| 121 | - mApplication.Quit(); | |
| 122 | - return true; | |
| 123 | - } | |
| 124 | - | |
| 125 | - /** | |
| 126 | - * @brief Called when any key event is received. | |
| 127 | - * | |
| 128 | - * Will use this to quit the application if Back or the Escape key is received | |
| 129 | - * @param[in] event The key event information | |
| 130 | - */ | |
| 131 | - void OnKeyEvent( const KeyEvent& event ) | |
| 132 | - { | |
| 133 | - if( event.state == KeyEvent::Down ) | |
| 134 | - { | |
| 135 | - if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) | |
| 136 | - { | |
| 137 | - mApplication.Quit(); | |
| 138 | - } | |
| 139 | - } | |
| 140 | - } | |
| 141 | - | |
| 142 | -private: | |
| 143 | - Application& mApplication; ///< A reference to the application object. | |
| 144 | -}; | |
| 145 | - | |
| 146 | -int DALI_EXPORT_API main( int argc, char **argv ) | |
| 147 | -{ | |
| 148 | - Application application = Application::New( &argc, &argv ); | |
| 149 | - SimpleLayoutExample test( application ); | |
| 150 | - application.MainLoop(); | |
| 151 | - return 0; | |
| 152 | -} |
resources/po/en_GB.po
| ... | ... | @@ -103,9 +103,6 @@ msgstr "Item View" |
| 103 | 103 | msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" |
| 104 | 104 | msgstr "Lights and Shadows" |
| 105 | 105 | |
| 106 | -msgid "DALI_DEMO_STR_TITLE_LAYOUTING" | |
| 107 | -msgstr "Layouting" | |
| 108 | - | |
| 109 | 106 | msgid "DALI_DEMO_STR_TITLE_LINE_MESH" |
| 110 | 107 | msgstr "Mesh Line" |
| 111 | 108 | |
| ... | ... | @@ -169,9 +166,6 @@ msgstr "Refraction" |
| 169 | 166 | msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" |
| 170 | 167 | msgstr "Renderer Stencil" |
| 171 | 168 | |
| 172 | -msgid "DALI_DEMO_STR_TITLE_SIMPLE_LAYOUT" | |
| 173 | -msgstr "Simple Layout" | |
| 174 | - | |
| 175 | 169 | msgid "DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL" |
| 176 | 170 | msgstr "Simple Visuals Control" |
| 177 | 171 | ... | ... |
resources/po/en_US.po
| ... | ... | @@ -106,9 +106,6 @@ msgstr "Item View" |
| 106 | 106 | msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" |
| 107 | 107 | msgstr "Lights and Shadows" |
| 108 | 108 | |
| 109 | -msgid "DALI_DEMO_STR_TITLE_LAYOUTING" | |
| 110 | -msgstr "Layouting" | |
| 111 | - | |
| 112 | 109 | msgid "DALI_DEMO_STR_TITLE_LINE_MESH" |
| 113 | 110 | msgstr "Mesh Line" |
| 114 | 111 | |
| ... | ... | @@ -172,9 +169,6 @@ msgstr "Refraction" |
| 172 | 169 | msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" |
| 173 | 170 | msgstr "Renderer Stencil" |
| 174 | 171 | |
| 175 | -msgid "DALI_DEMO_STR_TITLE_SIMPLE_LAYOUT" | |
| 176 | -msgstr "Simple Layout" | |
| 177 | - | |
| 178 | 172 | msgid "DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL" |
| 179 | 173 | msgstr "Simple Visuals Control" |
| 180 | 174 | ... | ... |
resources/po/ur.po
shared/dali-demo-strings.h
| ... | ... | @@ -71,7 +71,6 @@ extern "C" |
| 71 | 71 | #define DALI_DEMO_STR_TITLE_IMAGE_VIEW_URL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_IMAGE_VIEW_URL") |
| 72 | 72 | #define DALI_DEMO_STR_TITLE_ITEM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_ITEM_VIEW") |
| 73 | 73 | #define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS") |
| 74 | -#define DALI_DEMO_STR_TITLE_LAYOUTING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LAYOUTING") | |
| 75 | 74 | #define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LINE_MESH") |
| 76 | 75 | #define DALI_DEMO_STR_TITLE_MAGNIFIER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MAGNIFIER") |
| 77 | 76 | #define DALI_DEMO_STR_TITLE_MESH_MORPH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_MORPH") |
| ... | ... | @@ -100,7 +99,6 @@ extern "C" |
| 100 | 99 | #define DALI_DEMO_STR_TITLE_RENDERING_RADIAL_PROGRESS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_RADIAL_PROGRESS") |
| 101 | 100 | #define DALI_DEMO_STR_TITLE_RENDERING_RAY_MARCHING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_RAY_MARCHING") |
| 102 | 101 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") |
| 103 | -#define DALI_DEMO_STR_TITLE_SIMPLE_LAYOUT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SIMPLE_LAYOUT") | |
| 104 | 102 | #define DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL") |
| 105 | 103 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") |
| 106 | 104 | #define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW") |
| ... | ... | @@ -165,7 +163,6 @@ extern "C" |
| 165 | 163 | #define DALI_DEMO_STR_TITLE_IMAGE_VIEW_URL "Image View URL" |
| 166 | 164 | #define DALI_DEMO_STR_TITLE_ITEM_VIEW "Item View" |
| 167 | 165 | #define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS "Lights and shadows" |
| 168 | -#define DALI_DEMO_STR_TITLE_LAYOUTING "Layouting" | |
| 169 | 166 | #define DALI_DEMO_STR_TITLE_LINE_MESH "Mesh Line" |
| 170 | 167 | #define DALI_DEMO_STR_TITLE_MAGNIFIER "Magnifier" |
| 171 | 168 | #define DALI_DEMO_STR_TITLE_MESH_MORPH "Mesh Morph" |
| ... | ... | @@ -194,7 +191,6 @@ extern "C" |
| 194 | 191 | #define DALI_DEMO_STR_TITLE_RENDERING_RAY_MARCHING "Ray Marching" |
| 195 | 192 | #define DALI_DEMO_STR_TITLE_RENDERING_RADIAL_PROGRESS "Radial Progress" |
| 196 | 193 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" |
| 197 | -#define DALI_DEMO_STR_TITLE_SIMPLE_LAYOUT "Simple Layout" | |
| 198 | 194 | #define DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL "Simple Visuals Control" |
| 199 | 195 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" |
| 200 | 196 | #define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View" | ... | ... |
tests-reel/dali-tests-reel.cpp
| ... | ... | @@ -43,7 +43,6 @@ int DALI_EXPORT_API main(int argc, char **argv) |
| 43 | 43 | demo.AddExample(Example("perf-scroll.example", DALI_DEMO_STR_TITLE_PERF_SCROLL)); |
| 44 | 44 | demo.AddExample(Example("point-mesh.example", DALI_DEMO_STR_TITLE_POINT_MESH)); |
| 45 | 45 | demo.AddExample(Example("property-notification.example", DALI_DEMO_STR_TITLE_PROPERTY_NOTIFICATION)); |
| 46 | - demo.AddExample(Example("simple-layout.example", DALI_DEMO_STR_TITLE_SIMPLE_LAYOUT)); | |
| 47 | 46 | demo.AddExample(Example("simple-visuals-control.example", DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL)); |
| 48 | 47 | demo.AddExample(Example("text-fonts.example", DALI_DEMO_STR_TITLE_TEXT_FONTS)); |
| 49 | 48 | demo.AddExample(Example("text-memory-profiling.example", DALI_DEMO_STR_TITLE_TEXT_MEMORY_PROFILING)); | ... | ... |