コード例 #1
0
ファイル: dbg_code.c プロジェクト: debrouxl/tiemu
GLADE_CB gboolean
on_treeview1_button_press_event        (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{
    switch (event->type) 
    {
    case GDK_BUTTON_PRESS:	// third button clicked
	    if (event->button == 3) 
        {
            GdkEventButton *bevent;
            GtkWidget *menu;

		    bevent = (GdkEventButton *) (event);
            menu = display_popup_menu();

		    gtk_menu_popup(GTK_MENU(menu),
				       NULL, NULL, NULL, NULL,
				       bevent->button, bevent->time);
	        gtk_widget_show(menu);

		    return TRUE;
	    }
	    break;
    default:
        break;
    }

    return FALSE;
}
コード例 #2
0
ファイル: popup.c プロジェクト: debrouxl/tiemu
/* Display a popup menu: entry point */
void hid_popup_menu(SDL_MouseButtonEvent event)
{
  suspend();
  gtk_menu_popup(GTK_MENU(display_popup_menu()),
		 NULL, NULL, NULL, NULL,
		 event.button,
		 -897199374); // cannot pass time
}
コード例 #3
0
// raise the main popup menu
static void
do_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
{
	GtkWidget *menu;
	int event_button, event_time;

	menu = display_popup_menu();

	if (event)
    {
      event_button = event->button;
      event_time = event->time;
    }
	else
    {
      event_button = 0;
      event_time = gtk_get_current_event_time ();
    }

	gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 
                  event_button, event_time);
	gtk_widget_show(menu);
}
コード例 #4
0
ファイル: dbg_regs.c プロジェクト: debrouxl/tiemu
GLADE_CB gboolean
on_treeview3_button_press_event        (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{
    GtkTreeView *view = GTK_TREE_VIEW(widget);
    GtkTreeModel *model = gtk_tree_view_get_model(view);
	GtkTreePath *path;
	GtkTreeViewColumn *column;
    GtkTreeIter iter;
    gboolean ret;
    gchar *spath;
    gint i, j;
    gint col;

    if(event->type != GDK_BUTTON_PRESS)
        return FALSE;

    {
        // cell selection
        gint tx = (gint) event->x;
	    gint ty = (gint) event->y;
	    gint cx, cy;

        ret = gtk_tree_view_get_path_at_pos(view, tx, ty, &path, &column, &cx, &cy);
        if(ret == FALSE)
            return FALSE;

        col = column2index((GtkWidget *)view, column);
        spath = gtk_tree_path_to_string(path);
        sscanf(spath, "%i:%i", &i, &j);
        
        //gtk_tree_path_free(path);
        g_free(spath);
    }

    if(event->button == 1)  // first button clicked
    {
        if(!((col == 0) && (i == 2) && ((j == 4) ||(j ==5))))
            return FALSE;

        if(dbgsr_display_dbox() == -1)
            return TRUE;

        dbgregs_refresh_window();
        dbgstack_refresh_window();

        return TRUE;
    }

	if (event->button == 3)     // third button clicked
    {
        GdkEventButton *bevent;
        GtkWidget *menu;        

        // check for click on regs
        if(! 
            (
                (col == 1) && 
                (i>= 0) && (i <= 1) && 
                (j >= 0) && (j <= 7)
            ) 
          )
            return FALSE;

        // get iterator
	    if (!gtk_tree_model_get_iter(model, &iter, path))
		    return FALSE;
        gtk_tree_path_free(path);
        gtk_tree_model_get(model, &iter, COL_VALUE, &spath, -1);
        sscanf(spath, "%x", &value);
        printf("value = %x\n", value);

        // popup menu
       	bevent = (GdkEventButton *) (event);
        menu = display_popup_menu();

		gtk_menu_popup(GTK_MENU(menu),
				   NULL, NULL, NULL, NULL,
				   bevent->button, bevent->time);
	    gtk_widget_show(menu);

		return TRUE;
	}

    return FALSE;
}