Update to latest zwidget
This commit is contained in:
parent
22c788afc4
commit
d08b9b8568
23 changed files with 607 additions and 432 deletions
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
LineEdit::LineEdit(Widget* parent) : Widget(parent)
|
||||
{
|
||||
SetNoncontentSizes(5.0, 3.0, 5.0, 3.0);
|
||||
SetStyleClass("lineedit");
|
||||
|
||||
timer = new Timer(this);
|
||||
timer->FuncExpired = [=]() { OnTimerExpired(); };
|
||||
|
|
@ -1067,18 +1067,6 @@ std::string LineEdit::GetVisibleTextAfterSelection()
|
|||
}
|
||||
}
|
||||
|
||||
void LineEdit::OnPaintFrame(Canvas* canvas)
|
||||
{
|
||||
double w = GetFrameGeometry().width;
|
||||
double h = GetFrameGeometry().height;
|
||||
Colorf bordercolor = Colorf::fromRgba8(100, 100, 100);
|
||||
canvas->fillRect(Rect::xywh(0.0, 0.0, w, h), Colorf::fromRgba8(38, 38, 38));
|
||||
canvas->fillRect(Rect::xywh(0.0, 0.0, w, 1.0), bordercolor);
|
||||
canvas->fillRect(Rect::xywh(0.0, h - 1.0, w, 1.0), bordercolor);
|
||||
canvas->fillRect(Rect::xywh(0.0, 0.0, 1.0, h - 0.0), bordercolor);
|
||||
canvas->fillRect(Rect::xywh(w - 1.0, 0.0, 1.0, h - 0.0), bordercolor);
|
||||
}
|
||||
|
||||
void LineEdit::OnPaint(Canvas* canvas)
|
||||
{
|
||||
std::string txt_before = GetVisibleTextBeforeSelection();
|
||||
|
|
@ -1101,21 +1089,21 @@ void LineEdit::OnPaint(Canvas* canvas)
|
|||
{
|
||||
// Draw selection box.
|
||||
Rect selection_rect = GetSelectionRect();
|
||||
canvas->fillRect(selection_rect, HasFocus() ? Colorf::fromRgba8(100, 100, 100) : Colorf::fromRgba8(68, 68, 68));
|
||||
canvas->fillRect(selection_rect, HasFocus() ? GetStyleColor("selection-color") : GetStyleColor("no-focus-selection-color"));
|
||||
}
|
||||
|
||||
// Draw text before selection
|
||||
if (!txt_before.empty())
|
||||
{
|
||||
canvas->drawText(Point(0.0, canvas->verticalTextAlign().baseline), Colorf::fromRgba8(255, 255, 255), txt_before);
|
||||
canvas->drawText(Point(0.0, canvas->verticalTextAlign().baseline), GetStyleColor("color"), txt_before);
|
||||
}
|
||||
if (!txt_selected.empty())
|
||||
{
|
||||
canvas->drawText(Point(size_before.width, canvas->verticalTextAlign().baseline), Colorf::fromRgba8(255, 255, 255), txt_selected);
|
||||
canvas->drawText(Point(size_before.width, canvas->verticalTextAlign().baseline), GetStyleColor("color"), txt_selected);
|
||||
}
|
||||
if (!txt_after.empty())
|
||||
{
|
||||
canvas->drawText(Point(size_before.width + size_selected.width, canvas->verticalTextAlign().baseline), Colorf::fromRgba8(255, 255, 255), txt_after);
|
||||
canvas->drawText(Point(size_before.width + size_selected.width, canvas->verticalTextAlign().baseline), GetStyleColor("color"), txt_after);
|
||||
}
|
||||
|
||||
// draw cursor
|
||||
|
|
@ -1124,7 +1112,7 @@ void LineEdit::OnPaint(Canvas* canvas)
|
|||
if (cursor_blink_visible)
|
||||
{
|
||||
Rect cursor_rect = GetCursorRect();
|
||||
canvas->fillRect(cursor_rect, Colorf::fromRgba8(255, 255, 255));
|
||||
canvas->fillRect(cursor_rect, GetStyleColor("color"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue