Commit ac7bf7c5e975fdc70fd2397bd5ca0e34a7eb15bc
1 parent
f0f39a74
Added a custom style to the popup example
Change-Id: I60fde090b81f314c68064081effff331c3216128
Showing
8 changed files
with
37 additions
and
2 deletions
examples/popup/popup-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2016 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. |
| ... | ... | @@ -55,6 +55,7 @@ const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_ID = "POPUP_BUTTON_TITLE_CONTE |
| 55 | 55 | const char* const POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID = "POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS"; |
| 56 | 56 | const char* const POPUP_BUTTON_FIXED_SIZE_ID = "POPUP_BUTTON_FIXED_SIZE_ID"; |
| 57 | 57 | const char* const POPUP_BUTTON_COMPLEX_ID = "POPUP_BUTTON_COMPLEX"; |
| 58 | +const char* const POPUP_BUTTON_CUSTOM_STYLE = "POPUP_BUTTON_CUSTOM_STYLE"; | |
| 58 | 59 | |
| 59 | 60 | // Names to give Popup PushButton controls. |
| 60 | 61 | const char* const POPUP_CONTROL_OK_NAME = "controlOk"; |
| ... | ... | @@ -78,11 +79,13 @@ const ButtonItem POPUP_BUTTON_ITEMS[] = { |
| 78 | 79 | { POPUP_BUTTON_CONTENT_TEXT_ID, "Content Text" }, |
| 79 | 80 | { POPUP_BUTTON_CONTENT_IMAGE_ID, "Content Image" }, |
| 80 | 81 | { POPUP_BUTTON_TITLE_CONTENT_TEXT_ID, "Title + Content" }, |
| 81 | - { POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID, "Title + Large Content + Buttons" } | |
| 82 | + { POPUP_BUTTON_TITLE_LARGE_CONTENT_BUTTONS_ID, "Title + Large Content + Buttons" }, | |
| 83 | + { POPUP_BUTTON_CUSTOM_STYLE, "Custom Styled Popup" } | |
| 82 | 84 | }; |
| 83 | 85 | |
| 84 | 86 | const int POPUP_BUTTON_ITEMS_COUNT = sizeof( POPUP_BUTTON_ITEMS ) / sizeof( POPUP_BUTTON_ITEMS[0] ); |
| 85 | 87 | |
| 88 | +const char * const CUSTOM_POPUP_STYLE_NAME = "CustomPopupStyle"; ///< Custom popup style name | |
| 86 | 89 | } // anonymous namespace |
| 87 | 90 | |
| 88 | 91 | |
| ... | ... | @@ -651,6 +654,21 @@ public: |
| 651 | 654 | |
| 652 | 655 | SetupPopup( mPopup, button ); |
| 653 | 656 | } |
| 657 | + else if( button.GetName() == POPUP_BUTTON_CUSTOM_STYLE ) | |
| 658 | + { | |
| 659 | + mPopup = CreateConfirmationPopup( 2 ); | |
| 660 | + | |
| 661 | + Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( "Styled Popup" ); | |
| 662 | + titleActor.SetName( "titleActor" ); | |
| 663 | + titleActor.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::RED ); | |
| 664 | + titleActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true ); | |
| 665 | + titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | |
| 666 | + mPopup.SetTitle( titleActor ); | |
| 667 | + | |
| 668 | + SetupPopup( mPopup, button ); | |
| 669 | + | |
| 670 | + mPopup.SetStyleName( CUSTOM_POPUP_STYLE_NAME ); | |
| 671 | + } | |
| 654 | 672 | |
| 655 | 673 | return true; |
| 656 | 674 | } | ... | ... |
resources/images/popup-tail-down.png
0 โ 100644
19.6 KB
resources/images/popup-tail-left.png
0 โ 100644
19.1 KB
resources/images/popup-tail-right.png
0 โ 100644
19.2 KB
resources/images/popup-tail-up.png
0 โ 100644
19.2 KB
resources/images/popup.9.png
0 โ 100644
3.64 KB
resources/style/demo-theme.json.in
| ... | ... | @@ -21,6 +21,15 @@ |
| 21 | 21 | "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/00_popup_bg.9.png" |
| 22 | 22 | }, |
| 23 | 23 | |
| 24 | + "CustomPopupStyle":{ | |
| 25 | + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/popup.9.png", | |
| 26 | + "popupBackgroundBorder":[0,4,4,0], | |
| 27 | + "tailUpImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-up.png", | |
| 28 | + "tailDownImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-down.png", | |
| 29 | + "tailLeftImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-left.png", | |
| 30 | + "tailRightImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-right.png" | |
| 31 | + }, | |
| 32 | + | |
| 24 | 33 | "TextLabelRosemary": |
| 25 | 34 | { |
| 26 | 35 | "fontFamily":"Rosemary" | ... | ... |
resources/style/mobile/demo-theme.json.in
| ... | ... | @@ -18,6 +18,14 @@ |
| 18 | 18 | { |
| 19 | 19 | "styles": |
| 20 | 20 | { |
| 21 | + "CustomPopupStyle":{ | |
| 22 | + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/popup.9.png", | |
| 23 | + "popupBackgroundBorder":[0,4,4,0], | |
| 24 | + "tailUpImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-up.png", | |
| 25 | + "tailDownImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-down.png", | |
| 26 | + "tailLeftImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-left.png", | |
| 27 | + "tailRightImage":"{APPLICATION_RESOURCE_PATH}/images/popup-tail-right.png" | |
| 28 | + }, | |
| 21 | 29 | "TextLabelRosemary": |
| 22 | 30 | { |
| 23 | 31 | "fontFamily":"Rosemary" | ... | ... |