Revert "Revert "Renamed KeyEvent enum values to comply with coding standards.""
[platform/core/uifw/dali-demo.git] / examples / popup / popup-example.cpp
index b88982f..15475b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/popup/popup.h>
-#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
+#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
 
 using namespace Dali;
 
@@ -55,6 +55,7 @@ const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_ID = "POPUP_BUTTON_TITLE_CONTE
 const char* const POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID = "POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS";
 const char* const POPUP_BUTTON_FIXED_SIZE_ID = "POPUP_BUTTON_FIXED_SIZE_ID";
 const char* const POPUP_BUTTON_COMPLEX_ID = "POPUP_BUTTON_COMPLEX";
+const char* const POPUP_BUTTON_CUSTOM_STYLE = "POPUP_BUTTON_CUSTOM_STYLE";
 
 // Names to give Popup PushButton controls.
 const char* const POPUP_CONTROL_OK_NAME = "controlOk";
@@ -78,11 +79,13 @@ const ButtonItem POPUP_BUTTON_ITEMS[] = {
     { POPUP_BUTTON_CONTENT_TEXT_ID,                "Content Text" },
     { POPUP_BUTTON_CONTENT_IMAGE_ID,               "Content Image" },
     { POPUP_BUTTON_TITLE_CONTENT_TEXT_ID,          "Title + Content" },
-    { POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID, "Title + Large Content + Buttons" }
+    { POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID, "Title + Large Content + Buttons" },
+    { POPUP_BUTTON_CUSTOM_STYLE,                   "Custom Styled Popup" }
 };
 
 const int POPUP_BUTTON_ITEMS_COUNT = sizeof( POPUP_BUTTON_ITEMS ) / sizeof( POPUP_BUTTON_ITEMS[0] );
 
+const char * const CUSTOM_POPUP_STYLE_NAME = "CustomPopupStyle"; ///< Custom popup style name
 }  // anonymous namespace
 
 
@@ -110,17 +113,13 @@ public:
   void Create( Application& application )
   {
     // The Init signal is received once (only) during the Application lifetime
-    Stage stage = Stage::GetCurrent();
+    Window window = application.GetWindow();
 
     // Respond to key events if not handled
-    Toolkit::KeyInputFocusManager keyInputFocusManager = Toolkit::KeyInputFocusManager::Get();
-    if( keyInputFocusManager )
-    {
-      keyInputFocusManager.UnhandledKeyEventSignal().Connect( this, &PopupExample::OnKeyEvent );
-    }
+    window.KeyEventSignal().Connect( this, &PopupExample::OnKeyEvent );
 
     // Creates a default view with a default tool bar.
-    // The view is added to the stage.
+    // The view is added to the window.
     mContentLayer = DemoHelper::CreateView( application,
                                             mView,
                                             mToolBar,
@@ -137,49 +136,49 @@ public:
 
     // Create animation button.
     mAnimationButton = Toolkit::PushButton::New();
-    mAnimationButton.SetUnselectedImage( ANIMATION_FADE_ICON_IMAGE );
-    mAnimationButton.SetSelectedImage( ANIMATION_ZOOM_ICON_IMAGE );
-    mAnimationButton.SetTogglableButton( true );
+    mAnimationButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, ANIMATION_FADE_ICON_IMAGE );
+    mAnimationButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, ANIMATION_ZOOM_ICON_IMAGE );
+    mAnimationButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true );
     mAnimationButton.ClickedSignal().Connect( this, &PopupExample::OnAnimationClicked );
     mToolBar.AddControl( mAnimationButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );
 
     // Create context button.
     mContextButton = Toolkit::PushButton::New();
-    mContextButton.SetUnselectedImage( CONTEXT_DISABLED_ICON_IMAGE );
-    mContextButton.SetSelectedImage( CONTEXT_ENABLED_ICON_IMAGE );
-    mContextButton.SetTogglableButton( true );
+    mContextButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, CONTEXT_DISABLED_ICON_IMAGE );
+    mContextButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, CONTEXT_ENABLED_ICON_IMAGE );
+    mContextButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true );
     mContextButton.ClickedSignal().Connect( this, &PopupExample::OnContextClicked );
     mToolBar.AddControl( mContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );
 
     // Add title to the tool bar.
     mItemView = Toolkit::ItemView::New( *this );
-    mItemView.SetParentOrigin( ParentOrigin::CENTER );
-    mItemView.SetAnchorPoint( AnchorPoint::CENTER );
+    mItemView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+    mItemView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
     mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
     // Use a grid layout for tests
