From 7505e88db66798b2b8fcdff2d92a7136cd826b5b Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 9 Sep 2010 02:26:30 +0200 Subject: Upgrading to IUP 3.2 - and cleaning up. --- iup/src/gtk/iupgtk_canvas.c | 4 ++++ iup/src/gtk/iupgtk_help.c | 2 +- iup/src/gtk/iupgtk_tree.c | 30 +++++++++++++++++++++--------- 3 files changed, 26 insertions(+), 10 deletions(-) (limited to 'iup/src/gtk') diff --git a/iup/src/gtk/iupgtk_canvas.c b/iup/src/gtk/iupgtk_canvas.c index 3af48a4..ed34d66 100755 --- a/iup/src/gtk/iupgtk_canvas.c +++ b/iup/src/gtk/iupgtk_canvas.c @@ -494,6 +494,10 @@ static int gtkCanvasMapMethod(Ihandle* ih) if (!ih->handle) return IUP_ERROR; +#if GTK_CHECK_VERSION(2, 18, 0) + gtk_widget_set_has_window(ih->handle, TRUE); /* CD will NOT work without this, but this is NOT working... */ +#endif + scrolled_window = (GtkScrolledWindow*)gtk_scrolled_window_new(NULL, NULL); if (!scrolled_window) return IUP_ERROR; diff --git a/iup/src/gtk/iupgtk_help.c b/iup/src/gtk/iupgtk_help.c index 270677f..7ac60c6 100755 --- a/iup/src/gtk/iupgtk_help.c +++ b/iup/src/gtk/iupgtk_help.c @@ -29,7 +29,7 @@ int IupHelp(const char *url) if (iupStrEqualNoCase(system, "Linux") || iupStrEqualNoCase(system, "FreeBSD")) browser = "firefox"; - else if (iupStrEqualNoCase(system, "Darwin")) + else if (iupStrEqualNoCase(system, "MacOS")) browser = "safari"; else if (iupStrEqualPartial(system, "CYGWIN")) browser = "iexplore"; diff --git a/iup/src/gtk/iupgtk_tree.c b/iup/src/gtk/iupgtk_tree.c index 9595ada..931c097 100755 --- a/iup/src/gtk/iupgtk_tree.c +++ b/iup/src/gtk/iupgtk_tree.c @@ -1446,7 +1446,7 @@ static int gtkTreeSetDelNodeAttrib(Ihandle* ih, const char* name_id, const char* iupAttribSetStr(ih, "_IUPTREE_IGNORE_SELECTION_CB", "1"); - for(i = 1; i < ih->data->node_count; /* increment only if not removed */) + for(i = 0; i < ih->data->node_count; /* increment only if not removed */) { gtkTreeIterInit(ih, &iterItem, ih->data->node_cache[i].node_handle); if (gtkTreeIsNodeSelected(model, &iterItem)) @@ -2141,6 +2141,24 @@ static void gtkTreeCallMultiUnSelectionCb(Ihandle* ih) } } +static void gtkTreeCallRightClickCb(Ihandle* ih, int x, int y) +{ + GtkTreePath* path; + if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(ih->handle), x, y, &path, NULL)) + { + IFni cbRightClick = (IFni)IupGetCallback(ih, "RIGHTCLICK_CB"); + if (cbRightClick) + { + GtkTreeIter iterItem; + GtkTreeModel* model = gtk_tree_view_get_model(GTK_TREE_VIEW(ih->handle)); + gtk_tree_model_get_iter(model, &iterItem, path); + cbRightClick(ih, gtkTreeFindNodeId(ih, &iterItem)); + } + + gtk_tree_path_free (path); + } +} + static gboolean gtkTreeButtonEvent(GtkWidget *treeview, GdkEventButton *evt, Ihandle* ih) { if (iupgtkButtonEvent(treeview, evt, ih) == TRUE) @@ -2148,14 +2166,8 @@ static gboolean gtkTreeButtonEvent(GtkWidget *treeview, GdkEventButton *evt, Iha if (evt->type == GDK_BUTTON_PRESS && evt->button == 3) /* right single click */ { - IFni cbRightClick = (IFni)IupGetCallback(ih, "RIGHTCLICK_CB"); - if (cbRightClick) - { - int id = gtkTreeConvertXYToPos(ih, (int)evt->x, (int)evt->y); - if (id != -1) - cbRightClick(ih, id); - return TRUE; - } + gtkTreeCallRightClickCb(ih, (int)evt->x, (int)evt->y); + return TRUE; } else if (evt->type == GDK_2BUTTON_PRESS && evt->button == 1) /* left double click */ { -- cgit v1.2.3