comparison os2/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 fb2987817924
children b2211123274e
comparison
equal deleted inserted replaced
166:fb2987817924 167:0b3debaa9c6c
26 26
27 #define QWP_USER 0 27 #define QWP_USER 0
28 28
29 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); 29 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
30 void _do_resize(Box *thisbox, int x, int y); 30 void _do_resize(Box *thisbox, int x, int y);
31 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
31 32
32 char ClassName[] = "dynamicwindows"; 33 char ClassName[] = "dynamicwindows";
33 char SplitbarClassName[] = "dwsplitbar"; 34 char SplitbarClassName[] = "dwsplitbar";
34 char DefaultFont[] = "9.WarpSans"; 35 char DefaultFont[] = "9.WarpSans";
35 36
216 217
217 _fix_button_owner(child, dw); 218 _fix_button_owner(child, dw);
218 } 219 }
219 WinEndEnumWindows(henum); 220 WinEndEnumWindows(henum);
220 return; 221 return;
221 }
222
223 void _disconnect_windows(HWND handle)
224 {
225 HENUM henum;
226 HWND child;
227
228 dw_signal_disconnect_by_window(handle);
229
230 henum = WinBeginEnumWindows(handle);
231 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
232 _disconnect_windows(child);
233
234 WinEndEnumWindows(henum);
235 } 222 }
236 223
237 /* This function removes and handlers on windows and frees 224 /* This function removes and handlers on windows and frees
238 * the user memory allocated to it. 225 * the user memory allocated to it.
239 */ 226 */
1184 { 1171 {
1185 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, 1172 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
1186 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); 1173 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
1187 _check_resize_notebook(handle); 1174 _check_resize_notebook(handle);
1188 } 1175 }
1176 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
1177 {
1178 /* Then try the bottom or right box */
1179 float *percent = (float *)dw_window_get_data(handle, "_dw_percent");
1180 int type = (int)dw_window_get_data(handle, "_dw_type");
1181 int cx = width + vectorx;
1182 int cy = height + vectory;
1183
1184 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
1185 cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
1186
1187 if(cx > 0 && cy > 0 && percent)
1188 _handle_splitbar_resize(handle, *percent, type, cx, cy);
1189 }
1189 else 1190 else
1190 { 1191 {
1191 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, 1192 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
1192 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); 1193 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
1193 if(thisbox->items[z].type == TYPEBOX) 1194 if(thisbox->items[z].type == TYPEBOX)
1437 { 1438 {
1438 switch(msg) 1439 switch(msg)
1439 { 1440 {
1440 case WM_CONTEXTMENU: 1441 case WM_CONTEXTMENU:
1441 { 1442 {
1442 HWND menuitem;
1443 HMENUI hwndMenu = dw_menu_new(0L); 1443 HMENUI hwndMenu = dw_menu_new(0L);
1444 long x, y; 1444 long x, y;
1445 1445
1446 if(strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0)) 1446 if(strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0))
1447 { 1447 {
1448 menuitem = dw_menu_append_item(hwndMenu, "Undo", ENTRY_UNDO, 0L, TRUE, FALSE, 0L); 1448 dw_menu_append_item(hwndMenu, "Undo", ENTRY_UNDO, 0L, TRUE, FALSE, 0L);
1449 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L); 1449 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L);
1450 } 1450 }
1451 menuitem = dw_menu_append_item(hwndMenu, "Copy", ENTRY_COPY, 0L, TRUE, FALSE, 0L); 1451 dw_menu_append_item(hwndMenu, "Copy", ENTRY_COPY, 0L, TRUE, FALSE, 0L);
1452 if((strncmp(tmpbuf, "#10", 4)!=0 && !dw_window_get_data(hWnd, "_dw_disabled")) || (strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0))) 1452 if((strncmp(tmpbuf, "#10", 4)!=0 && !dw_window_get_data(hWnd, "_dw_disabled")) || (strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0)))
1453 { 1453 {
1454 menuitem = dw_menu_append_item(hwndMenu, "Cut", ENTRY_CUT, 0L, TRUE, FALSE, 0L); 1454 dw_menu_append_item(hwndMenu, "Cut", ENTRY_CUT, 0L, TRUE, FALSE, 0L);
1455 menuitem = dw_menu_append_item(hwndMenu, "Paste", ENTRY_PASTE, 0L, TRUE, FALSE, 0L); 1455 dw_menu_append_item(hwndMenu, "Paste", ENTRY_PASTE, 0L, TRUE, FALSE, 0L);
1456 } 1456 }
1457 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L); 1457 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L);
1458 menuitem = dw_menu_append_item(hwndMenu, "Select All", ENTRY_SALL, 0L, TRUE, FALSE, 0L); 1458 dw_menu_append_item(hwndMenu, "Select All", ENTRY_SALL, 0L, TRUE, FALSE, 0L);
1459 1459
1460 WinSetFocus(HWND_DESKTOP, hWnd); 1460 WinSetFocus(HWND_DESKTOP, hWnd);
1461 dw_pointer_query_pos(&x, &y); 1461 dw_pointer_query_pos(&x, &y);
1462 dw_menu_popup(&hwndMenu, hWnd, x, y); 1462 dw_menu_popup(&hwndMenu, hWnd, x, y);
1463 } 1463 }
1535 break; 1535 break;
1536 case WM_SETFOCUS: 1536 case WM_SETFOCUS:
1537 _run_event(hWnd, msg, mp1, mp2); 1537 _run_event(hWnd, msg, mp1, mp2);
1538 break; 1538 break;
1539 case WM_CHAR: 1539 case WM_CHAR:
1540 if(_run_event(hWnd, msg, mp1, mp2) == TRUE) 1540 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
1541 return (MRESULT)TRUE; 1541 return (MRESULT)TRUE;
1542 if(SHORT1FROMMP(mp2) == '\t') 1542 if(SHORT1FROMMP(mp2) == '\t')
1543 { 1543 {
1544 if(CHARMSG(&msg)->fs & KC_SHIFT) 1544 if(CHARMSG(&msg)->fs & KC_SHIFT)
1545 _shift_focus_back(hWnd); 1545 _shift_focus_back(hWnd);
1589 return _entryproc(hWnd, msg, mp1, mp2); 1589 return _entryproc(hWnd, msg, mp1, mp2);
1590 case WM_SETFOCUS: 1590 case WM_SETFOCUS:
1591 _run_event(hWnd, msg, mp1, mp2); 1591 _run_event(hWnd, msg, mp1, mp2);
1592 break; 1592 break;
1593 case WM_CHAR: 1593 case WM_CHAR:
1594 if(_run_event(hWnd, msg, mp1, mp2) == TRUE) 1594 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
1595 return (MRESULT)TRUE; 1595 return (MRESULT)TRUE;
1596 /* A Similar problem to the MLE, if ESC just return */ 1596 /* A Similar problem to the MLE, if ESC just return */
1597 if(SHORT1FROMMP(mp2) == 283) 1597 if(SHORT1FROMMP(mp2) == 283)
1598 return (MRESULT)TRUE; 1598 return (MRESULT)TRUE;
1599 break; 1599 break;
1724 return (MRESULT)TRUE; 1724 return (MRESULT)TRUE;
1725 break; 1725 break;
1726 case WM_BUTTON1DOWN: 1726 case WM_BUTTON1DOWN:
1727 case WM_BUTTON2DOWN: 1727 case WM_BUTTON2DOWN:
1728 case WM_BUTTON3DOWN: 1728 case WM_BUTTON3DOWN:
1729 if(_run_event(hWnd, msg, mp1, mp2) == TRUE) 1729 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
1730 return (MRESULT)TRUE; 1730 return (MRESULT)TRUE;
1731 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); 1731 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
1732 break; 1732 break;
1733 case WM_SETFOCUS: 1733 case WM_SETFOCUS:
1734 _run_event(hWnd, msg, mp1, mp2); 1734 _run_event(hWnd, msg, mp1, mp2);
2408 { 2408 {
2409 if(type == BOXHORZ) 2409 if(type == BOXHORZ)
2410 { 2410 {
2411 int newx = x - SPLITBAR_WIDTH; 2411 int newx = x - SPLITBAR_WIDTH;
2412 float ratio = (float)percent/(float)100.0; 2412 float ratio = (float)percent/(float)100.0;
2413 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); 2413 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
2414 Box *tmp = WinQueryWindowPtr(handle, QWP_USER); 2414 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
2415 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
2416
2417 WinShowWindow(handle1, FALSE);
2418 WinShowWindow(handle2, FALSE);
2415 2419
2416 newx = (int)((float)newx * ratio); 2420 newx = (int)((float)newx * ratio);
2417 2421
2418 WinSetWindowPos(handle, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE | SWP_SHOW); 2422 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE);
2419 _do_resize(tmp, newx, y); 2423 _do_resize(tmp, newx, y);
2420 2424
2421 dw_window_set_data(hwnd, "_dw_start", (void *)newx); 2425 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
2422 2426
2423 handle = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); 2427 tmp = WinQueryWindowPtr(handle2, QWP_USER);
2424 tmp = WinQueryWindowPtr(handle, QWP_USER);
2425 2428
2426 newx = x - newx - SPLITBAR_WIDTH; 2429 newx = x - newx - SPLITBAR_WIDTH;
2427 2430
2428 WinSetWindowPos(handle, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE | SWP_SHOW); 2431 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE);
2429 _do_resize(tmp, newx, y); 2432 _do_resize(tmp, newx, y);
2433
2434 WinShowWindow(handle1, TRUE);
2435 WinShowWindow(handle2, TRUE);
2430 } 2436 }
2431 else 2437 else
2432 { 2438 {
2433 int newy = y - SPLITBAR_WIDTH; 2439 int newy = y - SPLITBAR_WIDTH;
2434 float ratio = (float)percent/(float)100.0; 2440 float ratio = (float)percent/(float)100.0;
2435 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); 2441 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
2436 Box *tmp = WinQueryWindowPtr(handle, QWP_USER); 2442 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
2443 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
2444
2445 WinShowWindow(handle1, FALSE);
2446 WinShowWindow(handle2, FALSE);
2437 2447
2438 newy = (int)((float)newy * ratio); 2448 newy = (int)((float)newy * ratio);
2439 2449
2440 WinSetWindowPos(handle, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE | SWP_SHOW); 2450 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE);
2441 _do_resize(tmp, x, newy); 2451 _do_resize(tmp, x, newy);
2442 2452
2443 handle = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); 2453 tmp = WinQueryWindowPtr(handle2, QWP_USER);
2444 tmp = WinQueryWindowPtr(handle, QWP_USER);
2445 2454
2446 newy = y - newy - SPLITBAR_WIDTH; 2455 newy = y - newy - SPLITBAR_WIDTH;
2447 2456
2448 WinSetWindowPos(handle, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE | SWP_SHOW); 2457 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE);
2449 _do_resize(tmp, x, newy); 2458 _do_resize(tmp, x, newy);
2459
2460 WinShowWindow(handle1, TRUE);
2461 WinShowWindow(handle2, TRUE);
2450 2462
2451 dw_window_set_data(hwnd, "_dw_start", (void *)newy); 2463 dw_window_set_data(hwnd, "_dw_start", (void *)newy);
2452 } 2464 }
2453 } 2465 }
2454 2466
2464 { 2476 {
2465 case WM_ACTIVATE: 2477 case WM_ACTIVATE:
2466 case WM_SETFOCUS: 2478 case WM_SETFOCUS:
2467 return (MRESULT)(FALSE); 2479 return (MRESULT)(FALSE);
2468 2480
2469 case WM_SIZE:
2470 {
2471 int x = SHORT1FROMMP(mp2), y = SHORT2FROMMP(mp2);
2472
2473 if(x > 0 && y > 0 && percent)
2474 _handle_splitbar_resize(hwnd, *percent, type, x, y);
2475 }
2476 break;
2477 case WM_PAINT: 2481 case WM_PAINT:
2478 { 2482 {
2479 HPS hps; 2483 HPS hps;
2484 POINTL ptl[2];
2480 RECTL rcl; 2485 RECTL rcl;
2481 POINTL ptl[2];
2482 2486
2483 hps = WinBeginPaint(hwnd, 0, 0); 2487 hps = WinBeginPaint(hwnd, 0, 0);
2488
2484 WinQueryWindowRect(hwnd, &rcl); 2489 WinQueryWindowRect(hwnd, &rcl);
2485 ptl[0].x = rcl.xLeft; 2490
2486 ptl[0].y = rcl.yBottom; 2491 if(type == BOXHORZ)
2487 ptl[1].x = rcl.xRight; 2492 {
2488 ptl[1].y = rcl.yTop; 2493 ptl[0].x = rcl.xLeft + start;
2494 ptl[0].y = rcl.yBottom;
2495 ptl[1].x = rcl.xRight + start + 3;
2496 ptl[1].y = rcl.yTop;
2497 }
2498 else
2499 {
2500 ptl[0].x = rcl.xLeft;
2501 ptl[0].y = rcl.yBottom + start;
2502 ptl[1].x = rcl.xRight;
2503 ptl[1].y = rcl.yTop + start + 3;
2504 }
2505
2489 2506
2490 GpiSetColor(hps, CLR_PALEGRAY); 2507 GpiSetColor(hps, CLR_PALEGRAY);
2491 GpiMove(hps, &ptl[0]); 2508 GpiMove(hps, &ptl[0]);
2492 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0); 2509 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0);
2493 WinEndPaint(hps); 2510 WinEndPaint(hps);
3232 } 3249 }
3233 3250
3234 thisbox->items = tmpitem; 3251 thisbox->items = tmpitem;
3235 free(thisitem); 3252 free(thisitem);
3236 thisbox->count--; 3253 thisbox->count--;
3237 } 3254 _free_window_memory(handle);
3238 _disconnect_windows(handle); 3255 }
3239 return WinDestroyWindow(handle); 3256 return WinDestroyWindow(handle);
3240 } 3257 }
3241 3258
3242 /* Causes entire window to be invalidated and redrawn. 3259 /* Causes entire window to be invalidated and redrawn.
3243 * Parameters: 3260 * Parameters:
3244 * handle: Toplevel window handle to be redrawn. 3261 * handle: Toplevel window handle to be redrawn.
3245 */ 3262 */
3246 void dw_window_redraw(HWND handle) 3263 void dw_window_redraw(HWND handle)
3247 { 3264 {
3248 HWND window = WinWindowFromID(handle, FID_CLIENT); 3265 HWND client = WinWindowFromID(handle, FID_CLIENT);
3266 HWND window = client ? client : handle;
3249 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER); 3267 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER);
3250 3268
3251 if(window && mybox) 3269 if(window && mybox)
3252 { 3270 {
3253 unsigned long width, height; 3271 unsigned long width, height;
3254 3272
3255 dw_window_get_pos_size(window, NULL, NULL, &width, &height); 3273 dw_window_get_pos_size(window, NULL, NULL, &width, &height);
3256 3274
3257 WinShowWindow(mybox->items[0].hwnd, FALSE); 3275 WinShowWindow(client ? mybox->items[0].hwnd : handle, FALSE);
3258 _do_resize(mybox, width, height); 3276 _do_resize(mybox, width, height);
3259 WinShowWindow(mybox->items[0].hwnd, TRUE); 3277 WinShowWindow(client ? mybox->items[0].hwnd : handle, TRUE);
3260 } 3278 }
3261 } 3279 }
3262 3280
3263 /* 3281 /*
3264 * Changes a window's parent to newparent. 3282 * Changes a window's parent to newparent.
5630 ci->handle = handle; 5648 ci->handle = handle;
5631 5649
5632 return (void *)ci; 5650 return (void *)ci;
5633 } 5651 }
5634 5652
5635 /* 5653 /* Internal function that does the work for set_item and change_item */
5636 * Sets an item in specified row and column to the given data. 5654 void _dw_container_set_item(HWND handle, PRECORDCORE temp, int column, int row, void *data)
5637 * Parameters:
5638 * handle: Handle to the container window (widget).
5639 * pointer: Pointer to the allocated memory in dw_container_alloc().
5640 * column: Zero based column of data being set.
5641 * row: Zero based row of data being set.
5642 * data: Pointer to the data to be added.
5643 */
5644 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data)
5645 { 5655 {
5646 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); 5656 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
5647 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0; 5657 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
5648 int z, currentcount; 5658 int z, currentcount;
5649 ContainerInfo *ci = (ContainerInfo *)pointer;
5650 PRECORDCORE temp;
5651 CNRINFO cnr; 5659 CNRINFO cnr;
5652 void *dest; 5660 void *dest;
5653 5661
5654 if(!ci)
5655 return;
5656
5657 if(!flags) 5662 if(!flags)
5658 return; 5663 return;
5659
5660 temp = (PRECORDCORE)ci->data;
5661 5664
5662 z = 0; 5665 z = 0;
5663 5666
5664 while(WinSendMsg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))) == 0) 5667 while(WinSendMsg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))) == 0)
5665 { 5668 {
5711 * pointer: Pointer to the allocated memory in dw_container_alloc(). 5714 * pointer: Pointer to the allocated memory in dw_container_alloc().
5712 * column: Zero based column of data being set. 5715 * column: Zero based column of data being set.
5713 * row: Zero based row of data being set. 5716 * row: Zero based row of data being set.
5714 * data: Pointer to the data to be added. 5717 * data: Pointer to the data to be added.
5715 */ 5718 */
5719 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data)
5720 {
5721 ContainerInfo *ci = (ContainerInfo *)pointer;
5722
5723 if(!ci)
5724 return;
5725
5726 _dw_container_set_item(handle, (PRECORDCORE)ci->data, column, row, data);
5727 }
5728
5729 /*
5730 * Changes an existing item in specified row and column to the given data.
5731 * Parameters:
5732 * handle: Handle to the container window (widget).
5733 * column: Zero based column of data being set.
5734 * row: Zero based row of data being set.
5735 * data: Pointer to the data to be added.
5736 */
5737 void dw_container_change_item(HWND handle, int column, int row, void *data)
5738 {
5739 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
5740 int count = 0;
5741
5742 while(pCore)
5743 {
5744 if(count == row)
5745 {
5746 _dw_container_set_item(handle, pCore, column, row, data);
5747 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED));
5748 return;
5749 }
5750 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
5751 count++;
5752 }
5753 }
5754
5755 /*
5756 * Sets an item in specified row and column to the given data.
5757 * Parameters:
5758 * handle: Handle to the container window (widget).
5759 * pointer: Pointer to the allocated memory in dw_container_alloc().
5760 * column: Zero based column of data being set.
5761 * row: Zero based row of data being set.
5762 * data: Pointer to the data to be added.
5763 */
5716 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) 5764 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon)
5717 { 5765 {
5718 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); 5766 dw_container_set_item(handle, pointer, 0, row, (void *)&icon);
5719 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); 5767 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
5720 } 5768 }
5995 6043
5996 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels)); 6044 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels));
5997 return; 6045 return;
5998 } 6046 }
5999 6047
6048 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
6049 }
6050 }
6051
6052 /*
6053 * Deletes the item with the text speficied.
6054 * Parameters:
6055 * handle: Handle to the window (widget).
6056 * text: Text usually returned by dw_container_query().
6057 */
6058 void dw_container_delete_row(HWND handle, char *text)
6059 {
6060 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
6061
6062 while(pCore)
6063 {
6064 if((char *)pCore->pszIcon == text)
6065 {
6066 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE));
6067 return;
6068 }
6000 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 6069 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
6001 } 6070 }
6002 } 6071 }
6003 6072
6004 /* 6073 /*