I am creating a GUI application in D using the arsd.minigui library. I need to make my widget like LineEdit, but change the background, remove border, change font, font size and alignment of text inside input field. Everything else should work like in LineEdit.
I inherited from LineEdit and created this widget:
class MyLineEdit : LineEdit
{
private
{
TextAlignment _alignment;
int _textSize;
}
this(Widget parent, TextAlignment alignment = TextAlignment.Left, int textSize = 16)
{
super(parent);
_alignment = alignment;
_textSize = textSize;
}
override int maxHeight()
{
return 36;
}
override int maxWidth()
{
return 200;
}
override int paddingLeft()
{
return 12;
}
override int paddingRight()
{
return 12;
}
override int paddingTop()
{
return 6;
}
override int paddingBottom()
{
return 6;
}
class Style : LineEdit.Style
{
override Color foregroundColor()
{
return Color.fromString("#3549FF");
}
override WidgetBackground background()
{
return WidgetBackground(Color.fromString("#3549FF"));
}
override FrameStyle borderStyle()
{
return FrameStyle.none;
}
override OperatingSystemFont font()
{
return null; //todo ???
}
override Color outlineColor()
{
return Color.fromString("#3549FF");
}
}
mixin OverrideStyle!Style;
}
I override the background color and others, but when rendered on Windows 11 it looks like this:
example
Border has been removed, but the background is filled with a white rectangle. Where is it from, how can I remove it?
In addition, I don’t understand how to align the text vertically and horizontally, how to change the font and its size. I want to use a non-system font (ttf), load it from memory.
In addition, I need to round the corners of my line edit. How to do this?