/** * Show popup menu */ static gboolean popup_menu(GtkWidget *widget, gpointer user_data UNUSED) { show_popup_menu(widget, NULL); return TRUE; }
LRESULT CALLBACK tray_icon_msg (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if (WM_TRAY_ICON_NOTIFY == message) { if (WM_RBUTTONDOWN == lParam) { show_popup_menu (); } else if (WM_LBUTTONDBLCLK == lParam) { show_stats_window (); } return 0; } else if (WM_COMMAND == message) { if (ID_CLOSE == LOWORD(wParam)) { gtk_widget_destroy (appdata->main_window); appdata->main_window = NULL; free_appdata(appdata), appdata = NULL; remove_tray_icon (); PostQuitMessage (0); gtk_main_quit (); } else if (ID_PROPERTIES == LOWORD(wParam)) { show_prefs_window (); } else if (ID_ABOUT == LOWORD(wParam)) { show_about_window (); } } return DefWindowProc (hwnd, message, wParam, lParam); }
static gboolean key_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) { if ((event->type == GDK_KEY_PRESS) && (event->keyval == GDK_F8)) show_popup_menu(); else SendKeyEvent(cl, gdkKey2rfbKeySym (event->keyval), (event->type == GDK_KEY_PRESS) ? TRUE : FALSE); return FALSE; }
static void on_menu(GtkStatusIcon *status_icon, gpointer data) { // Do nothing unless we have been updated at least once if (!updated_once) return; // Show the popup menu unless something was already visible if (!is_volume_scale_visible() && !is_popup_menu_visible()) show_popup_menu(tray_icon); }
static gboolean panel_popup_menu (GtkWidget *treeview, PlumaDocumentsPanel *panel) { /* Only respond if the treeview is the actual focus */ if (gtk_window_get_focus (GTK_WINDOW (panel->priv->window)) == treeview) { return show_popup_menu (panel, NULL); } return FALSE; }
/* Button pressed */ static gboolean tilem_disasm_view_button_press(GtkWidget *w, GdkEventButton *event) { g_return_val_if_fail(TILEM_IS_DISASM_VIEW(w), FALSE); (*GTK_WIDGET_CLASS(parent_class)->button_press_event)(w, event); if (event->button == 3) show_popup_menu(TILEM_DISASM_VIEW(w), event); return TRUE; }
gboolean on_treeview_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) { if (event->type == GDK_BUTTON_PRESS && event->button == 3) { GtkTreeSelection *selection; GtkTreePath *path; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)); if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), event->x, event->y, &path, NULL, NULL, NULL)) { gtk_tree_selection_select_path (selection, path); gtk_tree_path_free (path); } show_popup_menu (widget, event, user_data); } return FALSE; }
static gboolean gpcap_devices_popup (GtkTreeView *treeview, GdkEventButton *event, gpointer user_data) { GnomePilotCapplet *gpcap = GNOME_PILOT_CAPPLET (user_data); GnomePilotCappletPrivate *priv; GtkActionEntry entries[] = { { "Edit", NULL, N_("_Edit this device..."), NULL, N_("Edit the currently selected device"), G_CALLBACK(gpcap_devices_edit)}, { "Delete", NULL, N_("_Delete this device"), NULL, N_("Delete the currently selected device"), G_CALLBACK(gpcap_devices_delete)}, }; static const char *ui_description = "<ui>" "<popup name='devicesPopupMenu'>" " <menuitem action='Edit'/>" " <menuitem action='Delete'/>" "</popup>" "</ui>"; GtkActionGroup *action_group = gtk_action_group_new ("MenuActions"); gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), gpcap); priv = gpcap->priv; if (priv->devices_popup == NULL) { GtkUIManager *ui_manager = gtk_ui_manager_new (); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); GError *error = NULL; if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error)) { g_message ("building menus failed: %s", error->message); g_error_free (error); exit (EXIT_FAILURE); } priv->devices_popup = gtk_ui_manager_get_widget (ui_manager, "/devicesPopupMenu"); } return show_popup_menu (treeview, event, GTK_MENU (priv->devices_popup)); }
// MouseDown void FontValueView::MouseDown(BPoint where) { if (BView* parent = Parent()) parent->MouseDown(ConvertToParent(where)); if (fProperty) { font_family family; font_style style; fProperty->Value().GetFamilyAndStyle(&family, &style); BPopUpMenu* menu = new BPopUpMenu("font popup", false, false); _PolulateMenu(menu, this, family, style); menu->SetTargetForItems(this); menu->SetEnabled(fEnabled); show_popup_menu(menu, where, this); } }
static gboolean on_search_results_button_press (GtkTreeView *treeview, GdkEventButton *event, gpointer userdata) { if (!gtkui_plugin->w_get_design_mode () && event->type == GDK_BUTTON_PRESS && event->button == 3) { GtkTreeSelection *selection; selection = gtk_tree_view_get_selection (treeview); if (gtk_tree_selection_count_selected_rows (selection) <= 1) { GtkTreePath *path; if (gtk_tree_view_get_path_at_pos (treeview, event->x, event->y, &path, NULL, NULL, NULL )) { gtk_tree_selection_unselect_all(selection); gtk_tree_selection_select_path (selection, path); gtk_tree_path_free (path); } } show_popup_menu (treeview, event); return TRUE; } return FALSE; }
static gboolean panel_button_press_event (GtkTreeView *treeview, GdkEventButton *event, PlumaDocumentsPanel *panel) { if ((GDK_BUTTON_PRESS == event->type) && (3 == event->button)) { GtkTreePath* path = NULL; if (event->window == gtk_tree_view_get_bin_window (treeview)) { /* Change the cursor position */ if (gtk_tree_view_get_path_at_pos (treeview, event->x, event->y, &path, NULL, NULL, NULL)) { gtk_tree_view_set_cursor (treeview, path, NULL, FALSE); gtk_tree_path_free (path); /* A row exists at mouse position */ return show_popup_menu (panel, event); } } } return FALSE; }
gboolean on_treeview_popup_menu (GtkWidget *widget, gpointer user_data) { show_popup_menu (widget, NULL, user_data); return TRUE; }
static gboolean gpcap_conduits_popup (GtkTreeView *treeview, GdkEventButton *event, gpointer user_data) { GnomePilotCapplet *gpcap = GNOME_PILOT_CAPPLET (user_data); GnomePilotCappletPrivate *priv; ConduitState *state; GtkTreePath *path; gboolean test = FALSE, enabled = FALSE; GtkActionEntry entries[] = { { "Enable", NULL, N_("_Enable this conduit"), NULL, N_("Disable the currently selected conduit"), G_CALLBACK(gpcap_conduits_enable)}, { "Disable", NULL, N_("_Disable this conduit"), NULL, N_("Enable the currently selected conduit"), G_CALLBACK(gpcap_conduits_disable)}, { "Settings", NULL, N_("_Settings..."), NULL, N_("Modify the currently selected conduit's settings"), G_CALLBACK(gpcap_conduits_settings)}, }; static const char *ui_description = "<ui>" "<popup name='conduitPopupMenu'>" " <menuitem action='Enable'/>" " <menuitem action='Disable'/>" " <separator/>" " <menuitem action='Settings'/>" "</popup>" "</ui>"; GtkActionGroup *action_group = gtk_action_group_new ("MenuActions"); gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), gpcap); priv = gpcap->priv; if (priv->conduit_popup == NULL) { GtkUIManager *ui_manager = gtk_ui_manager_new (); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); GError *error = NULL; if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error)) { g_message ("building menus failed: %s", error->message); g_error_free (error); exit (EXIT_FAILURE); } priv->conduit_popup = gtk_ui_manager_get_widget (ui_manager, "/conduitPopupMenu"); priv->conduit_popup_enable = gtk_ui_manager_get_widget (ui_manager, "/conduitPopupMenu/Enable"); priv->conduit_popup_disable = gtk_ui_manager_get_widget (ui_manager, "/conduitPopupMenu/Disable"); priv->conduit_popup_settings = gtk_ui_manager_get_widget (ui_manager, "/conduitPopupMenu/Settings"); } if (gtk_tree_view_get_path_at_pos (treeview, event->x, event->y, &path, NULL, NULL, NULL)) { GtkTreeIter iter; gtk_tree_model_get_iter (priv->conduit_model, &iter, path); gtk_tree_model_get (priv->conduit_model, &iter, 2, &state, -1); test = TRUE; enabled = state->enabled; gtk_tree_path_free (path); } gtk_widget_set_sensitive (priv->conduit_popup_enable, test && !enabled); gtk_widget_set_sensitive (priv->conduit_popup_disable, test && enabled); gtk_widget_set_sensitive (priv->conduit_popup_settings, test && enabled); return show_popup_menu (treeview, event, GTK_MENU (priv->conduit_popup)); }
/* Key pressed to activate context menu */ static gboolean tilem_disasm_view_popup_menu(GtkWidget *w) { g_return_val_if_fail(TILEM_IS_DISASM_VIEW(w), FALSE); show_popup_menu(TILEM_DISASM_VIEW(w), NULL); return TRUE; }
static gboolean on_search_results_popup_menu (GtkTreeView *treeview, gpointer userdata) { show_popup_menu(treeview, NULL); return TRUE; }