void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
-void DummyControlImplOverride::OnThemeChange(StyleManager change) { themeChangeCalled = true;}
-void DummyControlImplOverride::OnFontChange(bool defaultFontChange, bool defaultFontSizeChange) { fontChangeCalled = true; }
+void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change ) { themeChangeCalled = change.themeChange; fontChangeCalled = change.defaultFontSizeChange; }
void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
private: // From Internal::Control
virtual void OnInitialize();
- virtual void OnThemeChange( StyleManager styleManager );
- virtual void OnFontChange(bool defaultFontChange, bool defaultFontSizeChange);
+ virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
virtual void OnPinch(const PinchGesture& pinch);
virtual void OnPan(const PanGesture& pan);
virtual void OnTap(const TapGesture& tap);
void Popup::SetTitle( const std::string& text )
{
-// TODO
+ // Replaces the current title actor.
+ if( mPopupLayout )
+ {
+ mPopupLayout.RemoveChildAt( Toolkit::TableView::CellPosition( 0, 0 ) );
+ }
+
+ mTitle = Toolkit::TextLabel::New( text );
+ mTitle.SetName( "POPUP_TITLE" );
+ mTitle.SetColor( Color::BLACK );
+
+ if( mPopupLayout )
+ {
+ mTitle.SetPadding( Padding( 0.0f, 0.0f, mPopupStyle->margin, mPopupStyle->margin ) );
+ mTitle.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+ mTitle.SetDimensionDependency( HEIGHT, WIDTH ); // HeightForWidth
+ mPopupLayout.AddChild( mTitle, Toolkit::TableView::CellPosition( 0, 0 ) );
+ }
+
+ RelayoutRequest();
}
-const std::string& Popup::GetTitle() const
+std::string Popup::GetTitle() const
{
- static std::string temp("");
- return temp;
+ if( mTitle )
+ {
+ return mTitle.GetProperty<std::string>( Toolkit::TextLabel::Property::TEXT );
+ }
+
+ return std::string();
}
void Popup::CreateFooter()
Vector3 naturalSize( 0.0f, 0.0f, 0.0f );
+ if ( mTitle )
+ {
+ Vector3 titleNaturalSize = mTitle.GetImplementation().GetNaturalSize();
+ // Buffer to avoid errors. The width of the popup could potentially be the width of the title text.
+ // It was observed in this case that text wrapping was then inconsistent when seen on device
+ const float titleBuffer = 0.5f;
+ titleNaturalSize.width += titleBuffer;
+
+ // As TextLabel GetNaturalSize does not take wrapping into account, limit the width
+ // to that of the stage
+ if( titleNaturalSize.width >= maxWidth)
+ {
+ naturalSize.width = maxWidth;
+ naturalSize.height = mTitle.GetImplementation().GetHeightForWidth( naturalSize.width );
+ }
+ else
+ {
+ naturalSize += titleNaturalSize;
+ }
+
+ naturalSize.height += mPopupStyle->margin;
+ }
+
if( mContent )
{
Vector3 contentSize = mContent.GetNaturalSize();
float height( 0.0f );
float popupWidth( width - 2.f * ( POPUP_OUT_MARGIN_WIDTH + mPopupStyle->margin ) );
+ if ( mTitle )
+ {
+ height += mTitle.GetImplementation().GetHeightForWidth( popupWidth );
+ height += mPopupStyle->margin;
+ }
+
if( mContent )
{
height += mContent.GetHeightForWidth( popupWidth ) + mPopupStyle->margin;
#include <dali-toolkit/public-api/controls/popup/popup.h>
#include <dali-toolkit/internal/controls/popup/popup-style-impl.h>
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
namespace Dali
{
/**
* @copydoc Toolkit::Popup::GetTitle
*/
- const std::string& GetTitle() const;
+ std::string GetTitle() const;
/**
* @copydoc Toolkit::Popup::AddButton
Actor mBackgroundImage; ///< Stores the background image.
Actor mButtonAreaImage; ///< Stores the button background image.
+ Toolkit::TextLabel mTitle; ///< Stores the text title.
Actor mContent; ///< Stores popup's content.
Actor mBottomBg; ///< bottom button bar background. ImageActor is replaced with Actor due to hidden image.
Actor mTailImage; ///< Stores the tail image