(Indicator) Added SetIndicatorStyle()
authorSinjae Lee <sinjae4b.lee@samsung.com>
Thu, 29 May 2014 15:49:01 +0000 (00:49 +0900)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 10 Jun 2014 15:43:45 +0000 (16:43 +0100)
adaptors/tizen/internal/common/indicator-impl.cpp
adaptors/tizen/internal/common/indicator-impl.h
adaptors/tizen/internal/common/window-impl.cpp
adaptors/tizen/internal/common/window-impl.h
adaptors/tizen/public-api/adaptor-framework/common/window.cpp
capi/dali/public-api/adaptor-framework/common/window.h

index 338a1de..c4a18b6 100644 (file)
@@ -79,6 +79,8 @@ const float TRANSPARENT_THRESHOLD(0.05f);
 // Indicator orientation
 const char* ELM_INDICATOR_PORTRAIT("elm_indicator_portrait");
 const char* ELM_INDICATOR_LANDSCAPE("elm_indicator_landscape");
+const char* ELM_INDICATOR_PORTRAIT_FIXED_COLOR_STYLE("elm_indicator_portrait_fixed");
+const char* ELM_INDICATOR_LANDSCAPE_FIXED_COLOR_STYLE("elm_indicator_landscape_fixed");
 
 const char* MESH_VERTEX_SHADER =
 "attribute lowp vec3     aColor;\n"
@@ -362,9 +364,10 @@ bool Indicator::ScopedLock::IsLocked()
   return mLocked;
 }
 
-Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, Observer* observer )
+Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, Dali::Window::IndicatorStyle style, Observer* observer )
 : mPixmap( 0 ),
   mConnection( this ),
+  mStyle( style ),
   mOpacityMode( Dali::Window::OPAQUE ),
   mState( DISCONNECTED ),
   mAdaptor(adaptor),
@@ -677,16 +680,44 @@ bool Indicator::Connect( Dali::Window::WindowOrientation orientation )
   switch( orientation )
   {
     case Dali::Window::PORTRAIT:
-      connected = Connect( ELM_INDICATOR_PORTRAIT );
+      if(mStyle == Dali::Window::FIXED_COLOR)
+      {
+        connected = Connect( ELM_INDICATOR_PORTRAIT_FIXED_COLOR_STYLE );
+      }
+      else
+      {
+        connected = Connect( ELM_INDICATOR_PORTRAIT );
+      }
       break;
     case Dali::Window::PORTRAIT_INVERSE:
-      connected = Connect( ELM_INDICATOR_PORTRAIT );
+      if(mStyle == Dali::Window::FIXED_COLOR)
+      {
+        connected = Connect( ELM_INDICATOR_PORTRAIT_FIXED_COLOR_STYLE );
+      }
+      else
+      {
+        connected = Connect( ELM_INDICATOR_PORTRAIT );
+      }
       break;
     case Dali::Window::LANDSCAPE:
-      connected = Connect( ELM_INDICATOR_LANDSCAPE );
+      if(mStyle == Dali::Window::FIXED_COLOR)
+      {
+        connected = Connect( ELM_INDICATOR_LANDSCAPE_FIXED_COLOR_STYLE );
+      }
+      else
+      {
+        connected = Connect( ELM_INDICATOR_LANDSCAPE );
+      }
       break;
     case Dali::Window::LANDSCAPE_INVERSE:
-      connected = Connect( ELM_INDICATOR_LANDSCAPE );
+      if(mStyle == Dali::Window::FIXED_COLOR)
+      {
+        connected = Connect( ELM_INDICATOR_LANDSCAPE_FIXED_COLOR_STYLE );
+      }
+      else
+      {
+        connected = Connect( ELM_INDICATOR_LANDSCAPE );
+      }
       break;
   }
 
