changeset 346:81fae15885d7

Implemented switch-page on OS/2, and changed the signal prototype to unsigned long instead of int. Also dw_notebook_page_query should return unsigned long as well.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 11 Apr 2003 13:35:50 +0000
parents 599644ca9064
children 0137c30f485e
files dw.h dwtest.c gtk/dw.c os2/dw.c win/dw.c
diffstat 5 files changed, 30 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Fri Apr 11 12:26:54 2003 +0000
+++ b/dw.h	Fri Apr 11 13:35:50 2003 +0000
@@ -875,7 +875,7 @@
 void API dw_notebook_page_set_text(HWND handle, unsigned long pageid, char *text);
 void API dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, char *text);
 void API dw_notebook_page_set(HWND handle, unsigned int pageid);
-unsigned int API dw_notebook_page_query(HWND handle);
+unsigned long API dw_notebook_page_query(HWND handle);
 void API dw_notebook_pack(HWND handle, unsigned long pageid, HWND page);
 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id);
 void API dw_splitbar_set(HWND handle, float percent);
--- a/dwtest.c	Fri Apr 11 12:26:54 2003 +0000
+++ b/dwtest.c	Fri Apr 11 13:35:50 2003 +0000
@@ -386,11 +386,11 @@
 	return 0;
 }
 
-int DWSIGNAL switch_page_cb( HWND window, int page_num, void *itemdata )
+int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata )
 {
-FILE *fp=fopen("log","a");
-	fprintf(fp,"DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %d Itemdata: %x\n", (unsigned int)window, (unsigned int)page_num, (unsigned int)itemdata );
-fclose(fp);
+	FILE *fp=fopen("log","a");
+	fprintf(fp,"DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", (unsigned int)window, (unsigned int)page_num, (unsigned int)itemdata );
+	fclose(fp);
 	return 0;
 }
 
--- a/gtk/dw.c	Fri Apr 11 12:26:54 2003 +0000
+++ b/gtk/dw.c	Fri Apr 11 13:35:50 2003 +0000
@@ -575,7 +575,7 @@
 
 	if(work)
 	{
-		int (*switchpagefunc)(HWND, int, void *) = work->func;
+		int (*switchpagefunc)(HWND, unsigned long, void *) = work->func;
 		retval = switchpagefunc(work->window, _get_logical_page(GTK_WIDGET(notebook), page_num), work->data);
 	}
 	return retval;
@@ -6355,7 +6355,7 @@
  * Parameters:
  *          handle: Handle to the notebook widget.
  */
-unsigned int dw_notebook_page_query(HWND handle)
+unsigned long dw_notebook_page_query(HWND handle)
 {
 	int retval, phys;
 	int _locked_by_me = FALSE;
--- a/os2/dw.c	Fri Apr 11 12:26:54 2003 +0000
+++ b/os2/dw.c	Fri Apr 11 13:35:50 2003 +0000
@@ -94,7 +94,7 @@
 } SignalList;
 
 /* List of signals and their equivilent OS/2 message */
-#define SIGNALMAX 14
+#define SIGNALMAX 15
 
 SignalList SignalTranslate[SIGNALMAX] = {
 	{ WM_SIZE,         DW_SIGNAL_CONFIGURE },
@@ -110,7 +110,8 @@
 	{ LN_SELECT,       DW_SIGNAL_LIST_SELECT },
 	{ CN_EMPHASIS,     DW_SIGNAL_ITEM_SELECT },
 	{ WM_SETFOCUS,     DW_SIGNAL_SET_FOCUS },
-	{ SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED }
+	{ SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED },
+	{ BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE }
 };
 
 /* This function adds a signal handler callback into the linked list.
@@ -2295,7 +2296,19 @@
 								}
 							}
 						}
-
+						break;
+					case BKN_PAGESELECTED:
+						{
+							PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
+
+							if(psn && tmp->window == psn->hwndBook)
+							{
+								int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))tmp->signalfunction;
+
+								result = switchpagefunc(tmp->window, psn->ulPageIdNew, tmp->data);
+								tmp = NULL;
+							}
+						}
 						break;
 					}
 				}
@@ -5036,9 +5049,9 @@
  * Parameters:
  *          handle: Handle to the notebook widget.
  */
-unsigned int API dw_notebook_page_query(HWND handle)
-{
-	return (int)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
+unsigned long API dw_notebook_page_query(HWND handle)
+{
+	return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
 }
 
 /*
--- a/win/dw.c	Fri Apr 11 12:26:54 2003 +0000
+++ b/win/dw.c	Fri Apr 11 13:35:50 2003 +0000
@@ -1581,9 +1581,10 @@
 							NMHDR FAR *tem=(NMHDR FAR *)mp2;
 							if(tmp->window == tem->hwndFrom && tem->code == tmp->message)
 							{
-								int (*switchpagefunc)(HWND, int, void *) = tmp->signalfunction;
-								int num=dw_notebook_page_query(tem->hwndFrom);
+								int (*switchpagefunc)(HWND, unsigned long, void *) = tmp->signalfunction;
+								unsigned long num=dw_notebook_page_query(tem->hwndFrom);
 								result = switchpagefunc(tem->hwndFrom, num, tmp->data);
+								tmp = NULL;
 							}
 						}
 					}
@@ -5055,7 +5056,7 @@
  * Parameters:
  *          handle: Handle to the notebook widget.
  */
-unsigned int API dw_notebook_page_query(HWND handle)
+unsigned long API dw_notebook_page_query(HWND handle)
 {
 	NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array");
 	int physid = TabCtrl_GetCurSel(handle);