changeset 307:324587c06cea

Use the signal #defines internally so all that is required to change the signal strings is a header file change.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 31 Mar 2003 08:21:55 +0000
parents 9d13efce2894
children f844a07c5915
files gtk/dw.c os2/dw.c win/dw.c
diffstat 3 files changed, 71 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/dw.c	Mon Mar 31 07:50:20 2003 +0000
+++ b/gtk/dw.c	Mon Mar 31 08:21:55 2003 +0000
@@ -124,22 +124,22 @@
 
 /* A list of signal forwarders, to account for paramater differences. */
 static SignalList SignalTranslate[SIGNALMAX] = {
-	{ _configure_event, "configure_event" },
-	{ _key_press_event, "key_press_event" },
-	{ _button_press_event, "button_press_event" },
-	{ _button_release_event, "button_release_event" },
-	{ _motion_notify_event, "motion_notify_event" },
-	{ _delete_event, "delete_event" },
-	{ _expose_event, "expose_event" },
-	{ _activate_event, "activate" },
-	{ _generic_event, "clicked" },
-	{ _container_select_event, "container-select" },
-	{ _container_context_event, "container-context" },
-	{ _tree_context_event, "tree-context" },
-	{ _item_select_event, "item-select" },
-	{ _tree_select_event, "tree-select" },
-	{ _set_focus_event, "set-focus" },
-	{ _value_changed_event, "value_changed" }
+	{ _configure_event,         DW_SIGNAL_CONFIGURE },
+	{ _key_press_event,         DW_SIGNAL_KEY_PRESS },
+	{ _button_press_event,      DW_SIGNAL_BUTTON_PRESS },
+	{ _button_release_event,    DW_SIGNAL_BUTTON_RELEASE },
+	{ _motion_notify_event,     DW_SIGNAL_MOTION_NOTIFY },
+	{ _delete_event,            DW_SIGNAL_DELETE },
+	{ _expose_event,            DW_SIGNAL_EXPOSE },
+	{ _activate_event,          "activate" },
+	{ _generic_event,           DW_SIGNAL_CLICKED },
+	{ _container_select_event,  DW_SIGNAL_ITEM_ENTER },
+	{ _container_context_event, DW_SIGNAL_ITEM_CONTEXT },
+	{ _tree_context_event,      "tree-context" },
+	{ _item_select_event,       DW_SIGNAL_LIST_SELECT },
+	{ _tree_select_event,       DW_SIGNAL_ITEM_SELECT },
+	{ _set_focus_event,         DW_SIGNAL_SET_FOCUS },
+	{ _value_changed_event,     DW_SIGNAL_VALUE_CHANGED }
 };
 
 /* Alignment flags */
@@ -1026,7 +1026,7 @@
 
 	dwwait = dw_dialog_new((void *)entrywindow);
 
-	dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait);
+	dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait);
 
 	x = (dw_screen_width() - 220)/2;
 	y = (dw_screen_height() - 110)/2;
@@ -1106,8 +1106,8 @@
 
 	dwwait = dw_dialog_new((void *)entrywindow);
 
-	dw_signal_connect(yesbutton, "clicked", DW_SIGNAL_FUNC(_dw_yes_func), (void *)dwwait);
-	dw_signal_connect(nobutton, "clicked", DW_SIGNAL_FUNC(_dw_no_func), (void *)dwwait);
+	dw_signal_connect(yesbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_yes_func), (void *)dwwait);
+	dw_signal_connect(nobutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_no_func), (void *)dwwait);
 
 	x = (dw_screen_width() - 220)/2;
 	y = (dw_screen_height() - 110)/2;
@@ -7508,18 +7508,18 @@
 		thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window));
 	}
 
-	if(GTK_IS_MENU_ITEM(thiswindow) && strcmp(signame, "clicked") == 0)
+	if(GTK_IS_MENU_ITEM(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0)
 	{
 		thisname = "activate";
 		thisfunc = _findsigfunc(thisname);
 	}
-	else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, "container-context") == 0)
+	else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0)
 	{
 		thisname = "button_press_event";
-		thisfunc = _findsigfunc("container-context");
+		thisfunc = _findsigfunc(DW_SIGNAL_ITEM_CONTEXT);
 	}
 #if GTK_MAJOR_VERSION > 1
-	else if(GTK_IS_TREE_VIEW(thiswindow)  && strcmp(signame, "container-context") == 0)
+	else if(GTK_IS_TREE_VIEW(thiswindow)  && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0)
 	{
 		thisfunc = _findsigfunc("tree-context");
 
@@ -7532,7 +7532,7 @@
 		DW_MUTEX_UNLOCK;
 		return;
 	}
