/*
- * 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.
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 TOOLBAR_TITLE = "Buttons";
-const char* const SMALL_IMAGE_1 = DALI_IMAGE_DIR "gallery-small-14.jpg";
-const char* const BIG_IMAGE_1 = DALI_IMAGE_DIR "gallery-large-4.jpg";
+const char* const SMALL_IMAGE_1 = DEMO_IMAGE_DIR "gallery-small-14.jpg";
+const char* const BIG_IMAGE_1 = DEMO_IMAGE_DIR "gallery-large-4.jpg";
-const char* const SMALL_IMAGE_2 = DALI_IMAGE_DIR "gallery-small-20.jpg";
-const char* const BIG_IMAGE_2 = DALI_IMAGE_DIR "gallery-large-11.jpg";
+const char* const SMALL_IMAGE_2 = DEMO_IMAGE_DIR "gallery-small-20.jpg";
+const char* const BIG_IMAGE_2 = DEMO_IMAGE_DIR "gallery-large-11.jpg";
-const char* const SMALL_IMAGE_3 = DALI_IMAGE_DIR "gallery-small-25.jpg";
-const char* const BIG_IMAGE_3 = DALI_IMAGE_DIR "gallery-large-13.jpg";
+const char* const SMALL_IMAGE_3 = DEMO_IMAGE_DIR "gallery-small-25.jpg";
+const char* const BIG_IMAGE_3 = DEMO_IMAGE_DIR "gallery-large-13.jpg";
-const char* const ENABLED_IMAGE = DALI_IMAGE_DIR "item-select-check.png";
+const char* const ENABLED_IMAGE = DEMO_IMAGE_DIR "item-select-check.png";
const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f );
contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT );
contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT );
contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) );
-// contentTable.TouchedSignal().Connect( this, &ButtonsController::OnTouchEvent );
for( unsigned int i = 0; i < contentTable.GetRows(); ++i )
{
// Radio 1
{
- Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_1 ) );
+ Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_1 );
image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( "1" );
{
radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
- Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_2 ) );
+ Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_2 );
image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( "2" );
{
radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
- Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_3 ) );
+ Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_3 );
image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( "3" );
// Create select button
mUpdateButton = Toolkit::PushButton::New();
mUpdateButton.SetLabelText( "Select" );
- mUpdateButton.SetName( "select-button" );
+ mUpdateButton.SetName( "selectButton" );
mUpdateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
mUpdateButton.ClickedSignal().Connect( this, &ButtonsController::OnButtonClicked );
radioGroup2Background.AddChild( mUpdateButton, Toolkit::TableView::CellPosition( 1, 0 ) );
// ImageView to display selected image
- mBigImage1 = ResourceImage::New( BIG_IMAGE_1 );
- mBigImage2 = ResourceImage::New( BIG_IMAGE_2 );
- mBigImage3 = ResourceImage::New( BIG_IMAGE_3 );
-
- mImage = Toolkit::ImageView::New( mBigImage1 );
+ mImage = Toolkit::ImageView::New( BIG_IMAGE_1 );
mImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
radioGroup2Background.AddChild( mImage, Toolkit::TableView::CellPosition( 0, 1, 2, 1 ) );
textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
- Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( ENABLED_IMAGE ) );
+ Toolkit::ImageView image = Toolkit::ImageView::New( ENABLED_IMAGE );
image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
image.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) );
tableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
// First radio button
{
Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( "Select enabled" );
- radioButton.SetName( "radio-select-enable" );
+ radioButton.SetName( "radioSelectEnable" );
radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioButton.SetPosition( 0, 0 );
// Second radio button
{
Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( "Select disabled" );
- radioButton.SetName( "radio-select-disable" );
+ radioButton.SetName( "radioSelectDisable" );
radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioButton.SetPosition( 0, DP(50) );
mCheckboxButton1.SetName( "checkbox1" );
mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" );
mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
+ mCheckboxButton1.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
checkBoxBackground.Add( mCheckboxButton1 );
}
mCheckboxButton2.SetLabelText( "CheckBox2 is selected" );
mCheckboxButton2.SetSelected( true );
mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
+ mCheckboxButton2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
checkBoxBackground.Add( mCheckboxButton2 );
}
mCheckboxButton3.SetName( "checkbox3" );
mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" );
mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
+ mCheckboxButton3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
checkBoxBackground.Add( mCheckboxButton3 );
}
bool EnableSelectButton( Toolkit::Button button )
{
- if( button.GetName() == "radio-select-enable" && button.IsSelected() == true )
+ if( button.GetName() == "radioSelectEnable" && button.IsSelected() == true )
{
mUpdateButton.SetDisabled( false );
mToggleButton.SetDisabled( false );
}
- else if( button.GetName() == "radio-select-disable" && button.IsSelected() == true )
+ else if( button.GetName() == "radioSelectDisable" && button.IsSelected() == true )
{
mUpdateButton.SetDisabled( true );
{
if( mRadioButtonImage1.IsSelected() )
{
- mImage.SetImage( mBigImage1 );
+ mImage.SetImage( BIG_IMAGE_1 );
}
else if( mRadioButtonImage2.IsSelected() )
{
- mImage.SetImage( mBigImage2 );
+ mImage.SetImage( BIG_IMAGE_2 );
}
else if( mRadioButtonImage3.IsSelected() )
{
- mImage.SetImage( mBigImage3 );
+ mImage.SetImage( BIG_IMAGE_3 );
}
return true;
}
return true;
}
- bool OnTouchEvent( Actor actor, const TouchEvent& event )
- {
- if( 1u == event.GetPointCount() )
- {
- const TouchPoint::State state = event.GetPoint(0u).state;
-
- // Clamp to integer values; this is to reduce flicking due to pixel misalignment
- const float localPoint = static_cast<float>( static_cast<int>( event.GetPoint( 0 ).local.y ) );
-
- if( TouchPoint::Down == state )
- {
- mLastPoint = localPoint;
- mAnimation = Animation::New( 0.25f );
- }
- else if( TouchPoint::Motion == state )
- {
- if( mAnimation )
- {
- mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR );
- mAnimation.Play();
- mLastPoint = localPoint;
- }
- }
- }
-
- return true;
- }
-
- private:
+private:
Application& mApplication;
Toolkit::Control mView; ///< The View instance.
Animation mAnimation;
float mLastPoint;
- Image mBigImage1;
- Image mBigImage2;
- Image mBigImage3;
Toolkit::ImageView mImage;
};
// Entry point for Linux & Tizen applications
//
-int main( int argc, char **argv )
+int DALI_EXPORT_API main( int argc, char **argv )
{
- Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH );
+ Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
RunTest( application );