-    Vector2 stageSize = stage.GetSize();
+    Vector2 windowSize = window.GetSize();
     Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST );
     Vector3 itemSize;
-    gridLayout->GetItemSize( 0, Vector3( stageSize ), itemSize );
-    itemSize.height = stageSize.y / 10;
+    gridLayout->GetItemSize( 0, Vector3( windowSize ), itemSize );
+    itemSize.height = windowSize.y / 10;
     gridLayout->SetItemSize( itemSize );
     mItemView.AddLayout( *gridLayout );
 
-    mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
+    mItemView.ActivateLayout( 0, Vector3(windowSize.x, windowSize.y, windowSize.x), 0.0f );
 
     mContentLayer.Add( mItemView );
   }
 
   bool OnContextClicked( Toolkit::Button button )
   {
-    mContextual = button.IsSelected();
+    mContextual = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
     return true;
   }
 
   bool OnAnimationClicked( Toolkit::Button button )
   {
-    mAnimationFade = !button.IsSelected();
+    mAnimationFade = ! ( button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() );
     return true;
   }
 
@@ -196,28 +195,28 @@ public:
    */
   void SetupContextualResizePolicy( Toolkit::Popup& popup )
   {
-    Vector2 stageSize = Stage::GetCurrent().GetSize();
+    Vector2 windowSize = mApplication.GetWindow().GetSize();
     // Some defaults when creating a new fixed size.
     // This is NOT a Vector2 so we can modify each dimension in a for-loop.
-    float newSize[ Dimension::DIMENSION_COUNT ] = { stageSize.x * 0.75f, stageSize.y * 0.75f };
+    float newSize[ Dimension::DIMENSION_COUNT ] = { windowSize.x * 0.75f, windowSize.y * 0.75f };
     bool modifySize = false;
 
     // Loop through each of two dimensions to process them.
     for( unsigned int dimension = 0; dimension < 2; ++dimension )
     {
-      float stageDimensionSize, sizeModeFactor;
+      float windowDimensionSize, sizeModeFactor;
       Dimension::Type policyDimension = dimension == 0 ? Dimension::WIDTH : Dimension::HEIGHT;
 
       // Setup information related to the current dimension we are processing.
       if( policyDimension == Dimension::WIDTH )
       {
-        stageDimensionSize = stageSize.x;
-        sizeModeFactor = popup.GetSizeModeFactor().x;
+        windowDimensionSize = windowSize.x;
+        sizeModeFactor = popup.GetProperty< Vector3 >( Actor::Property::SIZE_MODE_FACTOR ).x;
       }
       else
       {
-        stageDimensionSize = stageSize.y;
-        sizeModeFactor = popup.GetSizeModeFactor().y;
+        windowDimensionSize = windowSize.y;
+        sizeModeFactor = popup.GetProperty< Vector3 >( Actor::Property::SIZE_MODE_FACTOR ).y;
       }
 
       bool modifyPolicy = false;
@@ -248,7 +247,7 @@ public:
         case ResizePolicy::FILL_TO_PARENT:
         {
           newPolicy = ResizePolicy::FIXED;
-          newSize[ dimension ] = stageDimensionSize;
+          newSize[ dimension ] = windowDimensionSize;
           modifyPolicy = true;
           break;
         }
@@ -256,7 +255,7 @@ public:
         case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
         {
           newPolicy = ResizePolicy::FIXED;
-          newSize[ dimension ] = stageDimensionSize * sizeModeFactor;
+          newSize[ dimension ] = windowDimensionSize * sizeModeFactor;
           modifyPolicy = true;
           break;
         }
@@ -264,7 +263,7 @@ public:
         case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
         {
           newPolicy = ResizePolicy::FIXED;
-          newSize[ dimension ] = stageDimensionSize + sizeModeFactor;
+          newSize[ dimension ] = windowDimensionSize + sizeModeFactor;
           modifyPolicy = true;
           break;
         }
@@ -281,7 +280,7 @@ public:
     if( modifySize )
     {
       // The size is set once at the end.
-      popup.SetSize( Vector2( newSize[ 0 ], newSize[ 1 ] ) );
+      popup.SetProperty( Actor::Property::SIZE, Vector2( newSize[ 0 ], newSize[ 1 ] ) );
     }
   }
 
@@ -307,7 +306,7 @@ public:
     }
     else
     {
-      Stage::GetCurrent().Add( popup );
+      mApplication.GetWindow().Add( popup );
     }
 
     mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