-	else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, "tree-select") == 0)
+	else if(GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0)
 	{
 		work->window = window;
 		work->data = data;
@@ -7546,7 +7546,7 @@
 		return;
 	}
 #else
-	else if(GTK_IS_TREE(thiswindow)  && strcmp(signame, "container-context") == 0)
+	else if(GTK_IS_TREE(thiswindow)  && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0)
 	{
 		thisfunc = _findsigfunc("tree-context");
 
@@ -7561,7 +7561,7 @@
 		DW_MUTEX_UNLOCK;
 		return;
 	}
-	else if(GTK_IS_TREE(thiswindow) && strcmp(signame, "tree-select") == 0)
+	else if(GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0)
 	{
 		if(thisfunc)
 		{
@@ -7571,37 +7571,39 @@
 		thisname = "select-child";
 	}
 #endif
-	else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, "container-select") == 0)
+	else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_ENTER) == 0)
 	{
 		thisname = "button_press_event";
-		thisfunc = _findsigfunc("container-select");
-	}
-	else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, "tree-select") == 0)
+		thisfunc = _findsigfunc(DW_SIGNAL_ITEM_ENTER);
+	}
+	else if(GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0)
 	{
 		thisname = "select_row";
 		thisfunc = (void *)_container_select_row;
 	}
