Merge branch 'jb-perrier-ui' into 1.1

This commit is contained in:
Wojtek Figat
2021-03-18 11:09:32 +01:00
9 changed files with 42 additions and 33 deletions

View File

@@ -5,7 +5,7 @@ namespace FlaxEngine.GUI
/// <summary>
/// Border control that draws the border around the control edges (inner and outer sides).
/// </summary>
public class Border : Control
public class Border : ContainerControl
{
/// <summary>
/// Gets or sets the color used to draw border lines.
@@ -30,9 +30,9 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override void Draw()
public override void DrawSelf()
{
base.Draw();
base.DrawSelf();
Render2D.DrawRectangle(new Rectangle(Vector2.Zero, Size), BorderColor, BorderWidth);
}

View File

@@ -7,7 +7,7 @@ namespace FlaxEngine.GUI
/// <summary>
/// Button control
/// </summary>
public class Button : Control
public class Button : ContainerControl
{
/// <summary>
/// The default height fro the buttons.
@@ -171,7 +171,7 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override void Draw()
public override void DrawSelf()
{
// Cache data
Rectangle clientRect = new Rectangle(Vector2.Zero, Size);

View File

@@ -80,10 +80,10 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override void Draw()
public override void DrawSelf()
{
base.Draw();
base.DrawSelf();
if (Brush == null)
return;

View File

@@ -8,7 +8,7 @@ namespace FlaxEngine.GUI
/// Progress bar control shows visual progress of the action or set of actions.
/// </summary>
/// <seealso cref="FlaxEngine.GUI.Control" />
public class ProgressBar : Control
public class ProgressBar : ContainerControl
{
/// <summary>
/// The value.
@@ -160,9 +160,9 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override void Draw()
public override void DrawSelf()
{
base.Draw();
base.DrawSelf();
float progressNormalized = (_current - _minimum) / _maximum;
if (progressNormalized > 0.001f)

View File

@@ -105,7 +105,7 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override void Draw()
public override void DrawSelf()
{
// Draw cached texture
if (_texture && !_invalid && !_isDuringTextureDraw)
@@ -119,7 +119,7 @@ namespace FlaxEngine.GUI
}
// Draw default UI directly
base.Draw();
base.DrawSelf();
}
/// <inheritdoc />

View File

@@ -220,7 +220,7 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override void Draw()
public override void DrawSelf()
{
// Cache data
var rect = new Rectangle(Vector2.Zero, Size);

View File

@@ -132,7 +132,7 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public override void Draw()
public override void DrawSelf()
{
// Cache data
var rect = new Rectangle(Vector2.Zero, Size);

View File

@@ -9,7 +9,7 @@ namespace FlaxEngine.GUI
/// <summary>
/// Base class for all text box controls which can gather text input from the user.
/// </summary>
public abstract class TextBoxBase : Control
public abstract class TextBoxBase : ContainerControl
{
/// <summary>
/// The text separators (used for words skipping).

View File

@@ -616,32 +616,35 @@ namespace FlaxEngine.GUI
}
}
/// <inheritdoc />
/// <summary>
/// Draw the control and the children.
/// </summary>
public override void Draw()
{
base.Draw();
DrawSelf();
DrawChildren();
}
/// <summary>
/// Draws the control.
/// </summary>
public virtual void DrawSelf()
{
base.Draw();
}
/// <summary>
/// Draws the children. Can be overridden to provide some customizations. Draw is performed with applied clipping mask for the client area.
/// </summary>
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();
}
}
/// <summary>
/// Draws the children. Can be overridden to provide some customizations. Draw is performed with applied clipping mask for the client area.
/// </summary>
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();
}
}
/// <inheritdoc />