Cleaned up and used cross sprite.
This commit is contained in:
@@ -13,8 +13,6 @@ namespace FlaxEditor.GUI.Input
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Button ClearSearchButton { get; }
|
public Button ClearSearchButton { get; }
|
||||||
|
|
||||||
private Color _defaultButtonTextColor;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Init search box
|
/// Init search box
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -34,33 +32,25 @@ namespace FlaxEditor.GUI.Input
|
|||||||
ClearSearchButton = new Button
|
ClearSearchButton = new Button
|
||||||
{
|
{
|
||||||
Parent = this,
|
Parent = this,
|
||||||
Width = 15.0f,
|
Width = 14.0f,
|
||||||
Height = 14.0f,
|
Height = 14.0f,
|
||||||
AnchorPreset = AnchorPresets.TopRight,
|
AnchorPreset = AnchorPresets.TopRight,
|
||||||
Text = "X",
|
Text = "",
|
||||||
TooltipText = "Cancel Search.",
|
TooltipText = "Cancel Search.",
|
||||||
BackgroundColor = Color.Transparent,
|
BackgroundColor = TextColor,
|
||||||
BorderColor = Color.Transparent,
|
BorderColor = Color.Transparent,
|
||||||
BackgroundColorHighlighted = Color.Transparent,
|
BackgroundColorHighlighted = Style.Current.ForegroundGrey,
|
||||||
BorderColorHighlighted = Color.Transparent,
|
BorderColorHighlighted = Color.Transparent,
|
||||||
BackgroundColorSelected = Color.Transparent,
|
BackgroundColorSelected = Style.Current.ForegroundGrey,
|
||||||
BorderColorSelected = Color.Transparent,
|
BorderColorSelected = Color.Transparent,
|
||||||
|
BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.Cross12),
|
||||||
Visible = false,
|
Visible = false,
|
||||||
};
|
};
|
||||||
ClearSearchButton.LocalY += 2;
|
ClearSearchButton.LocalY += 2;
|
||||||
ClearSearchButton.LocalX -= 2;
|
ClearSearchButton.LocalX -= 2;
|
||||||
ClearSearchButton.Clicked += Clear;
|
ClearSearchButton.Clicked += Clear;
|
||||||
_defaultButtonTextColor = ClearSearchButton.TextColor;
|
|
||||||
|
|
||||||
TextChanged += () => ClearSearchButton.Visible = !string.IsNullOrEmpty(Text);
|
TextChanged += () => ClearSearchButton.Visible = !string.IsNullOrEmpty(Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void Update(float deltaTime)
|
|
||||||
{
|
|
||||||
base.Update(deltaTime);
|
|
||||||
|
|
||||||
ClearSearchButton.TextColor = ClearSearchButton.IsMouseOver ? Style.Current.ForegroundGrey : _defaultButtonTextColor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user