comparison os2/dw.c @ 497:a7f478e9c20c

No longer use global variables for dw_container_query*() so it can be called from loops running in concurrent threads.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 12 Dec 2003 05:45:44 +0000
parents bc156294dd16
children 00d0514cadc8
comparison
equal deleted inserted replaced
496:33a266db534b 497:a7f478e9c20c
47 HMQ dwhmq = 0; 47 HMQ dwhmq = 0;
48 DWTID _dwtid = 0; 48 DWTID _dwtid = 0;
49 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT; 49 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT;
50 50
51 HWND hwndApp = NULLHANDLE, hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE; 51 HWND hwndApp = NULLHANDLE, hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE;
52 PRECORDCORE pCore = NULL, pCoreEmph = NULL; 52 PRECORDCORE pCoreEmph = NULL;
53 ULONG aulBuffer[4]; 53 ULONG aulBuffer[4];
54 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop; 54 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop;
55 55
56 unsigned long _colors[] = { 56 unsigned long _colors[] = {
57 CLR_BLACK, 57 CLR_BLACK,
6787 * return items that are currently selected. Otherwise 6787 * return items that are currently selected. Otherwise
6788 * it will return all records in the container. 6788 * it will return all records in the container.
6789 */ 6789 */
6790 char * API dw_container_query_start(HWND handle, unsigned long flags) 6790 char * API dw_container_query_start(HWND handle, unsigned long flags)
6791 { 6791 {
6792 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 6792 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
6793
6793 if(pCore) 6794 if(pCore)
6794 { 6795 {
6795 if(flags) 6796 if(flags)
6796 { 6797 {
6797 while(pCore) 6798 while(pCore)
6798 { 6799 {
6799 if(pCore->flRecordAttr & flags) 6800 if(pCore->flRecordAttr & flags)
6801 {
6802 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
6800 return pCore->pszIcon; 6803 return pCore->pszIcon;
6804 }
6801 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 6805 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
6802 } 6806 }
6803 } 6807 }
6804 else 6808 else
6809 {
6810 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
6805 return pCore->pszIcon; 6811 return pCore->pszIcon;
6812 }
6806 } 6813 }
6807 return NULL; 6814 return NULL;
6808 } 6815 }
6809 6816
6810 /* 6817 /*
6815 * return items that are currently selected. Otherwise 6822 * return items that are currently selected. Otherwise
6816 * it will return all records in the container. 6823 * it will return all records in the container.
6817 */ 6824 */
6818 char * API dw_container_query_next(HWND handle, unsigned long flags) 6825 char * API dw_container_query_next(HWND handle, unsigned long flags)
6819 { 6826 {
6827 PRECORDCORE pCore = (PRECORDCORE)dw_window_get_data(handle, "_dw_pcore");
6828
6820 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 6829 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
6830
6821 if(pCore) 6831 if(pCore)
6822 { 6832 {
6823 if(flags) 6833 if(flags)
6824 { 6834 {
6825 while(pCore) 6835 while(pCore)
6826 { 6836 {
6827 if(pCore->flRecordAttr & flags) 6837 if(pCore->flRecordAttr & flags)
6838 {
6839 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
6828 return pCore->pszIcon; 6840 return pCore->pszIcon;
6841 }
6829 6842
6830 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 6843 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
6831 } 6844 }
6832 } 6845 }
6833 else 6846 else
6847 {
6848 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
6834 return pCore->pszIcon; 6849 return pCore->pszIcon;
6850 }
6835 } 6851 }
6836 return NULL; 6852 return NULL;
6837 } 6853 }
6838 6854
6839 /* 6855 /*
6843 * text: Text usually returned by dw_container_query(). 6859 * text: Text usually returned by dw_container_query().
6844 */ 6860 */
6845 void API dw_container_cursor(HWND handle, char *text) 6861 void API dw_container_cursor(HWND handle, char *text)
6846 { 6862 {
6847 RECTL viewport, item; 6863 RECTL viewport, item;
6848 6864 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
6849 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 6865
6850 while(pCore) 6866 while(pCore)
6851 { 6867 {
6852 if((char *)pCore->pszIcon == text) 6868 if((char *)pCore->pszIcon == text)
6853 { 6869 {
6854 QUERYRECORDRECT qrr; 6870 QUERYRECORDRECT qrr;