Add submenu arrows to default ui::selector
This commit is contained in:
parent
72cbec959d
commit
a63bc2eb01
1 changed files with 32 additions and 1 deletions
|
|
@ -816,10 +816,41 @@ namespace psemek::ui
|
||||||
p.draw_rect(bbox, *st->bg_color);
|
p.draw_rect(bbox, *st->bg_color);
|
||||||
|
|
||||||
if (auto i = selected())
|
if (auto i = selected())
|
||||||
{
|
|
||||||
p.draw_rect(item_box(*i), *st->highlight_color);
|
p.draw_rect(item_box(*i), *st->highlight_color);
|
||||||
|
|
||||||
|
for (int i = 0; i < size(); ++i)
|
||||||
|
{
|
||||||
|
if (submenu(i))
|
||||||
|
{
|
||||||
|
auto box = item_box(i);
|
||||||
|
|
||||||
|
auto c = box.corner(1.f, 0.5f);
|
||||||
|
c[0] -= (*st->inner_margin)[0];
|
||||||
|
|
||||||
|
int w = st->font->size()[1];
|
||||||
|
|
||||||
|
auto p0 = c;
|
||||||
|
p0[0] -= w / 2.f;
|
||||||
|
p0[1] -= w / 2.f;
|
||||||
|
|
||||||
|
auto p1 = c;
|
||||||
|
p1[0] -= w / 2.f;
|
||||||
|
p1[1] += w / 2.f;
|
||||||
|
|
||||||
|
auto sh = geom::cast<float>(*st->shadow_offset);
|
||||||
|
|
||||||
|
p.draw_triangle({p0 + sh, p1 + sh, c + sh}, *st->shadow_color);
|
||||||
|
p.draw_triangle({p0, p1, c}, *st->text_color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int submenu_extra() const override
|
||||||
|
{
|
||||||
|
auto st = merged_own_style();
|
||||||
|
return 2 * (*st->inner_margin)[0] + st->font->size()[1] / 2;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct edit_impl
|
struct edit_impl
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue