From 614cafbe540c48837148ebb8b439b721da11811a Mon Sep 17 00:00:00 2001 From: Sinjae Lee Date: Fri, 30 May 2014 00:49:01 +0900 Subject: [PATCH] (Indicator) Added SetIndicatorStyle() --- adaptors/tizen/internal/common/indicator-impl.cpp | 41 +++++++++++++++++++--- adaptors/tizen/internal/common/indicator-impl.h | 2 ++ adaptors/tizen/internal/common/window-impl.cpp | 8 ++++- adaptors/tizen/internal/common/window-impl.h | 6 ++++ .../public-api/adaptor-framework/common/window.cpp | 5 +++ .../public-api/adaptor-framework/common/window.h | 16 +++++++++ 6 files changed, 72 insertions(+), 6 deletions(-) diff --git a/adaptors/tizen/internal/common/indicator-impl.cpp b/adaptors/tizen/internal/common/indicator-impl.cpp index 338a1de..c4a18b6 100644 --- a/adaptors/tizen/internal/common/indicator-impl.cpp +++ b/adaptors/tizen/internal/common/indicator-impl.cpp @@ -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; } diff --git a/adaptors/tizen/internal/common/indicator-impl.h b/adaptors/tizen/internal/common/indicator-impl.h index f1a5406..1688457 100644 --- a/adaptors/tizen/internal/common/indicator-impl.h +++ b/adaptors/tizen/internal/common/indicator-impl.h @@ -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 diff --git a/adaptors/tizen/internal/common/window-impl.cpp b/adaptors/tizen/internal/common/window-impl.cpp index 0607004..6bc40ca 100644 --- a/adaptors/tizen/internal/common/window-impl.cpp +++ b/adaptors/tizen/internal/common/window-impl.cpp @@ -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(); diff --git a/adaptors/tizen/internal/common/window-impl.h b/adaptors/tizen/internal/common/window-impl.h index 2dc9c72..a1f33fd 100644 --- a/adaptors/tizen/internal/common/window-impl.h +++ b/adaptors/tizen/internal/common/window-impl.h @@ -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 DiscardedIndicators; RenderSurface* mSurface; + Dali::Window::IndicatorStyle mIndicatorStyle; ///< indicator style Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state bool mIndicatorIsShown:1; ///< private state bool mShowRotatedIndicatorOnClose:1; diff --git a/adaptors/tizen/public-api/adaptor-framework/common/window.cpp b/adaptors/tizen/public-api/adaptor-framework/common/window.cpp index f80bbc8..b2f7086 100644 --- a/adaptors/tizen/public-api/adaptor-framework/common/window.cpp +++ b/adaptors/tizen/public-api/adaptor-framework/common/window.cpp @@ -39,6 +39,11 @@ Window::~Window() { } +void Window::SetIndicatorStyle( IndicatorStyle style ) +{ + GetImplementation(*this).SetIndicatorStyle( style ); +} + void Window::ShowIndicator( bool show ) { GetImplementation(*this).ShowIndicator( show ); diff --git a/capi/dali/public-api/adaptor-framework/common/window.h b/capi/dali/public-api/adaptor-framework/common/window.h index 4887315..1698cca 100644 --- a/capi/dali/public-api/adaptor-framework/common/window.h +++ b/capi/dali/public-api/adaptor-framework/common/window.h @@ -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 )" -- 2.7.4