mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +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
@ -400,6 +400,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));
|
||||||
|
|
||||||
if (menu->selected == 0)
|
if (menu->selected == 0)
|
||||||
@ -422,6 +424,12 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -429,6 +437,8 @@ menubar_first (WMenuBar * 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);
|
||||||
menu_entry_t *entry;
|
menu_entry_t *entry;
|
||||||
@ -448,6 +458,12 @@ menubar_last (WMenuBar * menubar)
|
|||||||
while ((entry == NULL) || (entry->command == CK_IgnoreKey));
|
while ((entry == NULL) || (entry->command == CK_IgnoreKey));
|
||||||
|
|
||||||
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