@@ -332,14 +331,14 @@ public:
 
   Toolkit::Popup CreatePopup()
   {
-    Stage stage = Stage::GetCurrent();
-    const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
+    Window window = mApplication.GetWindow();
+    const float POPUP_WIDTH_DP = window.GetSize().GetWidth() * 0.75f;
 
     Toolkit::Popup popup = Toolkit::Popup::New();
-    popup.SetName( "popup" );
-    popup.SetParentOrigin( ParentOrigin::CENTER );
-    popup.SetAnchorPoint( AnchorPoint::CENTER );
-    popup.SetSize( POPUP_WIDTH_DP, 0.0f );
+    popup.SetProperty( Dali::Actor::Property::NAME, "popup" );
+    popup.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+    popup.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+    popup.SetProperty( Actor::Property::SIZE, Vector2( POPUP_WIDTH_DP, 0.0f ) );
     popup.SetProperty( Toolkit::Popup::Property::TAIL_VISIBILITY, false );
 
     popup.OutsideTouchedSignal().Connect( this, &PopupExample::HidePopup );
@@ -351,38 +350,38 @@ public:
   Toolkit::Popup CreateConfirmationPopup( int numberOfButtons )
   {
     Toolkit::Popup confirmationPopup = Toolkit::Popup::New();
-    confirmationPopup.SetName( "MAIN-POPUP-SELF" );
+    confirmationPopup.SetProperty( Dali::Actor::Property::NAME, "MAIN-POPUP-SELF" );
 
     if( numberOfButtons > 0 )
     {
       // Start with a control area image.
       Toolkit::ImageView footer = Toolkit::ImageView::New( DEFAULT_CONTROL_AREA_IMAGE_PATH );
-      footer.SetName( "controlAreaImage" );
+      footer.SetProperty( Dali::Actor::Property::NAME, "controlAreaImage" );
       // Set up the container's layout.
       footer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
       footer.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
-      footer.SetSize( 0.0f, 80.0f );
-      footer.SetAnchorPoint( AnchorPoint::CENTER );
-      footer.SetParentOrigin( ParentOrigin::CENTER );
+      footer.SetProperty( Actor::Property::SIZE, Vector2( 0.0f, 130.0f ) );
+      footer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+      footer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
 
       Actor okButton = CreateOKButton();
-      okButton.SetParentOrigin( ParentOrigin::CENTER );
-      okButton.SetAnchorPoint( AnchorPoint::CENTER );
+      okButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+      okButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
       okButton.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
-      okButton.SetSizeModeFactor( Vector3( -20.0f, -20.0f, 0.0 ) );
+      okButton.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( -20.0f, -20.0f, 0.0 ) );
 
       if( numberOfButtons > 1 )
       {
         Toolkit::TableView controlLayout = Toolkit::TableView::New( 1, 2 );
-        controlLayout.SetParentOrigin( ParentOrigin::CENTER );
-        controlLayout.SetAnchorPoint( AnchorPoint::CENTER );
+        controlLayout.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+        controlLayout.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
         controlLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
         Actor cancelButton = CreateCancelButton();
-        cancelButton.SetParentOrigin( ParentOrigin::CENTER );
-        cancelButton.SetAnchorPoint( AnchorPoint::CENTER );
+        cancelButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+        cancelButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
         cancelButton.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
-        cancelButton.SetSizeModeFactor( Vector3( -20.0f, -20.0f, 0.0 ) );
+        cancelButton.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( -20.0f, -20.0f, 0.0 ) );
 
         controlLayout.SetCellPadding( Size( 10.0f, 10.0f ) );
 
@@ -412,7 +411,7 @@ public:
   Actor CreateTitle( std::string title )
   {
     Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( title );
-    titleActor.SetName( "titleActor" );
+    titleActor.SetProperty( Dali::Actor::Property::NAME, "titleActor" );
     titleActor.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
     titleActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
     titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
@@ -423,8 +422,8 @@ public:
   Toolkit::PushButton CreateOKButton()
   {
     Toolkit::PushButton okayButton = Toolkit::PushButton::New();
-    okayButton.SetName( POPUP_CONTROL_OK_NAME );
-    okayButton.SetLabelText( "OK!" );
+    okayButton.SetProperty( Dali::Actor::Property::NAME, POPUP_CONTROL_OK_NAME );
+    okayButton.SetProperty( Toolkit::Button::Property::LABEL, "OK!" );
 
     okayButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked );
 
@@ -434,8 +433,8 @@ public:
   Toolkit::PushButton CreateCancelButton()
   {
     Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
-    cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME );
-    cancelButton.SetLabelText( "Cancel" );
+    cancelButton.SetProperty( Dali::Actor::Property::NAME, POPUP_CONTROL_CANCEL_NAME );
+    cancelButton.SetProperty( Toolkit::Button::Property::LABEL, "Cancel" );
 
     cancelButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked );
 
@@ -452,28 +451,28 @@ public:
   bool OnButtonClicked( Toolkit::Button button )
   {
     // Handle menu items that create popups.
-    if( button.GetName() == POPUP_BUTTON_TITLE_ID )
+    if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_TITLE_ID )
     {
       mPopup = CreatePopup();
       mPopup.SetTitle( CreateTitle( "Popup!" ) );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_BUTTONS_1_ID )
     {
       mPopup = CreateConfirmationPopup( 1 );
       mPopup.SetTitle( CreateTitle( "Title" ) );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_BUTTONS_2_ID )
     {
       mPopup = CreateConfirmationPopup( 2 );
       mPopup.SetTitle( CreateTitle( "Title" ) );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_TOAST_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_TOAST_ID )
     {
       // Create a toast popup via the type registry (as it is a named-type).
       TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "PopupToast" );
@@ -485,123 +484,123 @@ public:
           mPopup = Toolkit::Popup::DownCast( baseHandle );
           mPopup.SetTitle( CreateTitle( "This is a Toast Popup.\nIt will auto-hide itself" ) );
 
-          Stage::GetCurrent().Add( mPopup );
+          mApplication.GetWindow().Add( mPopup );
           mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
         }
       }
     }
