mWatcherHandle( NULL ),
mRemoteSurface( NULL ),
mBuffer( NULL ),
- mReloadFlag( false )
+ mReloadFlag( false ),
+ mCreated( false ),
+ mResizeRequired( false )
{
}
mWatcherHandle( NULL ),
mRemoteSurface( NULL ),
mBuffer( NULL ),
- mReloadFlag( false )
+ mReloadFlag( false ),
+ mCreated( false ),
+ mResizeRequired( false )
{
}
if( !mWidgetId.empty() && !mInstanceId.empty() )
{
int ret = 0;
- ret = widget_instance_terminate( mInstanceId.c_str() );
- if( ret < 0 )
- {
- DALI_LOG_ERROR("widget_instance_terminate() is failed.");
- return false;
- }
- /*
- After TerminateWidget() is called, widget will be not used.
- so call widget_instance_destroy() is more appropriate.
- only call widget_instance_terminate(), appFW consider this instance will be reuse.
- */
+ // Destroy widget instance because it will be not used anymore.
ret = widget_instance_destroy( mInstanceId.c_str() );
if( ret < 0 )
{
mInstanceId.clear();
CloseRemoteSurface();
+
+ mCreated = false;
+ mResizeRequired = false;
return true;
}
// Emit signal
switch( event )
{
+ case WIDGET_INSTANCE_EVENT_CREATE:
+ {
+ mCreated = true;
+ if( mResizeRequired )
+ {
+ widget_instance_resize(mInstanceId.c_str(), mWidth, mHeight);
+ mResizeRequired = false;
+ }
+ break;
+ }
case WIDGET_INSTANCE_EVENT_UPDATE:
case WIDGET_INSTANCE_EVENT_EXTRA_UPDATED:
{
void WidgetView::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
Control::OnRelayout( size, container );
- widget_instance_resize(mInstanceId.c_str(), size.x, size.y);
+
+ // When widget is not created, we can't call widget_instance_resize().
+ // in this case, we just save the size and do resize when instance is created.
+ if( mCreated )
+ {
+ widget_instance_resize(mInstanceId.c_str(), size.x, size.y);
+ }
+ else
+ {
+ mResizeRequired = true;
+ mWidth = size.x;
+ mHeight = size.y;
+ }
}
void WidgetView::OnSizeAnimation( Animation& animation, const Vector3& targetSize )