Changes following Allow background property to be set as a URL string
[platform/core/uifw/dali-demo.git] / examples / popup / popup-example.cpp
index 4582f81..1068656 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -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
 
 
@@ -651,6 +654,21 @@ public:
 
       SetupPopup( mPopup, button );
     }
+    else if( button.GetName() == POPUP_BUTTON_CUSTOM_STYLE )
+    {
+      mPopup = CreateConfirmationPopup( 2 );
+
+      Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( "Styled Popup" );
+      titleActor.SetName( "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;
   }
@@ -712,11 +730,6 @@ 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
@@ -731,7 +744,7 @@ void RunTest( Application& application )
 }
 
 // Entry point for Linux & SLP applications
-int main( int argc, char **argv )
+int DALI_EXPORT_API main( int argc, char **argv )
 {
   Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );