mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
Menubar: support Home and End actions for Menubar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
4e5488d5b2
commit
ff7d1728e2
@ -399,6 +399,8 @@ menubar_up (WMenuBar * menubar)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
menubar_first (WMenuBar * menubar)
|
menubar_first (WMenuBar * menubar)
|
||||||
|
{
|
||||||
|
if (menubar->is_dropped)
|
||||||
{
|
{
|
||||||
menu_t *menu = MENU (g_list_nth_data (menubar->menu, menubar->selected));
|
menu_t *menu = MENU (g_list_nth_data (menubar->menu, menubar->selected));
|
||||||
|
|
||||||
@ -423,11 +425,19 @@ menubar_first (WMenuBar * menubar)
|
|||||||
|
|
||||||
menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR);
|
menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menubar->selected = 0;
|
||||||
|
menubar_draw (menubar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menubar_last (WMenuBar * menubar)
|
menubar_last (WMenuBar * menubar)
|
||||||
|
{
|
||||||
|
if (menubar->is_dropped)
|
||||||
{
|
{
|
||||||
menu_t *menu = MENU (g_list_nth_data (menubar->menu, menubar->selected));
|
menu_t *menu = MENU (g_list_nth_data (menubar->menu, menubar->selected));
|
||||||
const unsigned int len = g_list_length (menu->entries);
|
const unsigned int len = g_list_length (menu->entries);
|
||||||
@ -449,6 +459,12 @@ menubar_last (WMenuBar * menubar)
|
|||||||
|
|
||||||
menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR);
|
menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menubar->selected = g_list_length (menubar->menu) - 1;
|
||||||
|
menubar_draw (menubar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -538,11 +554,9 @@ menubar_execute_cmd (WMenuBar * menubar, unsigned long command, int key)
|
|||||||
menubar_drop (menubar, menubar->selected);
|
menubar_drop (menubar, menubar->selected);
|
||||||
break;
|
break;
|
||||||
case CK_Home:
|
case CK_Home:
|
||||||
if (menubar->is_dropped)
|
|
||||||
menubar_first (menubar);
|
menubar_first (menubar);
|
||||||
break;
|
break;
|
||||||
case CK_End:
|
case CK_End:
|
||||||
if (menubar->is_dropped)
|
|
||||||
menubar_last (menubar);
|
menubar_last (menubar);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user