Commit 102fd0ff958eca808fbf0c0c3195b20e9baf7282

Authored by Tom Robinson
1 parent 9ca6b6d8

New Popup implementation

Change-Id: I19544f18bd90836c039d045be4ab2d9d5386b37f
demo/dali-demo.cpp
... ... @@ -58,6 +58,7 @@ int main(int argc, char **argv)
58 58 demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE));
59 59 demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT));
60 60 demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE));
  61 + demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP));
61 62 demo.AddExample(Example("buttons.example", DALI_DEMO_STR_TITLE_BUTTONS));
62 63 demo.AddExample(Example("logging.example", DALI_DEMO_STR_TITLE_LOGGING));
63 64 demo.AddExample(Example("mesh-morph.example", DALI_DEMO_STR_TITLE_MESH_MORPH));
... ...
demo/dali-table-view.cpp
... ... @@ -175,8 +175,7 @@ DaliTableView::DaliTableView( Application& application )
175 175 mTotalPages(),
176 176 mScrolling( false ),
177 177 mSortAlphabetically( false ),
178   - mBackgroundAnimsPlaying( false ),
179   - mVersionPopupShown( false )
  178 + mBackgroundAnimsPlaying( false )
180 179 {
181 180 application.InitSignal().Connect( this, &DaliTableView::Initialize );
182 181 }
... ... @@ -697,9 +696,11 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event )
697 696 {
698 697 if ( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
699 698 {
700   - if ( mVersionPopup && mVersionPopupShown )
  699 + // If there's a Popup, Hide it if it's contributing to the display in any way (EG. transitioning in or out).
  700 + // Otherwise quit.
  701 + if ( mVersionPopup && ( mVersionPopup.GetDisplayState() != Toolkit::Popup::HIDDEN ) )
701 702 {
702   - HideVersionPopup();
  703 + mVersionPopup.SetDisplayState( Popup::HIDDEN );
703 704 }
704 705 else
705 706 {
... ... @@ -977,44 +978,48 @@ bool DaliTableView::OnTileHovered( Actor actor, const HoverEvent& event )
977 978  
978 979 void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap )
979 980 {
980   - if ( !mVersionPopupShown )
  981 + // Only show if currently fully hidden. If transitioning-out, the transition will not be interrupted.
  982 + if ( !mVersionPopup || ( mVersionPopup.GetDisplayState() == Toolkit::Popup::HIDDEN ) )
981 983 {
982 984 if ( !mVersionPopup )
983 985 {
984 986 std::ostringstream stream;
985   - stream << "DALi Core: " << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl << "(" << CORE_BUILD_DATE << ")" << std::endl << std::endl;
986   - stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl << "(" << ADAPTOR_BUILD_DATE << ")" << std::endl << std::endl;
987   - stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")";
  987 + stream << "DALi Core: " << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl << "(" << CORE_BUILD_DATE << ")\n";
  988 + stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl << "(" << ADAPTOR_BUILD_DATE << ")\n";
  989 + stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")\n";
988 990  
989 991 mVersionPopup = Dali::Toolkit::Popup::New();
990   - mVersionPopup.SetParentOrigin( ParentOrigin::CENTER );
991   - mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER );
  992 +
  993 + Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( "Version information" );
  994 + titleActor.SetName( "title-actor" );
  995 + titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  996 +
  997 + Toolkit::TextLabel contentActor = Toolkit::TextLabel::New( stream.str() );
  998 + contentActor.SetName( "content-actor" );
  999 + contentActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
  1000 + contentActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  1001 + contentActor.SetPadding( Padding( 0.0f, 0.0f, 20.0f, 0.0f ) );
  1002 +
  1003 + mVersionPopup.SetTitle( titleActor );
  1004 + mVersionPopup.SetContent( contentActor );
  1005 +
992 1006 mVersionPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH );
993 1007 mVersionPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
994 1008 mVersionPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
995   - mVersionPopup.SetTitle( stream.str() );
996   - mVersionPopup.HideTail();
  1009 +
997 1010 mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup );
998   - mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden );
  1011 + Stage::GetCurrent().Add( mVersionPopup );
999 1012 }
1000 1013  
1001   - mVersionPopup.Show();
1002   - mVersionPopupShown = true;
  1014 + mVersionPopup.SetDisplayState( Popup::SHOWN );
1003 1015 }
1004 1016 }
1005 1017  
1006 1018 void DaliTableView::HideVersionPopup()
1007 1019 {
1008   - if ( mVersionPopup )
1009   - {
1010   - mVersionPopup.Hide();
1011   - }
1012   -}
1013   -
1014   -void DaliTableView::PopupHidden()
1015   -{
1016   - if ( mVersionPopup )
  1020 + // Only hide if currently fully shown. If transitioning-in, the transition will not be interrupted.
  1021 + if ( mVersionPopup && ( mVersionPopup.GetDisplayState() == Toolkit::Popup::SHOWN ) )
1017 1022 {
1018   - mVersionPopupShown = false;
  1023 + mVersionPopup.SetDisplayState( Popup::HIDDEN );
1019 1024 }
1020 1025 }
... ...
demo/dali-table-view.h
... ... @@ -367,11 +367,6 @@ private: // Application callbacks &amp; implementation
367 367 */
368 368 void HideVersionPopup();
369 369  
370   - /**
371   - * Called when the popup is completely hidden
372   - */
373   - void PopupHidden();
374   -
375 370 /*
376 371 * @brief Callback called when the buttons page actor is relaid out
377 372 *
... ... @@ -418,7 +413,6 @@ private:
418 413 bool mScrolling:1; ///< Flag indicating whether view is currently being scrolled
419 414 bool mSortAlphabetically:1; ///< Sort examples alphabetically.
420 415 bool mBackgroundAnimsPlaying:1; ///< Are background animations playing
421   - bool mVersionPopupShown:1; ///< Whehter the version popup is shown or not
422 416  
423 417 };
424 418  
... ...
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
... ... @@ -384,7 +384,6 @@ public:
384 384 popup.SetParentOrigin( ParentOrigin::CENTER );
385 385 popup.SetAnchorPoint( AnchorPoint::CENTER );
386 386 popup.SetSize( POPUP_WIDTH_DP, 0.0f );
387   - popup.HideTail();
388 387  
389 388 popup.OutsideTouchedSignal().Connect( this, &ImageScalingAndFilteringController::OnPopupOutsideTouched );
390 389  
... ... @@ -419,7 +418,6 @@ public:
419 418 Toolkit::TableView fittingModes = Toolkit::TableView::New( 4, 1 );
420 419 fittingModes.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
421 420 fittingModes.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
422   - fittingModes.SetBackgroundColor( BACKGROUND_COLOUR );
423 421 fittingModes.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5 ) );
424 422 fittingModes.SetFitHeight( 0 );
425 423 fittingModes.SetFitHeight( 1 );
... ... @@ -431,8 +429,9 @@ public:
431 429 CreatePopupButton( fittingModes, StringFromScalingMode( FittingMode::FIT_WIDTH ) );
432 430 CreatePopupButton( fittingModes, StringFromScalingMode( FittingMode::FIT_HEIGHT ) );
433 431  
434   - mPopup.Add( fittingModes );
435   - mPopup.Show();
  432 + mPopup.SetContent( fittingModes );
  433 + Stage::GetCurrent().Add( mPopup );
  434 + mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
436 435 }
437 436 else if( button.GetName() == SAMPLING_BUTTON_ID )
438 437 {
... ... @@ -442,7 +441,6 @@ public:
442 441 Toolkit::TableView samplingModes = Toolkit::TableView::New( 6, 1 );
443 442 samplingModes.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
444 443 samplingModes.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
445   - samplingModes.SetBackgroundColor( BACKGROUND_COLOUR );
446 444 samplingModes.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5 ) );
447 445 samplingModes.SetFitHeight( 0 );
448 446 samplingModes.SetFitHeight( 1 );
... ... @@ -458,8 +456,9 @@ public:
458 456 CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::BOX_THEN_LINEAR ) );
459 457 CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::NO_FILTER ) );
460 458  
461   - mPopup.Add( samplingModes );
462   - mPopup.Show();
  459 + mPopup.SetContent( samplingModes );
  460 + Stage::GetCurrent().Add( mPopup );
  461 + mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
463 462 }
464 463 else if( CheckFittingModeButton( button, FittingMode::SCALE_TO_FILL) ||
465 464 CheckFittingModeButton( button, FittingMode::SHRINK_TO_FIT) ||
... ... @@ -487,7 +486,7 @@ public:
487 486 mFittingMode = mode;
488 487 mFittingModeButton.SetLabelText( modeName );
489 488 ResizeImage();
490   - mPopup.Hide();
  489 + mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
491 490 mPopup.Reset();
492 491 return true;
493 492 }
... ... @@ -502,7 +501,7 @@ public:
502 501 mSamplingMode = mode;
503 502 mSamplingModeButton.SetLabelText( modeName );
504 503 ResizeImage();
505   - mPopup.Hide();
  504 + mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
506 505 mPopup.Reset();
507 506 return true;
508 507 }
... ... @@ -513,7 +512,7 @@ public:
513 512 {
514 513 if( mPopup )
515 514 {
516   - mPopup.Hide();
  515 + mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
517 516 mPopup.Reset();
518 517 }
519 518 }
... ... @@ -600,7 +599,7 @@ public:
600 599 {
601 600 if( mPopup && mPopup.IsVisible() )
602 601 {
603   - mPopup.Hide();
  602 + mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
604 603 mPopup.Reset();
605 604 }
606 605 else
... ...
examples/popup/popup-example.cpp 0 โ†’ 100644
  1 +/*
  2 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +#include "shared/view.h"
  19 +#include <dali/dali.h>
  20 +#include <dali-toolkit/dali-toolkit.h>
  21 +#include <dali-toolkit/devel-api/controls/popup/popup.h>
  22 +
  23 +using namespace Dali;
  24 +
  25 +using Dali::Toolkit::TextLabel;
  26 +
  27 +struct ButtonItem
  28 +{
  29 + const char* name;
  30 + const char* text;
  31 +};
  32 +
  33 +namespace
  34 +{
  35 +
  36 +const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "background-gradient.jpg";
  37 +const char* const TOOLBAR_IMAGE = DALI_IMAGE_DIR "top-bar.png";
  38 +
  39 +const char* const TOOLBAR_TITLE = "Popup";
  40 +
  41 +const char* CONTEXT_DISABLED_ICON_IMAGE = DALI_IMAGE_DIR "icon-scroll-view-carousel.png";
  42 +const char* CONTEXT_ENABLED_ICON_IMAGE = DALI_IMAGE_DIR "icon-scroll-view-spiral.png";
  43 +const char* ANIMATION_FADE_ICON_IMAGE = DALI_IMAGE_DIR "icon-effects-off.png";
  44 +const char* ANIMATION_ZOOM_ICON_IMAGE = DALI_IMAGE_DIR "icon-effects-on.png";
  45 +
  46 +const char* const POPUP_BUTTON_TITLE_ID = "POPUP_BUTTON_TITLE";
  47 +const char* const POPUP_BUTTON_BUTTONS_1_ID = "POPUP_BUTTON_BUTTONS_1";
  48 +const char* const POPUP_BUTTON_BUTTONS_2_ID = "POPUP_BUTTON_BUTTONS_2";
  49 +const char* const POPUP_BUTTON_TOAST_ID = "POPUP_BUTTON_TOAST";
  50 +const char* const POPUP_BUTTON_TITLE_CONTENT_BUTTONS_ID = "POPUP_BUTTON_TITLE_CONTENT_BUTTONS";
  51 +const char* const POPUP_BUTTON_CONTENT_TEXT_ID = "POPUP_BUTTON_CONTENT_TEXT";
  52 +const char* const POPUP_BUTTON_CONTENT_IMAGE_ID = "POPUP_BUTTON_CONTENT_IMAGE";
  53 +const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT";
  54 +const char* const POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID = "POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS";
  55 +const char* const POPUP_BUTTON_FIXED_SIZE_ID = "POPUP_BUTTON_FIXED_SIZE_ID";
  56 +const char* const POPUP_BUTTON_COMPLEX_ID = "POPUP_BUTTON_COMPLEX";
  57 +
  58 +// Names to give Popup PushButton controls.
  59 +const char* const POPUP_CONTROL_OK_NAME = "control-ok";
  60 +const char* const POPUP_CONTROL_CANCEL_NAME = "control-cancel";
  61 +
  62 +const char* const CONTENT_TEXT = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
  63 +const char* const IMAGE1 = DALI_IMAGE_DIR "gallery-medium-5.jpg";
  64 +const char* const IMAGE2 = DALI_IMAGE_DIR "background-magnifier.jpg";
  65 +
  66 +// Control area image.
  67 +const char* DEFAULT_CONTROL_AREA_IMAGE_PATH = DALI_IMAGE_DIR "popup_button_background.png"; ///< Control area image for the popup.
  68 +const Vector4 DEFAULT_CONTROL_AREA_9_PATCH_BORDER( 13.0f, 8.0f, 13.0f, 8.0f ); ///< Nine patch information for the control area background.
  69 +
  70 +const ButtonItem POPUP_BUTTON_ITEMS[] = {
  71 + { POPUP_BUTTON_COMPLEX_ID, "Complex" },
  72 + { POPUP_BUTTON_TOAST_ID, "Toast Popup" },
  73 + { POPUP_BUTTON_TITLE_ID, "Title" },
  74 + { POPUP_BUTTON_BUTTONS_1_ID, "1 Button" },
  75 + { POPUP_BUTTON_BUTTONS_2_ID, "2 Buttons" },
  76 + { POPUP_BUTTON_FIXED_SIZE_ID, "Fixed Size" },
  77 + { POPUP_BUTTON_TITLE_CONTENT_BUTTONS_ID, "Title + Content + Buttons" },
  78 + { POPUP_BUTTON_CONTENT_TEXT_ID, "Content Text" },
  79 + { POPUP_BUTTON_CONTENT_IMAGE_ID, "Content Image" },
  80 + { POPUP_BUTTON_TITLE_CONTENT_TEXT_ID, "Title + Content" },
  81 + { POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID, "Title + Large Content + Buttons" }
  82 +};
  83 +
  84 +const int POPUP_BUTTON_ITEMS_COUNT = sizeof( POPUP_BUTTON_ITEMS ) / sizeof( POPUP_BUTTON_ITEMS[0] );
  85 +
  86 +} // anonymous namespace
  87 +
  88 +
  89 +/**
  90 + * This example shows the usage of the Popup class.
  91 + */
  92 +class PopupExample: public ConnectionTracker, public Toolkit::ItemFactory
  93 +{
  94 +public:
  95 +
  96 + PopupExample( Application& application )
  97 + : mApplication( application ),
  98 + mContextual( false ),
  99 + mAnimationFade( true )
  100 + {
  101 + // Connect to the Application's Init signal
  102 + mApplication.InitSignal().Connect( this, &PopupExample::Create );
  103 + }
  104 +
  105 + ~PopupExample()
  106 + {
  107 + // Nothing to do here
  108 + }
  109 +
  110 + void Create( Application& application )
  111 + {
  112 + // The Init signal is received once (only) during the Application lifetime
  113 + Stage stage = Stage::GetCurrent();
  114 +
  115 + // Respond to key events
  116 + stage.KeyEventSignal().Connect(this, &PopupExample::OnKeyEvent);
  117 +
  118 + // Creates a default view with a default tool bar.
  119 + // The view is added to the stage.
  120 + mContentLayer = DemoHelper::CreateView( application,
  121 + mView,
  122 + mToolBar,
  123 + BACKGROUND_IMAGE,
  124 + TOOLBAR_IMAGE,
  125 + std::string("") );
  126 +
  127 + mTitleActor = DemoHelper::CreateToolBarLabel( "CUSTOM_TOOLBAR_TITLE" );
  128 + mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, TOOLBAR_TITLE );
  129 +
  130 + // Add title to the tool bar.
  131 + const float padding( DemoHelper::DEFAULT_VIEW_STYLE.mToolBarPadding );
  132 + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::Padding( padding, padding, padding, padding ) );
  133 +
  134 + // Create animation button.
  135 + mAnimationButton = Toolkit::PushButton::New();
  136 + mAnimationButton.SetUnselectedImage( ANIMATION_FADE_ICON_IMAGE );
  137 + mAnimationButton.SetSelectedImage( ANIMATION_ZOOM_ICON_IMAGE );
  138 + mAnimationButton.SetTogglableButton( true );
  139 + mAnimationButton.ClickedSignal().Connect( this, &PopupExample::OnAnimationClicked );
  140 + mToolBar.AddControl( mAnimationButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
  141 +
  142 + // Create context button.
  143 + mContextButton = Toolkit::PushButton::New();
  144 + mContextButton.SetUnselectedImage( CONTEXT_DISABLED_ICON_IMAGE );
  145 + mContextButton.SetSelectedImage( CONTEXT_ENABLED_ICON_IMAGE );
  146 + mContextButton.SetTogglableButton( true );
  147 + mContextButton.ClickedSignal().Connect( this, &PopupExample::OnContextClicked );
  148 + mToolBar.AddControl( mContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
  149 +
  150 + // Add title to the tool bar.
  151 + mItemView = Toolkit::ItemView::New( *this );
  152 + mItemView.SetParentOrigin( ParentOrigin::CENTER );
  153 + mItemView.SetAnchorPoint( AnchorPoint::CENTER );
  154 + mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  155 +
  156 + // Use a grid layout for tests
  157 + Vector2 stageSize = stage.GetSize();
  158 + Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST );
  159 + Vector3 itemSize;
  160 + gridLayout->GetItemSize( 0, Vector3( stageSize ), itemSize );
  161 + itemSize.height = stageSize.y / 10;
  162 + gridLayout->SetItemSize( itemSize );
  163 + mItemView.AddLayout( *gridLayout );
  164 +
  165 + mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
  166 +
  167 + mContentLayer.Add( mItemView );
  168 + }
  169 +
  170 + bool OnContextClicked( Toolkit::Button button )
  171 + {
  172 + mContextual = button.IsSelected();
  173 + return true;
  174 + }
  175 +
  176 + bool OnAnimationClicked( Toolkit::Button button )
  177 + {
  178 + mAnimationFade = !button.IsSelected();
  179 + return true;
  180 + }
  181 +
  182 + /**
  183 + * This function is designed as a shortcut to convert any resize policies set for a popup to
  184 + * ones that will work for contextual mode (for demo purposes).
  185 + * Note that in a real-use case example the policies would be set to something appropriate
  186 + * manually, but in the case of this demo, the popup is parented from the popup-opening buttons
  187 + * and (incorrectly) have their policies as "SIZE_RELATIVE_TO_PARENT". This would create a tiny
  188 + * popup that would not be able to contain it's contents, so to illustrate contextual behaviour
  189 + * this function converts the old policies and size to new ones that would give the popup the
  190 + * same visual appearance.
  191 + * @param[in] popup The popup whose policies should be modified.
  192 + */
  193 + void SetupContextualResizePolicy( Toolkit::Popup& popup )
  194 + {
  195 + Vector2 stageSize = Stage::GetCurrent().GetSize();
  196 + // Some defaults when creating a new fixed size.
  197 + // This is NOT a Vector2 so we can modify each dimension in a for-loop.
  198 + float newSize[ Dimension::DIMENSION_COUNT ] = { stageSize.x * 0.75f, stageSize.y * 0.75f };
  199 + bool modifySize = false;
  200 +
  201 + // Loop through each of two dimensions to process them.
  202 + for( unsigned int dimension = 0; dimension < 2; ++dimension )
  203 + {
  204 + float stageDimensionSize, sizeModeFactor;
  205 + Dimension::Type policyDimension = dimension == 0 ? Dimension::WIDTH : Dimension::HEIGHT;
  206 +
  207 + // Setup information related to the current dimension we are processing.
  208 + if( policyDimension == Dimension::WIDTH )
  209 + {
  210 + stageDimensionSize = stageSize.x;
  211 + sizeModeFactor = popup.GetSizeModeFactor().x;
  212 + }
  213 + else
  214 + {
  215 + stageDimensionSize = stageSize.y;
  216 + sizeModeFactor = popup.GetSizeModeFactor().y;
  217 + }
  218 +
  219 + bool modifyPolicy = false;
  220 + ResizePolicy::Type policy = popup.GetResizePolicy( policyDimension );
  221 + ResizePolicy::Type newPolicy( policy );
  222 +
  223 + // Switch on each policy type to determine the new behaviour.
  224 + switch( policy )
  225 + {
  226 + case ResizePolicy::FIXED:
  227 + case ResizePolicy::USE_ASSIGNED_SIZE:
  228 + {
  229 + break;
  230 + }
  231 +
  232 + case ResizePolicy::USE_NATURAL_SIZE:
  233 + case ResizePolicy::FIT_TO_CHILDREN:
  234 + case ResizePolicy::DIMENSION_DEPENDENCY:
  235 + {
  236 + // Set size to 0 so the policy determines size.
  237 + // If a non-zero size is set, policy is converted to fixed.
  238 + newSize[ dimension ] = 0.0f;
  239 + modifySize = true;
  240 + break;
  241 + }
  242 +
  243 + // The following cases emulate the three size-mode related resize policies.
  244 + case ResizePolicy::FILL_TO_PARENT:
  245 + {
  246 + newPolicy = ResizePolicy::FIXED;
  247 + newSize[ dimension ] = stageDimensionSize;
  248 + modifyPolicy = true;
  249 + break;
  250 + }
  251 +
  252 + case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
  253 + {
  254 + newPolicy = ResizePolicy::FIXED;
  255 + newSize[ dimension ] = stageDimensionSize * sizeModeFactor;
  256 + modifyPolicy = true;
  257 + break;
  258 + }
  259 +
  260 + case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
  261 + {
  262 + newPolicy = ResizePolicy::FIXED;
  263 + newSize[ dimension ] = stageDimensionSize + sizeModeFactor;
  264 + modifyPolicy = true;
  265 + break;
  266 + }
  267 + }
  268 +
  269 + if( modifyPolicy )
  270 + {
  271 + // Set the new policy for this dimension, if it has been modified.
  272 + popup.SetResizePolicy( newPolicy, policyDimension );
  273 + modifySize = true;
  274 + }
  275 + }
  276 +
  277 + if( modifySize )
  278 + {
  279 + // The size is set once at the end.
  280 + popup.SetSize( Vector2( newSize[ 0 ], newSize[ 1 ] ) );
  281 + }
  282 + }
  283 +
  284 + void SetupPopup( Toolkit::Popup popup, Actor parent )
  285 + {
  286 + if( mAnimationFade )
  287 + {
  288 + popup.SetProperty( Toolkit::Popup::Property::ANIMATION_MODE, "FADE" );
  289 + }
  290 + else
  291 + {
  292 + popup.SetProperty( Toolkit::Popup::Property::ANIMATION_MODE, "ZOOM" );
  293 + }
  294 +
  295 + if( mContextual )
  296 + {
  297 + popup.SetProperty( Toolkit::Popup::Property::CONTEXTUAL_MODE, "BELOW" );
  298 +
  299 + // Modify the preset demo resize policies (and size) to contextual ones.
  300 + SetupContextualResizePolicy( popup );
  301 +
  302 + parent.Add( popup );
  303 + }
  304 + else
  305 + {
  306 + Stage::GetCurrent().Add( popup );
  307 + }
  308 +
  309 + mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
  310 + }
  311 +
  312 + void HidePopup()
  313 + {
  314 + if( mPopup )
  315 + {
  316 + mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
  317 + }
  318 + }
  319 +
  320 + void PopupHidden()
  321 + {
  322 + if( mPopup )
  323 + {
  324 + mPopup.Unparent();
  325 + mPopup.Reset();
  326 + }
  327 + }
  328 +
  329 + Toolkit::Popup CreatePopup()
  330 + {
  331 + Stage stage = Stage::GetCurrent();
  332 + const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
  333 +
  334 + Toolkit::Popup popup = Toolkit::Popup::New();
  335 + popup.SetName( "popup" );
  336 + popup.SetParentOrigin( ParentOrigin::CENTER );
  337 + popup.SetAnchorPoint( AnchorPoint::CENTER );
  338 + popup.SetSize( POPUP_WIDTH_DP, 0.0f );
  339 + popup.SetProperty( Toolkit::Popup::Property::TAIL_VISIBILITY, false );
  340 +
  341 + popup.OutsideTouchedSignal().Connect( this, &PopupExample::HidePopup );
  342 + popup.HiddenSignal().Connect( this, &PopupExample::PopupHidden );
  343 +
  344 + return popup;
  345 + }
  346 +
  347 + Toolkit::Popup CreateConfirmationPopup( int numberOfButtons )
  348 + {
  349 + Toolkit::Popup confirmationPopup = Toolkit::Popup::New();
  350 + confirmationPopup.SetName( "MAIN-POPUP-SELF" );
  351 +
  352 + if( numberOfButtons > 0 )
  353 + {
  354 + // Start with a control area image.
  355 + ImageActor footer = ImageActor::New( ResourceImage::New( DEFAULT_CONTROL_AREA_IMAGE_PATH ) );
  356 + // Nine patch information is only used for the default control area image.
  357 + footer.SetStyle( ImageActor::STYLE_NINE_PATCH );
  358 + footer.SetNinePatchBorder( DEFAULT_CONTROL_AREA_9_PATCH_BORDER );
  359 + footer.SetName( "control-area-image" );
  360 + // Set up the container's layout.
  361 + footer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  362 + footer.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
  363 + footer.SetSize( 0.0f, 80.0f );
  364 + footer.SetAnchorPoint( AnchorPoint::CENTER );
  365 + footer.SetParentOrigin( ParentOrigin::CENTER );
  366 +
  367 + Actor okButton = CreateOKButton();
  368 + okButton.SetParentOrigin( ParentOrigin::CENTER );
  369 + okButton.SetAnchorPoint( AnchorPoint::CENTER );
  370 + okButton.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
  371 + okButton.SetSizeModeFactor( Vector3( -20.0f, -20.0f, 0.0 ) );
  372 +
  373 + if( numberOfButtons > 1 )
  374 + {
  375 + Toolkit::TableView controlLayout = Toolkit::TableView::New( 1, 2 );
  376 + controlLayout.SetParentOrigin( ParentOrigin::CENTER );
  377 + controlLayout.SetAnchorPoint( AnchorPoint::CENTER );
  378 + controlLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  379 +
  380 + Actor cancelButton = CreateCancelButton();
  381 + cancelButton.SetParentOrigin( ParentOrigin::CENTER );
  382 + cancelButton.SetAnchorPoint( AnchorPoint::CENTER );
  383 + cancelButton.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
  384 + cancelButton.SetSizeModeFactor( Vector3( -20.0f, -20.0f, 0.0 ) );
  385 +
  386 + controlLayout.SetCellPadding( Size( 10.0f, 10.0f ) );
  387 +
  388 + controlLayout.SetRelativeWidth( 0, 0.5f );
  389 + controlLayout.SetRelativeWidth( 1, 0.5f );
  390 +
  391 + controlLayout.SetCellAlignment( Toolkit::TableView::CellPosition( 0, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
  392 + controlLayout.SetCellAlignment( Toolkit::TableView::CellPosition( 0, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
  393 + controlLayout.AddChild( okButton, Toolkit::TableView::CellPosition( 0, 0 ) );
  394 + controlLayout.AddChild( cancelButton, Toolkit::TableView::CellPosition( 0, 1 ) );
  395 +
  396 + footer.Add( controlLayout );
  397 + }
  398 + else
  399 + {
  400 + footer.Add( okButton );
  401 + }
  402 +
  403 + confirmationPopup.SetFooter( footer );
  404 + }
  405 +
  406 + confirmationPopup.OutsideTouchedSignal().Connect( this, &PopupExample::HidePopup );
  407 +
  408 + return confirmationPopup;
  409 + }
  410 +
  411 + Actor CreateTitle( std::string title )
  412 + {
  413 + Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( title );
  414 + titleActor.SetName( "title-actor" );
  415 + titleActor.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
  416 + titleActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
  417 + titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  418 +
  419 + return titleActor;
  420 + }
  421 +
  422 + Toolkit::PushButton CreateOKButton()
  423 + {
  424 + Toolkit::PushButton okayButton = Toolkit::PushButton::New();
  425 + okayButton.SetName( POPUP_CONTROL_OK_NAME );
  426 + okayButton.SetLabelText( "OK!" );
  427 +
  428 + okayButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked );
  429 +
  430 + return okayButton;
  431 + }
  432 +
  433 + Toolkit::PushButton CreateCancelButton()
  434 + {
  435 + Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
  436 + cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME );
  437 + cancelButton.SetLabelText( "Cancel" );
  438 +
  439 + cancelButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked );
  440 +
  441 + return cancelButton;
  442 + }
  443 +
  444 + bool OnPopupButtonClicked( Toolkit::Button button )
  445 + {
  446 + // Handle Popup pushbuttons being clicked.
  447 + HidePopup();
  448 + return true;
  449 + }
  450 +
  451 + bool OnButtonClicked( Toolkit::Button button )
  452 + {
  453 + // Handle menu items that create popups.
  454 + if( button.GetName() == POPUP_BUTTON_TITLE_ID )
  455 + {
  456 + mPopup = CreatePopup();
  457 + mPopup.SetTitle( CreateTitle( "Popup!" ) );
  458 +
  459 + SetupPopup( mPopup, button );
  460 + }
  461 + else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID )
  462 + {
  463 + mPopup = CreateConfirmationPopup( 1 );
  464 + mPopup.SetTitle( CreateTitle( "Title" ) );
  465 +
  466 + SetupPopup( mPopup, button );
  467 + }
  468 + else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID )
  469 + {
  470 + mPopup = CreateConfirmationPopup( 2 );
  471 + mPopup.SetTitle( CreateTitle( "Title" ) );
  472 +
  473 + SetupPopup( mPopup, button );
  474 + }
  475 + else if( button.GetName() == POPUP_BUTTON_TOAST_ID )
  476 + {
  477 + // Create a toast popup via the type registry (as it is a named-type).
  478 + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "popup-toast" );
  479 + if( typeInfo )
  480 + {
  481 + BaseHandle baseHandle = typeInfo.CreateInstance();
  482 + if( baseHandle )
  483 + {
  484 + mPopup = Toolkit::Popup::DownCast( baseHandle );
  485 + mPopup.SetTitle( CreateTitle( "This is a Toast Popup.\nIt will auto-hide itself" ) );
  486 +
  487 + Stage::GetCurrent().Add( mPopup );
  488 + mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
  489 + }
  490 + }
  491 + }
  492 + else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_BUTTONS_ID )
  493 + {
  494 + mPopup = CreateConfirmationPopup( 2 );
  495 + mPopup.SetTitle( CreateTitle( "Erase image" ) );
  496 +
  497 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "This will erase the image permanently. Are you sure?" );
  498 + text.SetName( "POPUP_CONTENT_TEXT" );
  499 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
  500 + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  501 + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  502 + text.SetProperty( TextLabel::Property::MULTI_LINE, true );
  503 + text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
  504 + mPopup.SetContent( text );
  505 +
  506 + SetupPopup( mPopup, button );
  507 + }
  508 + else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID )
  509 + {
  510 + mPopup = CreatePopup();
  511 +
  512 + TextLabel text = TextLabel::New( CONTENT_TEXT );
  513 + text.SetName( "POPUP_CONTENT_TEXT" );
  514 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
  515 + text.SetProperty( TextLabel::Property::MULTI_LINE, true );
  516 + text.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  517 + text.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
  518 + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  519 + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  520 + text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
  521 +
  522 + mPopup.Add( text );
  523 +
  524 + SetupPopup( mPopup, button );
  525 + }
  526 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID )
  527 + {
  528 + mPopup = CreatePopup();
  529 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
  530 + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  531 + image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  532 + image.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
  533 +
  534 + mPopup.Add( image );
  535 +
  536 + SetupPopup( mPopup, button );
  537 + }
  538 + else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
  539 + {
  540 + mPopup = CreatePopup();
  541 + mPopup.SetTitle( CreateTitle( "Popup!" ) );
  542 +
  543 + Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
  544 + text.SetName( "POPUP_CONTENT_TEXT" );
  545 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
  546 + text.SetProperty( TextLabel::Property::MULTI_LINE, true );
  547 + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  548 + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  549 + text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
  550 +
  551 + mPopup.Add( text );
  552 +
  553 + SetupPopup( mPopup, button );
  554 + }
  555 + else if( button.GetName() == POPUP_BUTTON_FIXED_SIZE_ID )
  556 + {
  557 + mPopup = CreatePopup();
  558 + mPopup.SetTitle( CreateTitle( "Popup!" ) );
  559 +
  560 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed size popup" );
  561 + text.SetName( "POPUP_CONTENT_TEXT" );
  562 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
  563 + text.SetProperty( TextLabel::Property::MULTI_LINE, true );
  564 + text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
  565 +
  566 + mPopup.Add( text );
  567 +
  568 + // Fix the popup's size.
  569 + mPopup.SetSize( 240.0f, 400.0f );
  570 + mPopup.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
  571 +
  572 + SetupPopup( mPopup, button );
  573 + }
  574 + else if( button.GetName() == POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID )
  575 + {
  576 + mPopup = CreateConfirmationPopup( 2 );
  577 + mPopup.SetTitle( CreateTitle( "Popup!" ) );
  578 +
  579 + Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
  580 + text.SetName( "POPUP_CONTENT_TEXT" );
  581 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
  582 + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  583 + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  584 + text.SetProperty( TextLabel::Property::MULTI_LINE, true );
  585 + text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
  586 +
  587 + mPopup.Add( text );
  588 +
  589 + SetupPopup( mPopup, button );
  590 + }
  591 + else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
  592 + {
  593 + mPopup = CreateConfirmationPopup( 2 );
  594 + mPopup.SetTitle( CreateTitle( "Warning" ) );
  595 +
  596 + // Content
  597 + Toolkit::TableView content = Toolkit::TableView::New( 2, 2 );
  598 + content.SetName( "COMPLEX_TABLEVIEW" );
  599 + content.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  600 + content.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  601 + content.SetFitHeight( 0 );
  602 + content.SetFitHeight( 1 );
  603 + content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
  604 +
  605 + // Text
  606 + {
  607 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Do you really want to quit?" );
  608 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
  609 + text.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
  610 + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  611 + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  612 +
  613 + content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
  614 + }
  615 +
  616 + // Image
  617 + {
  618 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) );
  619 + image.SetName( "COMPLEX_IMAGE" );
  620 + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  621 + image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
  622 + image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
  623 + content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
  624 + }
  625 +
  626 + // Text 2
  627 + {
  628 + Toolkit::TableView root = Toolkit::TableView::New( 1, 2 );
  629 + root.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  630 + root.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  631 + root.SetFitHeight( 0 );
  632 + root.SetFitWidth( 0 );
  633 + root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) );
  634 +
  635 + Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
  636 + checkBox.SetSize( 48, 48 );
  637 + root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
  638 +
  639 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Don't show again" );
  640 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
  641 + Actor textActor = text;
  642 + textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
  643 +
  644 + root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
  645 +
  646 + content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0 ) );
  647 + }
  648 +
  649 + mPopup.SetContent( content );
  650 +
  651 + SetupPopup( mPopup, button );
  652 + }
  653 +
  654 + return true;
  655 + }
  656 +
  657 + void OnKeyEvent( const KeyEvent& event )
  658 + {
  659 + if( event.state == KeyEvent::Down )
  660 + {
  661 + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
  662 + {
  663 + // Exit application when click back or escape.
  664 + mApplication.Quit();
  665 + }
  666 + }
  667 + }
  668 +
  669 +public: // From ItemFactory
  670 +
  671 + /**
  672 + * @brief Return the number of items to display in the item view
  673 + *
  674 + * @return Return the number of items to display
  675 + */
  676 + virtual unsigned int GetNumberOfItems()
  677 + {
  678 + return POPUP_BUTTON_ITEMS_COUNT;
  679 + }
  680 +
  681 + /**
  682 + * @brief Create a new item to populate the item view with
  683 + *
  684 + * @param[in] itemId The index of the item to create
  685 + * @return Return the created actor for the given ID
  686 + */
  687 + virtual Actor NewItem(unsigned int itemId)
  688 + {
  689 + Toolkit::PushButton popupButton = Toolkit::PushButton::New();
  690 + popupButton.SetName( POPUP_BUTTON_ITEMS[ itemId ].name );
  691 + popupButton.SetLabelText( POPUP_BUTTON_ITEMS[ itemId ].text );
  692 + popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
  693 +
  694 + popupButton.ClickedSignal().Connect( this, &PopupExample::OnButtonClicked );
  695 +
  696 + return popupButton;
  697 + }
  698 +
  699 +private:
  700 +
  701 +
  702 + Application& mApplication;
  703 + Toolkit::Control mView; ///< The View instance.
  704 + Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  705 + Toolkit::PushButton mContextButton; ///< For toggling contextual mode.
  706 + Toolkit::PushButton mAnimationButton; ///< For toggling the fade animation.
  707 + Layer mContentLayer; ///< Content layer
  708 +
  709 + Toolkit::TextLabel mTitleActor; ///< Title text
  710 +
  711 + bool mContextual; ///< True if currently using the contextual popup mode.
  712 + bool mAnimationFade; ///< True if currently using the fade animation.
  713 +
  714 + ResourceImage mContextButtonDisabledImage; ///< The disabled context button icon.
  715 + ResourceImage mContextButtonEnabledImage; ///< The enabled context button icon.
  716 + ResourceImage mAnimationButtonZoomImage; ///< The zoom animation button icon.
  717 + ResourceImage mAnimationButtonFadeImage; ///< The fade animation button icon.
  718 +
  719 + Toolkit::Popup mPopup; ///< The current example popup.
  720 +
  721 + Toolkit::ItemView mItemView; ///< ItemView to hold test images
  722 +
  723 +};
  724 +
  725 +void RunTest( Application& application )
  726 +{
  727 + PopupExample test( application );
  728 +
  729 + application.MainLoop();
  730 +}
  731 +
  732 +// Entry point for Linux & SLP applications
  733 +int main( int argc, char **argv )
  734 +{
  735 + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH );
  736 +
  737 + RunTest( application );
  738 +
  739 + return 0;
  740 +}
