using System;
namespace Gwen.Control.Property
{
///
/// Text property.
///
public class Text : Base
{
protected readonly TextBox m_TextBox;
///
/// Initializes a new instance of the class.
///
/// Parent control.
public Text(Control.Base parent) : base(parent)
{
m_TextBox = new TextBox(this);
m_TextBox.Dock = Pos.Fill;
m_TextBox.ShouldDrawBackground = false;
m_TextBox.TextChanged += OnValueChanged;
}
///
/// Property value.
///
public override string Value
{
get { return m_TextBox.Text; }
set { base.Value = value; }
}
///
/// Sets the property value.
///
/// Value to set.
/// Determines whether to fire "value changed" event.
public override void SetValue(string value, bool fireEvents = false)
{
m_TextBox.SetText(value, fireEvents);
}
///
/// Indicates whether the property value is being edited.
///
public override bool IsEditing
{
get { return m_TextBox.HasFocus; }
}
///
/// Indicates whether the control is hovered by mouse pointer.
///
public override bool IsHovered
{
get { return base.IsHovered | m_TextBox.IsHovered; }
}
}
}