changeset 350:2216e65ad2ae

Removed slider flags and container selection flags from the header file. Added "multi" parameter to dw_container_new() to control multiple selection.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 14 Apr 2003 13:47:20 +0000
parents 5d3f2e2dcc6b
children 84a24d739d12
files dw.h dwtest.c gtk/dw.c os2/dw.c win/dw.c
diffstat 5 files changed, 19 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Sun Apr 13 09:04:50 2003 +0000
+++ b/dw.h	Mon Apr 14 13:47:20 2003 +0000
@@ -133,12 +133,6 @@
 #define DW_CRA_SELECTED          CRA_SELECTED
 #define DW_CRA_CURSORED          CRA_CURSORED
 
-#define DW_SLS_READONLY          SLS_READONLY
-#define DW_SLS_RIBBONSTRIP       SLS_RIBBONSTRIP
-
-#define DW_CCS_SINGLESEL         CCS_SINGLESEL
-#define DW_CCS_EXTENDSEL         CCS_EXTENDSEL
-
 #define DW_LS_MULTIPLESEL        LS_MULTIPLESEL
 
 #define DW_LIT_NONE              -1
@@ -290,12 +284,6 @@
 #define DW_CRA_SELECTED          LVNI_SELECTED
 #define DW_CRA_CURSORED          LVNI_FOCUSED
 
-#define DW_SLS_READONLY          0
-#define DW_SLS_RIBBONSTRIP       0
-
-#define DW_CCS_SINGLESEL         0
-#define DW_CCS_EXTENDSEL         0
-
 #define DW_LS_MULTIPLESEL        LBS_MULTIPLESEL
 
 #define DW_LIT_NONE              -1
@@ -488,12 +476,6 @@
 #define DW_CFA_HORZSEPARATOR     (1 << 8)
 #define DW_CFA_SEPARATOR         (1 << 9)
 
-#define DW_SLS_READONLY          1
-#define DW_SLS_RIBBONSTRIP       (1 << 1)
-
-#define DW_CCS_SINGLESEL         1
-#define DW_CCS_EXTENDSEL         (1 << 1)
-
 #define DW_CRA_SELECTED          1
 #define DW_CRA_CURSORED          (1 << 1)
 
@@ -766,7 +748,7 @@
 HWND API dw_bitmap_new(unsigned long id);
 HWND API dw_bitmapbutton_new(char *text, unsigned long id);
 HWND API dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename);
-HWND API dw_container_new(unsigned long id);
+HWND API dw_container_new(unsigned long id, int multi);
 HWND API dw_tree_new(unsigned long id);
 HWND API dw_text_new(char *text, unsigned long id);
 HWND API dw_status_text_new(char *text, unsigned long id);
--- a/dwtest.c	Sun Apr 13 09:04:50 2003 +0000
+++ b/dwtest.c	Mon Apr 14 13:47:20 2003 +0000
@@ -404,6 +404,8 @@
 		mle_point = dw_mle_import( container_mle, buf, mle_point);
 		str = dw_container_query_next(container, DW_CRA_SELECTED);
 	}
+	/* Make the last inserted point the cursor location */
+	dw_mle_set(container_mle, mle_point);
 	return 0;
 }
 
@@ -581,7 +583,7 @@
 	dw_box_pack_start( notebookbox4, containerbox, 500, 200, TRUE, TRUE, 0);
 
 	/* now a container area under this box */
-	container = dw_container_new(100);
+	container = dw_container_new(100, TRUE);
 	dw_box_pack_start( notebookbox4, container, 500, 200, TRUE, FALSE, 1);
 
 	/* and a status area to see whats going on */
--- a/gtk/dw.c	Sun Apr 13 09:04:50 2003 +0000
+++ b/gtk/dw.c	Mon Apr 14 13:47:20 2003 +0000
@@ -2126,7 +2126,7 @@
  *       id: An ID to be used for getting the resource from the
  *           resource file.
  */
-HWND dw_container_new(unsigned long id)
+HWND dw_container_new(unsigned long id, int multi)
 {
 	GtkWidget *tmp;
 	int _locked_by_me = FALSE;
@@ -2136,6 +2136,7 @@
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tmp),
 					GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
 
+	gtk_object_set_data(GTK_OBJECT(tmp), "multi", (gpointer)multi);
 	gtk_object_set_data(GTK_OBJECT(tmp), "id", (gpointer)id);
 	gtk_widget_show(tmp);
 