... ...
examples/size-negotiation/size-negotiation-example.cpp
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -24,47 +24,22 @@ using namespace Dali;
24 24  
25 25 using Dali::Toolkit::TextLabel;
26 26  
27   -// Define this so that it is interchangeable
28   -// "DP" stands for Device independent Pixels
29   -#define DP(x) DemoHelper::ScalePointSize(x)
30   -
31 27 struct ButtonItem
32 28 {
33 29 const char* name;
34 30 const char* text;
35 31 };
36 32  
37   -
38 33 namespace
39 34 {
40 35  
41 36 const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "background-gradient.jpg";
42 37 const char* const TOOLBAR_IMAGE = DALI_IMAGE_DIR "top-bar.png";
  38 +const char* const IMAGE = DALI_IMAGE_DIR "background-magnifier.jpg";
43 39  
44 40 const char* const TOOLBAR_TITLE = "Negotiate Size";
45   -const int TOOLBAR_HEIGHT = 62;
46   -
47   -const char* MENU_ICON_IMAGE = DALI_IMAGE_DIR "icon-cluster-none.png";
48   -const char* MENU_ICON_IMAGE_SELECTED = DALI_IMAGE_DIR "icon-cluster-none-selected.png";
49 41  
50   -const char* const POPUPS_MENU_ID = "POPUPS_MENU";
51   -const char* const TABLEVIEW_MENU_ID = "TABLEVIEW_MENU";
52   -
53   -const char* const POPUP_BUTTON_EMPTY_ID = "POPUP_BUTTON_EMPTY";
54   -const char* const POPUP_BUTTON_TITLE_ID = "POPUP_BUTTON_TITLE";
55   -const char* const POPUP_BUTTON_BUTTONS_1_ID = "POPUP_BUTTON_BUTTONS_1";
56   -const char* const POPUP_BUTTON_BUTTONS_2_ID = "POPUP_BUTTON_BUTTONS_2";
57   -const char* const POPUP_BUTTON_TITLE_BUTTONS_ID = "POPUP_BUTTON_TITLE_BUTTONS";
58   -const char* const POPUP_BUTTON_CONTENT_TEXT_ID = "POPUP_BUTTON_CONTENT_TEXT";
59   -const char* const POPUP_BUTTON_CONTENT_IMAGE_ID = "POPUP_BUTTON_CONTENT_IMAGE";
60   -const char* const POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID = "POPUP_BUTTON_CONTENT_IMAGE_SCALE";
61   -const char* const POPUP_BUTTON_CONTENT_IMAGE_FIT_ID = "POPUP_BUTTON_CONTENT_IMAGE_FIT";
62   -const char* const POPUP_BUTTON_CONTENT_IMAGE_FILL_ID = "POPUP_BUTTON_CONTENT_IMAGE_FILL";
63   -const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT";
64   -const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS";
65   -const char* const POPUP_BUTTON_COMPLEX_ID = "POPUP_BUTTON_COMPLEX";
66   -
67   -const char* const TABLEVIEW_BUTTON_EMPTY_ID = "TABLEVIEW_BUTTON_EMPTY";
  42 +// This example contains size negotiation tests for TableView and Popup.
68 43 const char* const TABLEVIEW_BUTTON_1CELL_ID = "TABLEVIEW_BUTTON_1CELL";
69 44 const char* const TABLEVIEW_BUTTON_3CELL_ID = "TABLEVIEW_BUTTON_3CELL";
70 45 const char* const TABLEVIEW_BUTTON_3X3CELL_ID = "TABLEVIEW_BUTTON_3X3CELL";
... ... @@ -75,44 +50,11 @@ const char* const TABLEVIEW_BUTTON_FIT2_ID = &quot;TABLEVIEW_BUTTON_FIT2&quot;;
75 50 const char* const TABLEVIEW_BUTTON_NATURAL1_ID = "TABLEVIEW_BUTTON_NATURAL1";
76 51 const char* const TABLEVIEW_BUTTON_NATURAL2_ID = "TABLEVIEW_BUTTON_NATURAL2";
77 52 const char* const TABLEVIEW_BUTTON_NATURAL3_ID = "TABLEVIEW_BUTTON_NATURAL3";
78   -
79   -const char* const OKAY_BUTTON_ID = "OKAY_BUTTON";
80   -const char* const CANCEL_BUTTON_ID = "CANCEL_BUTTON";
81   -
82   -const char* const CONTENT_TEXT = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
83   -const char* const IMAGE1 = DALI_IMAGE_DIR "gallery-medium-5.jpg";
84   -const char* const IMAGE2 = DALI_IMAGE_DIR "background-magnifier.jpg";
85   -const char* const CHECKBOX_UNCHECKED_IMAGE = DALI_IMAGE_DIR "checkbox-unselected.png";
86   -const char* const CHECKBOX_CHECKED_IMAGE = DALI_IMAGE_DIR "checkbox-selected.png";
87   -
88   -const ButtonItem MENU_ITEMS[] = {
89   - { POPUPS_MENU_ID, "Popups" },
90   - { TABLEVIEW_MENU_ID, "TableView" }
91   -};
92   -
93   -const unsigned int MENU_ITEMS_COUNT = sizeof( MENU_ITEMS ) / sizeof( MENU_ITEMS[0] );
94   -
95   -const ButtonItem POPUP_BUTTON_ITEMS[] = {
96   - { POPUP_BUTTON_COMPLEX_ID, "Complex" },
97   - { POPUP_BUTTON_EMPTY_ID, "Empty" },
98   - { POPUP_BUTTON_TITLE_ID, "Title" },
99   - { POPUP_BUTTON_BUTTONS_1_ID, "1 Button" },
100   - { POPUP_BUTTON_BUTTONS_2_ID, "2 Buttons" },
101   - { POPUP_BUTTON_TITLE_BUTTONS_ID, "Title & Buttons" },
102   - { POPUP_BUTTON_CONTENT_TEXT_ID, "Text" },
103   - { POPUP_BUTTON_CONTENT_IMAGE_ID, "Image" },
104   - { POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID, "Image Scale" },
105   - { POPUP_BUTTON_CONTENT_IMAGE_FIT_ID, "Image Fit" },
106   - { POPUP_BUTTON_CONTENT_IMAGE_FILL_ID, "Image Fill" },
107   - { POPUP_BUTTON_TITLE_CONTENT_TEXT_ID, "Title Text" },
108   - { POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID, "Title, text, buttons" }
109   -
110   -};
111   -
112   -const int POPUP_BUTTON_ITEMS_COUNT = sizeof( POPUP_BUTTON_ITEMS ) / sizeof( POPUP_BUTTON_ITEMS[0] );
  53 +const char* const POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID = "POPUP_BUTTON_CONTENT_IMAGE_SCALE";
  54 +const char* const POPUP_BUTTON_CONTENT_IMAGE_FIT_ID = "POPUP_BUTTON_CONTENT_IMAGE_FIT";
  55 +const char* const POPUP_BUTTON_CONTENT_IMAGE_FILL_ID = "POPUP_BUTTON_CONTENT_IMAGE_FILL";
113 56  
114 57 const ButtonItem TABLEVIEW_BUTTON_ITEMS[] = {
115   - { TABLEVIEW_BUTTON_EMPTY_ID, "Empty" },
116 58 { TABLEVIEW_BUTTON_1CELL_ID, "1 Cell" },
117 59 { TABLEVIEW_BUTTON_3CELL_ID, "3 Cell" },
118 60 { TABLEVIEW_BUTTON_3X3CELL_ID, "3x3 Cells" },
... ... @@ -123,12 +65,14 @@ const ButtonItem TABLEVIEW_BUTTON_ITEMS[] = {
123 65 { TABLEVIEW_BUTTON_NATURAL1_ID, "Natural 1" },
124 66 { TABLEVIEW_BUTTON_NATURAL2_ID, "Natural 2" },
125 67 { TABLEVIEW_BUTTON_NATURAL3_ID, "Natural 3" },
  68 + { POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID, "Image Scale" },
  69 + { POPUP_BUTTON_CONTENT_IMAGE_FIT_ID, "Image Fit" },
  70 + { POPUP_BUTTON_CONTENT_IMAGE_FILL_ID, "Image Fill" },
126 71 };
127 72  
128 73 const unsigned int TABLEVIEW_BUTTON_ITEMS_COUNT = sizeof( TABLEVIEW_BUTTON_ITEMS ) / sizeof( TABLEVIEW_BUTTON_ITEMS[0] );
129 74  
130   -} // namespace
131   -
  75 +} // anonymous namespace
