DALi Version 1.2.8
[platform/core/uifw/dali-demo.git] / demo / dali-table-view.h
index c712a5b..749bf4b 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_DEMO_H
-#define DALI_DEMO_H
+#ifndef __DALI_DEMO_H__
+#define __DALI_DEMO_H__
 
 /*
- * Copyright (c) 2016 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.
@@ -98,6 +98,15 @@ public:
 private: // Application callbacks & implementation
 
   /**
+   * Shape enum for create function
+   */
+  enum ShapeType
+  {
+    CIRCLE,
+    BUBBLE
+  };
+
+  /**
    * Initialize application.
    *
    * @param[in] app Application instance
@@ -126,16 +135,16 @@ 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] color The color (including alpha) of the tiles contents.
+   * @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, const Dali::Vector4& color );
+  Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, Dali::Vector2& position );
 
   // Signal handlers
 
@@ -241,6 +250,50 @@ private: // Application callbacks & implementation
   void OnKeyEvent( const Dali::KeyEvent& event );
 
   /**
+   * Create a depth field background
+   *
+   * @param[in] bubbleLayer Add the graphics to this layer
+   */
+  void SetupBackground( Dali::Actor bubbleLayer );
+
+  /**
+   * Create background actors for the given layer
+   *
+   * @param[in] layer The layer to add the actors to
+   * @param[in] count The number of actors to generate
+   * @param[in] distanceField A array (pointer) to 2 distance field types to use
+   */
+  void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage* distanceField );
+
+  /**
+   * Create a bitmap with the specified shape and also output a distance field
+   *
+   * @param[in] shapeType The shape to generate
+   * @param[in] size The size of the bitmap to create
+   * @param[out] distanceFieldOut The return depth field alpha map
+   */
+  void CreateShapeImage( ShapeType shapeType, const Dali::Size& size, Dali::BufferImage& distanceFieldOut );
+
+  /**
+   * Generate a square bit pattern and depth field
+   *
+   * @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
+   */
+  void GenerateSquare( const Dali::Size& size, std::vector<unsigned char>& distanceFieldOut );
+
+  /**
+   * Generate a circle bit pattern and depth field
+   *
+   * @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<unsigned char>& distanceFieldOut, bool hollow = false );
+
+  /**
    * Creates the logo.
    *
    * @param[in] imagePath The path to the image file to load
@@ -250,6 +303,23 @@ private: // Application callbacks & implementation
   Dali::Toolkit::ImageView CreateLogo( std::string imagePath );
 
   /**
+   * Timer handler for ending background animation
+   *
+   * @return Return value for timer handler
+   */
+  bool PauseBackgroundAnimation();
+
+  /**
+   * Pause all animations
+   */
+  void PauseAnimation();
+
+  /**
+   * Resume all animations
+   */
+  void PlayAnimation();
+
+  /**
    * Callback when the keyboard focus is going to be changed.
    *
    * @param[in] current The current focused actor
@@ -286,30 +356,50 @@ 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
+  */
+ void InitialiseBackgroundActors( Dali::Actor actor );
+
 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::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::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::Toolkit::ImageView        mFocusContainer;           ///< The parent keyboard focus highlight actor
+  Dali::Toolkit::ImageView        mFocusInner;               ///< The child keyboard focus highlight actor
+  Dali::Animation                 mFocusAnimation;           ///< The animation for the parent keyboard focus highlight actor
+  Dali::Animation                 mFocusAnimationInner;      ///< The animation for the child keyboard focus highlight actor
+
   std::vector< Dali::Actor >      mPages;                    ///< List of pages.
+  AnimationList                   mBackgroundAnimations;     ///< List of background bubble animations
   ExampleList                     mExampleList;              ///< List of examples.
 
+  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
 
 };
 
-#endif // DALI_DEMO_H
+#endif // __DALI_DEMO_H__