comparison gtk/dw.c @ 167:0b3debaa9c6c

Added new container functions, and fixed resource leaks.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Nov 2002 07:10:37 +0000
parents d03716228b7f
children f55677513954
comparison
equal deleted inserted replaced
166:fb2987817924 167:0b3debaa9c6c
4143 } 4143 }
4144 DW_MUTEX_UNLOCK; 4144 DW_MUTEX_UNLOCK;
4145 } 4145 }
4146 4146
4147 /* 4147 /*
4148 * Changes an existing item in specified row and column to the given data.
4149 * Parameters:
4150 * handle: Handle to the container window (widget).
4151 * column: Zero based column of data being set.
4152 * row: Zero based row of data being set.
4153 * data: Pointer to the data to be added.
4154 */
4155 void dw_container_change_item(HWND handle, int column, int row, void *data)
4156 {
4157 dw_container_set_item(handle, NULL, column, row, data);
4158 }
4159
4160 /*
4148 * Sets an item in specified row and column to the given data. 4161 * Sets an item in specified row and column to the given data.
4149 * Parameters: 4162 * Parameters:
4150 * handle: Handle to the container window (widget). 4163 * handle: Handle to the container window (widget).
4151 * pointer: Pointer to the allocated memory in dw_container_alloc(). 4164 * pointer: Pointer to the allocated memory in dw_container_alloc().
4152 * column: Zero based column of data being set. 4165 * column: Zero based column of data being set.
4484 4497
4485 gtk_clist_select_row(GTK_CLIST(clist), z, 0); 4498 gtk_clist_select_row(GTK_CLIST(clist), z, 0);
4486 4499
4487 pos = ((adj->upper - adj->lower) * ((gfloat)z/(gfloat)rowcount)) + adj->lower; 4500 pos = ((adj->upper - adj->lower) * ((gfloat)z/(gfloat)rowcount)) + adj->lower;
4488 gtk_adjustment_set_value(adj, pos); 4501 gtk_adjustment_set_value(adj, pos);
4502 DW_MUTEX_UNLOCK;
4503 return;
4504 }
4505 }
4506
4507 DW_MUTEX_UNLOCK;
4508 }
4509
4510 /*
4511 * Deletes the item with the text speficied.
4512 * Parameters:
4513 * handle: Handle to the window (widget).
4514 * text: Text usually returned by dw_container_query().
4515 */
4516 void dw_container_delete_row(HWND handle, char *text)
4517 {
4518 int _locked_by_me = FALSE;
4519 GtkWidget *clist;
4520 int rowcount, z;
4521 char *rowdata;
4522
4523 DW_MUTEX_LOCK;
4524 clist = (GtkWidget*)gtk_object_get_user_data(GTK_OBJECT(handle));
4525
4526 if(!clist)
4527 {
4528 DW_MUTEX_UNLOCK;
4529 return;
4530 }
4531 rowcount = (int)gtk_object_get_data(GTK_OBJECT(clist), "rowcount");
4532
4533 for(z=0;z<rowcount;z++)
4534 {
4535 rowdata = gtk_clist_get_row_data(GTK_CLIST(clist), z);
4536 if(rowdata == text)
4537 {
4538 _dw_unselect(clist);
4539
4540 gtk_clist_remove(GTK_CLIST(clist), z);
4541
4542 rowcount--;
4543
4544 gtk_object_set_data(GTK_OBJECT(clist), "rowcount", (gpointer)rowcount);
4489 DW_MUTEX_UNLOCK; 4545 DW_MUTEX_UNLOCK;
4490 return; 4546 return;
4491 } 4547 }
4492 } 4548 }
4493 4549