-	else if(GTK_IS_COMBO(thiswindow) && strcmp(signame, "item-select") == 0)
+	else if(GTK_IS_COMBO(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0)
 	{
 		thisname = "select_child";
 		thiswindow = GTK_COMBO(thiswindow)->list;
 	}
-	else if(GTK_IS_LIST(thiswindow) && strcmp(signame, "item-select") == 0)
+	else if(GTK_IS_LIST(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0)
 	{
 		thisname = "select_child";
 	}
-	else if(strcmp(signame, "set-focus") == 0)
+	else if(strcmp(signame, DW_SIGNAL_SET_FOCUS) == 0)
 	{
 		thisname = "focus-in-event";
 		if(GTK_IS_COMBO(thiswindow))
 			thiswindow = GTK_COMBO(thiswindow)->entry;
 	}
-	else if(strcmp(signame, "lose-focus") == 0)
+#if 0
+	else if(strcmp(signame, DW_SIGNAL_LOSE_FOCUS) == 0)
 	{
 		thisname = "focus-out-event";
 		if(GTK_IS_COMBO(thiswindow))
 			thiswindow = GTK_COMBO(thiswindow)->entry;
 	}
+#endif
 	else if(GTK_IS_VSCALE(thiswindow) || GTK_IS_HSCALE(thiswindow) ||
 			GTK_IS_VSCROLLBAR(thiswindow) || GTK_IS_HSCROLLBAR(thiswindow))
 	{
--- a/os2/dw.c	Mon Mar 31 07:50:20 2003 +0000
+++ b/os2/dw.c	Mon Mar 31 08:21:55 2003 +0000
@@ -94,24 +94,23 @@
 } SignalList;
 
 /* List of signals and their equivilent OS/2 message */
-#define SIGNALMAX 15
+#define SIGNALMAX 14
 
 SignalList SignalTranslate[SIGNALMAX] = {
-	{ WM_SIZE, "configure_event" },
-	{ WM_CHAR, "key_press_event" },
-	{ WM_BUTTON1DOWN, "button_press_event" },
-	{ WM_BUTTON1UP, "button_release_event"},
-	{ WM_MOUSEMOVE, "motion_notify_event" },
-	{ WM_CLOSE, "delete_event" },
-	{ WM_PAINT, "expose_event" },
-	{ WM_COMMAND, "clicked" },
-	{ CN_ENTER, "container-select" },
-	{ CN_CONTEXTMENU, "container-context" },
-	{ LN_SELECT, "item-select" },
-	{ CN_EMPHASIS, "tree-select" },
-	{ WM_SETFOCUS, "set-focus" },
-	{ WM_USER+1, "lose-focus" },
-	{ SLN_SLIDERTRACK, "value_changed" }
+	{ WM_SIZE,         DW_SIGNAL_CONFIGURE },
+	{ WM_CHAR,         DW_SIGNAL_KEY_PRESS },
+	{ WM_BUTTON1DOWN,  DW_SIGNAL_BUTTON_PRESS },
+	{ WM_BUTTON1UP,    DW_SIGNAL_BUTTON_RELEASE },
+	{ WM_MOUSEMOVE,    DW_SIGNAL_MOTION_NOTIFY },
+	{ WM_CLOSE,        DW_SIGNAL_DELETE },
+	{ WM_PAINT,        DW_SIGNAL_EXPOSE },
+	{ WM_COMMAND,      DW_SIGNAL_CLICKED },
+	{ CN_ENTER,        DW_SIGNAL_ITEM_ENTER },
+	{ CN_CONTEXTMENU,  DW_SIGNAL_ITEM_CONTEXT },
+	{ LN_SELECT,       DW_SIGNAL_LIST_SELECT },
+	{ CN_EMPHASIS,     DW_SIGNAL_ITEM_SELECT },
+	{ WM_SETFOCUS,     DW_SIGNAL_SET_FOCUS },
+	{ SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED }
 };
 
 /* This function adds a signal handler callback into the linked list.
@@ -4708,16 +4707,16 @@
 		case 7:
 			hwnd = _find_entryfield(handle);
 			_dw_window_set_color(hwnd ? hwnd : handle, DW_CLR_BLACK, DW_CLR_PALEGRAY);
-			dw_signal_connect(hwnd ? hwnd : handle, "key_press_event", DW_SIGNAL_FUNC(_null_key), (void *)100);
+			dw_signal_connect(hwnd ? hwnd : handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
             if(val == 2)
-				dw_signal_connect(handle, "button_press_event", DW_SIGNAL_FUNC(_null_key), (void *)100);
+				dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
 			if(hwnd)
 				dw_window_set_data(hwnd, "_dw_disabled", (void *)1);
 			return;
 		case 3:
 			_dw_window_set_color(handle, DW_CLR_DARKGRAY, DW_CLR_PALEGRAY);
-			dw_signal_connect(handle, "key_press_event", DW_SIGNAL_FUNC(_null_key), (void *)100);
-			dw_signal_connect(handle, "button_press_event", DW_SIGNAL_FUNC(_null_key), (void *)100);
+			dw_signal_connect(handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
+			dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
 			return;
 		}
 	}
--- a/win/dw.c	Mon Mar 31 07:50:20 2003 +0000
+++ b/win/dw.c	Mon Mar 31 08:21:55 2003 +0000
@@ -88,24 +88,23 @@
 static int in_checkbox_handler = 0;
 
 /* List of signals and their equivilent Win32 message */
-#define SIGNALMAX 15
+#define SIGNALMAX 14
 
 SignalList SignalTranslate[SIGNALMAX] = {
-	{ WM_SIZE, "configure_event" },
-	{ WM_CHAR, "key_press_event" },
-	{ WM_LBUTTONDOWN, "button_press_event" },
-	{ WM_LBUTTONUP, "button_release_event" },
-	{ WM_MOUSEMOVE, "motion_notify_event" },
-	{ WM_CLOSE, "delete_event" },
-	{ WM_PAINT, "expose_event" },
-	{ WM_COMMAND, "clicked" },
-	{ NM_DBLCLK, "container-select" },
-	{ NM_RCLICK, "container-context" },
-	{ LBN_SELCHANGE, "item-select" },
-	{ TVN_SELCHANGED, "tree-select" },
-	{ WM_SETFOCUS, "set-focus" },
-	{ WM_USER+1, "lose-focus" },
-	{ WM_VSCROLL, "value_changed" }
+	{ WM_SIZE,        DW_SIGNAL_CONFIGURE },
+	{ WM_CHAR,        DW_SIGNAL_KEY_PRESS },
+	{ WM_LBUTTONDOWN, DW_SIGNAL_BUTTON_PRESS },
+	{ WM_LBUTTONUP,   DW_SIGNAL_BUTTON_PRESS },
+	{ WM_MOUSEMOVE,   DW_SIGNAL_MOTION_NOTIFY },
+	{ WM_CLOSE,       DW_SIGNAL_DELETE },
+	{ WM_PAINT,       DW_SIGNAL_EXPOSE },
+	{ WM_COMMAND,     DW_SIGNAL_CLICKED },
+	{ NM_DBLCLK,      DW_SIGNAL_ITEM_ENTER },
+	{ NM_RCLICK,      DW_SIGNAL_ITEM_CONTEXT },
+	{ LBN_SELCHANGE,  DW_SIGNAL_LIST_SELECT },
+	{ TVN_SELCHANGED, DW_SIGNAL_ITEM_SELECT },
+	{ WM_SETFOCUS,    DW_SIGNAL_SET_FOCUS },
+	{ WM_VSCROLL,     DW_SIGNAL_VALUE_CHANGE }
 };
 
 #ifdef BUILD_DLL
@@ -7865,7 +7864,7 @@
 
 	if(window && signame && sigfunc)
 	{
-		if(stricmp(signame, "set-focus") == 0)
+		if(stricmp(signame, DW_SIGNAL_SET_FOCUS) == 0)
 			window = _normalize_handle(window);
 
 		if((message = _findsigmessage(signame)) != 0)