132 76  
133 77  
134 78 /**
... ... @@ -139,9 +83,7 @@ class SizeNegotiationController: public ConnectionTracker, public Toolkit::ItemF
139 83 public:
140 84  
141 85 SizeNegotiationController( Application& application )
142   - : mApplication( application ),
143   - mMenuShown( false ),
144   - mDemoState( POPUP )
  86 + : mApplication( application )
145 87 {
146 88 // Connect to the Application's Init signal
147 89 mApplication.InitSignal().Connect( this, &SizeNegotiationController::Create );
... ... @@ -155,7 +97,6 @@ public:
155 97 void Create( Application& application )
156 98 {
157 99 // The Init signal is received once (only) during the Application lifetime
158   -
159 100 Stage stage = Stage::GetCurrent();
160 101  
161 102 // Respond to key events
... ... @@ -171,15 +112,7 @@ public:
171 112 std::string("") );
172 113  
173 114 mTitleActor = DemoHelper::CreateToolBarLabel( "CUSTOM_TOOLBAR_TITLE" );
174   -
175   - SetTitle();
176   -
177   - // Create menu button
178   - Toolkit::PushButton viewButton = Toolkit::PushButton::New();
179   - viewButton.SetUnselectedImage( MENU_ICON_IMAGE );
180   - viewButton.SetSelectedImage( MENU_ICON_IMAGE_SELECTED );
181   - viewButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenu );
182   - mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
  115 + mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, TOOLBAR_TITLE );
183 116  
184 117 // Add title to the tool bar.
185 118 const float padding( DemoHelper::DEFAULT_VIEW_STYLE.mToolBarPadding );
... ... @@ -204,116 +137,27 @@ public:
204 137 mContentLayer.Add( mItemView );
205 138 }
206 139  
207   - void SetTitle()
208   - {
209   - std::string subTitle = "";
210   -
211   - switch( mDemoState )
212   - {
213   - case POPUP:
214   - {
215   - subTitle = "Popups";
216   - break;
217   - }
218   -
219   - case TABLEVIEW:
220   - {
221   - subTitle = "TableView";
222   - break;
223   - }
224   -
225   - default:
226   - {
227   - break;
228   - }
229   - }
230   -
231   - mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, std::string( std::string( TOOLBAR_TITLE ) + ": " + subTitle ) );
232   - }
233   -
234   - bool OnMenu( Toolkit::Button button )
  140 + void StagePopup( Toolkit::Popup popup )
235 141 {
236   - ShowMenu();
237   - return true;
238   - }
239   -
240   - void ShowMenu()
241   - {
242   - Stage stage = Stage::GetCurrent();
243   - const float popupWidth = stage.GetSize().x * 0.5f;
244   -
245   - mMenu = Toolkit::Popup::New();
246   - mMenu.SetParentOrigin( ParentOrigin::TOP_LEFT );
247   - mMenu.SetAnchorPoint( AnchorPoint::TOP_LEFT );
248   - mMenu.HideTail();
249   - mMenu.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::HideMenu );
250   - mMenu.SetSize( popupWidth, 0.0f );
251   - mMenu.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
252   -
253   - Toolkit::TableView tableView = Toolkit::TableView::New( 0, 0 );
254   - tableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
255   - tableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
256   - mMenu.Add( tableView );
257   -
258   - for( unsigned int i = 0; i < MENU_ITEMS_COUNT; ++i )
259   - {
260   - Toolkit::PushButton menuButton = Toolkit::PushButton::New();
261   - menuButton.SetName( MENU_ITEMS[ i ].name );
262   - menuButton.SetLabelText( MENU_ITEMS[ i ].text );
263   - menuButton.SetUnselectedImage( "" );
264   - menuButton.SetSelectedImage( "" );
265   - menuButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenuSelect );
266   -
267   - tableView.Add( menuButton );
268   - tableView.SetFitHeight( i );
269   - }
270   -
271   - // Show the menu
272   - mMenu.Show();
273   - mMenuShown = true;
  142 + Stage::GetCurrent().Add( popup );
  143 + popup.SetDisplayState( Toolkit::Popup::SHOWN );
274 144 }
275 145  
276   - void HideMenu()
  146 + void OnPopupOutsideTouched()
277 147 {
278   - if( mMenu )
  148 + if( mPopup )
279 149 {
280   - mMenu.Hide();
281   - mMenu.Reset();
  150 + mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
282 151 }
283   -
284   - mMenuShown = false;
285 152 }
286 153  
287   - bool OnMenuSelect( Toolkit::Button button )
  154 + void PopupHidden()
288 155 {
289   - bool refresh = false;
290   -
291   - if( button.GetName() == POPUPS_MENU_ID )
292   - {
293   - if( mDemoState != POPUP )
294   - {
295   - refresh = true;
296   - mDemoState = POPUP;
297   - }
298   - }
299   - else if( button.GetName() == TABLEVIEW_MENU_ID )
300   - {
301   - if( mDemoState != TABLEVIEW )
302   - {
303   - refresh = true;
304   - mDemoState = TABLEVIEW;
305   - }
306   - }
307   -
308   - if( refresh )
  156 + if( mPopup )
309 157 {
310   - SetTitle();
311   -
312   - mItemView.Refresh();
  158 + mPopup.Unparent();
  159 + mPopup.Reset();
313 160 }
314   -
315   - HideMenu();
316   - return true;
317 161 }
318 162  
319 163 Toolkit::Popup CreatePopup()
... ... @@ -322,312 +166,26 @@ public:
322 166 const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
323 167  
324 168 Toolkit::Popup popup = Toolkit::Popup::New();
325   - popup.SetName( "POPUP" );
  169 + popup.SetName( "popup" );
326 170 popup.SetParentOrigin( ParentOrigin::CENTER );
327 171 popup.SetAnchorPoint( AnchorPoint::CENTER );
328 172 popup.SetSize( POPUP_WIDTH_DP, 0.0f );
329   - popup.HideTail();
  173 + popup.SetProperty( Toolkit::Popup::Property::TAIL_VISIBILITY, false );
330 174  
331 175 popup.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::OnPopupOutsideTouched );
  176 + popup.HiddenSignal().Connect( this, &SizeNegotiationController::PopupHidden );
332 177  
333 178 return popup;
334 179 }
335 180  
336 181 bool OnButtonClicked( Toolkit::Button button )
337 182 {
338   - if( button.GetName() == POPUP_BUTTON_EMPTY_ID )
339   - {
340   - mPopup = CreatePopup();
341   -
342   - mPopup.Show();
343   - }
344   - else if( button.GetName() == POPUP_BUTTON_TITLE_ID )
345   - {
346   - mPopup = CreatePopup();
347   - mPopup.SetTitle( "Popup!" );
348   -
349   - mPopup.Show();
350   - }
351   - else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID )
352   - {
353   - mPopup = CreatePopup();
354   -
355   - Toolkit::PushButton okayButton = Toolkit::PushButton::New();
356   - okayButton.SetName( OKAY_BUTTON_ID );
357   - okayButton.SetLabelText( "OK!" );
358   -
359   - okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
360   -
361   - mPopup.AddButton( okayButton );
362   -
363   - mPopup.Show();
364   - }
365   - else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID )
366   - {
367   - mPopup = CreatePopup();
368   -
369   - Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
370   - cancelButton.SetName( CANCEL_BUTTON_ID );
371   - cancelButton.SetLabelText( "Cancel" );
372   -
373   - cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
374   -
375   - mPopup.AddButton( cancelButton );
376   -
377   - Toolkit::PushButton okayButton = Toolkit::PushButton::New();
378   - okayButton.SetName( OKAY_BUTTON_ID );
379   - okayButton.SetLabelText( "OK!" );
380   -
381   - okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
382   -
383   - mPopup.AddButton( okayButton );
384   -
385   - mPopup.Show();
386   - }
387   - else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID )
388   - {
389   - mPopup = CreatePopup();
390   - mPopup.SetTitle( "Popup!" );
391   -
392   - Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
393   - cancelButton.SetName( CANCEL_BUTTON_ID );
394   - cancelButton.SetLabelText( "Cancel" );
395   -
396   - cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
397   -
398   - mPopup.AddButton( cancelButton );
399   -
400   - Toolkit::PushButton okayButton = Toolkit::PushButton::New();
401   - okayButton.SetName( OKAY_BUTTON_ID );
402   - okayButton.SetLabelText( "OK!" );
403   -
404   - okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
405   -
406   - mPopup.AddButton( okayButton );
407   -
408   - mPopup.Show();
409   - }
410   - else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID )
411   - {
412   - mPopup = CreatePopup();
413   -
414   - TextLabel text = TextLabel::New( CONTENT_TEXT );
415   - text.SetName( "POPUP_CONTENT_TEXT" );
416   - text.SetProperty( TextLabel::Property::MULTI_LINE, true );
417   - text.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
418   - text.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
419   - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
420   - text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
421   - text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
422   -
423   - mPopup.Add( text );
424   -
425   - mPopup.Show();
426   - }
427   - else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID )
428   - {
429   - mPopup = CreatePopup();
430   -
431   - Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE2 );
432   - image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
433   - image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
434   - image.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
435   -
436   - mPopup.Add( image );
437   -
438   - mPopup.Show();
439   - }
440   - else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
441   - {
442   - mPopup = CreatePopup();
443   -
444   - mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
445   - mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
446   -
447   - Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE2 );
448   - image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
449   -
450   - mPopup.Add( image );
451   -
452   - mPopup.Show();
453   - }
454   - else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
455   - {
456   - mPopup = CreatePopup();
457   -
458   - mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
459   - mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
460   -
461   - Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE2 );
462   - image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
463   - image.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
464   -
465   - mPopup.Add( image );
466   -
467   - mPopup.Show();
468   - }
469   - else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
  183 + if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
470 184 {
471 185 mPopup = CreatePopup();
472   -
473 186 mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
474 187 mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
475 188  
476   - Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE2 );
477   - image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
478   - image.SetSizeScalePolicy( SizeScalePolicy::FILL_WITH_ASPECT_RATIO );
479   -
480   - mPopup.Add( image );
481   -
482   - mPopup.Show();
483   - }
484   - else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
485   - {
486   - mPopup = CreatePopup();
487   - mPopup.SetTitle( "Popup!" );
488   -
489   - Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
490   - text.SetName( "POPUP_CONTENT_TEXT" );
491   - text.SetProperty( TextLabel::Property::MULTI_LINE, true );
492   - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
493   - text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
494   - text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
495   -
496   - mPopup.Add( text );
497   -
498   - mPopup.Show();
499   - }
500   - else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID )
501   - {
502   - mPopup = CreatePopup();
503   - mPopup.SetTitle( "Popup!" );
504   -
505   - Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
506   - text.SetName( "POPUP_CONTENT_TEXT" );
507   - text.SetProperty( TextLabel::Property::MULTI_LINE, true );
508   - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
509   - text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
510   - text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
511   -
512   - mPopup.Add( text );
513   -
514   - Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
515   - cancelButton.SetName( CANCEL_BUTTON_ID );
516   - cancelButton.SetLabelText( "Cancel" );
517   -
518   - cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
519   -
520   - mPopup.AddButton( cancelButton );
521   -
522   - Toolkit::PushButton okayButton = Toolkit::PushButton::New();
523   - okayButton.SetName( OKAY_BUTTON_ID );
524   - okayButton.SetLabelText( "OK!" );
525   -
526   - okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
527   -
528   - mPopup.AddButton( okayButton );
529   -
530   - mPopup.Show();
531   - }
532   - else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
533   - {
534   - mPopup = CreatePopup();
535   - mPopup.SetTitle( "Warning" );
536   -
537   - // Content
538   - Toolkit::TableView content = Toolkit::TableView::New( 2, 2 );
539   - content.SetName( "COMPLEX_TABLEVIEW" );
540   - content.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
541   - content.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
542   - content.SetFitHeight( 0 );
543   - content.SetFitHeight( 1 );
544   - content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
545   -
546   - // Text
547   - {
548   - Toolkit::TextLabel text = Toolkit::TextLabel::New( "Do you really want to quit?" );
549   - text.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
550   - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
551   - text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
552   -
553   - content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
554   - }
555   -
556   - // Image
557   - {
558   - Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE1 );
559   - image.SetName( "COMPLEX_IMAGE" );
560   - image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
561   - image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
562   - image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
563   - content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
564   - }
565   -
566   - // Text 2
567   - {
568   - Toolkit::TableView root = Toolkit::TableView::New( 1, 2 );
569   - root.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
570   - root.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
571   - root.SetFitHeight( 0 );
572   - root.SetFitWidth( 0 );
573   - root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) );
574   -
575   - Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
576   - checkBox.SetSize( 48, 48 );
577   -
578   - root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
579   -
580   - Toolkit::TextLabel text = Toolkit::TextLabel::New( "Don't show again" );
581   - Actor textActor = text;
582   - textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
583   -
584   - root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
585   -
586   - content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0 ) );
587   - }
588   -
589   - mPopup.Add( content );
590   -
591   - // Buttons
592   - Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
593   - cancelButton.SetName( CANCEL_BUTTON_ID );
594   - cancelButton.SetLabelText( "Cancel" );
595   -
596   - cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
597   -
598   - mPopup.AddButton( cancelButton );
599   -
600   - Toolkit::PushButton okayButton = Toolkit::PushButton::New();
601   - okayButton.SetName( OKAY_BUTTON_ID );
602   - okayButton.SetLabelText( "OK!" );
603   -
604   - okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
605   -
606   - mPopup.AddButton( okayButton );
607   -
608   - mPopup.Show();
609   - }
610   - else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID )
611   - {
612   - mPopup = CreatePopup();
613   - mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
614   - mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
615   -
616   -
617   - Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
618   - table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
619   -
620   - mPopup.Add( table );
621   -
622   - mPopup.Show();
623   - }
624   - else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
625   - {
626   - mPopup = CreatePopup();
627   - mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
628   - mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
629   -
630   -
631 189 Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
632 190 table.SetName( "TABLEVIEW_BUTTON_1CELL_ID" );
633 191 table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -638,7 +196,7 @@ public:
638 196  
639 197 mPopup.Add( table );
640 198  
641   - mPopup.Show();
  199 + StagePopup( mPopup );
642 200 }
643 201 else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID )
644 202 {
... ... @@ -646,29 +204,28 @@ public:
646 204 mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
647 205 mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
648 206  
649   -
650   - Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
  207 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
651 208 table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
652 209  
653 210 {
654 211 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
655 212 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
656   - table.Add( backing );
  213 + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) );
657 214 }
658 215 {
659 216 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
660 217 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
661   - table.Add( backing );
  218 + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) );
662 219 }
663 220 {
664 221 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
665 222 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
666   - table.Add( backing );
  223 + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) );
667 224 }
668 225  
669   - mPopup.Add( table );
  226 + mPopup.SetContent( table );
670 227  
671   - mPopup.Show();
  228 + StagePopup( mPopup );
672 229 }
673 230 else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID )
674 231 {
... ... @@ -676,7 +233,6 @@ public:
676 233 mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
677 234 mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
678 235  
679   -
680 236 Toolkit::TableView table = Toolkit::TableView::New( 3, 3 );
681 237 table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
682 238  
... ... @@ -733,7 +289,7 @@ public:
733 289  
734 290 mPopup.Add( table );
735 291  
736   - mPopup.Show();
  292 + StagePopup( mPopup );
737 293 }
738 294 else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID )
739 295 {
... ... @@ -741,7 +297,6 @@ public:
741 297 mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
742 298 mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
743 299  
744   -
745 300 Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
746 301 table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
747 302 table.SetFixedHeight( 0, 50.0f );
... ... @@ -750,6 +305,7 @@ public:
750 305 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
751 306 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
752 307 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
  308 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
753 309 text.SetParentOrigin( ParentOrigin::CENTER );
754 310 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
755 311 text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
... ... @@ -761,6 +317,7 @@ public:
761 317 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
762 318 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
763 319 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  320 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
764 321 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
765 322 text.SetParentOrigin( ParentOrigin::CENTER );
766 323 text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
... ... @@ -772,6 +329,7 @@ public:
772 329 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
773 330 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
774 331 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  332 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
775 333 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
776 334 text.SetParentOrigin( ParentOrigin::CENTER );
777 335 text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
... ... @@ -782,7 +340,7 @@ public:
782 340  
783 341 mPopup.Add( table );
784 342  
785   - mPopup.Show();
  343 + StagePopup( mPopup );
786 344 }
787 345 else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID )
788 346 {
... ... @@ -790,7 +348,6 @@ public:
790 348 mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
791 349 mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
792 350  
793   -
794 351 Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
795 352 table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
796 353 table.SetFixedHeight( 0, 50.0f );
... ... @@ -800,6 +357,7 @@ public:
800 357 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
801 358 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
802 359 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
  360 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
803 361 text.SetAnchorPoint( AnchorPoint::CENTER );
804 362 text.SetParentOrigin( ParentOrigin::CENTER );
805 363 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -813,6 +371,7 @@ public:
813 371 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
814 372 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
815 373 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  374 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
816 375 text.SetAnchorPoint( AnchorPoint::CENTER );
817 376 text.SetParentOrigin( ParentOrigin::CENTER );
818 377 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -826,6 +385,7 @@ public:
826 385 Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
827 386 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
828 387 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
  388 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
829 389 text.SetAnchorPoint( AnchorPoint::CENTER );
830 390 text.SetParentOrigin( ParentOrigin::CENTER );
831 391 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -838,7 +398,7 @@ public:
838 398  
839 399 mPopup.Add( table );
840 400  
841   - mPopup.Show();
  401 + StagePopup( mPopup );
842 402 }
843 403 else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID )
844 404 {
... ... @@ -846,7 +406,6 @@ public:
846 406 mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
847 407 mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
848 408  
849   -
850 409 Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
851 410 table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
852 411 table.SetFitHeight( 0 );
... ... @@ -858,6 +417,7 @@ public:
858 417 backing.SetSize( 0.0f, 100.0f );
859 418  
860 419 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  420 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
861 421 text.SetAnchorPoint( AnchorPoint::CENTER );
862 422 text.SetParentOrigin( ParentOrigin::CENTER );
863 423 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -873,6 +433,7 @@ public:
873 433 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
874 434  
875 435 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  436 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
876 437 text.SetAnchorPoint( AnchorPoint::CENTER );
877 438 text.SetParentOrigin( ParentOrigin::CENTER );
878 439 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -889,6 +450,7 @@ public:
889 450 backing.SetSize( 0.0f, 100.0f );
890 451  
891 452 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  453 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
892 454 text.SetAnchorPoint( AnchorPoint::CENTER );
893 455 text.SetParentOrigin( ParentOrigin::CENTER );
894 456 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -902,7 +464,7 @@ public:
902 464  
903 465 mPopup.Add( table );
904 466  
905   - mPopup.Show();
  467 + StagePopup( mPopup );
906 468 }
907 469 else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID )
908 470 {
... ... @@ -919,6 +481,7 @@ public:
919 481 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
920 482  
921 483 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  484 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
922 485 text.SetAnchorPoint( AnchorPoint::CENTER );
923 486 text.SetParentOrigin( ParentOrigin::CENTER );
924 487 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -935,6 +498,7 @@ public:
935 498 backing.SetSize( 0.0f, 200.0f );
936 499  
937 500 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  501 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
938 502 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
939 503 text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
940 504 text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
... ... @@ -950,6 +514,7 @@ public:
950 514 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
951 515  
952 516 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  517 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
953 518 text.SetAnchorPoint( AnchorPoint::CENTER );
954 519 text.SetParentOrigin( ParentOrigin::CENTER );
955 520 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -963,7 +528,7 @@ public:
963 528  
964 529 mPopup.Add( table );
965 530  
966   - mPopup.Show();
  531 + StagePopup( mPopup );
967 532 }
968 533 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID )
969 534 {
... ... @@ -985,6 +550,7 @@ public:
985 550 backing.SetSize( 0.0f, 100.0f );
986 551  
987 552 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  553 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
988 554 text.SetAnchorPoint( AnchorPoint::CENTER );
989 555 text.SetParentOrigin( ParentOrigin::CENTER );
990 556 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -1001,6 +567,7 @@ public:
1001 567 backing.SetSize( 0.0f, 200.0f );
1002 568  
1003 569 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  570 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
1004 571 text.SetAnchorPoint( AnchorPoint::CENTER );
1005 572 text.SetParentOrigin( ParentOrigin::CENTER );
1006 573 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -1017,6 +584,7 @@ public:
1017 584 backing.SetSize( 0.0f, 300.0f );
1018 585  
1019 586 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  587 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
1020 588 text.SetAnchorPoint( AnchorPoint::CENTER );
1021 589 text.SetParentOrigin( ParentOrigin::CENTER );
1022 590 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -1030,7 +598,7 @@ public:
1030 598  
1031 599 mPopup.Add( table );
1032 600  
1033   - mPopup.Show();
  601 + StagePopup( mPopup );
1034 602 }
1035 603 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID )
1036 604 {
... ... @@ -1052,6 +620,7 @@ public:
1052 620 backing.SetSize( 0.0f, 100.0f );
1053 621  
1054 622 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  623 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
1055 624 text.SetAnchorPoint( AnchorPoint::CENTER );
1056 625 text.SetParentOrigin( ParentOrigin::CENTER );
1057 626 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -1068,6 +637,7 @@ public:
1068 637 backing.SetSize( 0.0f, 200.0f );
1069 638  
1070 639 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  640 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
1071 641 text.SetAnchorPoint( AnchorPoint::CENTER );
1072 642 text.SetParentOrigin( ParentOrigin::CENTER );
1073 643 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -1081,7 +651,7 @@ public:
1081 651  
1082 652 mPopup.Add( table );
1083 653  
1084   - mPopup.Show();
  654 + StagePopup( mPopup );
1085 655 }
1086 656 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID )
1087 657 {
... ... @@ -1101,6 +671,7 @@ public:
1101 671 backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
1102 672  
1103 673 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
  674 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
1104 675 text.SetAnchorPoint( AnchorPoint::CENTER );
1105 676 text.SetParentOrigin( ParentOrigin::CENTER );
1106 677 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -1117,6 +688,7 @@ public:
1117 688 backing.SetSize( 0.0f, 200.0f );
1118 689  
1119 690 Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  691 + text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
1120 692 text.SetAnchorPoint( AnchorPoint::CENTER );
1121 693 text.SetParentOrigin( ParentOrigin::CENTER );
1122 694 text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
... ... @@ -1127,28 +699,53 @@ public:
1127 699  
1128 700 table.Add( backing );
1129 701 }
1130   -
1131 702 mPopup.Add( table );
1132 703  
1133   - mPopup.Show();
  704 + StagePopup( mPopup );
1134 705 }
1135   - else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID )
  706 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
1136 707 {
1137   - if( mPopup )
1138   - {
1139   - mPopup.Hide();
1140   - }
  708 + mPopup = CreatePopup();
  709 + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
  710 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  711 +
  712 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE ) );
  713 + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  714 +
  715 + mPopup.Add( image );
  716 +
  717 + StagePopup( mPopup );
1141 718 }
  719 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
  720 + {
  721 + mPopup = CreatePopup();
  722 + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
  723 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
1142 724  
1143   - return true;
1144   - }
  725 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE ) );
  726 + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  727 + image.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
1145 728  
1146   - void OnPopupOutsideTouched()
1147   - {
1148   - if( mPopup )
  729 + mPopup.Add( image );
  730 +
  731 + StagePopup( mPopup );
  732 + }
  733 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
1149 734 {
1150   - mPopup.Hide();
  735 + mPopup = CreatePopup();
  736 + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
  737 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  738 +
  739 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE ) );
  740 + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  741 + image.SetSizeScalePolicy( SizeScalePolicy::FILL_WITH_ASPECT_RATIO );
  742 +
  743 + mPopup.Add( image );
  744 +
  745 + StagePopup( mPopup );
1151 746 }
  747 +
  748 + return true;
1152 749 }
1153 750  
1154 751 void OnKeyEvent( const KeyEvent& event )
... ... @@ -1172,25 +769,7 @@ public: // From ItemFactory
1172 769 */
1173 770 virtual unsigned int GetNumberOfItems()
1174 771 {
1175   - switch( mDemoState )
1176   - {
1177   - case POPUP:
1178   - {
1179   - return POPUP_BUTTON_ITEMS_COUNT;
1180   - }
1181   -
1182   - case TABLEVIEW:
1183   - {
1184   - return TABLEVIEW_BUTTON_ITEMS_COUNT;
1185   - }
1186   -
1187   - default:
1188   - {
1189   - break;
1190   - }
1191   - }
1192   -
1193   - return 0;
  772 + return TABLEVIEW_BUTTON_ITEMS_COUNT;
1194 773 }
1195 774  
1196 775 /**
... ... @@ -1201,65 +780,29 @@ public: // From ItemFactory
1201 780 */
1202 781 virtual Actor NewItem(unsigned int itemId)
1203 782 {
1204   - const ButtonItem* buttonDataArray = NULL;
1205   - switch( mDemoState )
1206   - {
1207   - case POPUP:
1208   - {
1209   - buttonDataArray = POPUP_BUTTON_ITEMS;
1210   - break;
1211   - }
  783 + Toolkit::PushButton popupButton = Toolkit::PushButton::New();
  784 + popupButton.SetName( TABLEVIEW_BUTTON_ITEMS[ itemId ].name );
  785 + popupButton.SetLabelText( TABLEVIEW_BUTTON_ITEMS[ itemId ].text );
  786 + popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
1212 787  
1213   - case TABLEVIEW:
1214   - {
1215   - buttonDataArray = TABLEVIEW_BUTTON_ITEMS;
1216   - break;
1217   - }
  788 + popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
1218 789  
1219   - default:
1220   - {
1221   - break;
1222   - }
1223   - }
1224   -
1225   - if( buttonDataArray )
1226   - {
1227   - Toolkit::PushButton popupButton = Toolkit::PushButton::New();
1228   - popupButton.SetName( buttonDataArray[ itemId ].name );
1229   - popupButton.SetLabelText( buttonDataArray[ itemId ].text );
1230   - popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
1231   -
1232   - popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
1233   -
1234   - return popupButton;
1235   - }
1236   -
1237   - return Actor();
  790 + return popupButton;
1238 791 }
1239 792  
1240 793 private:
1241 794  
1242   - enum DemoState
1243   - {
1244   - POPUP,
1245   - TABLEVIEW
1246   - };
1247   -
1248   - Application& mApplication;
1249   - Toolkit::Control mView; ///< The View instance.
1250   - Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
1251   - Layer mContentLayer; ///< Content layer
1252   -
1253   - Toolkit::TextLabel mTitleActor; ///< Title text
1254   -
1255   - Toolkit::Popup mMenu; ///< The navigation menu
1256   - bool mMenuShown; ///< If the navigation menu is currently being displayed or not
  795 + Application& mApplication;
  796 + Toolkit::Control mView; ///< The View instance.
  797 + Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  798 + Layer mContentLayer; ///< Content layer.