-    else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_BUTTONS_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_TITLE_CONTENT_BUTTONS_ID )
     {
       mPopup = CreateConfirmationPopup( 2 );
       mPopup.SetTitle( CreateTitle( "Erase image" ) );
 
       Toolkit::TextLabel text = Toolkit::TextLabel::New( "This will erase the image permanently. Are you sure?" );
-      text.SetName( "POPUP_CONTENT_TEXT" );
+      text.SetProperty( Dali::Actor::Property::NAME, "POPUP_CONTENT_TEXT" );
       text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
       text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
       text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
       text.SetProperty( TextLabel::Property::MULTI_LINE, true );
-      text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
+      text.SetProperty( Actor::Property::PADDING, Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
       mPopup.SetContent( text );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_TEXT_ID )
     {
       mPopup = CreatePopup();
 
       TextLabel text = TextLabel::New( CONTENT_TEXT );
-      text.SetName( "POPUP_CONTENT_TEXT" );
+      text.SetProperty( Dali::Actor::Property::NAME, "POPUP_CONTENT_TEXT" );
       text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
       text.SetProperty( TextLabel::Property::MULTI_LINE, true );
       text.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
       text.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
       text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
       text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
-      text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+      text.SetProperty( Actor::Property::PADDING, Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
 
       mPopup.Add( text );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_ID )
     {
       mPopup = CreatePopup();
       Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE2 );
       image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
       image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
-      image.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+      image.SetProperty( Actor::Property::PADDING, Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
 
       mPopup.Add( image );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
     {
       mPopup = CreatePopup();
       mPopup.SetTitle( CreateTitle( "Popup!" ) );
 
       Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
-      text.SetName( "POPUP_CONTENT_TEXT" );
+      text.SetProperty( Dali::Actor::Property::NAME, "POPUP_CONTENT_TEXT" );
       text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
       text.SetProperty( TextLabel::Property::MULTI_LINE, true );
       text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
       text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
-      text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+      text.SetProperty( Actor::Property::PADDING, Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
 
       mPopup.Add( text );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_FIXED_SIZE_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_FIXED_SIZE_ID )
     {
       mPopup = CreatePopup();
       mPopup.SetTitle( CreateTitle( "Popup!" ) );
 
       Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed size popup" );
-      text.SetName( "POPUP_CONTENT_TEXT" );
+      text.SetProperty( Dali::Actor::Property::NAME, "POPUP_CONTENT_TEXT" );
       text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
       text.SetProperty( TextLabel::Property::MULTI_LINE, true );
-      text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
+      text.SetProperty( Actor::Property::PADDING, Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
 
       mPopup.Add( text );
 
       // Fix the popup's size.
-      mPopup.SetSize( 240.0f, 400.0f );
+      mPopup.SetProperty( Actor::Property::SIZE, Vector2( 240.0f, 400.0f ) );
       mPopup.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID )
     {
       mPopup = CreateConfirmationPopup( 2 );
       mPopup.SetTitle( CreateTitle( "Popup!" ) );
 
       Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
-      text.SetName( "POPUP_CONTENT_TEXT" );
+      text.SetProperty( Dali::Actor::Property::NAME, "POPUP_CONTENT_TEXT" );
       text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
       text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
       text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
       text.SetProperty( TextLabel::Property::MULTI_LINE, true );
-      text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
+      text.SetProperty( Actor::Property::PADDING, Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
 
       mPopup.Add( text );
 
       SetupPopup( mPopup, button );
     }
-    else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_COMPLEX_ID )
     {
       mPopup = CreateConfirmationPopup( 2 );
       mPopup.SetTitle( CreateTitle( "Warning" ) );
 
       // Content
       Toolkit::TableView content = Toolkit::TableView::New( 2, 2 );
-      content.SetName( "COMPLEX_TABLEVIEW" );
+      content.SetProperty( Dali::Actor::Property::NAME, "COMPLEX_TABLEVIEW" );
       content.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
       content.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
       content.SetFitHeight( 0 );
       content.SetFitHeight( 1 );
-      content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
+      content.SetProperty( Actor::Property::PADDING, Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
 
       // Text
       {
@@ -617,10 +616,10 @@ public:
       // Image
       {
         Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE1 );
-        image.SetName( "COMPLEX_IMAGE" );
+        image.SetProperty( Dali::Actor::Property::NAME, "COMPLEX_IMAGE" );
         image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
         image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
-        image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
+        image.SetProperty( Actor::Property::PADDING, Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
         content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
       }
 
@@ -631,16 +630,16 @@ public:
         root.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
         root.SetFitHeight( 0 );
         root.SetFitWidth( 0 );
-        root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) );
+        root.SetProperty( Actor::Property::PADDING, Padding( 0.0f, 0.0f, 0.0f, 20.0f ) );
 
         Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
-        checkBox.SetSize( 48, 48 );
+        checkBox.SetProperty( Actor::Property::SIZE, Vector2( 48, 48 ) );
         root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
 
         Toolkit::TextLabel text = Toolkit::TextLabel::New( "Don't show again" );
         text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
         Actor textActor = text;
-        textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
+        textActor.SetProperty( Actor::Property::PADDING, Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
 
         root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
 
@@ -651,13 +650,28 @@ public:
 
       SetupPopup( mPopup, button );
     }
+    else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CUSTOM_STYLE )
+    {
+      mPopup = CreateConfirmationPopup( 2 );
+
+      Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( "Styled Popup" );
+      titleActor.SetProperty( Dali::Actor::Property::NAME, "titleActor" );
+      titleActor.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::RED );
+      titleActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
+      titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+      mPopup.SetTitle( titleActor );
+
+      SetupPopup( mPopup, button );
+
+      mPopup.SetStyleName( CUSTOM_POPUP_STYLE_NAME );
+    }
 
     return true;
   }
 
   void OnKeyEvent( const KeyEvent& event )
   {
-    if( event.state == KeyEvent::Down )
+    if( event.GetState() == KeyEvent::DOWN )
     {
       if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
       {
@@ -688,8 +702,8 @@ public: // From ItemFactory
   virtual Actor NewItem(unsigned int itemId)
   {
     Toolkit::PushButton popupButton = Toolkit::PushButton::New();
-    popupButton.SetName( POPUP_BUTTON_ITEMS[ itemId ].name );
-    popupButton.SetLabelText( POPUP_BUTTON_ITEMS[ itemId ].text );
+    popupButton.SetProperty( Dali::Actor::Property::NAME, POPUP_BUTTON_ITEMS[ itemId ].name );
+    popupButton.SetProperty( Toolkit::Button::Property::LABEL, POPUP_BUTTON_ITEMS[ itemId ].text );
     popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
 
     popupButton.ClickedSignal().Connect( this, &PopupExample::OnButtonClicked );
@@ -712,30 +726,16 @@ private:
   bool                mContextual;                 ///< True if currently using the contextual popup mode.
   bool                mAnimationFade;              ///< True if currently using the fade animation.
 
-  ResourceImage       mContextButtonDisabledImage; ///< The disabled context button icon.
-  ResourceImage       mContextButtonEnabledImage;  ///< The enabled context button icon.
-  ResourceImage       mAnimationButtonZoomImage;   ///< The zoom animation button icon.
-  ResourceImage       mAnimationButtonFadeImage;   ///< The fade animation button icon.
-
   Toolkit::Popup      mPopup;                       ///< The current example popup.
 
   Toolkit::ItemView   mItemView;                    ///< ItemView to hold test images
 
 };
 
-void RunTest( Application& application )
-{
-  PopupExample test( application );
-
-  application.MainLoop();
-}
-
-// Entry point for Linux & SLP applications
 int DALI_EXPORT_API main( int argc, char **argv )
 {
   Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
-
-  RunTest( application );
-
+  PopupExample test( application );
+  application.MainLoop();
   return 0;
 }