Browse Source

Add submenu tick

K. Lange 4 years ago
parent
commit
1381116048
3 changed files with 7 additions and 1 deletions
  1. 1 1
      apps/terminal.c
  2. BIN
      base/usr/share/icons/16/menu-tick.bmp
  3. 6 0
      lib/menu.c

+ 1 - 1
apps/terminal.c

@@ -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();

BIN
base/usr/share/icons/16/menu-tick.bmp


+ 6 - 0
lib/menu.c

@@ -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) {