-
- const std::string& name = button.name;
- const std::string& caption = button.caption;
- Image iconImage = button.icon;
-
- // 1. Create the backgrounds for the popup option both normal and pressed.
- // Both containers will be added to a button.
-
- Toolkit::TableView optionContainer = Toolkit::TableView::New( (showIcons&showCaption)?2:1 , 1 );
- optionContainer.SetDrawMode( DrawMode::OVERLAY );
- optionContainer.SetFitHeight( 0 );
- optionContainer.SetFitWidth( 0 );
-
- Toolkit::TableView optionPressedContainer = Toolkit::TableView::New( (showIcons&showCaption)?2:1 , 1 );
- optionPressedContainer.SetDrawMode( DrawMode::OVERLAY );
- optionPressedContainer.SetFitHeight( 0 );
- optionPressedContainer.SetFitWidth( 0 );
- optionPressedContainer.SetBackgroundColor( mPressedColor );
-
-#ifdef DECORATOR_DEBUG
- optionContainer.SetName("optionContainer");
- optionPressedContainer.SetName("optionPressedContainer");
-#endif
- // 2. Add text.
-
- if ( showCaption )
- {
- Toolkit::TextLabel captionTextLabel = Toolkit::TextLabel::New();
- captionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
- captionTextLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-
- Toolkit::TextLabel pressedCaptionTextLabel = Toolkit::TextLabel::New();
- pressedCaptionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
- pressedCaptionTextLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-
- Padding padding;
- padding.left = 24.0f;
- padding.right = 24.0f;
- padding.top = 14.0f;
- padding.bottom = 14.0f;
- captionTextLabel.SetPadding( padding );
- pressedCaptionTextLabel.SetPadding( padding );
-
- optionContainer.AddChild( captionTextLabel, Toolkit::TableView::CellPosition(( showIcons&showCaption)?1:0, 0 ) );
- optionPressedContainer.AddChild( pressedCaptionTextLabel, Toolkit::TableView::CellPosition(( showIcons&showCaption)?1:0, 0 ) );
- }
-
- // 3. Create the icons
- if ( showIcons )
- {
- ImageActor pressedIcon = ImageActor::New( iconImage );
- ImageActor icon = ImageActor::New( iconImage );
-
- icon.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- pressedIcon.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- icon.SetColor( mIconColor );
-
- if ( showCaption & showIcons )
- {
- optionContainer.SetFitHeight( 1 );
- optionContainer.SetFitWidth( 1 );
- optionPressedContainer.SetFitHeight( 1 );
- optionPressedContainer.SetFitWidth( 1 );
- }
-
- optionContainer.AddChild( icon, Toolkit::TableView::CellPosition( 0, 0 ) );
- optionPressedContainer.AddChild( pressedIcon, Toolkit::TableView::CellPosition( 0, 0 ) );
-
- icon.SetPadding( Padding( 10.0f, 10.0f, 10.0f, 10.0f ) );
- pressedIcon.SetPadding( Padding( 10.0f, 10.0f, 10.0f, 10.0f ) );
- }
-
- // 4. Create a option.