index f1a5406..1688457 100644 (file)
@@ -163,6 +163,7 @@ public:
    */
   Indicator( Adaptor* adaptor,
              Dali::Window::WindowOrientation orientation,
+             Dali::Window::IndicatorStyle style,
              Observer* observer );
 
   /**
@@ -398,6 +399,7 @@ private:
   Dali::Timer                      mReconnectTimer;      ///< Reconnection timer
   SlotDelegate< Indicator >        mConnection;
 
+  Dali::Window::IndicatorStyle     mStyle;               ///< Style of the indicator
   Dali::Window::IndicatorBgOpacity mOpacityMode;         ///< Opacity enum for background
   Indicator::State                 mState;               ///< The connection state
 
index 0607004..6bc40ca 100644 (file)
@@ -236,6 +236,11 @@ RenderSurface* Window::GetSurface()
   return mSurface;
 }
 
+void Window::SetIndicatorStyle( Dali::Window::IndicatorStyle style )
+{
+  mIndicatorStyle = style;
+}
+
 void Window::ShowIndicator( bool show )
 {
   DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "%s\n", show?"SHOW":"HIDE" );
@@ -323,6 +328,7 @@ void Window::SetClass(std::string name, std::string klass)
 
 Window::Window()
 : mSurface(NULL),
+  mIndicatorStyle(Dali::Window::CHANGEABLE_COLOR),
   mIndicatorVisible(Dali::Window::VISIBLE),
   mIndicatorIsShown(false),
   mShowRotatedIndicatorOnClose(false),
@@ -370,7 +376,7 @@ void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
   {
     if( mIndicatorVisible != Dali::Window::INVISIBLE )
     {
-      mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, this );
+      mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, mIndicatorStyle, this );
       mIndicator->SetOpacityMode( mIndicatorOpacityMode );
       Dali::Actor actor = mIndicator->GetActor();
       SetIndicatorActorRotation();
index 2dc9c72..a1f33fd 100644 (file)
@@ -81,6 +81,11 @@ public:
   RenderSurface* GetSurface();
 
   /**
+   * @copydoc Dali::Window::SetIndicatorStyle()
+   */
+  void SetIndicatorStyle( Dali::Window::IndicatorStyle style );
+
+  /**
    * @copydoc Dali::Window::ShowIndicator()
    */
   void ShowIndicator( bool show );
@@ -249,6 +254,7 @@ private:
   typedef std::vector<Indicator*> DiscardedIndicators;
 
   RenderSurface*                   mSurface;
+  Dali::Window::IndicatorStyle     mIndicatorStyle;     ///< indicator style
   Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state
   bool                             mIndicatorIsShown:1; ///< private state
   bool                             mShowRotatedIndicatorOnClose:1;
index f80bbc8..b2f7086 100644 (file)
@@ -39,6 +39,11 @@ Window::~Window()
 {
 }
 
+void Window::SetIndicatorStyle( IndicatorStyle style )
+{
+  GetImplementation(*this).SetIndicatorStyle( style );
+}
+
 void Window::ShowIndicator( bool show )
 {
   GetImplementation(*this).ShowIndicator( show );
index 4887315..1698cca 100644 (file)
@@ -87,6 +87,14 @@ public:
     AUTO = 2 // hide in default, will show when necessary
   };
 
+  /**
+   * @brief Style of the indicator.
+   */
+  enum IndicatorStyle
+  {
+    FIXED_COLOR = 0, // fixed color style
+    CHANGEABLE_COLOR // changeable color style
+  };
 
   // Methods
 
@@ -118,6 +126,14 @@ public:
   using BaseHandle::operator=;
 
   /**
+   * @brief This sets the style of indicator
+   * @param[in] style style type of the indicator
+   *
+   * @note This should be called before ShowIndicator()
+   */
+  void SetIndicatorStyle( IndicatorStyle style );
+
+  /**
    * @brief This sets whether the indicator bar should be shown or not.
    * @param[in] show - true if the indicator bar should be shown
    * @deprecated use "void ShowIndicator( IndicatorVisibleMode visibleMode )"