Commit c69a61d59c8d844bbe822c13ae14a80b8ddeaede
1 parent
b39776e9
Change FittingMode on Item view demos.
Change-Id: I4d05c72240d2dd69c373ee2feb5b97254cb8f77f
Showing
2 changed files
with
17 additions
and
4 deletions
examples/clipping/clipping-item-factory.cpp
| 1 | /* | 1 | /* |
| 2 | - * Copyright (c) 2017 Samsung Electronics Co., Ltd. | 2 | + * Copyright (c) 2018 Samsung Electronics Co., Ltd. |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -23,6 +23,8 @@ | @@ -23,6 +23,8 @@ | ||
| 23 | #include <dali-toolkit/public-api/controls/image-view/image-view.h> | 23 | #include <dali-toolkit/public-api/controls/image-view/image-view.h> |
| 24 | #include <dali-toolkit/public-api/visuals/border-visual-properties.h> | 24 | #include <dali-toolkit/public-api/visuals/border-visual-properties.h> |
| 25 | #include <dali-toolkit/public-api/visuals/visual-properties.h> | 25 | #include <dali-toolkit/public-api/visuals/visual-properties.h> |
| 26 | +#include <dali-toolkit/public-api/visuals/image-visual-properties.h> | ||
| 27 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | ||
| 26 | 28 | ||
| 27 | using namespace Dali; | 29 | using namespace Dali; |
| 28 | using namespace Dali::Toolkit; | 30 | using namespace Dali::Toolkit; |
| @@ -102,7 +104,12 @@ unsigned int ClippingItemFactory::GetNumberOfItems() | @@ -102,7 +104,12 @@ unsigned int ClippingItemFactory::GetNumberOfItems() | ||
| 102 | Actor ClippingItemFactory::NewItem( unsigned int itemId ) | 104 | Actor ClippingItemFactory::NewItem( unsigned int itemId ) |
| 103 | { | 105 | { |
| 104 | // Create an image view for this item | 106 | // Create an image view for this item |
| 105 | - ImageView actor = ImageView::New( IMAGE_PATHS[ itemId % NUM_IMAGES ] ); | 107 | + Property::Map propertyMap; |
| 108 | + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); | ||
| 109 | + propertyMap.Insert(ImageVisual::Property::URL, IMAGE_PATHS[ itemId % NUM_IMAGES ] ); | ||
| 110 | + propertyMap.Insert(DevelVisual::Property::FITTING_MODE, DevelVisual::FILL); | ||
| 111 | + ImageView actor = ImageView::New(); | ||
| 112 | + actor.SetProperty(Toolkit::ImageView::Property::IMAGE, propertyMap); | ||
| 106 | 113 | ||
| 107 | // Add a border image child actor | 114 | // Add a border image child actor |
| 108 | ImageView borderActor = ImageView::New(); | 115 | ImageView borderActor = ImageView::New(); |
examples/item-view/item-view-example.cpp
| 1 | /* | 1 | /* |
| 2 | - * Copyright (c) 2017 Samsung Electronics Co., Ltd. | 2 | + * Copyright (c) 2018 Samsung Electronics Co., Ltd. |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | #include <dali/dali.h> | 21 | #include <dali/dali.h> |
| 22 | #include <dali-toolkit/dali-toolkit.h> | 22 | #include <dali-toolkit/dali-toolkit.h> |
| 23 | #include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | 23 | #include <dali-toolkit/devel-api/controls/buttons/button-devel.h> |
| 24 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | ||
| 24 | 25 | ||
| 25 | using namespace Dali; | 26 | using namespace Dali; |
| 26 | using namespace Dali::Toolkit; | 27 | using namespace Dali::Toolkit; |
| @@ -866,7 +867,12 @@ public: // From ItemFactory | @@ -866,7 +867,12 @@ public: // From ItemFactory | ||
| 866 | virtual Actor NewItem(unsigned int itemId) | 867 | virtual Actor NewItem(unsigned int itemId) |
| 867 | { | 868 | { |
| 868 | // Create an image view for this item | 869 | // Create an image view for this item |
| 869 | - ImageView actor = ImageView::New( IMAGE_PATHS[ itemId % NUM_IMAGES ] ); | 870 | + Property::Map propertyMap; |
| 871 | + propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::IMAGE); | ||
| 872 | + propertyMap.Insert(ImageVisual::Property::URL, IMAGE_PATHS[ itemId % NUM_IMAGES ] ); | ||
| 873 | + propertyMap.Insert(DevelVisual::Property::FITTING_MODE, DevelVisual::FILL); | ||
| 874 | + ImageView actor = ImageView::New(); | ||
| 875 | + actor.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap ); | ||
| 870 | actor.SetZ( 0.0f ); | 876 | actor.SetZ( 0.0f ); |
| 871 | actor.SetPosition( INITIAL_OFFSCREEN_POSITION ); | 877 | actor.SetPosition( INITIAL_OFFSCREEN_POSITION ); |
| 872 | 878 |