# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1051307151 0 # Node ID aa827971da397f9272b5c9a4ab8d6ffd9eddc155 # Parent eaebef97fc4fd70c66ea4217d7aa99bd2661bd44 Handle ENTER keypress on the container control. Also make dw_container_query_start/next correctly return DW_CRA_CURSORED items. diff -r eaebef97fc4f -r aa827971da39 gtk/dw.c --- a/gtk/dw.c Thu Apr 24 04:54:55 2003 +0000 +++ b/gtk/dw.c Fri Apr 25 21:45:51 2003 +0000 @@ -587,6 +587,22 @@ return retval; } +static gint _container_enter_event(GtkWidget *widget, GdkEventKey *event, gpointer data) +{ + SignalHandler work = _get_signal_handler(widget, data); + int retval = FALSE; + + if(work.window && event->keyval == VK_RETURN) + { + int (*contextfunc)(HWND, char *, void *) = work.func; + char *text; + + text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), GTK_CLIST(widget)->focus_row); + retval = contextfunc(work.window, text, work.data); + } + return retval; +} + /* Return the logical page id from the physical page id */ int _get_logical_page(HWND handle, unsigned long pageid) { @@ -4960,7 +4976,7 @@ } /* These should be separate but right now this will work */ - if(flags & DW_CRA_SELECTED || flags & DW_CRA_CURSORED) + if(flags & DW_CRA_SELECTED) { list = GTK_CLIST(clist)->selection; @@ -4970,6 +4986,10 @@ retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), GPOINTER_TO_UINT(list->data)); } } + else if(flags & DW_CRA_CURSORED) + { + retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), GTK_CLIST(clist)->focus_row); + } else { retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), 0); @@ -5004,7 +5024,7 @@ } /* These should be separate but right now this will work */ - if(flags & DW_CRA_SELECTED || flags & DW_CRA_CURSORED) + if(flags & DW_CRA_SELECTED) { list = GTK_CLIST(clist)->selection; @@ -5023,6 +5043,13 @@ retval = (char *)gtk_clist_get_row_data(GTK_CLIST(clist), GPOINTER_TO_UINT(list->data)); } } + else if(flags & DW_CRA_CURSORED) + { + /* There will only be one item cursored, + * retrieve it with dw_container_query_start() + */ + retval = NULL; + } else { int pos = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_querypos"); @@ -7696,6 +7723,9 @@ #endif else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_ENTER) == 0) { + gtk_signal_connect(GTK_OBJECT(thiswindow), "key_press_event", GTK_SIGNAL_FUNC(_container_enter_event), + (gpointer)_set_signal_handler(thiswindow, window, sigfunc, data)); + thisname = "button_press_event"; thisfunc = _findsigfunc(DW_SIGNAL_ITEM_ENTER); }