Add submenu tick

This commit is contained in:
K. Lange 2018-06-20 11:17:27 +09:00
parent cba3b2e804
commit 1381116048
3 changed files with 7 additions and 1 deletions

View File

@ -1980,7 +1980,7 @@ int main(int argc, char ** argv) {
m = menu_create();
menu_insert(m, menu_create_normal(NULL, NULL, "Hide borders", _menu_action_hide_borders));
menu_insert(m, menu_create_submenu(NULL,"zoom","Set Zoom..."));
menu_insert(m, menu_create_submenu(NULL,"zoom","Set zoom..."));
menu_set_insert(terminal_menu_bar.set, "view", m);
m = menu_create();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -127,6 +127,12 @@ struct MenuEntry * menu_create_normal(const char * icon, const char * action, co
void _menu_draw_MenuEntry_Submenu(gfx_context_t * ctx, struct MenuEntry * self, int offset) {
_menu_draw_MenuEntry_Normal(ctx,self,offset);
struct MenuEntry_Submenu * _self = (struct MenuEntry_Submenu *)self;
/* Draw the tick on the right side to indicate this is a submenu */
uint32_t color = _self->hilight ? rgb(255,255,255) : rgb(0,0,0);
sprite_t * tick = icon_get_16("menu-tick");
draw_sprite_alpha_paint(ctx, tick, _self->width - 16, offset + 2, 1.0, color);
}
void _menu_focus_MenuEntry_Submenu(struct MenuEntry * self, int focused) {