@@ -4295,7 +4296,7 @@
 {
 	GtkWidget *clist;
 	char numbuf[10];
-	int z;
+	int z, multi;
 	int _locked_by_me = FALSE;
 
 	DW_MUTEX_LOCK;
@@ -4305,14 +4306,18 @@
 		DW_MUTEX_UNLOCK;
 		return FALSE;
 	}
+	multi = (int)gtk_object_get_data(GTK_OBJECT(handle), "multi");
+	gtk_object_set_data(GTK_OBJECT(handle), "multi", (gpointer)multi);
 
 	gtk_signal_connect(GTK_OBJECT(clist), "select_row", GTK_SIGNAL_FUNC(_select_row),  NULL);
 	gtk_signal_connect(GTK_OBJECT(clist), "unselect_row", GTK_SIGNAL_FUNC(_unselect_row),  NULL);
 
 	gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 0, TRUE);
-	gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_SINGLE);
+	if(multi)
+		gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_EXTENDED);
+	else
+		gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_SINGLE);
 	gtk_container_add(GTK_CONTAINER(handle), clist);
-	gtk_object_set_data(GTK_OBJECT(clist), "multi", (gpointer)0);
 	gtk_object_set_user_data(GTK_OBJECT(handle), (gpointer)clist);
 	gtk_widget_show(clist);
 	gtk_object_set_data(GTK_OBJECT(clist), "colcount", (gpointer)count);
@@ -6231,19 +6236,6 @@
 		if(tmp)
 			handle2 = tmp;
 	}
-	if(GTK_IS_CLIST(handle2))
-	{
-		if(style & DW_CCS_EXTENDSEL)
-		{
-			gtk_clist_set_selection_mode(GTK_CLIST(handle2), GTK_SELECTION_EXTENDED);
-			gtk_object_set_data(GTK_OBJECT(handle2), "multi", (gpointer)1);
-		}
-		if(style & DW_CCS_SINGLESEL)
-		{
-			gtk_clist_set_selection_mode(GTK_CLIST(handle2), GTK_SELECTION_SINGLE);
-			gtk_object_set_data(GTK_OBJECT(handle2), "multi", (gpointer)0);
-		}
-	}
 	if(GTK_IS_LABEL(handle2))
 	{
 		if(style & DW_DT_CENTER || style & DW_DT_VCENTER)
--- a/os2/dw.c	Sun Apr 13 09:04:50 2003 +0000
+++ b/os2/dw.c	Mon Apr 14 13:47:20 2003 +0000
@@ -3941,14 +3941,15 @@
  *       id: An ID to be used for getting the resource from the
  *           resource file.
  */
-HWND API dw_container_new(ULONG id)
+HWND API dw_container_new(ULONG id, int multi)
 {
 	WindowData *blah = calloc(1, sizeof(WindowData));
 	HWND tmp = WinCreateWindow(HWND_OBJECT,
 							   WC_CONTAINER,
 							   NULL,
 							   WS_VISIBLE | CCS_READONLY |
-							   CCS_SINGLESEL | CCS_AUTOPOSITION,
+							   (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) |
+							   CCS_AUTOPOSITION,
 							   0,0,2000,1000,
 							   NULLHANDLE,
 							   HWND_TOP,
--- a/win/dw.c	Sun Apr 13 09:04:50 2003 +0000
+++ b/win/dw.c	Mon Apr 14 13:47:20 2003 +0000
@@ -1552,7 +1552,7 @@
 										LV_ITEM lvi;
 										int iItem;
 
-										iItem = ListView_GetNextItem(tmp->window, -1, LVNI_FOCUSED);
+										iItem = ListView_GetNextItem(tmp->window, -1, LVNI_SELECTED);
 
 										memset(&lvi, 0, sizeof(LV_ITEM));
 
@@ -3881,11 +3881,12 @@
  *       id: An ID to be used for getting the resource from the
  *           resource file.
  */
-HWND API dw_container_new(ULONG id)
+HWND API dw_container_new(ULONG id, int multi)
 {
 	HWND tmp = CreateWindow(WC_LISTVIEW,
 							"",
 							WS_VISIBLE | WS_CHILD |
+							(multi ? 0 : LVS_SINGLESEL) |
 							LVS_REPORT | LVS_SHOWSELALWAYS |
 							LVS_SHAREIMAGELISTS | WS_BORDER |
 							WS_CLIPCHILDREN,