/*
+ * Samsung API
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
// CLASS HEADER
} // 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 )
}
}
+bool WidgetView::PauseWidget()
+{
+ int ret = widget_instance_pause( mWidgetId.c_str(), mInstanceId.c_str() );
+ if( ret < 0 )
+ {
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::PauseWidget: Fail to pause widget(%s, %s) [%d]\n", mWidgetId.c_str(), mInstanceId.c_str(), ret );
+ return false;
+ }
+
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::PauseWidget: Widget is paused (%s, %s)\n", mWidgetId.c_str(), mInstanceId.c_str() );
+
+ return true;
+}
+
+bool WidgetView::ResumeWidget()
+{
+ int ret = widget_instance_resume( mWidgetId.c_str(), mInstanceId.c_str() );
+ if( ret < 0 )
+ {
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ResumeWidget: Fail to resume widget(%s, %s) [%d]\n", mWidgetId.c_str(), mInstanceId.c_str(), ret );
+ return false;
+ }
+
+ DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ResumeWidget: Widget is resumed (%s, %s)\n", mWidgetId.c_str(), mInstanceId.c_str() );
+
+ return true;
+}
+
const std::string& WidgetView::GetWidgetId() const
{
return mWidgetId;
return mTitle;
}
-double WidgetView::GetPeriod() const
+double WidgetView::GetUpdatePeriod() const
+{
+ return mUpdatePeriod;
+}
+
+void WidgetView::Show()
{
- return mPeriod;
+ if( mObjectView )
+ {
+ mObjectView.Show();
+ }
+}
+
+void WidgetView::Hide()
+{
+ if( mObjectView )
+ {
+ mObjectView.Hide();
+ }
+}
+
+bool WidgetView::CancelTouchEvent()
+{
+ if( mObjectView )
+ {
+ return mObjectView.CancelTouchEvent();
+ }
+
+ return false;
}
void WidgetView::SetPreviewEnabled( bool enabled )
if( mPid < 0)
{
DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ActivateFaultedWidget: widget_instance_launch is failed. [%s]\n", mWidgetId.c_str() );
+
+ // Emit signal
+ Dali::WidgetView::WidgetView handle( GetOwner() );
+ mWidgetCreationAbortedSignal.Emit( handle );
+
return;
}
// 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;
+ }
+ case WIDGET_INSTANCE_EVENT_FAULT:
+ {
+ mWidgetFaultedSignal.Emit( handle );
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetAddedSignal()
return mWidgetDeletedSignal;
}
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetCreationAbortedSignal()
+{
+ return mWidgetCreationAbortedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetResizedSignal()
+{
+ return mWidgetResizedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetContentUpdatedSignal()
+{
+ return mWidgetContentUpdatedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetExtraInfoUpdatedSignal()
+{
+ return mWidgetExtraInfoUpdatedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetUpdatePeriodChangedSignal()
+{
+ return mWidgetUpdatePeriodChangedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetFaultedSignal()
+{
+ return mWidgetFaultedSignal;
+}
+
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() );
+ mWidgetCreationAbortedSignal.Emit( handle );
+
return;
}
DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_launch is called. [%s, mPid = %d]\n", mWidgetId.c_str(), mPid );
}
+void WidgetView::OnSizeSet( const Vector3& targetSize )
+{
+ if( mObjectView )
+ {
+ mObjectView.SetSize( targetSize );
+ }
+}
+
} // namespace Internal
} // namespace WidgetView