comparison os2/dw.c @ 69:9510897c0b03

Added new container functions, and implemented some missing functionality.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 04 Feb 2002 16:04:43 +0000
parents 8d6100960adf
children 5e7a4d93d8d7
comparison
equal deleted inserted replaced
68:8d6100960adf 69:9510897c0b03
5471 if(!flags) 5471 if(!flags)
5472 return; 5472 return;
5473 5473
5474 temp = (PRECORDCORE)ci->data; 5474 temp = (PRECORDCORE)ci->data;
5475 5475
5476 WinSendMsg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))); 5476 if(!WinSendMsg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))))
5477 return;
5478
5477 currentcount = cnr.cRecords; 5479 currentcount = cnr.cRecords;
5478 5480
5479 /* Figure out the offsets to the items in the struct */ 5481 /* Figure out the offsets to the items in the struct */
5480 for(z=0;z<column;z++) 5482 for(z=0;z<column;z++)
5481 { 5483 {
5610 z++; 5612 z++;
5611 if(z > 5000000) 5613 if(z > 5000000)
5612 break; 5614 break;
5613 DosSleep(1); 5615 DosSleep(1);
5614 } 5616 }
5617
5618 free(ci);
5615 } 5619 }
5616 5620
5617 /* 5621 /*
5618 * Removes all rows from a container. 5622 * Removes all rows from a container.
5619 * Parameters: 5623 * Parameters:
5717 { 5721 {
5718 if(flags) 5722 if(flags)
5719 { 5723 {
5720 while(pCore) 5724 while(pCore)
5721 { 5725 {
5722 if(pCore->flRecordAttr & CRA_SELECTED) 5726 if(pCore->flRecordAttr & flags)
5723 return pCore->pszIcon; 5727 return pCore->pszIcon;
5724 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 5728 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
5725 } 5729 }
5726 } 5730 }
5727 else 5731 else
5745 { 5749 {
5746 if(flags) 5750 if(flags)
5747 { 5751 {
5748 while(pCore) 5752 while(pCore)
5749 { 5753 {
5750 if(pCore->flRecordAttr & CRA_SELECTED) 5754 if(pCore->flRecordAttr & flags)
5751 return pCore->pszIcon; 5755 return pCore->pszIcon;
5752 5756
5753 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 5757 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
5754 } 5758 }
5755 } 5759 }
5756 else 5760 else
5757 return pCore->pszIcon; 5761 return pCore->pszIcon;
5758 } 5762 }
5759 return NULL; 5763 return NULL;
5764 }
5765
5766 /*
5767 * Cursors the item with the text speficied, and scrolls to that item.
5768 * Parameters:
5769 * handle: Handle to the window (widget) to be queried.
5770 * text: Text usually returned by dw_container_query().
5771 */
5772 void dw_container_cursor(HWND handle, char *text)
5773 {
5774 RECTL viewport, item;
5775
5776 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
5777 while(pCore)
5778 {
5779 if(pCore->pszIcon == text)
5780 {
5781 QUERYRECORDRECT qrr;
5782 int scrollpixels = 0, midway;
5783
5784 qrr.cb = sizeof(QUERYRECORDRECT);
5785 qrr.pRecord = pCore;
5786 qrr.fRightSplitWindow = 0;
5787 qrr.fsExtent = CMA_TEXT;
5788
5789 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(TRUE, CRA_CURSORED));
5790 WinSendMsg(handle, CM_QUERYVIEWPORTRECT, (MPARAM)&viewport, MPFROM2SHORT(CMA_WORKSPACE, FALSE));
5791 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
5792
5793 midway = (viewport.yTop - viewport.yBottom)/2;
5794 scrollpixels = viewport.yTop - (item.yTop + midway);
5795
5796 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels));
5797 return;
5798 }
5799
5800 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
5801 }
5802 }
5803
5804 /*
5805 * Optimizes the column widths so that all data is visible.
5806 * Parameters:
5807 * handle: Handle to the window (widget) to be optimized.
5808 */
5809 void dw_container_optimize(HWND handle)
5810 {
5760 } 5811 }
5761 5812
5762 /* 5813 /*
5763 * Creates a rendering context widget (window) to be packed. 5814 * Creates a rendering context widget (window) to be packed.
5764 * Parameters: 5815 * Parameters: