H. Utku Maden
9339295378
I have had a long break from this project due to other higher priority things going on in my life. Big changes inbound.
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using Quik.Typography;
|
|
|
|
namespace Quik.Controls
|
|
{
|
|
public class Label : Control
|
|
{
|
|
public bool MultiLine { get; set; } = false;
|
|
public string Text { get; set; } = "";
|
|
|
|
public float Padding { get; set; } = 4.0f;
|
|
|
|
public QuikFont Font { get; set; }
|
|
|
|
protected override void OnPaint(QuikDraw draw)
|
|
{
|
|
if (MultiLine)
|
|
{
|
|
QuikRectangle absolute = AbsoluteBounds;
|
|
QuikVec2 paddingVector = new QuikVec2(Padding, Padding);
|
|
QuikRectangle rectangle;
|
|
rectangle.Min = absolute.Min + paddingVector;
|
|
rectangle.Max = absolute.Min - paddingVector;
|
|
|
|
// FIXME: For now use a puttext command.
|
|
draw.PutText(Text, rectangle.Min + new QuikVec2(0, rectangle.Size.Y / 3f));
|
|
|
|
// draw.FlowText(Text, rectangle);
|
|
}
|
|
else
|
|
{
|
|
QuikVec2 position = AbsoluteBounds.Min + new QuikVec2(Padding, Padding + AbsoluteBounds.Size.Y / 3f);
|
|
draw.PutText(Text, position);
|
|
}
|
|
}
|
|
}
|
|
} |