Additionally, correctly sets the background renderer size when OnSizeSet is called.
Change-Id: I6952e0a2e317b54bdb28adf2b013ca1244595522
void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
-void DummyControlImplOverride::OnStageConnection( int depth ) { stageConnectionCalled = true; }
-void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; }
+void DummyControlImplOverride::OnStageConnection( int depth ) { Control::OnStageConnection( depth ); stageConnectionCalled = true; }
+void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); }
void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
-void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; }
-void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; }
+void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; }
+void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; }
bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
void BloomView::OnSizeSet(const Vector3& targetSize)
{
+ Control::OnSizeSet( targetSize );
+
mTargetSize = Vector2(targetSize);
mChildrenRoot.SetSize(targetSize);
mCompositeImageActor.SetSize(targetSize);
}
}
-void BloomView::OnControlChildAdd( Actor& child )
+void BloomView::OnChildAdd( Actor& child )
{
+ Control::OnChildAdd( child );
+
if( child != mChildrenRoot && child != mInternalRoot)
{
mChildrenRoot.Add( child );
}
}
-void BloomView::OnControlChildRemove( Actor& child )
+void BloomView::OnChildRemove( Actor& child )
{
mChildrenRoot.Remove( child );
+
+ Control::OnChildRemove( child );
}
void BloomView::AllocateResources()
virtual void OnSizeSet(const Vector3& targetSize);
/**
- * @copydoc Control::OnControlChildAdd()
+ * @copydoc Control::OnChildAdd()
*/
- virtual void OnControlChildAdd( Actor& child );
+ virtual void OnChildAdd( Actor& child );
/**
- * @copydoc Control::OnControlChildRemove()
+ * @copydoc Control::OnChildRemove()
*/
- virtual void OnControlChildRemove( Actor& child );
+ virtual void OnChildRemove( Actor& child );
void AllocateResources();
void CreateRenderTasks();
return ret;
}
-void Button::OnControlStageDisconnection()
+void Button::OnStageDisconnection()
{
OnButtonStageDisconnection(); // Notification for derived classes.
mState = ButtonUp;
+
+ Control::OnStageDisconnection();
}
void Button::OnTap(Actor actor, const TapGesture& tap)
* Callback received when the button is disconnected from the stage.
* It resets the button status.
*/
- void OnControlStageDisconnection();
+ void OnStageDisconnection();
private:
void EffectsView::OnSizeSet(const Vector3& targetSize)
{
+ Control::OnSizeSet( targetSize );
+
mTargetSize = Vector2(targetSize);
// if we are already on stage, need to update render target sizes now to reflect the new size of this actor
{
mFilters[i]->Disable();
}
+
+ Control::OnStageDisconnection();
}
void EffectsView::SetupFilters()
void GaussianBlurView::OnSizeSet(const Vector3& targetSize)
{
+ Control::OnSizeSet( targetSize );
+
mTargetSize = Vector2(targetSize);
mChildrenRoot.SetSize(targetSize);
}
}
-void GaussianBlurView::OnControlChildAdd( Actor& child )
+void GaussianBlurView::OnChildAdd( Actor& child )
{
+ Control::OnChildAdd( child );
+
if( child != mChildrenRoot && child != mInternalRoot)
{
mChildrenRoot.Add( child );
}
}
-void GaussianBlurView::OnControlChildRemove( Actor& child )
+void GaussianBlurView::OnChildRemove( Actor& child )
{
mChildrenRoot.Remove( child );
+
+ Control::OnChildRemove( child );
}
void GaussianBlurView::AllocateResources()
virtual void OnSizeSet(const Vector3& targetSize);
/**
- * @copydoc Control::OnControlChildAdd()
+ * @copydoc Control::OnChildAdd()
*/
- virtual void OnControlChildAdd( Actor& child );
+ virtual void OnChildAdd( Actor& child );
/**
- * @copydoc Control::OnControlChildRemove()
+ * @copydoc Control::OnChildRemove()
*/
- virtual void OnControlChildRemove( Actor& child );
+ virtual void OnChildRemove( Actor& child );
void SetBlurBellCurveWidth(float blurBellCurveWidth);
float CalcGaussianWeight(float x);
void ImageView::OnSizeSet( const Vector3& targetSize )
{
+ Control::OnSizeSet( targetSize );
+
if( mRenderer )
{
Vector2 size( targetSize );
void Magnifier::OnSizeSet(const Vector3& targetSize)
{
+ Control::OnSizeSet( targetSize );
+
// TODO: Once Camera/CameraActor properties function as proper animatable properties
// this code can disappear.
// whenever the size of the magnifier changes, the field of view needs to change
return true;
}
-void Popup::OnControlStageConnection()
+void Popup::OnStageConnection( int depth )
{
+ Control::OnStageConnection( depth );
+
mLayoutDirty = true;
RelayoutRequest();
}
-void Popup::OnControlChildAdd( Actor& child )
+void Popup::OnChildAdd( Actor& child )
{
+ Control::OnChildAdd( child );
+
// Re-parent any children added by user to the body layer.
if( mAlterAddedChild )
{
/**
* Called when the popup is directly or indirectly parented to the stage.
*/
- virtual void OnControlStageConnection();
+ virtual void OnStageConnection( int depth );
/**
* From Control; called after a child has been added to the owning actor.
* @param[in] child The child which has been added.
*/
- virtual void OnControlChildAdd( Actor& child );
+ virtual void OnChildAdd( Actor& child );
/**
* @copydoc Control::OnRelayOut()
void ScrollView::OnChildAdd(Actor& child)
{
+ ScrollBase::OnChildAdd( child );
+
Dali::Toolkit::ScrollBar scrollBar = Dali::Toolkit::ScrollBar::DownCast(child);
if(scrollBar)
{
{
// TODO: Actor needs a RemoveConstraint method to take out an individual constraint.
UnbindActor(child);
+
+ ScrollBase::OnChildRemove( child );
}
void ScrollView::StartTouchDownTimer()
blurStrengthConstraint.Apply();
}
-void ShadowView::OnControlChildAdd( Actor& child )
+void ShadowView::OnChildAdd( Actor& child )
{
+ Control::OnChildAdd( child );
+
if( child != mChildrenRoot && child != mBlurRootActor)
{
mChildrenRoot.Add( child );
}
}
-void ShadowView::OnControlChildRemove( Actor& child )
+void ShadowView::OnChildRemove( Actor& child )
{
mChildrenRoot.Remove( child );
+
+ Control::OnChildRemove( child );
}
void ShadowView::ConstrainCamera()
virtual void OnInitialize();
/**
- * @copydoc Control::OnControlChildAdd()
+ * @copydoc Control::OnChildAdd()
*/
- virtual void OnControlChildAdd( Actor& child );
+ virtual void OnChildAdd( Actor& child );
/**
- * @copydoc Control::OnControlChildRemove()
+ * @copydoc Control::OnChildRemove()
*/
- virtual void OnControlChildRemove( Actor& child );
+ virtual void OnChildRemove( Actor& child );
/**
* Constrain the camera actor to the position of the point light, pointing
if( child )
{
RelayoutingLock lock( *this );
- // Remove the child, this will trigger a call to OnControlChildRemove
+ // Remove the child, this will trigger a call to OnChildRemove
Self().Remove( child );
// relayout the table only if instances were found
return value;
}
-void TableView::OnControlChildAdd( Actor& child )
+void TableView::OnChildAdd( Actor& child )
{
+ Control::OnChildAdd( child );
+
if( mLayoutingChild )
{
// we're in the middle of laying out children so no point doing anything here
RelayoutRequest();
}
-void TableView::OnControlChildRemove( Actor& child )
+void TableView::OnChildRemove( Actor& child )
{
// dont process if we're in the middle of bigger operation like delete row, column or resize
if( !mLayoutingChild )
RelayoutRequest();
}
}
+
+ Control::OnChildRemove( child );
}
TableView::TableView( unsigned int initialRows, unsigned int initialColumns )
private: // From Control
/**
- * @copydoc Control::OnControlChildAdd(Actor& child)
+ * @copydoc Control::OnChildAdd(Actor& child)
*/
- virtual void OnControlChildAdd( Actor& child );
+ virtual void OnChildAdd( Actor& child );
/**
- * @copydoc Control::OnControlChildRemove(Actor& child)
+ * @copydoc Control::OnChildRemove(Actor& child)
*/
- virtual void OnControlChildRemove( Actor& child );
+ virtual void OnChildRemove( Actor& child );
/**
* @copydoc Control::OnRelayout
mLayout.SetRelativeWidth( 1, mRightRelativeSpace );
}
-void ToolBar::OnControlChildAdd(Actor& child)
+void ToolBar::OnChildAdd(Actor& child)
{
+ Control::OnChildAdd( child );
+
if( !mInitializing )
{
// An actor is being added through the Actor's API.
AddControl( child, DEFAULT_RELATIVE_SIZE, DEFAULT_ALIGNMENT, Toolkit::ToolBar::DEFAULT_PADDING );
}
- // No OnControlChildRemove method required because Actors are added to the mLayout table view, so if an
+ // No OnChildRemove method required because Actors are added to the mLayout table view, so if an
// actor is removed using the Actor::RemoveChild method it will not remove anything because the
// actor is in mLayout not in Self().
}
* Adds a control using some default values (the control uses 10% of the tool bar space and is placed on the left group).
* @param child The control to be added.
*
- * @see Control::OnControlChildAdd()
+ * @see Control::OnChildAdd()
*/
- virtual void OnControlChildAdd(Actor& child);
+ virtual void OnChildAdd(Actor& child);
private:
/**
void CubeTransitionEffect::OnStageConnection( int depth )
{
+ Control::OnStageConnection( depth );
+
Geometry geometry = CreateQuadGeometry();
Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
}
mTargetRenderer.Reset();
}
+
+ Control::OnStageDisconnection();
}
void CubeTransitionEffect::SetTransitionDuration( float duration )
mLongPressGestureDetector(),
mFlags( Control::ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
mIsKeyboardNavigationSupported( false ),
- mIsKeyboardFocusGroup( false ),
- mAddRemoveBackgroundChild( false )
+ mIsKeyboardFocusGroup( false )
{
}
ControlBehaviour mFlags :CONTROL_BEHAVIOUR_FLAG_COUNT; ///< Flags passed in from constructor.
bool mIsKeyboardNavigationSupported :1; ///< Stores whether keyboard navigation is supported by the control.
bool mIsKeyboardFocusGroup :1; ///< Stores whether the control is a focus group.
- bool mAddRemoveBackgroundChild:1; ///< Flag to know when we are adding or removing our own actor to avoid call to OnControlChildAdd
// Properties - these need to be members of Internal::Control::Impl as they need to function within this class.
static const PropertyRegistration PROPERTY_1;
void Control::OnChildAdd(Actor& child)
{
- // If this is the background actor, then we do not want to inform deriving classes
- if ( mImpl->mAddRemoveBackgroundChild )
- {
- return;
- }
-
// Notify derived classes.
OnControlChildAdd( child );
}
void Control::OnChildRemove(Actor& child)
{
- // If this is the background actor, then we do not want to inform deriving classes
- if ( mImpl->mAddRemoveBackgroundChild )
- {
- return;
- }
-
// Notify derived classes.
OnControlChildRemove( child );
}
void Control::OnSizeSet(const Vector3& targetSize)
{
- // Background is resized through size negotiation
+ if( mImpl->mBackgroundRenderer )
+ {
+ Vector2 size( targetSize );
+ mImpl->mBackgroundRenderer.SetSize( size );
+ }
}
void Control::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
/**
* @copydoc CustomActorImpl::OnStageConnection()
+ * @note If overridden, then an up-call to Control::OnStageConnection MUST be made at the start.
*/
virtual void OnStageConnection( int depth );
/**
* @copydoc CustomActorImpl::OnStageDisconnection()
+ * @note If overridden, then an up-call to Control::OnStageDisconnection MUST be made at the end.
*/
virtual void OnStageDisconnection();
/**
* @copydoc CustomActorImpl::OnChildAdd()
+ * @note If overridden, then an up-call to Control::OnChildAdd MUST be made at the start.
*/
virtual void OnChildAdd( Actor& child );
/**
* @copydoc CustomActorImpl::OnChildRemove()
+ * @note If overridden, then an up-call to Control::OnChildRemove MUST be made at the end.
*/
virtual void OnChildRemove( Actor& child );
/**
* @copydoc CustomActorImpl::OnSizeSet()
+ * @note If overridden, then an up-call to Control::OnSizeSet MUST be made at the start.
*/
virtual void OnSizeSet( const Vector3& targetSize );
/**
* @copydoc CustomActorImpl::OnSizeAnimation()
+ * @note If overridden, then an up-call to Control::OnSizeAnimation MUST be made at the start.
*/
virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize );
virtual void OnInitialize();
/**
+ * @DEPRECATED_1_1.30. Override OnChildAdd instead.
+ *
* @brief Called whenever an Actor is added to the control.
*
* Could be overridden by derived classes.
virtual void OnControlChildAdd( Actor& child );
/**
+ * @DEPRECATED_1_1.30. Override OnChildRemove instead.
+ *
* @brief Called whenever an Actor is removed from the control.
*
* Could be overridden by derived classes.
customControl.MyCustomSignal.Connect( this, &AppFunction );
~~~
+
+___________________________________________________________________________________________________
+
+### Children Added/Removed {#creating-controls-children}
+
+Methods are provided that can be overridden if notification is required when a child is added or removed from our control.
+An up call to the Control class is necessary if these methods are overridden.
+
+~~~{.cpp}
+// C++
+void MyUIControlImpl::OnChildAdd( Actor& child );
+{
+ // Up call to Control first
+ Control::OnChildAdd( child );
+
+ // Do any other operations required upon child addition
+}
+~~~
+~~~{.cpp}
+// C++
+void MyUIControlImpl::OnChildRemove( Actor& child );
+{
+ // Do any other operations required upon child removal
+
+ // Up call to Control at the end
+ Control::OnChildRemove( child );
+}
+~~~
+
+Avoid adding or removing the child again within these methods.
+
+___________________________________________________________________________________________________
+
+### Stage Connection {#creating-controls-stage}
+
+Methods are provided that can be overridden if notification is required when our control is connected to or disconnected from the stage.
+An up call to the Control class is necessary if these methods are overridden.
+
+~~~{.cpp}
+// C++
+void MyUIControlImpl::OnStageConnection( int depth )
+{
+ // Up call to Control first
+ Control::OnStageConnection( depth );
+
+ // Do any other operations required upon stage connection
+}
+~~~
+~~~{.cpp}
+// C++
+void MyUIControlImpl::OnStageDisconnection()
+{
+ // Do any other operations required upon stage disconnection
+
+ // Up call to Control at the end
+ Control::OnStageDisconnection();
+}
+~~~
+
+___________________________________________________________________________________________________
+
+### Size {#creating-controls-size}
+
+Methods are provided that can be overridden if notification is required when our control's size is manipulated.
+An up call to the Control class is necessary if these methods are overridden.
+
+~~~{.cpp}
+// C++
+void MyUIControlImpl::OnSizeSet( const Vector3& targetSize )
+{
+ // Up call to Control
+ Control::OnSizeSet( targetSize );
+
+ // Do any other operations required upon size set
+}
+~~~
+~~~{.cpp}
+// C++
+void MyUIControlImpl::OnSizeAnimation( Animation& animation, const Vector3& targetSize )
+{
+ // Up call to Control
+ Control::OnSizeAnimation( animation, targetSize );
+
+ // Do any other operations required upon size animation
+}
+~~~
+
___________________________________________________________________________________________________
### Other Features {#creating-controls-other}