using namespace Dali;
-namespace
-{
-// Used to produce visually same dimensions on desktop and device builds
-float ScalePointSize( int pointSize )
-{
- Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi();
- float meanDpi = (dpi.height + dpi.width) * 0.5f;
- return pointSize * meanDpi / 220.0f;
-}
-
-} // namespace
-
// Define this so that it is interchangeable
// "DP" stands for Device independent Pixels
-#define DP(x) ScalePointSize(x)
+#define DP(x) x
namespace
const char* const ENABLED_IMAGE = DALI_IMAGE_DIR "item-select-check.png";
-const char* const PUSHBUTTON_PRESS_IMAGE = DALI_IMAGE_DIR "button-down.9.png";
-const char* const PUSHBUTTON_DISABLED_IMAGE = DALI_IMAGE_DIR "button-disabled.9.png";
-const char* const PUSHBUTTON_BUTTON_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
-
-const char* const CHECKBOX_UNSELECTED_IMAGE = DALI_IMAGE_DIR "checkbox-unselected.png";
-const char* const CHECKBOX_SELECTED_IMAGE = DALI_IMAGE_DIR "checkbox-selected.png";
-
const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f );
// Layout sizes
-const int RADIO_LABEL_THUMBNAIL_SIZE = 48;
+const int RADIO_LABEL_THUMBNAIL_SIZE = 60;
+const int RADIO_LABEL_THUMBNAIL_SIZE_SMALL = 40;
const int RADIO_IMAGE_SPACING = 8;
const int BUTTON_HEIGHT = 48;
TOOLBAR_IMAGE,
TOOLBAR_TITLE );
- int yPos = TOP_MARGIN + MARGIN_SIZE;
+ Toolkit::TableView contentTable = Toolkit::TableView::New( 4, 1 );
+ contentTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ contentTable.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ 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 )
+ {
+ contentTable.SetFitHeight( i );
+ }
+
+ contentTable.SetPosition( 0.0f, TOP_MARGIN );
+
+ mContentLayer.Add( contentTable );
// Image selector radio group
- Actor radioGroup2Background = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR );
- radioGroup2Background.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- radioGroup2Background.SetParentOrigin( ParentOrigin::TOP_LEFT );
- radioGroup2Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
- radioGroup2Background.SetRelayoutEnabled( true );
- radioGroup2Background.SetPreferredSize( Vector2( DP(348), DP(GROUP2_HEIGHT) ) );
- mContentLayer.Add( radioGroup2Background );
-
- Actor radioButtonsGroup2 = Actor::New();
- radioButtonsGroup2.SetParentOrigin( ParentOrigin::TOP_LEFT );
- radioButtonsGroup2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- radioButtonsGroup2.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
- radioButtonsGroup2.SetRelayoutEnabled( true );
- radioButtonsGroup2.SetPreferredSize( Vector2( DP(100), DP(160) ) );
-
- radioGroup2Background.Add( radioButtonsGroup2 );
+ Toolkit::TableView radioGroup2Background = Toolkit::TableView::New( 2, 2 );
+ radioGroup2Background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ radioGroup2Background.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ radioGroup2Background.SetBackgroundColor( BACKGROUND_COLOUR );
+ radioGroup2Background.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
+ radioGroup2Background.SetFitHeight( 0 );
+ radioGroup2Background.SetFitHeight( 1 );
+ radioGroup2Background.SetFitWidth( 0 );
+
+ contentTable.Add( radioGroup2Background );
+
+ Toolkit::TableView radioButtonsGroup2 = Toolkit::TableView::New( 3, 1 );
+ radioButtonsGroup2.SetCellPadding( Size( 0.0f, MARGIN_SIZE * 0.5f ) );
+ radioButtonsGroup2.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ for( unsigned int i = 0; i < radioButtonsGroup2.GetRows(); ++i )
+ {
+ radioButtonsGroup2.SetFitHeight( i );
+ }
+ radioButtonsGroup2.SetFitWidth( 0 );
+
+ radioGroup2Background.AddChild( radioButtonsGroup2, Toolkit::TableView::CellPosition( 0, 0 ) );
+
+ // TableView to lay out 3x Radio buttons on the left, and 3x Image thumbnails on the right.
+ Toolkit::TableView imageSelectTableView = Toolkit::TableView::New( 3, 2 );
+ imageSelectTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ imageSelectTableView.SetFitHeight( 0 );
+ imageSelectTableView.SetFitHeight( 1 );
+ imageSelectTableView.SetFitHeight( 2 );
+ imageSelectTableView.SetFitWidth( 0 );
+ imageSelectTableView.SetFitWidth( 1 );
+ imageSelectTableView.SetCellPadding( Vector2( 6.0f, 0.0f ) );
+
+ radioButtonsGroup2.Add( imageSelectTableView );
int radioY = 0;
// Radio 1
{
- ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_1 ) );
- imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
- mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( imageActor );
+ Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_1 ) );
+ image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
+
+ mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( "1" );
mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT );
mRadioButtonImage1.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mRadioButtonImage1.SetPosition( 0, DP(radioY) );
mRadioButtonImage1.SetSelected( true );
- radioButtonsGroup2.Add( mRadioButtonImage1 );
+ imageSelectTableView.AddChild( mRadioButtonImage1, Toolkit::TableView::CellPosition( 0, 0 ) );
+ imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
}
// Radio 2
{
radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
- ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_2 ) );
- imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
+ Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_2 ) );
+ image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
- mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( imageActor );
+ mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( "2" );
mRadioButtonImage2.SetParentOrigin( ParentOrigin::TOP_LEFT );
mRadioButtonImage2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mRadioButtonImage2.SetPosition( 0, DP(radioY) );
- radioButtonsGroup2.Add( mRadioButtonImage2 );
+ imageSelectTableView.AddChild( mRadioButtonImage2, Toolkit::TableView::CellPosition( 1, 0 ) );
+ imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 1, 1 ) );
}
// Radio 3
{
radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
- ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_3 ) );
- imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
+ Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_3 ) );
+ image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) );
- mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( imageActor );
+ mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( "3" );
mRadioButtonImage3.SetParentOrigin( ParentOrigin::TOP_LEFT );
mRadioButtonImage3.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mRadioButtonImage3.SetPosition( 0, DP(radioY) );
- radioButtonsGroup2.Add( mRadioButtonImage3 );
+ imageSelectTableView.AddChild( mRadioButtonImage3, Toolkit::TableView::CellPosition( 2, 0 ) );
+ imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 2, 1 ) );
}
// Create select button
mUpdateButton = Toolkit::PushButton::New();
- mUpdateButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
- mUpdateButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- mUpdateButton.SetPosition( 0, DP(MARGIN_SIZE) );
- mUpdateButton.SetLabel( "Select" );
- mUpdateButton.SetPreferredSize( Vector2( DP(100), DP(BUTTON_HEIGHT) ) );
-
- mUpdateButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- mUpdateButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
- mUpdateButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+ mUpdateButton.SetLabelText( "Select" );
+ mUpdateButton.SetName( "select-button" );
+ mUpdateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
mUpdateButton.ClickedSignal().Connect( this, &ButtonsController::OnButtonClicked );
- radioButtonsGroup2.Add(mUpdateButton);
+ radioGroup2Background.AddChild( mUpdateButton, Toolkit::TableView::CellPosition( 1, 0 ) );
- // ImageActor to display selected image
+ // ImageView to display selected image
mBigImage1 = ResourceImage::New( BIG_IMAGE_1 );
mBigImage2 = ResourceImage::New( BIG_IMAGE_2 );
mBigImage3 = ResourceImage::New( BIG_IMAGE_3 );
- mImage = ImageActor::New( mBigImage1 );
- mImage.SetParentOrigin( ParentOrigin::TOP_RIGHT );
- mImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mImage.SetPosition( DP(MARGIN_SIZE), 0 );
- mImage.SetPreferredSize( Vector2( DP(218), DP(218) ) );
- radioButtonsGroup2.Add( mImage );
+ mImage = Toolkit::ImageView::New( mBigImage1 );
+ 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 ) );
// The enable/disable radio group
- yPos += GROUP2_HEIGHT + MARGIN_SIZE;
+ Toolkit::TableView radioGroup1Background = Toolkit::TableView::New( 1, 1 );
+ radioGroup1Background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ radioGroup1Background.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ radioGroup1Background.SetBackgroundColor( BACKGROUND_COLOUR );
+ radioGroup1Background.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
+ radioGroup1Background.SetFitHeight( 0 );
- Actor radioGroup1Background = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR );
- radioGroup1Background.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- radioGroup1Background.SetParentOrigin( ParentOrigin::TOP_LEFT );
- radioGroup1Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
- radioGroup1Background.SetRelayoutEnabled( true );
- radioGroup1Background.SetPreferredSize( Vector2( DP(348), DP(GROUP1_HEIGHT) ) );
- mContentLayer.Add( radioGroup1Background );
+ contentTable.Add( radioGroup1Background );
// Radio group
- Actor radioButtonsGroup1 = Actor::New();
- radioButtonsGroup1.SetParentOrigin( ParentOrigin::TOP_LEFT );
- radioButtonsGroup1.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- radioButtonsGroup1.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
+ Toolkit::TableView radioButtonsGroup1 = Toolkit::TableView::New( 2, 1 );
+ radioButtonsGroup1.SetCellPadding( Size( 0.0f, MARGIN_SIZE * 0.5f ) );
+ radioButtonsGroup1.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ for( unsigned int i = 0; i < radioButtonsGroup1.GetRows(); ++i )
+ {
+ radioButtonsGroup1.SetFitHeight( i );
+ }
+ radioButtonsGroup1.SetFitWidth( 0 );
radioGroup1Background.Add( radioButtonsGroup1 );
- // First radio button
- {
- Toolkit::TableView tableView = Toolkit::TableView::New( 1, 2 );
- tableView.SetPreferredSize( Vector2( DP(260), 0.0f ) );
- tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+ // TableView to lay out 2x Radio buttons on the left, and 1x Tick image on the right.
+ Toolkit::TableView tableView = Toolkit::TableView::New( 2, 2 );
+ tableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ tableView.SetFitHeight( 0 );
+ tableView.SetFitHeight( 1 );
+ tableView.SetFitWidth( 0 );
+ tableView.SetFitWidth( 1 );
+
+ Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( "Select enabled" );
+ textLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH );
+ textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
+ textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
- Toolkit::TextView textView = Toolkit::TextView::New( "Select enabled" );
- tableView.AddChild( textView, Toolkit::TableView::CellPosition( 0, 0 ) );
+ Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::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 ) );
- ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) );
- imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
- imageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
- imageActor.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) );
- tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) );
+ radioButtonsGroup1.Add( tableView );
- Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( tableView );
+ // First radio button
+ {
+ Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( "Select enabled" );
radioButton.SetName( "radio-select-enable" );
radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton );
- radioButtonsGroup1.Add( radioButton );
+ tableView.AddChild( radioButton, Toolkit::TableView::CellPosition( 0, 0 ) );
}
// Second radio button
radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton );
- radioButtonsGroup1.Add( radioButton );
+ tableView.AddChild( radioButton, Toolkit::TableView::CellPosition( 1, 0 ) );
}
// CheckBoxes
- yPos += GROUP1_HEIGHT + MARGIN_SIZE;
+ Toolkit::TableView checkBoxBackground = Toolkit::TableView::New( 3, 1 );
+ checkBoxBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ checkBoxBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ checkBoxBackground.SetBackgroundColor( BACKGROUND_COLOUR );
+ checkBoxBackground.SetCellPadding( Size( MARGIN_SIZE / 2.0f, MARGIN_SIZE / 2.0f ) );
- Actor checkBoxBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR );
- checkBoxBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- checkBoxBackground.SetParentOrigin( ParentOrigin::TOP_LEFT );
- checkBoxBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
- checkBoxBackground.SetRelayoutEnabled( true );
- checkBoxBackground.SetPreferredSize( Vector2( DP(430), DP(GROUP3_HEIGHT) ) );
- mContentLayer.Add( checkBoxBackground );
-
- Dali::Image unselected = Dali::ResourceImage::New( CHECKBOX_UNSELECTED_IMAGE );
- Dali::Image selected = Dali::ResourceImage::New( CHECKBOX_SELECTED_IMAGE );
+ for( unsigned int i = 0; i < checkBoxBackground.GetRows(); ++i )
+ {
+ checkBoxBackground.SetFitHeight( i );
+ }
- int checkYPos = MARGIN_SIZE;
+ contentTable.Add( checkBoxBackground );
{
- Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
- checkBox.SetName( "checkbox1" );
- checkBox.SetPosition( DP(MARGIN_SIZE), DP(checkYPos) );
- checkBox.SetParentOrigin( ParentOrigin::TOP_LEFT );
- checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- checkBox.SetBackgroundImage( unselected );
- checkBox.SetSelectedImage( selected );
- checkBox.SetLabel( "CheckBox1 is unselected" );
- checkBox.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
-
- checkBoxBackground.Add( checkBox );
+ mCheckboxButton1 = Toolkit::CheckBoxButton::New();
+ mCheckboxButton1.SetName( "checkbox1" );
+ mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" );
+ mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
+
+ checkBoxBackground.Add( mCheckboxButton1 );
}
- checkYPos += 60;
+ {
+ mCheckboxButton2 = Toolkit::CheckBoxButton::New();
+ mCheckboxButton2.SetName( "checkbox2" );
+ mCheckboxButton2.SetLabelText( "CheckBox2 is selected" );
+ mCheckboxButton2.SetSelected( true );
+ mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
+
+ checkBoxBackground.Add( mCheckboxButton2 );
+ }
{
- Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
- checkBox.SetName( "checkbox2" );
- checkBox.SetPosition( DP(MARGIN_SIZE), DP(checkYPos) );
- checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- checkBox.SetBackgroundImage( unselected );
- checkBox.SetSelectedImage( selected );
- checkBox.SetLabel( "CheckBox2 is selected" );
- checkBox.SetSelected( true );
- checkBox.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
-
- checkBoxBackground.Add( checkBox );
+ mCheckboxButton3 = Toolkit::CheckBoxButton::New();
+ mCheckboxButton3.SetName( "checkbox3" );
+ mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" );
+ mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
+
+ checkBoxBackground.Add( mCheckboxButton3 );
}
- checkYPos += 60;
+ // Create togglabe button
+ Toolkit::TableView toggleBackground = Toolkit::TableView::New( 3, 1 );
+ toggleBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ toggleBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ toggleBackground.SetBackgroundColor( BACKGROUND_COLOUR );
+ toggleBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
+ for( unsigned int i = 0; i < toggleBackground.GetRows(); ++i )
{
- Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
- checkBox.SetName( "checkbox3" );
- checkBox.SetPosition( DP(MARGIN_SIZE), DP(checkYPos) );
- checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- checkBox.SetBackgroundImage( unselected );
- checkBox.SetSelectedImage( selected );
- checkBox.SetLabel( "CheckBox3 is unselected" );
- checkBox.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
-
- checkBoxBackground.Add( checkBox );
+ toggleBackground.SetFitHeight( i );
}
- // Create togglabe button
- yPos += GROUP3_HEIGHT + MARGIN_SIZE;
-
- Actor toggleBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR );
- toggleBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- toggleBackground.SetParentOrigin( ParentOrigin::TOP_LEFT );
- toggleBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
- toggleBackground.SetRelayoutEnabled( true );
- toggleBackground.SetPreferredSize( Vector2( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ) );
- mContentLayer.Add( toggleBackground );
-
- Toolkit::PushButton toggleButton = Toolkit::PushButton::New();
- toggleButton.SetTogglableButton( true );
- toggleButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
- toggleButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- toggleButton.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
- toggleButton.SetLabel( "Unselected" );
- toggleButton.SetPreferredSize( Vector2( DP(150), DP(BUTTON_HEIGHT) ) );
-
- toggleButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
- toggleButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
- toggleButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
-
- toggleButton.StateChangedSignal().Connect( this, &ButtonsController::OnButtonSelected );
-
- toggleBackground.Add( toggleButton );
+ contentTable.Add( toggleBackground );
+
+ mToggleButton = Toolkit::PushButton::New();
+ mToggleButton.SetTogglableButton( true );
+ mToggleButton.SetLabelText( "Unselected" );
+ mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ mToggleButton.StateChangedSignal().Connect( this, &ButtonsController::OnButtonSelected );
+
+ toggleBackground.Add( mToggleButton );
}
void OnKeyEvent( const KeyEvent& event )
{
if( button.IsSelected() )
{
- pushButton.SetLabel( "Selected" );
+ pushButton.SetLabelText( "Selected" );
}
else
{
- pushButton.SetLabel( "Unselected" );
+ pushButton.SetLabelText( "Unselected" );
}
}
if( button.GetName() == "radio-select-enable" && button.IsSelected() == true )
{
mUpdateButton.SetDisabled( false );
+
+ mRadioButtonImage1.SetDisabled( false );
+ mRadioButtonImage2.SetDisabled( false );
+ mRadioButtonImage3.SetDisabled( false );
+
+ mCheckboxButton1.SetDisabled( false );
+ mCheckboxButton2.SetDisabled( false );
+ mCheckboxButton3.SetDisabled( false );
+
+ mToggleButton.SetDisabled( false );
}
else if( button.GetName() == "radio-select-disable" && button.IsSelected() == true )
{
mUpdateButton.SetDisabled( true );
+
+ mRadioButtonImage1.SetDisabled( true );
+ mRadioButtonImage2.SetDisabled( true );
+ mRadioButtonImage3.SetDisabled( true );
+
+ mCheckboxButton1.SetDisabled( true );
+ mCheckboxButton2.SetDisabled( true );
+ mCheckboxButton3.SetDisabled( true );
+
+ mToggleButton.SetDisabled( true );
}
return true;
{
if( button.IsSelected() )
{
- button.SetLabel("CheckBox1 is selected");
+ button.SetLabelText("CheckBox1 is selected");
}
else
{
- button.SetLabel("CheckBox1 is unselected");
+ button.SetLabelText("CheckBox1 is unselected");
}
}
{
if( button.IsSelected() )
{
- button.SetLabel("CheckBox2 is selected");
+ button.SetLabelText("CheckBox2 is selected");
}
else
{
- button.SetLabel("CheckBox2 is unselected");
+ button.SetLabelText("CheckBox2 is unselected");
}
}
{
if( button.IsSelected() )
{
- button.SetLabel("CheckBox3 is selected");
+ button.SetLabelText("CheckBox3 is selected");
}
else
{
- button.SetLabel("CheckBox3 is unselected");
+ button.SetLabelText("CheckBox3 is unselected");
+ }
+ }
+
+ 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;
+ }
}
}
private:
Application& mApplication;
- Toolkit::View mView; ///< The View instance.
+ Toolkit::Control mView; ///< The View instance.
Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
Layer mContentLayer; ///< Content layer
Toolkit::RadioButton mRadioButtonImage3;
Toolkit::PushButton mUpdateButton;
+ Toolkit::PushButton mToggleButton;
+
+ Toolkit::CheckBoxButton mCheckboxButton1;
+ Toolkit::CheckBoxButton mCheckboxButton2;
+ Toolkit::CheckBoxButton mCheckboxButton3;
+
+ Animation mAnimation;
+ float mLastPoint;
Image mBigImage1;
Image mBigImage2;
Image mBigImage3;
- ImageActor mImage;
+ Toolkit::ImageView mImage;
};
void RunTest( Application& application )
//
int main( int argc, char **argv )
{
- Application application = Application::New( &argc, &argv );
+ Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH );
RunTest( application );