summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorTom Robinson <tom.robinson@samsung.com>2015-07-28 15:18:58 +0100
committerTom Robinson <tom.robinson@samsung.com>2015-08-05 11:46:41 +0100
commit102fd0ff958eca808fbf0c0c3195b20e9baf7282 (patch)
treeeef374bc1a30083498db8e146019ccdcb49ab69b /demo
parent9ca6b6d87318aea175e80e9c62eac35cfa220c74 (diff)
downloaddali-demo-102fd0ff958eca808fbf0c0c3195b20e9baf7282.tar.gz
dali-demo-102fd0ff958eca808fbf0c0c3195b20e9baf7282.tar.bz2
dali-demo-102fd0ff958eca808fbf0c0c3195b20e9baf7282.zip
New Popup implementation
Change-Id: I19544f18bd90836c039d045be4ab2d9d5386b37f
Diffstat (limited to 'demo')
-rw-r--r--demo/dali-demo.cpp1
-rw-r--r--demo/dali-table-view.cpp55
-rw-r--r--demo/dali-table-view.h6
3 files changed, 31 insertions, 31 deletions
diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp
index ce22a9ad..0bd1ddd0 100644
--- a/demo/dali-demo.cpp
+++ b/demo/dali-demo.cpp
@@ -58,6 +58,7 @@ int main(int argc, char **argv)
demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE));
demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT));
demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE));
+ demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP));
demo.AddExample(Example("buttons.example", DALI_DEMO_STR_TITLE_BUTTONS));
demo.AddExample(Example("logging.example", DALI_DEMO_STR_TITLE_LOGGING));
demo.AddExample(Example("mesh-morph.example", DALI_DEMO_STR_TITLE_MESH_MORPH));
diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp
index bbe7495b..990a7877 100644
--- a/demo/dali-table-view.cpp
+++ b/demo/dali-table-view.cpp
@@ -175,8 +175,7 @@ DaliTableView::DaliTableView( Application& application )
mTotalPages(),
mScrolling( false ),
mSortAlphabetically( false ),
- mBackgroundAnimsPlaying( false ),
- mVersionPopupShown( false )
+ mBackgroundAnimsPlaying( false )
{
application.InitSignal().Connect( this, &DaliTableView::Initialize );
}
@@ -697,9 +696,11 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event )
{
if ( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
{
- if ( mVersionPopup && mVersionPopupShown )
+ // If there's a Popup, Hide it if it's contributing to the display in any way (EG. transitioning in or out).
+ // Otherwise quit.
+ if ( mVersionPopup && ( mVersionPopup.GetDisplayState() != Toolkit::Popup::HIDDEN ) )
{
- HideVersionPopup();
+ mVersionPopup.SetDisplayState( Popup::HIDDEN );
}
else
{
@@ -977,44 +978,48 @@ bool DaliTableView::OnTileHovered( Actor actor, const HoverEvent& event )
void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap )
{
- if ( !mVersionPopupShown )
+ // Only show if currently fully hidden. If transitioning-out, the transition will not be interrupted.
+ if ( !mVersionPopup || ( mVersionPopup.GetDisplayState() == Toolkit::Popup::HIDDEN ) )
{
if ( !mVersionPopup )
{
std::ostringstream stream;
- stream << "DALi Core: " << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl << "(" << CORE_BUILD_DATE << ")" << std::endl << std::endl;
- stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl << "(" << ADAPTOR_BUILD_DATE << ")" << std::endl << std::endl;
- stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")";
+ stream << "DALi Core: " << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl << "(" << CORE_BUILD_DATE << ")\n";
+ stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl << "(" << ADAPTOR_BUILD_DATE << ")\n";
+ stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")\n";
mVersionPopup = Dali::Toolkit::Popup::New();
- mVersionPopup.SetParentOrigin( ParentOrigin::CENTER );
- mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER );
+
+ Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( "Version information" );
+ titleActor.SetName( "title-actor" );
+ titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+
+ Toolkit::TextLabel contentActor = Toolkit::TextLabel::New( stream.str() );
+ contentActor.SetName( "content-actor" );
+ contentActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
+ contentActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ contentActor.SetPadding( Padding( 0.0f, 0.0f, 20.0f, 0.0f ) );
+
+ mVersionPopup.SetTitle( titleActor );
+ mVersionPopup.SetContent( contentActor );
+
mVersionPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH );
mVersionPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
mVersionPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
- mVersionPopup.SetTitle( stream.str() );
- mVersionPopup.HideTail();
+
mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup );
- mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden );
+ Stage::GetCurrent().Add( mVersionPopup );
}
- mVersionPopup.Show();
- mVersionPopupShown = true;
+ mVersionPopup.SetDisplayState( Popup::SHOWN );
}
}
void DaliTableView::HideVersionPopup()
{
- if ( mVersionPopup )
- {
- mVersionPopup.Hide();
- }
-}
-
-void DaliTableView::PopupHidden()
-{
- if ( mVersionPopup )
+ // Only hide if currently fully shown. If transitioning-in, the transition will not be interrupted.
+ if ( mVersionPopup && ( mVersionPopup.GetDisplayState() == Toolkit::Popup::SHOWN ) )
{
- mVersionPopupShown = false;
+ mVersionPopup.SetDisplayState( Popup::HIDDEN );
}
}
diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h
index bbc4d52e..8b1353d4 100644
--- a/demo/dali-table-view.h
+++ b/demo/dali-table-view.h
@@ -367,11 +367,6 @@ private: // Application callbacks & implementation
*/
void HideVersionPopup();
- /**
- * Called when the popup is completely hidden
- */
- void PopupHidden();
-
/*
* @brief Callback called when the buttons page actor is relaid out
*
@@ -418,7 +413,6 @@ private:
bool mScrolling:1; ///< Flag indicating whether view is currently being scrolled
bool mSortAlphabetically:1; ///< Sort examples alphabetically.
bool mBackgroundAnimsPlaying:1; ///< Are background animations playing
- bool mVersionPopupShown:1; ///< Whehter the version popup is shown or not
};