Go to the source code of this file.
Defines | |
#define | MENU_STATE_NORMAL "normal"; |
#define | MENU_STATE_SELECTED "selected"; |
#define | MENU_STATE_DISABLED "disabled"; |
Functions | |
void | menu_init (void) |
Initialise popup menus. | |
void | menu_destroy (void) |
Remove the popup menus. | |
void | menu_show (void) |
Display the proper popup menu for the current context. | |
void | menu_set_text (void) |
Initiliase text items in popup menu(s). | |
void | menu_on_item_activated (const gchar *item, const gchar *group, const gchar *menu, const gchar *state) |
Handle a menu button that has been pressed by the user. |
#define MENU_STATE_DISABLED "disabled"; |
Definition at line 47 of file hello-world/settings/menu.h.
#define MENU_STATE_NORMAL "normal"; |
File Name : menu.h
Description: Control the popup menus Copyright (C) 2009 iRex Technologies B.V. All rights reserved.
Definition at line 45 of file hello-world/settings/menu.h.
#define MENU_STATE_SELECTED "selected"; |
Definition at line 46 of file hello-world/settings/menu.h.
void menu_destroy | ( | void | ) |
Remove the popup menus.
---------------------------------------------------------------------------
Name : menu_destroy
-- |
--------------------------------------------------------------------------
Definition at line 145 of file erbrowser/src/menu.c.
References eripc_menu_remove_menu(), notepad::eripcClient, notepad::ipc_menu, ipc_remove_menu(), LOGPRINTF, and MENU_MAIN.
00146 { 00147 LOGPRINTF("entry"); 00148 00149 // remove the main menu 00150 ipc_remove_menu( MENU_MAIN ); 00151 }
void menu_init | ( | void | ) |
Initialise popup menus.
---------------------------------------------------------------------------
Name : menu_init
-- |
--------------------------------------------------------------------------
Initialise popup menus.
---------------------------------------------------------------------------
Name : menu_init
-- |
--------------------------------------------------------------------------
Definition at line 101 of file ctb/src/menu.c.
00102 { 00103 g_sort_item = g_string_new(""); 00104 00105 // add groups 00106 const char *group = GROUP_VIEWS; 00107 ipc_menu_add_group( group, "", "folder" ); 00108 ipc_menu_add_item ( ITEM_VIEW_ICON, group, "view_small" ); 00109 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00110 ipc_menu_add_item ( ITEM_VIEW_DETAIL, group, "view_detail" ); 00111 #endif 00112 ipc_menu_add_item ( ITEM_VIEW_CONTENT, group, "view_content" ); 00113 00114 group = GROUP_SORT; 00115 ipc_menu_add_group( group, "", "folder" ); 00116 ipc_menu_add_item ( ITEM_SORT_NAME, group, "sort_name" ); 00117 ipc_menu_add_item ( ITEM_SORT_AUTHOR, group, "sort_author" ); 00118 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00119 ipc_menu_add_item ( ITEM_SORT_TYPE, group, "sort_type" ); 00120 ipc_menu_add_item ( ITEM_SORT_SIZE, group, "sort_size" ); 00121 #endif 00122 ipc_menu_add_item ( ITEM_SORT_DATE_ADDED, group, "sort_date_added" ); 00123 ipc_menu_add_item ( ITEM_SORT_DATE_READ, group, "sort_date_read" ); 00124 00125 group = GROUP_ACTIONS; 00126 ipc_menu_add_group( group, "", "folder" ); 00127 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00128 ipc_menu_add_item ( ITEM_ACTION_SHORTCUT, group, "create_shortcut" ); 00129 #endif 00130 ipc_menu_add_item ( ITEM_ACTION_DELETE, group, "delete" ); 00131 00132 // add menus 00133 ipc_menu_add_menu(MENU_CONTENT_MEDIA, GROUP_VIEWS, GROUP_SORT, GROUP_ACTIONS); 00134 ipc_menu_add_menu(MENU_CONTENT, GROUP_VIEWS, NULL, NULL); 00135 ipc_menu_add_menu(MENU_CONTENT_DELETE_MODE, GROUP_ACTIONS, NULL, NULL); 00136 ipc_menu_add_menu(MENU_CONTENT_RECENT_MODE, GROUP_VIEWS, GROUP_ACTIONS, NULL); 00137 00138 ipc_menu_set_item_state(BACK_TO_LIBRARY, SYSTEM_TOP, STATE_NORMAL); 00139 00140 menu_set_text(); 00141 }
void menu_on_item_activated | ( | const gchar * | item, | |
const gchar * | group, | |||
const gchar * | menu, | |||
const gchar * | state | |||
) |
Handle a menu button that has been pressed by the user.
---------------------------------------------------------------------------
Name : menu_on_item_activated
[in] | item | - item name of the activated item |
[in] | group | - name of the parent group of the activated item |
[in] | menu | - name of the current menu |
[in] | state | - state of the item when activated |
--------------------------------------------------------------------------
Definition at line 381 of file ctb/src/menu.c.
References CTB_CONTENTVIEW, CTB_ICONVIEW, CTB_LISTVIEW, CTB_SORT_BY_AUTHOR, CTB_SORT_BY_DATE_ADDED, CTB_SORT_BY_DATE_READ, CTB_SORT_BY_NAME, CTB_SORT_BY_SIZE, CTB_SORT_BY_TYPE, ERRORPRINTF, fileview_create_shortcut(), fileview_set_sort_order(), fileview_set_view_type(), fileview_toggle_delete_mode(), g_action, g_mountpoint, GROUP_ACTIONS, GROUP_SORT, GROUP_VIEWS, GROUP_ZOOM_FONT_TOOLS, ICONVIEW, ipc_menu_updates_finished(), ipc_sys_start_task(), ITEM_ACTION_BACK, ITEM_ACTION_CLOSE, ITEM_ACTION_DELETE, ITEM_ACTION_FORWARD, ITEM_ACTION_OPEN, ITEM_ACTION_RELOAD, ITEM_FONT_SIZE_LARGE, ITEM_FONT_SIZE_MEDIUM, ITEM_FONT_SIZE_SMALL, ITEM_FONT_SIZE_XLARGE, ITEM_SORT_AUTHOR, ITEM_SORT_DATE_ADDED, ITEM_SORT_DATE_READ, ITEM_SORT_NAME, ITEM_VIEW_CONTENT, ITEM_VIEW_DETAIL, ITEM_VIEW_ICON, ITEM_VIEW_LIST, LISTVIEW, LOGPRINTF, main_quit(), main_set_view_type(), msg, START_TIMER, STATE_NORMAL, STATE_SELECTED, view_full_screen(), view_go_back(), view_go_forward(), view_reload(), view_set_zoom_level(), WARNPRINTF, ZOOM_LEVEL_LARGE, ZOOM_LEVEL_MEDIUM, ZOOM_LEVEL_SMALL, and ZOOM_LEVEL_XLARGE.
00385 { 00386 START_TIMER(); 00387 gboolean ok = TRUE; 00388 00389 LOGPRINTF("entry: item [%s] group [%s]", item, group); 00390 00391 if ( strcmp(group, GROUP_VIEWS) == 0 ) 00392 { 00393 if ( strcmp(state, STATE_NORMAL) == 0 ) 00394 { 00395 ctb_viewtypes_t view_type = 0; 00396 if (strcmp(item, ITEM_VIEW_ICON) == 0 ) 00397 { 00398 view_type = CTB_ICONVIEW; 00399 } 00400 else if (strcmp(item, ITEM_VIEW_DETAIL) == 0 ) 00401 { 00402 view_type = CTB_LISTVIEW; 00403 } 00404 else if (strcmp(item, ITEM_VIEW_CONTENT) == 0 ) 00405 { 00406 view_type = CTB_CONTENTVIEW; 00407 } 00408 else 00409 { 00410 WARNPRINTF("unexpected menu item [%s] in group [%s]", item, group); 00411 ok = FALSE; 00412 } 00413 00414 if (ok) fileview_set_view_type( view_type, TRUE ); 00415 } 00416 else 00417 { 00418 WARNPRINTF("ignore state [%s] item [%s][%s]", state, item, group); 00419 } 00420 } 00421 else if ( strcmp(group, GROUP_SORT) == 0 ) 00422 { 00423 ctb_sort_order_t sort_order = 0; 00424 if ( strcmp(state, STATE_NORMAL) == 0 ) 00425 { 00426 if ( strcmp(item, ITEM_SORT_NAME ) == 0 ) 00427 { 00428 sort_order = CTB_SORT_BY_NAME; 00429 } 00430 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00431 else if ( strcmp(item, ITEM_SORT_TYPE ) == 0 ) 00432 { 00433 sort_order = CTB_SORT_BY_TYPE; 00434 } 00435 else if ( strcmp(item, ITEM_SORT_SIZE ) == 0 ) 00436 { 00437 sort_order = CTB_SORT_BY_SIZE; 00438 } 00439 #endif 00440 else if ( strcmp(item, ITEM_SORT_DATE_ADDED ) == 0 ) 00441 { 00442 sort_order = CTB_SORT_BY_DATE_ADDED; 00443 } 00444 else if ( strcmp(item, ITEM_SORT_DATE_READ ) == 0 ) 00445 { 00446 sort_order = CTB_SORT_BY_DATE_READ; 00447 } 00448 else if ( strcmp(item, ITEM_SORT_AUTHOR) == 0 ) 00449 { 00450 sort_order = CTB_SORT_BY_AUTHOR; 00451 } 00452 else 00453 { 00454 WARNPRINTF("unexpected menu item [%s] in group [%s]", item, group); 00455 ok = FALSE; 00456 } 00457 00458 if (ok) 00459 { 00460 fileview_set_sort_order( sort_order ); 00461 } 00462 } 00463 else 00464 { 00465 WARNPRINTF("ignore state [%s] item [%s][%s]", state, item, group); 00466 } 00467 } 00468 else if ( strcmp(group, GROUP_ACTIONS) == 0 ) 00469 { 00470 if ( strcmp(state, STATE_NORMAL) == 0 ) 00471 { 00472 if ( strcmp(item, ITEM_ACTION_DELETE ) == 0 ) 00473 { 00474 fileview_toggle_delete_mode(); 00475 } 00476 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00477 else if ( strcmp(item, ITEM_ACTION_SHORTCUT ) == 0 ) 00478 { 00479 fileview_create_shortcut(); 00480 } 00481 #endif 00482 else 00483 { 00484 WARNPRINTF("unexpected menu item [%s] in group [%s]", item, group); 00485 ok = FALSE; 00486 } 00487 } 00488 else 00489 { 00490 WARNPRINTF("ignore state [%s] item [%s][%s]", state, item, group); 00491 } 00492 } 00493 else 00494 { 00495 WARNPRINTF("unexpected menu group [%s]", group); 00496 } 00497 ipc_menu_updates_finished(); 00498 }
void menu_set_text | ( | void | ) |
Initiliase text items in popup menu(s).
---------------------------------------------------------------------------
Name : menu_set_text
-- |
--------------------------------------------------------------------------
Initiliase text items in popup menu(s).
---------------------------------------------------------------------------
Name : menu_set_text
-- |
--------------------------------------------------------------------------
Definition at line 191 of file ctb/src/menu.c.
References GROUP_ACTIONS, GROUP_SORT, GROUP_TOOLS, GROUP_TOOLS_FONTSIZE, GROUP_VIEWS, GROUP_ZOOM_FONT_TOOLS, ipc_menu_set_group_label(), ipc_menu_set_item_label(), ipc_menu_set_menu_label(), ITEM_ACTION_BACK, ITEM_ACTION_CLOSE, ITEM_ACTION_COPY, ITEM_ACTION_CUT, ITEM_ACTION_FORWARD, ITEM_ACTION_OPEN, ITEM_ACTION_PASTE, ITEM_ACTION_RELOAD, ITEM_FONT_SIZE_LARGE, ITEM_FONT_SIZE_MEDIUM, ITEM_FONT_SIZE_SMALL, ITEM_FONT_SIZE_XLARGE, ITEM_SORT_AUTHOR, ITEM_SORT_DATE_ADDED, ITEM_SORT_DATE_READ, ITEM_SORT_NAME, ITEM_VIEW_CONTENT, ITEM_VIEW_DETAIL, ITEM_VIEW_ICON, ITEM_VIEW_LIST, LOGPRINTF, MENU_MAIN, update_category(), and update_viewmode_text().
00192 { 00193 const char *group; 00194 00195 // set groups + items 00196 group = GROUP_VIEWS; 00197 ipc_menu_set_group_label( group, _("View") ); 00198 #if MACHINE_IS_DR800S || MACHINE_IS_DR800SG || MACHINE_IS_DR800SW 00199 ipc_menu_set_item_label ( ITEM_VIEW_ICON, group, _("View as Covers") ); 00200 #elif MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00201 ipc_menu_set_item_label ( ITEM_VIEW_ICON, group, _("View as Thumbnails")); 00202 ipc_menu_set_item_label ( ITEM_VIEW_DETAIL, group, _("View as Details") ); 00203 #else 00204 #error Unhandled machine type 00205 #endif 00206 ipc_menu_set_item_label ( ITEM_VIEW_CONTENT, group, _("View as List") ); 00207 // 00208 group = GROUP_SORT; 00209 ipc_menu_set_group_label( group, _("Sort by") ); 00210 ipc_menu_set_item_label ( ITEM_SORT_NAME, group, _("Sort by Title") ); 00211 ipc_menu_set_item_label ( ITEM_SORT_AUTHOR, group, _("Sort by Author") ); 00212 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00213 ipc_menu_set_item_label ( ITEM_SORT_TYPE, group, _("Sort by Type") ); 00214 ipc_menu_set_item_label ( ITEM_SORT_SIZE, group, _("Sort by Size") ); 00215 #endif 00216 ipc_menu_set_item_label ( ITEM_SORT_DATE_ADDED, group, _("Sort by Date Added") ); 00217 ipc_menu_set_item_label ( ITEM_SORT_DATE_READ, group, _("Sort by Recently Opened")); 00218 // 00219 group = GROUP_ACTIONS; 00220 ipc_menu_set_group_label( group, _("Actions") ); 00221 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00222 ipc_menu_set_item_label ( ITEM_ACTION_SHORTCUT, group, _("Add Shortcut") ); 00223 #endif 00224 00225 update_viewmode_text(); 00226 update_category(); 00227 }
void menu_show | ( | void | ) |
Display the proper popup menu for the current context.
---------------------------------------------------------------------------
Name : menu_show
-- |
--------------------------------------------------------------------------
Display the proper popup menu for the current context.
---------------------------------------------------------------------------
Name : menu_show
-- |
--------------------------------------------------------------------------
Definition at line 230 of file ctb/src/menu.c.
References filemodel_get_menu_content(), filemodel_update_pagecounter(), filemodel_window_is_on_top(), ipc_menu_show_menu(), ipc_status_set_stylus(), LOGPRINTF, MENU_MAIN, STYLUS_NONE, and update_category().
00231 { 00232 if (!filemodel_window_is_on_top()) return; 00233 00234 ipc_status_set_stylus( STYLUS_NONE ); 00235 update_category(); 00236 ipc_menu_show_menu(filemodel_get_menu_content()); 00237 filemodel_update_pagecounter(); 00238 }