From 5af3a22fd01f4b32809cfbf5690992a8388edfec Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Wed, 17 Mar 2021 20:22:06 +0100 Subject: [PATCH] Add DrawSelf. --- Source/Engine/UI/GUI/ContainerControl.cs | 43 ++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/Source/Engine/UI/GUI/ContainerControl.cs b/Source/Engine/UI/GUI/ContainerControl.cs index 817bc28a5..8e046ecde 100644 --- a/Source/Engine/UI/GUI/ContainerControl.cs +++ b/Source/Engine/UI/GUI/ContainerControl.cs @@ -616,32 +616,35 @@ namespace FlaxEngine.GUI } } - /// + /// + /// Draw the control and the children. + /// public override void Draw() { - base.Draw(); + DrawSelf(); + DrawChildren(); + } + /// + /// Draws the control. + /// + public virtual void DrawSelf() + { + base.Draw(); + } + + /// + /// Draws the children. Can be overridden to provide some customizations. Draw is performed with applied clipping mask for the client area. + /// + protected virtual void DrawChildren() + { // Push clipping mask if (ClipChildren) { GetDesireClientArea(out var clientArea); Render2D.PushClip(ref clientArea); } - - DrawChildren(); - - // Pop clipping mask - if (ClipChildren) - { - Render2D.PopClip(); - } - } - - /// - /// Draws the children. Can be overridden to provide some customizations. Draw is performed with applied clipping mask for the client area. - /// - protected virtual void DrawChildren() - { + // Draw all visible child controls if (CullChildren) { @@ -676,6 +679,12 @@ namespace FlaxEngine.GUI } } } + + // Pop clipping mask + if (ClipChildren) + { + Render2D.PopClip(); + } } ///