/*
- * Copyright (c) 2014 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.
#include "shared/view.h"
#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>
using namespace Dali;
using Dali::Toolkit::TextLabel;
-// Define this so that it is interchangeable
-// "DP" stands for Device independent Pixels
-#define DP(x) DemoHelper::ScalePointSize(x)
-
struct ButtonItem
{
const char* name;
const char* text;
};
-
namespace
{
-const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "background-gradient.jpg";
-const char* const TOOLBAR_IMAGE = DALI_IMAGE_DIR "top-bar.png";
+const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-gradient.jpg";
+const char* const TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png";
+const char* const IMAGE = DEMO_IMAGE_DIR "background-magnifier.jpg";
const char* const TOOLBAR_TITLE = "Negotiate Size";
-const int TOOLBAR_HEIGHT = 62;
-
-const char* MENU_ICON_IMAGE = DALI_IMAGE_DIR "icon-cluster-none.png";
-
-const char* const PUSHBUTTON_BUTTON_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
-const char* const PUSHBUTTON_PRESS_IMAGE = DALI_IMAGE_DIR "button-down.9.png";
-
-const char* const POPUPS_MENU_ID = "POPUPS_MENU";
-const char* const TABLEVIEW_MENU_ID = "TABLEVIEW_MENU";
-const char* const POPUP_BUTTON_EMPTY_ID = "POPUP_BUTTON_EMPTY";
-const char* const POPUP_BUTTON_TITLE_ID = "POPUP_BUTTON_TITLE";
-const char* const POPUP_BUTTON_BUTTONS_1_ID = "POPUP_BUTTON_BUTTONS_1";
-const char* const POPUP_BUTTON_BUTTONS_2_ID = "POPUP_BUTTON_BUTTONS_2";
-const char* const POPUP_BUTTON_TITLE_BUTTONS_ID = "POPUP_BUTTON_TITLE_BUTTONS";
-const char* const POPUP_BUTTON_CONTENT_TEXT_ID = "POPUP_BUTTON_CONTENT_TEXT";
-const char* const POPUP_BUTTON_CONTENT_IMAGE_ID = "POPUP_BUTTON_CONTENT_IMAGE";
-const char* const POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID = "POPUP_BUTTON_CONTENT_IMAGE_SCALE";
-const char* const POPUP_BUTTON_CONTENT_IMAGE_FIT_ID = "POPUP_BUTTON_CONTENT_IMAGE_FIT";
-const char* const POPUP_BUTTON_CONTENT_IMAGE_FILL_ID = "POPUP_BUTTON_CONTENT_IMAGE_FILL";
-const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT";
-const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS";
-const char* const POPUP_BUTTON_COMPLEX_ID = "POPUP_BUTTON_COMPLEX";
-
-const char* const TABLEVIEW_BUTTON_EMPTY_ID = "TABLEVIEW_BUTTON_EMPTY";
+// This example contains size negotiation tests for TableView and Popup.
const char* const TABLEVIEW_BUTTON_1CELL_ID = "TABLEVIEW_BUTTON_1CELL";
const char* const TABLEVIEW_BUTTON_3CELL_ID = "TABLEVIEW_BUTTON_3CELL";
const char* const TABLEVIEW_BUTTON_3X3CELL_ID = "TABLEVIEW_BUTTON_3X3CELL";
const char* const TABLEVIEW_BUTTON_NATURAL1_ID = "TABLEVIEW_BUTTON_NATURAL1";
const char* const TABLEVIEW_BUTTON_NATURAL2_ID = "TABLEVIEW_BUTTON_NATURAL2";
const char* const TABLEVIEW_BUTTON_NATURAL3_ID = "TABLEVIEW_BUTTON_NATURAL3";
-
-const char* const OKAY_BUTTON_ID = "OKAY_BUTTON";
-const char* const CANCEL_BUTTON_ID = "CANCEL_BUTTON";
-
-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.";
-const char* const IMAGE1 = DALI_IMAGE_DIR "gallery-medium-5.jpg";
-const char* const IMAGE2 = DALI_IMAGE_DIR "background-magnifier.jpg";
-const char* const CHECKBOX_UNCHECKED_IMAGE = DALI_IMAGE_DIR "checkbox-unselected.png";
-const char* const CHECKBOX_CHECKED_IMAGE = DALI_IMAGE_DIR "checkbox-selected.png";
-
-const ButtonItem MENU_ITEMS[] = {
- { POPUPS_MENU_ID, "Popups" },
- { TABLEVIEW_MENU_ID, "TableView" }
-};
-
-const unsigned int MENU_ITEMS_COUNT = sizeof( MENU_ITEMS ) / sizeof( MENU_ITEMS[0] );
-
-const ButtonItem POPUP_BUTTON_ITEMS[] = {
- { POPUP_BUTTON_COMPLEX_ID, "Complex" },
- { POPUP_BUTTON_EMPTY_ID, "Empty" },
- { POPUP_BUTTON_TITLE_ID, "Title" },
- { POPUP_BUTTON_BUTTONS_1_ID, "1 Button" },
- { POPUP_BUTTON_BUTTONS_2_ID, "2 Buttons" },
- { POPUP_BUTTON_TITLE_BUTTONS_ID, "Title & Buttons" },
- { POPUP_BUTTON_CONTENT_TEXT_ID, "Text" },
- { POPUP_BUTTON_CONTENT_IMAGE_ID, "Image" },
- { POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID, "Image Scale" },
- { POPUP_BUTTON_CONTENT_IMAGE_FIT_ID, "Image Fit" },
- { POPUP_BUTTON_CONTENT_IMAGE_FILL_ID, "Image Fill" },
- { POPUP_BUTTON_TITLE_CONTENT_TEXT_ID, "Title Text" },
- { POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID, "Title, text, buttons" }
-
-};
-
-const int POPUP_BUTTON_ITEMS_COUNT = sizeof( POPUP_BUTTON_ITEMS ) / sizeof( POPUP_BUTTON_ITEMS[0] );
+const char* const POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID = "POPUP_BUTTON_CONTENT_IMAGE_SCALE";
+const char* const POPUP_BUTTON_CONTENT_IMAGE_FIT_ID = "POPUP_BUTTON_CONTENT_IMAGE_FIT";
+const char* const POPUP_BUTTON_CONTENT_IMAGE_FILL_ID = "POPUP_BUTTON_CONTENT_IMAGE_FILL";
const ButtonItem TABLEVIEW_BUTTON_ITEMS[] = {
- { TABLEVIEW_BUTTON_EMPTY_ID, "Empty" },
{ TABLEVIEW_BUTTON_1CELL_ID, "1 Cell" },
{ TABLEVIEW_BUTTON_3CELL_ID, "3 Cell" },
{ TABLEVIEW_BUTTON_3X3CELL_ID, "3x3 Cells" },
{ TABLEVIEW_BUTTON_NATURAL1_ID, "Natural 1" },
{ TABLEVIEW_BUTTON_NATURAL2_ID, "Natural 2" },
{ TABLEVIEW_BUTTON_NATURAL3_ID, "Natural 3" },
+ { POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID, "Image Scale" },
+ { POPUP_BUTTON_CONTENT_IMAGE_FIT_ID, "Image Fit" },
+ { POPUP_BUTTON_CONTENT_IMAGE_FILL_ID, "Image Fill" },
};
const unsigned int TABLEVIEW_BUTTON_ITEMS_COUNT = sizeof( TABLEVIEW_BUTTON_ITEMS ) / sizeof( TABLEVIEW_BUTTON_ITEMS[0] );
-} // namespace
+Actor CreateSolidColor( Vector4 color )
+{
+ Toolkit::Control control = Toolkit::Control::New();
+
+ Property::Map map;
+ map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
+ map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
+ control.SetProperty( Toolkit::Control::Property::BACKGROUND, map );
+
+ return control;
+}
+
+} // anonymous namespace
/**
public:
SizeNegotiationController( Application& application )
- : mApplication( application ),
- mMenuShown( false ),
- mDemoState( POPUP )
+ : mApplication( application )
{
// Connect to the Application's Init signal
mApplication.InitSignal().Connect( this, &SizeNegotiationController::Create );
void Create( Application& application )
{
// The Init signal is received once (only) during the Application lifetime
-
- DemoHelper::RequestThemeChange();
-
Stage stage = Stage::GetCurrent();
- // Respond to key events
+ // Respond to key events if not handled
stage.KeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent);
// Creates a default view with a default tool bar.
std::string("") );
mTitleActor = DemoHelper::CreateToolBarLabel( "CUSTOM_TOOLBAR_TITLE" );
-
- SetTitle();
-
- // Create menu button
- Toolkit::PushButton viewButton = Toolkit::PushButton::New();
- viewButton.SetBackgroundImage( ResourceImage::New( MENU_ICON_IMAGE ) );
- viewButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenu );
- mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
+ mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, TOOLBAR_TITLE );
// Add title to the tool bar.
const float padding( DemoHelper::DEFAULT_VIEW_STYLE.mToolBarPadding );
mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
// Use a grid layout for tests
- Toolkit::GridLayoutPtr gridLayout = Toolkit::GridLayout::New();
- gridLayout->SetNumberOfColumns( 2 );
- gridLayout->SetTopMargin( DP(TOOLBAR_HEIGHT) + DP(20.0f) );
- gridLayout->SetBottomMargin( DP(100.0f) );
- gridLayout->SetRowSpacing( DP(20.0f) );
- mItemView.AddLayout( *gridLayout );
-
Vector2 stageSize = stage.GetSize();
- float layoutWidth = Toolkit::IsHorizontal( gridLayout->GetOrientation() ) ? stageSize.height : stageSize.width;
- float gridItemSize = ( layoutWidth / gridLayout->GetNumberOfColumns() ) * 0.5f;
- gridLayout->SetScrollSpeedFactor( gridLayout->GetNumberOfColumns() / gridItemSize * 0.5f );
+ Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST );
+ Vector3 itemSize;
+ gridLayout->GetItemSize( 0, Vector3( stageSize ), itemSize );
+ itemSize.height = stageSize.y / 10;
+ gridLayout->SetItemSize( itemSize );
+ mItemView.AddLayout( *gridLayout );
mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
mContentLayer.Add( mItemView );
}
- void SetTitle()
+ void StagePopup( Toolkit::Popup popup )
{
- std::string subTitle = "";
-
- switch( mDemoState )
- {
- case POPUP:
- {
- subTitle = "Popups";
- break;
- }
-
- case TABLEVIEW:
- {
- subTitle = "TableView";
- break;
- }
-
- default:
- {
- break;
- }
- }
-
- mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, std::string( std::string( TOOLBAR_TITLE ) + ": " + subTitle ) );
- }
-
- bool OnMenu( Toolkit::Button button )
- {
- ShowMenu();
- return true;
+ Stage::GetCurrent().Add( popup );
+ popup.SetDisplayState( Toolkit::Popup::SHOWN );
}
- void ShowMenu()
- {
- Stage stage = Stage::GetCurrent();
- const float popupWidth = stage.GetSize().x * 0.5f;
-
- mMenu = Toolkit::Popup::New();
- mMenu.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mMenu.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mMenu.HideTail();
- mMenu.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::HideMenu );
- mMenu.SetSize( popupWidth, 0.0f );
- mMenu.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
-
- Toolkit::TableView tableView = Toolkit::TableView::New( 0, 0 );
- tableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
- tableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
- mMenu.Add( tableView );
-
- for( unsigned int i = 0; i < MENU_ITEMS_COUNT; ++i )
- {
- Toolkit::PushButton menuButton = Toolkit::PushButton::New();
- menuButton.SetName( MENU_ITEMS[ i ].name );
- menuButton.SetLabel( MENU_ITEMS[ i ].text );
- menuButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenuSelect );
-
- tableView.Add( menuButton );
- tableView.SetFitHeight( i );
- }
-
- // Show the menu
- mMenu.Show();
- mMenuShown = true;
- }
-
- void HideMenu()
+ void OnPopupOutsideTouched()
{
- if( mMenu )
+ if( mPopup )
{
- mMenu.Hide();
- mMenu.Reset();
+ mPopup.SetDisplayState( Toolkit::Popup::HIDDEN );
}
-
- mMenuShown = false;
}
- bool OnMenuSelect( Toolkit::Button button )
+ void PopupHidden()
{
- bool refresh = false;
-
- if( button.GetName() == POPUPS_MENU_ID )
- {
- if( mDemoState != POPUP )
- {
- refresh = true;
- mDemoState = POPUP;
- }
- }
- else if( button.GetName() == TABLEVIEW_MENU_ID )
- {
- if( mDemoState != TABLEVIEW )
- {
- refresh = true;
- mDemoState = TABLEVIEW;
- }
- }
-
- if( refresh )
+ if( mPopup )
{
- SetTitle();
-
- mItemView.Refresh();
+ mPopup.Unparent();
+ mPopup.Reset();
}
-
- HideMenu();
- return true;
}
Toolkit::Popup CreatePopup()
const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
Toolkit::Popup popup = Toolkit::Popup::New();
- popup.SetName( "POPUP" );
+ popup.SetName( "popup" );
popup.SetParentOrigin( ParentOrigin::CENTER );
popup.SetAnchorPoint( AnchorPoint::CENTER );
popup.SetSize( POPUP_WIDTH_DP, 0.0f );
- popup.HideTail();
+ popup.SetProperty( Toolkit::Popup::Property::TAIL_VISIBILITY, false );
popup.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::OnPopupOutsideTouched );
+ popup.HiddenSignal().Connect( this, &SizeNegotiationController::PopupHidden );
return popup;
}
bool OnButtonClicked( Toolkit::Button button )
{
- if( button.GetName() == POPUP_BUTTON_EMPTY_ID )
- {
- mPopup = CreatePopup();
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_TITLE_ID )
- {
- mPopup = CreatePopup();
- mPopup.SetTitle( "Popup!" );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID )
- {
- mPopup = CreatePopup();
-
- Toolkit::PushButton okayButton = Toolkit::PushButton::New();
- okayButton.SetName( OKAY_BUTTON_ID );
- okayButton.SetLabel( "OK!" );
- okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( okayButton );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID )
- {
- mPopup = CreatePopup();
-
- Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
- cancelButton.SetName( CANCEL_BUTTON_ID );
- cancelButton.SetLabel( "Cancel" );
- cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( cancelButton );
-
- Toolkit::PushButton okayButton = Toolkit::PushButton::New();
- okayButton.SetName( OKAY_BUTTON_ID );
- okayButton.SetLabel( "OK!" );
- okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( okayButton );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID )
- {
- mPopup = CreatePopup();
- mPopup.SetTitle( "Popup!" );
-
- Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
- cancelButton.SetName( CANCEL_BUTTON_ID );
- cancelButton.SetLabel( "Cancel" );
- cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( cancelButton );
-
- Toolkit::PushButton okayButton = Toolkit::PushButton::New();
- okayButton.SetName( OKAY_BUTTON_ID );
- okayButton.SetLabel( "OK!" );
- okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( okayButton );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID )
- {
- mPopup = CreatePopup();
-
- TextLabel text = TextLabel::New( CONTENT_TEXT );
- text.SetName( "POPUP_CONTENT_TEXT" );
- 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 ) );
-
- mPopup.Add( text );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID )
- {
- mPopup = CreatePopup();
-
- ImageActor image = ImageActor::New( ResourceImage::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 ) );
-
- mPopup.Add( image );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
- {
- mPopup = CreatePopup();
-
- mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
- mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
- ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
- image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- mPopup.Add( image );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
- {
- mPopup = CreatePopup();
-
- mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
- mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
- ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
- image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- image.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
-
- mPopup.Add( image );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
- {
- mPopup = CreatePopup();
-
- mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
- mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
- ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
- image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- image.SetSizeScalePolicy( SizeScalePolicy::FILL_WITH_ASPECT_RATIO );
-
- mPopup.Add( image );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
- {
- mPopup = CreatePopup();
- mPopup.SetTitle( "Popup!" );
-
- Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
- text.SetName( "POPUP_CONTENT_TEXT" );
- 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 ) );
-
- mPopup.Add( text );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID )
- {
- mPopup = CreatePopup();
- mPopup.SetTitle( "Popup!" );
-
- Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT );
- text.SetName( "POPUP_CONTENT_TEXT" );
- 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( 10.0f, 10.0f, 20.0f, 0.0f ) );
-
- mPopup.Add( text );
-
- Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
- cancelButton.SetName( CANCEL_BUTTON_ID );
- cancelButton.SetLabel( "Cancel" );
- cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( cancelButton );
-
- Toolkit::PushButton okayButton = Toolkit::PushButton::New();
- okayButton.SetName( OKAY_BUTTON_ID );
- okayButton.SetLabel( "OK!" );
- okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( okayButton );
-
- mPopup.Show();
- }
- else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
- {
- mPopup = CreatePopup();
- mPopup.SetTitle( "Warning" );
-
- // Content
- Toolkit::TableView content = Toolkit::TableView::New( 2, 2 );
- content.SetName( "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 ) );
-
- // Text
- {
- Toolkit::TextLabel text = Toolkit::TextLabel::New( "Do you really want to quit?" );
- text.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
- text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
- text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
-
- content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
- }
-
- // Image
- {
- ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) );
- image.SetName( "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 ) );
- content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
- }
-
- // Text 2
- {
- Toolkit::TableView root = Toolkit::TableView::New( 1, 2 );
- root.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
- 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 ) );
-
- Dali::Image unchecked = Dali::ResourceImage::New( CHECKBOX_UNCHECKED_IMAGE );
- Dali::Image checked = Dali::ResourceImage::New( CHECKBOX_CHECKED_IMAGE );
- Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
- checkBox.SetBackgroundImage( unchecked );
- checkBox.SetSelectedImage( checked );
- checkBox.SetSize( 48, 48 );
-
- root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
-
- Toolkit::TextLabel text = Toolkit::TextLabel::New( "Don't show again" );
- Actor textActor = text;
- textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
-
- root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
-
- content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0 ) );
- }
-
- mPopup.Add( content );
-
- // Buttons
- Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
- cancelButton.SetName( CANCEL_BUTTON_ID );
- cancelButton.SetLabel( "Cancel" );
- cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( cancelButton );
-
- Toolkit::PushButton okayButton = Toolkit::PushButton::New();
- okayButton.SetName( OKAY_BUTTON_ID );
- okayButton.SetLabel( "OK!" );
- okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- mPopup.AddButton( okayButton );
-
- mPopup.Show();
- }
- else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID )
+ if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
{
mPopup = CreatePopup();
mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
- Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
- table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- mPopup.Add( table );
-
- mPopup.Show();
- }
- else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
- {
- mPopup = CreatePopup();
- mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
- mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
-
Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
table.SetName( "TABLEVIEW_BUTTON_1CELL_ID" );
table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID )
{
mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
- Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
+ Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- table.Add( backing );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- table.Add( backing );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- table.Add( backing );
+ table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) );
}
- mPopup.Add( table );
+ mPopup.SetContent( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID )
{
mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
Toolkit::TableView table = Toolkit::TableView::New( 3, 3 );
table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
// Column 0
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) );
}
// Column 1
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 1 ) );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 1 ) );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 1.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 0.0f, 1.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 1 ) );
}
// Column 2
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 2 ) );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.5f, 0.5f, 0.5f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.5f, 0.5f, 0.5f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 2 ) );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.5f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.5f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 2 ) );
}
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID )
{
mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.SetFixedHeight( 0, 50.0f );
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID )
{
mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.SetFixedHeight( 0, 50.0f );
table.SetFixedHeight( 2, 50.0f );
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID )
{
mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
-
Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.SetFitHeight( 0 );
table.SetFitHeight( 2 );
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetSize( 0.0f, 100.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetSize( 0.0f, 100.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID )
{
table.SetFitHeight( 1 );
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetSize( 0.0f, 200.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID )
{
table.SetFitHeight( 2 );
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetSize( 0.0f, 100.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetSize( 0.0f, 200.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetSize( 0.0f, 300.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID )
{
table.SetFitHeight( 1 );
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
backing.SetSize( 0.0f, 100.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetSize( 0.0f, 200.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID )
{
table.SetFitHeight( 1 );
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
{
- Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
+ Actor backing = CreateSolidColor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
backing.SetSize( 0.0f, 200.0f );
Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
+ text.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
text.SetAnchorPoint( AnchorPoint::CENTER );
text.SetParentOrigin( ParentOrigin::CENTER );
text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
table.Add( backing );
}
-
mPopup.Add( table );
- mPopup.Show();
+ StagePopup( mPopup );
}
- else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID )
+ else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
{
- if( mPopup )
- {
- mPopup.Hide();
- }
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+ Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE );
+ image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+ mPopup.Add( image );
+
+ StagePopup( mPopup );
}
+ else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
+ {
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
- return true;
- }
+ Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE );
+ image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ image.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
- void OnPopupOutsideTouched()
- {
- if( mPopup )
+ mPopup.Add( image );
+
+ StagePopup( mPopup );
+ }
+ else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
{
- mPopup.Hide();
+ mPopup = CreatePopup();
+ mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
+
+ Toolkit::ImageView image = Toolkit::ImageView::New( IMAGE );
+ image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ image.SetSizeScalePolicy( SizeScalePolicy::FILL_WITH_ASPECT_RATIO );
+
+ mPopup.Add( image );
+
+ StagePopup( mPopup );
}
+
+ return true;
}
void OnKeyEvent( const KeyEvent& event )
*/
virtual unsigned int GetNumberOfItems()
{
- switch( mDemoState )
- {
- case POPUP:
- {
- return POPUP_BUTTON_ITEMS_COUNT;
- }
-
- case TABLEVIEW:
- {
- return TABLEVIEW_BUTTON_ITEMS_COUNT;
- }
-
- default:
- {
- break;
- }
- }
-
- return 0;
+ return TABLEVIEW_BUTTON_ITEMS_COUNT;
}
/**
*/
virtual Actor NewItem(unsigned int itemId)
{
- const ButtonItem* buttonDataArray = NULL;
- switch( mDemoState )
- {
- case POPUP:
- {
- buttonDataArray = POPUP_BUTTON_ITEMS;
- break;
- }
-
- case TABLEVIEW:
- {
- buttonDataArray = TABLEVIEW_BUTTON_ITEMS;
- break;
- }
-
- default:
- {
- break;
- }
- }
+ Toolkit::PushButton popupButton = Toolkit::PushButton::New();
+ popupButton.SetName( TABLEVIEW_BUTTON_ITEMS[ itemId ].name );
+ popupButton.SetProperty( Toolkit::Button::Property::LABEL, TABLEVIEW_BUTTON_ITEMS[ itemId ].text );
+ popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- if( buttonDataArray )
- {
- Toolkit::PushButton popupButton = Toolkit::PushButton::New();
- popupButton.SetName( buttonDataArray[ itemId ].name );
- popupButton.SetLabel( buttonDataArray[ itemId ].text );
- popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-
- popupButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- popupButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
-
- return popupButton;
- }
+ popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
- return Actor();
+ return popupButton;
}
private:
- enum DemoState
- {
- POPUP,
- TABLEVIEW
- };
-
- Application& mApplication;
- Toolkit::View mView; ///< The View instance.
- Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
- Layer mContentLayer; ///< Content layer
-
- Toolkit::TextLabel mTitleActor; ///< Title text
-
- Toolkit::Popup mMenu; ///< The navigation menu
- bool mMenuShown; ///< If the navigation menu is currently being displayed or not
+ Application& mApplication;
+ Toolkit::Control mView; ///< The View instance.
+ Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
+ Layer mContentLayer; ///< Content layer.
- Toolkit::Popup mPopup;
+ Toolkit::TextLabel mTitleActor; ///< Title text.
+ Toolkit::Popup mMenu; ///< The navigation menu.
+ Toolkit::Popup mPopup; ///< The current example popup.
- Toolkit::ItemView mItemView; ///< ItemView to hold test images
+ Toolkit::ItemView mItemView; ///< ItemView to hold test images.
- DemoState mDemoState;
};
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 );
+ Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
RunTest( application );