} // unnamed namespace
-Dali::WidgetView::WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+Dali::WidgetView::WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
{
// Create the implementation, temporarily owned on stack
- IntrusivePtr< WidgetView > internalWidgetView = new WidgetView( widgetId, contentInfo, width, height, period );
+ IntrusivePtr< WidgetView > internalWidgetView = new WidgetView( widgetId, contentInfo, width, height, updatePeriod );
// Pass ownership to CustomActor
Dali::WidgetView::WidgetView widgetView( *internalWidgetView );
mWidth( 0 ),
mHeight( 0 ),
mPid( 0 ),
- mPeriod( 0.0 ),
+ mUpdatePeriod( 0.0 ),
mPreviewEnabled( true ),
mStateTextEnabled( true ),
mPermanentDelete( true )
{
}
-WidgetView::WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+WidgetView::WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
mWidgetId( widgetId ),
mInstanceId(),
mWidth( width ),
mHeight( height ),
mPid( 0 ),
- mPeriod( period ),
+ mUpdatePeriod( updatePeriod ),
mPreviewEnabled( true ),
mStateTextEnabled( true ),
mPermanentDelete( true )
return mTitle;
}
-double WidgetView::GetPeriod() const
+double WidgetView::GetUpdatePeriod() const
{
- return mPeriod;
+ return mUpdatePeriod;
}
void WidgetView::Show()
// Emit signal
Dali::WidgetView::WidgetView handle( GetOwner() );
mWidgetAddedSignal.Emit( handle );
+
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::AddObjectView: ObjectView is added.\n" );
}
void WidgetView::RemoveObjectView()
{
+ // Enable preview and text
+ if( mPreviewEnabled )
+ {
+ mPreviewImage.SetVisible( true );
+ }
+
+ if( mStateTextEnabled )
+ {
+ mStateText.SetVisible( true );
+ }
+
// Emit signal
Dali::WidgetView::WidgetView handle( GetOwner() );
mWidgetDeletedSignal.Emit( handle );
mObjectView.Reset();
+
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::RemoveObjectView: ObjectView is removed.\n" );
+}
+
+void WidgetView::SendWidgetEvent( int event )
+{
+ Dali::WidgetView::WidgetView handle( GetOwner() );
+
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::SendWidgetEvent: event = %d widget = %s\n", event, mWidgetId.c_str() );
+
+ // Emit signal
+ switch( event )
+ {
+ case WIDGET_INSTANCE_EVENT_UPDATE:
+ {
+ mWidgetContentUpdatedSignal.Emit( handle );
+ break;
+ }
+ case WIDGET_INSTANCE_EVENT_PERIOD_CHANGED:
+ {
+ mWidgetUpdatePeriodChangedSignal.Emit( handle );
+ break;
+ }
+ case WIDGET_INSTANCE_EVENT_SIZE_CHANGED:
+ {
+ mWidgetResizedSignal.Emit( handle );
+ break;
+ }
+ case WIDGET_INSTANCE_EVENT_EXTRA_UPDATED:
+ {
+ mWidgetExtraInfoUpdatedSignal.Emit( handle );
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetAddedSignal()
return mWidgetDeletedSignal;
}
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetAbortedSignal()
+{
+ return mWidgetAbortedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetResized()
+{
+ return mWidgetResizedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetContentUpdated()
+{
+ return mWidgetContentUpdatedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetExtraInfoUpdated()
+{
+ return mWidgetExtraInfoUpdatedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetUpdatePeriodChanged()
+{
+ return mWidgetUpdatePeriodChangedSignal;
+}
+
void WidgetView::OnInitialize()
{
char* instanceId = NULL;
if( mPid < 0)
{
DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_launch is failed. [%s]\n", mWidgetId.c_str() );
+
+ // Emit signal
+ Dali::WidgetView::WidgetView handle( GetOwner() );
+ mWidgetAbortedSignal.Emit( handle );
+
return;
}
/**
* @copydoc Dali::WidgetView::WidgetView::New
*/
- static Dali::WidgetView::WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+ static Dali::WidgetView::WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
/**
* @copydoc Dali::WidgetView::WidgetView::GetWidgetId
const std::string& GetTitle();
/**
- * @copydoc Dali::WidgetView::WidgetView::GetPeriod
+ * @copydoc Dali::WidgetView::WidgetView::GetUpdatePeriod
*/
- double GetPeriod() const;
+ double GetUpdatePeriod() const;
/**
* @copydoc Dali::WidgetView::WidgetView::Show
void AddObjectView( Pepper::ObjectView objectView );
void RemoveObjectView();
+ void SendWidgetEvent( int event );
+
public: //Signals
+ /**
+ * @copydoc Dali::WidgetView::WidgetView::WidgetAddedSignal
+ */
Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetAddedSignal();
+
+ /**
+ * @copydoc Dali::WidgetView::WidgetView::WidgetDeletedSignal
+ */
Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetDeletedSignal();
+ /**
+ * @copydoc Dali::WidgetView::WidgetView::WidgetAbortedSignal
+ */
+ Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetAbortedSignal();
+
+ /**
+ * @copydoc Dali::WidgetView::WidgetView::WidgetResized
+ */
+ Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetResized();
+
+ /**
+ * @copydoc Dali::WidgetView::WidgetView::WidgetContentUpdated
+ */
+ Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetContentUpdated();
+
+ /**
+ * @copydoc Dali::WidgetView::WidgetView::WidgetExtraInfoUpdated
+ */
+ Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetExtraInfoUpdated();
+
+ /**
+ * @copydoc Dali::WidgetView::WidgetView::WidgetUpdatePeriodChanged
+ */
+ Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetUpdatePeriodChanged();
+
protected:
/**
/**
* Construct a new WidgetView.
*/
- WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+ WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
/**
* A reference counted object may only be deleted by calling Unreference()
int mWidth;
int mHeight;
int mPid;
- double mPeriod;
+ double mUpdatePeriod;
bool mPreviewEnabled;
bool mStateTextEnabled;
// Signals
Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetAddedSignal;
Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetDeletedSignal;
+ Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetAbortedSignal;
+ Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetResizedSignal;
+ Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetContentUpdatedSignal;
+ Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetExtraInfoUpdatedSignal;
+ Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetUpdatePeriodChangedSignal;
};
} // namespace Internal
WidgetViewManager::~WidgetViewManager()
{
+ widget_instance_unlisten_event( WidgetViewManager::WidgetEventCallback );
widget_instance_fini();
}
// init widget service
widget_instance_init( name.c_str() );
+ widget_instance_listen_event( WidgetViewManager::WidgetEventCallback, this );
DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::Initialize: success.\n" );
return WIDGET_ERROR_NONE;
}
-Dali::WidgetView::WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+Dali::WidgetView::WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
{
// Add a new widget view
- Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::New( widgetId, contentInfo, width, height, period );
+ Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::New( widgetId, contentInfo, width, height, updatePeriod );
std::string instanceId = widgetView.GetInstanceId();
DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::OnObjectViewDeleted: ObjectView is deleted!\n" );
}
+int WidgetViewManager::WidgetEventCallback( const char* widgetId, const char* instanceId, int event, void* data )
+{
+ WidgetViewManager* widgetViewManager = static_cast< WidgetViewManager* >( data );
+
+ if( widgetViewManager->mWidgetViewContainer.size() > 0)
+ {
+ WidgetViewIter iter = widgetViewManager->mWidgetViewContainer.find( std::string( instanceId ) );
+ if( iter != widgetViewManager->mWidgetViewContainer.end() )
+ {
+ Dali::WidgetView::WidgetView widgetView = iter->second;
+
+ Dali::WidgetView::GetImplementation( widgetView ).SendWidgetEvent( event );
+
+ return 0;
+ }
+ }
+
+ DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::WidgetEventCallback: WidgetView is not found! [%s, %s]\n", widgetId, instanceId );
+
+ return 0;
+}
+
} // namespace Internal
} // namespace WidgetView
/**
* @copydoc Dali::WidgetView::WidgetViewManager::AddWidget()
*/
- Dali::WidgetView::WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+ Dali::WidgetView::WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
private:
void OnObjectViewAdded( Pepper::Compositor compositor, Pepper::ObjectView objectView );
void OnObjectViewDeleted( Pepper::Compositor compositor, Pepper::ObjectView objectView );
+ static int WidgetEventCallback( const char* widgetId, const char* instanceId, int event, void* data );
+
private:
// Undefined
namespace WidgetView
{
-WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
{
- return Internal::WidgetView::New( widgetId, contentInfo, width, height, period );
+ return Internal::WidgetView::New( widgetId, contentInfo, width, height, updatePeriod );
}
WidgetView WidgetView::DownCast( BaseHandle handle )
return Dali::WidgetView::GetImplementation( *this ).GetTitle();
}
-double WidgetView::GetPeriod() const
+double WidgetView::GetUpdatePeriod() const
{
- return Dali::WidgetView::GetImplementation( *this ).GetPeriod();
+ return Dali::WidgetView::GetImplementation( *this ).GetUpdatePeriod();
}
void WidgetView::Show()
return Dali::WidgetView::GetImplementation(*this).WidgetDeletedSignal();
}
+WidgetView::WidgetViewSignalType& WidgetView::WidgetAbortedSignal()
+{
+ return Dali::WidgetView::GetImplementation(*this).WidgetAbortedSignal();
+}
+
+WidgetView::WidgetViewSignalType& WidgetView::WidgetResized()
+{
+ return Dali::WidgetView::GetImplementation(*this).WidgetResized();
+}
+
+WidgetView::WidgetViewSignalType& WidgetView::WidgetContentUpdated()
+{
+ return Dali::WidgetView::GetImplementation(*this).WidgetContentUpdated();
+}
+
+WidgetView::WidgetViewSignalType& WidgetView::WidgetExtraInfoUpdated()
+{
+ return Dali::WidgetView::GetImplementation(*this).WidgetExtraInfoUpdated();
+}
+
+WidgetView::WidgetViewSignalType& WidgetView::WidgetUpdatePeriodChanged()
+{
+ return Dali::WidgetView::GetImplementation(*this).WidgetUpdatePeriodChanged();
+}
+
WidgetView::WidgetView( Internal::WidgetView& implementation )
: Control( implementation )
{
* @param[in] contentInfo Contents that will be given to the widget instance.
* @param[in] width The widget width.
* @param[in] height The widget height.
- * @param[in] period The period of updating contents of the widget.
+ * @param[in] updatePeriod The period of updating contents of the widget.
* @return A handle to WidgetView.
*/
- static WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+ static WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
/**
* @brief Downcast a handle to WidgetView handle.
const std::string& GetTitle();
/**
- * @brief Get the update period of the widget.
+ * @brief Get the update period of the widget content.
*
* @since_tizen 3.0
* @privlevel public
* @privilege %http://tizen.org/privilege/widget.viewer
- * @return The update period of the widget.
+ * @return The update period of the widget content.
*/
- double GetPeriod() const;
+ double GetUpdatePeriod() const;
/**
* @brief Shows the widget.
* @brief This signal is emitted when the widget is added.
*
* @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/widget.viewer
* @return The signal to connect to.
*/
WidgetViewSignalType& WidgetAddedSignal();
* @brief This signal is emitted when the widget is deleted.
*
* @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/widget.viewer
* @return The signal to connect to.
*/
WidgetViewSignalType& WidgetDeletedSignal();
+ /**
+ * @brief This signal is emitted when the widget is aborted.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/widget.viewer
+ * @return The signal to connect to.
+ */
+ WidgetViewSignalType& WidgetAbortedSignal();
+
+ /**
+ * @brief This signal is emitted when the widget is resized.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/widget.viewer
+ * @return The signal to connect to.
+ */
+ WidgetViewSignalType& WidgetResized();
+
+ /**
+ * @brief This signal is emitted when the widget content is updated.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/widget.viewer
+ * @return The signal to connect to.
+ */
+ WidgetViewSignalType& WidgetContentUpdated();
+
+ /**
+ * @brief This signal is emitted when the widget extra info is updated.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/widget.viewer
+ * @return The signal to connect to.
+ */
+ WidgetViewSignalType& WidgetExtraInfoUpdated();
+
+ /**
+ * @brief This signal is emitted when the widget update period is changed.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/widget.viewer
+ * @return The signal to connect to.
+ */
+ WidgetViewSignalType& WidgetUpdatePeriodChanged();
+
public: // Not intended for application developers
/**
{
}
-WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod )
{
- return GetImplementation(*this).AddWidget( widgetId, contentInfo, width, height, period );
+ return GetImplementation(*this).AddWidget( widgetId, contentInfo, width, height, updatePeriod );
}
} // namespace WidgetView
* @param[in] contentInfo Contents that will be given to the widget instance.
* @param[in] width The widget width.
* @param[in] height The widget height.
- * @param[in] period The period of updating contents of the widget.
+ * @param[in] updatePeriod The period of updating contents of the widget.
* @return A handle to WidgetView.
*/
- WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+ WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double updatePeriod );
public: // Not intended for application developers