void w_saves::click(int x, int y) { if (x == 0 && y == 0 && active) { // almost certainly a simulated click if (num_items > 0) item_selected(); } else if (x >= trough_rect.x && x < trough_rect.x + trough_rect.w && y >= thumb_y && y <= thumb_y + thumb_height) { thumb_dragging = dirty = true; thumb_drag_y = y - thumb_y; } else { if (x < get_theme_space(LIST_WIDGET, L_SPACE) || x >= rect.w - get_theme_space(LIST_WIDGET, R_SPACE) || y < get_theme_space(LIST_WIDGET, T_SPACE) || y >= rect.h - get_theme_space(LIST_WIDGET, B_SPACE)) return; if ((y - get_theme_space(LIST_WIDGET, T_SPACE)) / item_height() + top_item < min(num_items, top_item + shown_items)) { size_t old_sel = selection; set_selection((y - get_theme_space(LIST_WIDGET, T_SPACE)) / item_height() + top_item); if (selection == old_sel && num_items > 0 && is_item_selectable(selection)) item_selected(); } } }
static gboolean menu_key_pressed(GtkWidget *history_menu, GdkEventKey *event, gpointer user_data) { switch (event->keyval) { case XK_1: case XK_KP_1: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(0)); gtk_widget_destroy(history_menu); break; case XK_2: case XK_KP_2: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(1)); gtk_widget_destroy(history_menu); break; case XK_3: case XK_KP_3: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(2)); gtk_widget_destroy(history_menu); break; case XK_4: case XK_KP_4: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(3)); gtk_widget_destroy(history_menu); break; case XK_5: case XK_KP_5: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(4)); gtk_widget_destroy(history_menu); break; case XK_6: case XK_KP_6: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(5)); gtk_widget_destroy(history_menu); break; case XK_7: case XK_KP_7: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(6)); gtk_widget_destroy(history_menu); break; case XK_8: case XK_KP_8: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(7)); gtk_widget_destroy(history_menu); break; case XK_9: case XK_KP_9: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(8)); gtk_widget_destroy(history_menu); break; case XK_0: case XK_KP_0: item_selected((GtkMenuItem*)history_menu, GINT_TO_POINTER(9)); gtk_widget_destroy(history_menu); break; } return FALSE; }
void tbrowse::reload_file_table(twindow& window, int cursel) { tlistbox* list = find_widget<tlistbox>(&window, "default", false, true); list->clear(); int size = int(dirs_in_current_dir_.size() + files_in_current_dir_.size()); for (std::set<tfile>::const_iterator it = dirs_in_current_dir_.begin(); it != dirs_in_current_dir_.end(); ++ it) { const tfile& file = *it; add_row(window, *list, file.name, true); } for (std::set<tfile>::const_iterator it = files_in_current_dir_.begin(); it != files_in_current_dir_.end(); ++ it) { const tfile& file = *it; add_row(window, *list, file.name, false); } if (size) { if (cursel >= size) { cursel = size - 1; } list->select_row(cursel); } item_selected(window, *list, twidget::drag_none); // window.invalidate_layout(); list->invalidate_layout(true); }
//------------------------------------------------------------------------------ // Name: create_menu // Desc: //------------------------------------------------------------------------------ void RecentFileManager::update() { if(menu_) { menu_->clear(); for(const QString &s: file_list_) { if(QAction *const action = menu_->addAction(s, this, SLOT(item_selected()))) { action->setData(s); } } menu_->addSeparator(); menu_->addAction(tr("Clear &Menu"), this, SLOT(clear_file_list())); } }
void directory_selected_cb (GtkTreeSelection *selection, gpointer data) { GtkTreeIter iter; GtkTreeModel *model; if (transfer_mode == UPLOAD_MODE) { if (gtk_tree_selection_get_selected (selection, &model, &iter)) { item_selected (model, &iter, NULL); } } else { number_of_songs = 0; gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc) multiple_items_selected_foreach_cb, &number_of_songs); } }
gboolean multiple_items_selected_foreach_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { item_selected (model, iter, (int *)data); return TRUE; }
void OptionsScreen::select() { Main::audio->play(SND_SELECT); item_selected(); }