1257 799  
1258   - Toolkit::Popup mPopup;
  800 + Toolkit::TextLabel mTitleActor; ///< Title text.
  801 + Toolkit::Popup mMenu; ///< The navigation menu todor.
  802 + Toolkit::Popup mPopup; ///< The current example popup.
1259 803  
1260   - Toolkit::ItemView mItemView; ///< ItemView to hold test images
  804 + Toolkit::ItemView mItemView; ///< ItemView to hold test images.
1261 805  
1262   - DemoState mDemoState;
1263 806 };
1264 807  
1265 808 void RunTest( Application& application )
... ... @@ -1270,7 +813,6 @@ void RunTest( Application&amp; application )
1270 813 }
1271 814  
1272 815 // Entry point for Linux & SLP applications
1273   -//
1274 816 int main( int argc, char **argv )
1275 817 {
1276 818 Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH );
... ...
examples/text-field/text-field-example.cpp
... ... @@ -106,7 +106,7 @@ public:
106 106 mPopup = CreatePopup( stageSize.width * 0.8f );
107 107 mPopup.Add( mField );
108 108 mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched );
109   - mPopup.Show();
  109 + mPopup.SetDisplayState( Popup::SHOWN );
110 110  
111 111 return true;
112 112 }
... ... @@ -133,7 +133,6 @@ public:
133 133 popup.SetParentOrigin( ParentOrigin::CENTER );
134 134 popup.SetAnchorPoint( AnchorPoint::CENTER );
135 135 popup.SetSize( width, 0.0f );
136   - popup.HideTail();
137 136 popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT );
138 137 popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT );
139 138 popup.TouchedSignal().Connect( this, &TextFieldExample::OnPopupTouched );
... ... @@ -154,7 +153,7 @@ public:
154 153 // Hide & discard the pop-up
155 154 if( mPopup )
156 155 {
157   - mPopup.Hide();
  156 + mPopup.SetDisplayState( Popup::HIDDEN );
158 157 }
159 158 mField.Reset();
160 159 }
... ...
resources/images/popup_button_background.png 0 โ†’ 100644

