From: Adeel Kazmi Date: Wed, 23 Nov 2016 16:27:27 +0000 (+0000) Subject: Added a custom style to the popup example X-Git-Tag: dali_1.2.16~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F99690%2F2;p=platform%2Fcore%2Fuifw%2Fdali-demo.git Added a custom style to the popup example Change-Id: I60fde090b81f314c68064081effff331c3216128 --- diff --git a/examples/popup/popup-example.cpp b/examples/popup/popup-example.cpp index b79bccc..1068656 100644 --- a/examples/popup/popup-example.cpp +++ b/examples/popup/popup-example.cpp @@ -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; } diff --git a/resources/images/popup-tail-down.png b/resources/images/popup-tail-down.png new file mode 100644 index 0000000..2d60fce Binary files /dev/null and b/resources/images/popup-tail-down.png differ diff --git a/resources/images/popup-tail-left.png b/resources/images/popup-tail-left.png new file mode 100644 index 0000000..12dfd99 Binary files /dev/null and b/resources/images/popup-tail-left.png differ diff --git a/resources/images/popup-tail-right.png b/resources/images/popup-tail-right.png new file mode 100644 index 0000000..26aca93 Binary files /dev/null and b/resources/images/popup-tail-right.png differ diff --git a/resources/images/popup-tail-up.png b/resources/images/popup-tail-up.png new file mode 100644 index 0000000..b600b6b Binary files /dev/null and b/resources/images/popup-tail-up.png differ diff --git a/resources/images/popup.9.png b/resources/images/popup.9.png new file mode 100644 index 0000000..3f6875f Binary files /dev/null and b/resources/images/popup.9.png differ diff --git a/resources/style/demo-theme.json.in b/resources/style/demo-theme.json.in index f9c0d99..95b562a 100644 --- a/resources/style/demo-theme.json.in +++ b/resources/style/demo-theme.json.in @@ -21,6 +21,15 @@ "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/00_popup_bg.9.png" }, + "CustomPopupStyle":{ + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/popup.9.png", + "popupBackgroundBorder":[0,4,4,0], + "tailUpImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-up.png", + "tailDownImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-down.png", + "tailLeftImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-left.png", + "tailRightImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-right.png" + }, + "TextLabelRosemary": { "fontFamily":"Rosemary" diff --git a/resources/style/mobile/demo-theme.json.in b/resources/style/mobile/demo-theme.json.in index f42198e..644814f 100644 --- a/resources/style/mobile/demo-theme.json.in +++ b/resources/style/mobile/demo-theme.json.in @@ -18,6 +18,14 @@ { "styles": { + "CustomPopupStyle":{ + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/popup.9.png", + "popupBackgroundBorder":[0,4,4,0], + "tailUpImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-up.png", + "tailDownImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-down.png", + "tailLeftImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-left.png", + "tailRightImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-right.png" + }, "TextLabelRosemary": { "fontFamily":"Rosemary"