/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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 std::string BUTTON_BACKWARD( "Backward" );
-const std::string BUTTON_FORWARD( "Forward" );
-const std::string BUTTON_QUIT( "Quit" );
-const std::string BUTTON_OK( "Ok" );
-const std::string BUTTON_CANCEL( "Cancel" );
-
const std::string LOGO_PATH( DALI_IMAGE_DIR "Logo-for-demo.png" );
const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" );
-const std::string BUTTON_BACKGROUND(DALI_IMAGE_DIR "button-background.png");
const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.png");
const std::string TILE_BACKGROUND_ALPHA(DALI_IMAGE_DIR "item-background-alpha.png");
mScrollViewEffect(),
mScrollRulerX(),
mScrollRulerY(),
- mButtons(),
mPressedActor(),
mAnimationTimer(),
mLogoTapDetector(),
mVersionPopup(),
- mButtonsPageRelativeSize(),
mPages(),
- mTableViewImages(),
- mBackgroundActors(),
mBackgroundAnimations(),
mExampleList(),
- mExampleMap(),
mTotalPages(),
mScrolling( false ),
mSortAlphabetically( false ),
void DaliTableView::AddExample( Example example )
{
mExampleList.push_back( example );
- mExampleMap[ example.name ] = example;
}
void DaliTableView::SortAlphabetically( bool sortAlphabetically )
for( int t = 0; t < mTotalPages; t++ )
{
- // Create Table. (contains up to 9 Examples)
- TableView page = TableView::New( 3, 3 );
+ // Create Table
+ TableView page = TableView::New( ROWS_PER_PAGE, EXAMPLES_PER_ROW );
page.SetAnchorPoint( AnchorPoint::CENTER );
page.SetParentOrigin( ParentOrigin::CENTER );
page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
if( ( TouchPoint::Up == point.state ) &&
( mPressedActor == actor ) )
{
- std::string name = actor.GetName();
- ExampleMapConstIter iter = mExampleMap.find( name );
-
- AccessibilityManager accessibilityManager = AccessibilityManager::Get();
-
- if( iter != mExampleMap.end() )
+ // ignore Example button presses when scrolling or button animating.
+ if( ( !mScrolling ) && ( !mPressedAnimation ) )
{
- // ignore Example button presses when scrolling or button animating.
- if( ( !mScrolling ) && ( !mPressedAnimation ) )
+ std::string name = actor.GetName();
+ const ExampleListIter end = mExampleList.end();
+ for( ExampleListIter iter = mExampleList.begin(); iter != end; ++iter )
{
- // do nothing, until pressed animation finished.
- consumed = true;
+ if( (*iter).name == name )
+ {
+ // do nothing, until pressed animation finished.
+ consumed = true;
+ break;
+ }
}
}
if( mPressedActor )
{
std::string name = mPressedActor.GetName();
- ExampleMapConstIter iter = mExampleMap.find( name );
- if( iter == mExampleMap.end() )
+ std::stringstream stream;
+ stream << DALI_EXAMPLE_BIN << name.c_str();
+ pid_t pid = fork();
+ if( pid == 0)
{
- if( name == BUTTON_QUIT )
- {
- // Move focus to the OK button
- AccessibilityManager accessibilityManager = AccessibilityManager::Get();
-
- // Enable the group mode and wrap mode
- accessibilityManager.SetGroupMode( true );
- accessibilityManager.SetWrapMode( true );
- }
- }
- else
- {
- const Example& example( iter->second );
-
- std::stringstream stream;
- stream << DALI_EXAMPLE_BIN << example.name.c_str();
- pid_t pid = fork();
- if( pid == 0)
- {
- execlp( stream.str().c_str(), example.name.c_str(), NULL );
- DALI_ASSERT_ALWAYS(false && "exec failed!");
- }
+ execlp( stream.str().c_str(), name.c_str(), NULL );
+ DALI_ASSERT_ALWAYS(false && "exec failed!");
}
mPressedActor.Reset();
}
#define __DALI_DEMO_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
*
*/
-#include <map>
-
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/popup/popup.h>
class Example;
typedef std::vector<Example> ExampleList;
-typedef std::map<std::string,Example> ExampleMap;
typedef ExampleList::iterator ExampleListIter;
typedef ExampleList::const_iterator ExampleListConstIter;
-typedef ExampleMap::iterator ExampleMapIter;
-typedef ExampleMap::const_iterator ExampleMapConstIter;
-
-typedef std::vector<Dali::Toolkit::TableView> TableViewList;
-typedef TableViewList::iterator TableViewListIter;
-typedef TableViewList::const_iterator TableViewListConstIter;
-
-typedef std::vector<Dali::ImageActor> ImageActorList;
-typedef ImageActorList::iterator ImageActorListIter;
-typedef ImageActorList::const_iterator ImageActorListConstIter;
typedef std::vector<Dali::Animation> AnimationList;
typedef AnimationList::iterator AnimationListIter;
Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view
Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler
Dali::Toolkit::RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler
- Dali::Toolkit::TableView mButtons; ///< Navigation buttons
Dali::Actor mPressedActor; ///< The currently pressed actor.
Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period
Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo
Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information
- Dali::Vector3 mButtonsPageRelativeSize; ///< Size of a buttons page relative to the stage size
std::vector< Dali::Actor > mPages; ///< List of pages.
- std::vector< Dali::Actor > mTableViewImages; ///< Offscreen render of tableview
- std::vector< Dali::Actor > mBackgroundActors; ///< List of background actors used in the effect
AnimationList mBackgroundAnimations; ///< List of background bubble animations
ExampleList mExampleList; ///< List of examples.
- ExampleMap mExampleMap; ///< Map LUT for examples.
int mTotalPages; ///< Total pages within scrollview.