2.91 KB

resources/scripts/popup.json 0 โ†’ 100644
  1 +{
  2 + "constants": {
  3 + "CONFIG_SCRIPT_LOG_LEVEL": "Verbose"
  4 + },
  5 + "stage": [
  6 + {
  7 + "type": "ConfirmationPopup",
  8 + "name": "confirmation-popup",
  9 + "parent-origin": [0.5, 0.55, 0.5],
  10 + "anchor-point": "CENTER",
  11 + "width-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  12 + "height-resize-policy": "USE_NATURAL_SIZE",
  13 + "size-mode-factor": [0.65, 1.0, 1.0],
  14 + "tail-visibility": false,
  15 + "tail-position": [0, 0, 0],
  16 + "display-change-animation-duration": 1.0,
  17 + "contextual-mode": "NON_CONTEXTUAL",
  18 + "animation-mode": "ZOOM",
  19 + "control-ok": "control-ok",
  20 + "control-cancel": "control-cancel",
  21 + "connect-signal-ok-selected": "clicked",
  22 + "connect-signal-cancel-selected": "clicked",
  23 + "title": {
  24 + "type": "TextLabel",
  25 + "text": "Title text",
  26 + "text-color": [1, 1, 1, 1]
  27 + },
  28 + "content": {
  29 + "type": "TextLabel",
  30 + "text": "Content text",
  31 + "padding": [20, 20, 20, 0],
  32 + "text-color": [1, 1, 1, 1]
  33 + },
  34 + "footer": {
  35 + "type": "Control",
  36 + "size": [0, 80, 0],
  37 + "width-resize-policy": "FILL_TO_PARENT",
  38 + "height-resize-policy": "FIXED",
  39 + "parent-origin": "CENTER",
  40 + "anchor-point": "CENTER",
  41 + "actors": [
  42 + {
  43 + "type": "PushButton",
  44 + "name": "control-ok",
  45 + "parent-origin": "CENTER_LEFT",
  46 + "anchor-point": "CENTER_LEFT",
  47 + "position": [20, 0, 0],
  48 + "label-text": "OK"
  49 + },
  50 + {
  51 + "type": "PushButton",
  52 + "name": "control-cancel",
  53 + "parent-origin": "CENTER_RIGHT",
  54 + "anchor-point": "CENTER_RIGHT",
  55 + "position": [-20, 0, 0],
  56 + "label-text": "Cancel"
  57 + }
  58 + ]
  59 + },
  60 + "signals": [
  61 + {
  62 + "name": "control-signal-ok",
  63 + "action": "set",
  64 + "actor": "selection-label",
  65 + "property": "text",
  66 + "value": "User pressed: OK Button"
  67 + },
  68 + {
  69 + "name": "control-signal-ok",
  70 + "action": "set",
  71 + "actor": "confirmation-popup",
  72 + "property": "display-state",
  73 + "value": "HIDDEN"
  74 + },
  75 + {
  76 + "name": "control-signal-cancel",
  77 + "action": "set",
  78 + "actor": "selection-label",
  79 + "property": "text",
  80 + "value": "User pressed: Cancel Button"
  81 + },
  82 + {
  83 + "name": "control-signal-cancel",
  84 + "action": "set",
  85 + "actor": "confirmation-popup",
  86 + "property": "display-state",
  87 + "value": "HIDDEN"
  88 + },
  89 + {
  90 + "name": "touched-outside",
  91 + "action": "set",
  92 + "actor": "confirmation-popup",
  93 + "property": "display-state",
  94 + "value": "HIDDEN"
  95 + },
  96 + {
  97 + "name": "touched-outside",
  98 + "action": "set",
  99 + "actor": "selection-label",
  100 + "property": "text",
  101 + "value": "No button pressed, backing touched"
  102 + }
  103 + ]
  104 + },
  105 + {
  106 + "type": "ConfirmationPopup",
  107 + "name": "custom-animation-popup",
  108 + "parent-origin": [0.5, 0.55, 0.5],
  109 + "anchor-point": "CENTER",
  110 + "width-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  111 + "height-resize-policy": "USE_NATURAL_SIZE",
  112 + "size-mode-factor": [0.65, 1.0, 1.0],
  113 + "tail-visible": false,
  114 + "tail-position": [0, 0, 0],
  115 + "display-change-animation-duration": 1.0,
  116 + "contextual-mode": "NON_CONTEXTUAL",
  117 + "control-ok": "control-ok",
  118 + "control-cancel": "control-cancel",
  119 + "connect-signal-ok-selected": "clicked",
  120 + "connect-signal-cancel-selected": "clicked",
  121 + "animation-mode": "CUSTOM",
  122 + "entry-animation": {
  123 + "actor": "custom-animation-popup",
  124 + "property": "position",
  125 + "value": [
  126 + 0,
  127 + 0,
  128 + 0
  129 + ],
  130 + "alpha-function": "EASE_OUT",
  131 + "time-period": {
  132 + "delay": 0.0,
  133 + "duration": 1.0
  134 + }
  135 + },
  136 + "exit-animation": {
  137 + "actor": "custom-animation-popup",
  138 + "property": "position",
  139 + "value": [
  140 + -450,
  141 + -225,
  142 + 0
  143 + ],
  144 + "alpha-function": "EASE_IN",
  145 + "time-period": {
  146 + "delay": 0.0,
  147 + "duration": 1.0
  148 + }
  149 + },
  150 + "title": {
  151 + "type": "TextLabel",
  152 + "text": "Title text",
  153 + "text-color": [1, 1, 1, 1]
  154 + },
  155 + "content": {
  156 + "type": "TextLabel",
  157 + "text": "Content text",
  158 + "padding": [20, 20, 20, 0],
  159 + "text-color": [1, 1, 1, 1]
  160 + },
  161 + "footer": {
  162 + "type": "Control",
  163 + "size": [0, 80, 0],
  164 + "width-resize-policy": "FILL_TO_PARENT",
  165 + "height-resize-policy": "FIXED",
  166 + "parent-origin": "CENTER",
  167 + "anchor-point": "CENTER",
  168 + "actors": [
  169 + {
  170 + "type": "PushButton",
  171 + "name": "control-ok",
  172 + "parent-origin": "CENTER_LEFT",
  173 + "anchor-point": "CENTER_LEFT",
  174 + "position": [20, 0, 0],
  175 + "label-text": "OK"
  176 + },
  177 + {
  178 + "type": "PushButton",
  179 + "name": "control-cancel",
  180 + "parent-origin": "CENTER_RIGHT",
  181 + "anchor-point": "CENTER_RIGHT",
  182 + "position": [-20, 0, 0],
  183 + "label-text": "Cancel"
  184 + }
  185 + ]
  186 + },
  187 + "signals": [
  188 + {
  189 + "name": "control-signal-ok",
  190 + "action": "set",
  191 + "actor": "selection-label",
  192 + "property": "text",
  193 + "value": "User pressed: OK Button"
  194 + },
  195 + {
  196 + "name": "control-signal-ok",
  197 + "action": "set",
  198 + "actor": "custom-animation-popup",
  199 + "property": "display-state",
  200 + "value": "HIDDEN"
  201 + },
  202 + {
  203 + "name": "control-signal-cancel",
  204 + "action": "set",
  205 + "actor": "selection-label",
  206 + "property": "text",
  207 + "value": "User pressed: Cancel Button"
  208 + },
  209 + {
  210 + "name": "control-signal-cancel",
  211 + "action": "set",
  212 + "actor": "custom-animation-popup",
  213 + "property": "display-state",
  214 + "value": "HIDDEN"
  215 + },
  216 + {
  217 + "name": "touched-outside",
  218 + "action": "set",
  219 + "actor": "custom-animation-popup",
  220 + "property": "display-state",
  221 + "value": "HIDDEN"
  222 + },
  223 + {
  224 + "name": "touched-outside",
  225 + "action": "set",
  226 + "actor": "selection-label",
  227 + "property": "text",
  228 + "value": "No button pressed, backing touched"
  229 + }
  230 + ]
  231 + },
  232 + {
  233 + "type": "popup-toast",
  234 + "name": "toast",
  235 + "width-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  236 + "height-resize-policy": "USE_NATURAL_SIZE",
  237 + "size-mode-factor": [0.85, 0, 0],
  238 + "title": {
  239 + "type": "TextLabel",
  240 + "width-resize-policy": "FILL_TO_PARENT",
  241 + "height-resize-policy": "USE_NATURAL_SIZE",
  242 + "parent-origin": "CENTER",
  243 + "anchor-point": "CENTER",
  244 + "text": "This is a toast popup. \nIt will auto-hide itself.",
  245 + "text-color": [1, 1, 1, 1],
  246 + "multi-line": true,
  247 + "horizontal-alignment": "CENTER",
  248 + "vertical-alignment": "CENTER",
  249 + "padding": [20.0, 20.0, 20.0, 20.0]
  250 + }
  251 + },
  252 + {
  253 + "type": "PushButton",
  254 + "name": "popup-trigger-button",
  255 + "parent-origin": [0.1, 0.1, 0.5],
  256 + "anchor-point": "TOP_LEFT",
  257 + "width-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  258 + "height-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  259 + "size-mode-factor": [0.38, 0.14, 1.0],
  260 + "label-text": "Popup",
  261 + "signals": [{
  262 + "name": "clicked",
  263 + "action": "set",
  264 + "actor": "confirmation-popup",
  265 + "property": "display-state",
  266 + "value": "SHOWN"
  267 + }]
  268 + },
  269 + {
  270 + "type": "PushButton",
  271 + "name": "animated-popup-trigger-button",
  272 + "parent-origin": [0.9, 0.1, 0.5],
  273 + "anchor-point": "TOP_RIGHT",
  274 + "width-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  275 + "height-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  276 + "size-mode-factor": [0.38, 0.14, 1.0],
  277 + "label-text": "Animated",
  278 + "signals": [{
  279 + "name": "clicked",
  280 + "action": "set",
  281 + "actor": "custom-animation-popup",
  282 + "property": "display-state",
  283 + "value": "SHOWN"
  284 + }]
  285 + },
  286 + {
  287 + "type": "PushButton",
  288 + "name": "toast-trigger-button",
  289 + "parent-origin": [0.5, 1.0, 0.5],
  290 + "anchor-point": "BOTTOM_CENTER",
  291 + "width-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  292 + "height-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  293 + "size-mode-factor": [0.5, 0.14, 1.0],
  294 + "label-text": "Push for Toast",
  295 + "signals": [{
  296 + "name": "clicked",
  297 + "action": "set",
  298 + "actor": "toast",
  299 + "property": "display-state",
  300 + "value": "SHOWN"
  301 + }]
  302 + },
  303 + {
  304 + "type": "TextLabel",
  305 + "name": "selection-label",
  306 + "parent-origin": [0.5, 0.22, 0.5],
  307 + "anchor-point": "TOP_CENTER",
  308 + "width-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  309 + "height-resize-policy": "SIZE_RELATIVE_TO_PARENT",
  310 + "size-mode-factor": [0.9, 0.14, 1.0],
  311 + "text": "No selection made",
  312 + "horizontal-alignment": "CENTER",
  313 + "vertical-alignment": "CENTER"
  314 + }
  315 + ]
  316 +}
