X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=demo%2Fdali-table-view.h;h=c91f2fcac20b1c1b878313a13661105e87a4240e;hb=e47e49fb750cc0e29a5e8a60b29e7bcaa4127173;hp=55b5d41dcf8c56d138e07d05db7aee99ea5f7ceb;hpb=3f93d68f9608bb516ab3fe148a9705ac1b00a4aa;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index 55b5d41..c91f2fc 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -1,8 +1,8 @@ -#ifndef __DALI_DEMO_H__ -#define __DALI_DEMO_H__ +#ifndef DALI_DEMO_H +#define DALI_DEMO_H /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -18,8 +18,6 @@ * */ -#include - #include #include #include @@ -27,25 +25,13 @@ class Example; typedef std::vector ExampleList; -typedef std::map ExampleMap; typedef ExampleList::iterator ExampleListIter; typedef ExampleList::const_iterator ExampleListConstIter; -typedef ExampleMap::iterator ExampleMapIter; -typedef ExampleMap::const_iterator ExampleMapConstIter; - -typedef std::vector TableViewList; -typedef TableViewList::iterator TableViewListIter; -typedef TableViewList::const_iterator TableViewListConstIter; - -typedef std::vector ImageActorList; -typedef ImageActorList::iterator ImageActorListIter; -typedef ImageActorList::const_iterator ImageActorListConstIter; typedef std::vector AnimationList; typedef AnimationList::iterator AnimationListIter; typedef AnimationList::const_iterator AnimationListConstIter; - /** * Example information * @@ -99,15 +85,6 @@ public: void AddExample(Example example); /** - * Sets the background image PATH. - * - * @param[in] imagePath The file path to the image to use as the background. - * - * @note Should be called before the Application MainLoop is started. - */ - void SetBackgroundPath( std::string imagePath ); - - /** * Sorts the example list alphabetically by Title if parameter is true. * * @param[in] sortAlphabetically If true, example list is sorted alphabetically. @@ -119,13 +96,15 @@ public: private: // Application callbacks & implementation + static const unsigned int FOCUS_ANIMATION_ACTOR_NUMBER = 2; ///< The number of elements used to form the custom focus effect + /** * Shape enum for create function */ enum ShapeType { CIRCLE, - SQUARE + BUBBLE }; /** @@ -157,35 +136,38 @@ private: // Application callbacks & implementation void Rotate( unsigned int degrees ); /** - * Creates a tile for the main menu and toolbar. + * Creates a tile for the main menu. * * @param[in] name The unique name for this Tile * @param[in] title The text caption that appears on the Tile * @param[in] parentSize Tile's parent size. - * @param[in] addBackground Whether to add a background graphic to the tile or not + * @param[in] position The tiles relative position within a page * * @return The Actor for the created tile. */ - Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground ); + Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, Dali::Vector2& position ); + + // Signal handlers /** - * Create a stencil image + * Signal emitted when any tile has been pressed + * + * @param[in] actor The Actor representing this tile. + * @param[in] event The Touch information. * - * @return The stencil image + * @return Consume flag */ - Dali::ImageActor NewStencilImage(); - - // Signal handlers + bool OnTilePressed( Dali::Actor actor, const Dali::TouchData& event ); /** - * Signal emitted when any tile has been pressed + * Called by OnTilePressed & Accessibility to do the appropriate action. * * @param[in] actor The Actor representing this tile. - * @param[in] event The TouchEvent + * @param[in] state The Touch state * * @return Consume flag */ - bool OnTilePressed( Dali::Actor actor, const Dali::TouchEvent& event ); + bool DoTilePress( Dali::Actor actor, Dali::PointState::Type state ); /** * Signal emitted when any tile has been hovered @@ -232,11 +214,11 @@ private: // Application callbacks & implementation * (other than those touches consumed by OnTilePressed) * * @param[in] actor The Actor touched. - * @param[in] event The TouchEvent + * @param[in] event The Touch information. * * @return Consume flag */ - bool OnScrollTouched( Dali::Actor actor, const Dali::TouchEvent& event ); + bool OnScrollTouched( Dali::Actor actor, const Dali::TouchData& event ); /** * Setup the effect on the scroll view @@ -280,9 +262,9 @@ private: // Application callbacks & implementation * * @param[in] layer The layer to add the actors to * @param[in] count The number of actors to generate - * @param[in] distanceField The distance field bitmap to use + * @param[in] distanceField A array (pointer) to 2 distance field types to use */ - void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField ); + void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage* distanceField ); /** * Create a bitmap with the specified shape and also output a distance field @@ -308,8 +290,9 @@ private: // Application callbacks & implementation * @param[in] size The size of the bitmap to create * @param[out] imageOut The return bitmap * @param[out] distanceFieldOut The return depth field alpha map + * @param[in] hollow Optional - Set to true for a thick circle outline without fill */ - void GenerateCircle( const Dali::Size& size, std::vector& distanceFieldOut ); + void GenerateCircle( const Dali::Size& size, std::vector& distanceFieldOut, bool hollow = false ); /** * Creates the logo. @@ -318,7 +301,7 @@ private: // Application callbacks & implementation * * @return The created image actor */ - Dali::ImageActor CreateLogo( std::string imagePath ); + Dali::Toolkit::ImageView CreateLogo( std::string imagePath ); /** * Timer handler for ending background animation @@ -338,6 +321,11 @@ private: // Application callbacks & implementation void PlayAnimation(); /** + * @brief Creates and sets up the custom effect used for the keyboard (and mouse) focus. + */ + void CreateFocusEffect(); + + /** * Callback when the keyboard focus is going to be changed. * * @param[in] current The current focused actor @@ -345,7 +333,7 @@ private: // Application callbacks & implementation * @param[in] direction The direction to move the focus * @return The actor to move the keyboard focus to. */ - Dali::Actor OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction ); + Dali::Actor OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction ); /** * Callback when the keyboard focused actor is activated. @@ -367,11 +355,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 * @@ -380,6 +363,12 @@ private: // Application callbacks & implementation void OnButtonsPageRelayout( const Dali::Actor& actor ); /** + * @brief The is connected to the keyboard focus highlight actor, and called when it is placed on stage. + * @param[in] actor The actor that has been placed on stage. + */ + void OnStageConnect( Dali::Actor actor ); + + /** * @brief Callback called to set up background actors * * @param[in] actor The actor raising the callback @@ -389,38 +378,39 @@ private: // Application callbacks & implementation private: Dali::Application& mApplication; ///< Application instance. - Dali::Layer mBackgroundLayer; ///< Background resides on a separate layer. - Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor) + Dali::Toolkit::Control mRootActor; ///< All content (excluding background is anchored to this Actor) Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor. - Dali::ImageActor mBackground; ///< Background's static image. Dali::Animation mPressedAnimation; ///< Button press scaling animation. - Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer. Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples) 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 + + /** + * This struct encapsulates all data relevant to each of the elements used within the custom keyboard focus effect. + */ + struct FocusEffect + { + Dali::Toolkit::ImageView actor; ///< The parent keyboard focus highlight actor + Dali::Animation animation; ///< The animation for the parent keyboard focus highlight actor + }; + FocusEffect mFocusEffect[FOCUS_ANIMATION_ACTOR_NUMBER]; ///< The elements used to create the custom focus effect 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. - std::string mBackgroundImagePath; ///< The path to the background image. + float mPageWidth; ///< The width of a page within the scroll-view, used to calculate the domain int mTotalPages; ///< Total pages within scrollview. 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 }; -#endif // __DALI_DEMO_H__ +#endif // DALI_DEMO_H