(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 338a1de22cd1af62f496d5a53879e978d9118455..c4a18b6a2884f3cc72e2803bb50a87dc08c218cd 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 f1a5406d31c83c2ddce949a0ea0ae3d3781f3805..1688457b208dff52cf16644782b14eed00ab0d6a 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 0607004ca5e773da5c2d22e4976d27b84dc1a2ef..6bc40cae30161150a3eabc4c39fb071ba6d9ee98 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 2dc9c72ecd7f0125a454221c6e431138a6549243..a1f33fdc91257742914dc5db906482d3828ca0d5 100644 (file)
@@ -80,6 +80,11 @@ public:
    */
   RenderSurface* GetSurface();
 
+  /**
+   * @copydoc Dali::Window::SetIndicatorStyle()
+   */
+  void SetIndicatorStyle( Dali::Window::IndicatorStyle style );
+
   /**
    * @copydoc Dali::Window::ShowIndicator()
    */
@@ -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 f80bbc8c65db77c3482d24171065f8548661380d..b2f7086f5eabaa92aa4e7ac27a9855f0410e753d 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 4887315ee61c2d90f855ef492ace095aa2ee8792..1698ccaebc3869bf82b80cf46c11d86e13ac94e3 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
 
@@ -117,6 +125,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