... ...
resources/scripts/super-blur-view.json
... ... @@ -70,8 +70,8 @@
70 70 "type": "TextLabel",
71 71 "text": "Blur"
72 72 },
73   - "unselected-state-actor": "{DALI_IMAGE_DIR}button-background.png",
74   - "selected-state-actor": "{DALI_IMAGE_DIR}button-background.png",
  73 + "unselected-state-image": "{DALI_IMAGE_DIR}button-background.png",
  74 + "selected-state-image": "{DALI_IMAGE_DIR}button-background.png",
75 75 "signals": [{
76 76 "name": "pressed",
77 77 "action": "play",
... ...
shared/dali-demo-strings.h
... ... @@ -53,7 +53,8 @@ extern &quot;C&quot;
53 53 #define DALI_DEMO_STR_TITLE_TEXT_LABEL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL")
54 54 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE")
55 55 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_EMOJI_TEXT")
56   -#define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE dgettext(DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE)
  56 +#define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE")
  57 +#define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP")
57 58 #define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS")
58 59 #define DALI_DEMO_STR_TITLE_LOGGING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LOGGING")
59 60 #define DALI_DEMO_STR_TITLE_MESH_MORPH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_MESH_MORPH")
... ... @@ -85,6 +86,7 @@ extern &quot;C&quot;
85 86 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts"
86 87 #define DALI_DEMO_STR_TITLE_EMOJI_TEXT "Emoji Text"
87 88 #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE "Negotiate Size"
  89 +#define DALI_DEMO_STR_TITLE_POPUP "Popup"
88 90 #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons"
89 91 #define DALI_DEMO_STR_TITLE_LOGGING "Logging"
90 92 #define DALI_DEMO_STR_TITLE_MESH_MORPH "Mesh Morph"
... ...