void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i) { wimp_window_state state; wimp_icon_state icon_state; os_error *error; state.w = w; icon_state.w = w; icon_state.i = i; error = xwimp_get_window_state(&state); if (error) { LOG(("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess)); warn_user("MenuError", error->errmess); return; } error = xwimp_get_icon_state(&icon_state); if (error) { LOG(("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess)); warn_user("MenuError", error->errmess); return; } ro_gui_menu_create(menu, state.visible.x0 + icon_state.icon.extent.x1 + 64, state.visible.y1 + icon_state.icon.extent.y1 - state.yscroll, w); current_menu_icon = i; }
/** * Respond to a mouse click * * \param pointer the pointer state * \return true to indicate click handled */ bool ro_gui_global_history_click(wimp_pointer *pointer) { ro_gui_tree_click(pointer, global_history_tree); if (pointer->buttons == wimp_CLICK_MENU) ro_gui_menu_create(global_history_menu, pointer->pos.x, pointer->pos.y, pointer->w); else ro_gui_menu_prepare_action(pointer->w, TREE_SELECTION, false); return true; }
void ro_gui_menu_selection(wimp_selection *selection) { int i; //, j; wimp_menu_entry *menu_entry; menu_action action; wimp_pointer pointer; os_error *error; int previous_menu_icon = current_menu_icon; /* if we are using gui_multitask then menu selection events * may be delivered after the menu has been closed. As such, * we simply ignore these events. */ if (!current_menu) return; assert(current_menu_window); /* get the menu entry and associated action and definition */ menu_entry = ¤t_menu->entries[selection->items[0]]; for (i = 1; selection->items[i] != -1; i++) menu_entry = &menu_entry->sub_menu-> entries[selection->items[i]]; action = ro_gui_menu_find_action(current_menu, menu_entry); /* Deal with the menu action. If this manages to re-prepare the * menu for re-opening, we test for and act on Adjust clicks. */ if (!ro_gui_wimp_event_menu_selection(current_menu_window, current_menu_icon, current_menu, selection, action)) return; /* re-open the menu for Adjust clicks */ error = xwimp_get_pointer_info(&pointer); if (error) { LOG(("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess)); warn_user("WimpError", error->errmess); ro_gui_menu_closed(); return; } if (pointer.buttons != wimp_CLICK_ADJUST) { ro_gui_menu_closed(); return; } ro_gui_menu_create(current_menu, 0, 0, current_menu_window); current_menu_icon = previous_menu_icon; }