Mercurial > dwindows
comparison os2/dw.c @ 1880:6949c73e30fd
Fixes for building on OS/2 and removed some strdup()s in
the test program which are no longer needed.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 09 Aug 2013 23:28:17 +0000 |
parents | 8a205b80617e |
children | 71780cf68aa2 |
comparison
equal
deleted
inserted
replaced
1879:8a205b80617e | 1880:6949c73e30fd |
---|---|
3160 | 3160 |
3161 switch(svar) | 3161 switch(svar) |
3162 { | 3162 { |
3163 case CN_ENTER: | 3163 case CN_ENTER: |
3164 { | 3164 { |
3165 int (API_FUNC containerselectfunc)(HWND, char *, void *) = (int (API_FUNC)(HWND, char *, void *))tmp->signalfunction; | 3165 int (API_FUNC containerselectfunc)(HWND, char *, void *, void *) = (int (API_FUNC)(HWND, char *, void *, void *))tmp->signalfunction; |
3166 char *text = NULL; | 3166 char *text = NULL; |
3167 void *data = NULL; | |
3167 | 3168 |
3168 if(mp2) | 3169 if(mp2) |
3169 { | 3170 { |
3170 PRECORDCORE pre; | 3171 PRECORDCORE pre; |
3171 | 3172 |
3172 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; | 3173 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; |
3173 if(pre) | 3174 if(pre) |
3174 text = (char *)pre->pszIcon; | 3175 { |
3176 text = (char *)pre->pszIcon; | |
3177 data = (void *)pre->pszText; | |
3178 } | |
3175 } | 3179 } |
3176 | 3180 |
3177 if(tmp->window == notifyhwnd) | 3181 if(tmp->window == notifyhwnd) |
3178 { | 3182 { |
3179 result = containerselectfunc(tmp->window, text, tmp->data); | 3183 result = containerselectfunc(tmp->window, text, tmp->data, data); |
3180 tmp = NULL; | 3184 tmp = NULL; |
3181 } | 3185 } |
3182 } | 3186 } |
3183 break; | 3187 break; |
3184 case CN_EXPANDTREE: | 3188 case CN_EXPANDTREE: |
3253 | 3257 |
3254 if(mp2) | 3258 if(mp2) |
3255 { | 3259 { |
3256 if(tmp->window == pre->hwndCnr) | 3260 if(tmp->window == pre->hwndCnr) |
3257 { | 3261 { |
3262 /* PCNRITEM for Tree PRECORDCORE for Container */ | |
3258 PCNRITEM pci = (PCNRITEM)pre->pRecord; | 3263 PCNRITEM pci = (PCNRITEM)pre->pRecord; |
3264 PRECORDCORE prc = pre->pRecord; | |
3259 | 3265 |
3260 if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED)) | 3266 if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED)) |
3261 { | 3267 { |
3262 int (API_FUNC treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (API_FUNC)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction; | 3268 int (API_FUNC treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (API_FUNC)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction; |
3263 | 3269 |
3264 if(dw_window_get_data(tmp->window, "_dw_container")) | 3270 if(dw_window_get_data(tmp->window, "_dw_container")) |
3265 result = treeselectfunc(tmp->window, 0, (char *)pci->rc.pszIcon, tmp->data, 0); | 3271 result = treeselectfunc(tmp->window, 0, (char *)prc->pszIcon, tmp->data, (void *)prc->pszText); |
3266 else | 3272 else |
3267 { | 3273 { |
3268 if(lasthcnr == tmp->window && lastitem == (HWND)pci) | 3274 if(lasthcnr == tmp->window && lastitem == (HWND)pci) |
3269 { | 3275 { |
3270 lasthcnr = 0; | 3276 lasthcnr = 0; |
10028 | 10034 |
10029 for(z=0;z<(row-currentcount);z++) | 10035 for(z=0;z<(row-currentcount);z++) |
10030 temp = temp->preccNextRecord; | 10036 temp = temp->preccNextRecord; |
10031 | 10037 |
10032 newtitle = title ? strdup(title) : NULL; | 10038 newtitle = title ? strdup(title) : NULL; |
10033 temp->pszName = temp->pszIcon = (PSZ)title; | 10039 temp->pszName = temp->pszIcon = (PSZ)newtitle; |
10034 } | 10040 } |
10035 | 10041 |
10036 /* | 10042 /* |
10037 * Changes the title of a row already inserted in the container. | 10043 * Changes the title of a row already inserted in the container. |
10038 * Parameters: | 10044 * Parameters: |
10049 { | 10055 { |
10050 if(count == row) | 10056 if(count == row) |
10051 { | 10057 { |
10052 char *oldtitle = (char *)pCore->pszIcon; | 10058 char *oldtitle = (char *)pCore->pszIcon; |
10053 char *newtitle = title ? strdup(title) : NULL; | 10059 char *newtitle = title ? strdup(title) : NULL; |
10054 pCore->pszName = pCore->pszIcon = (PSZ)title; | 10060 pCore->pszName = pCore->pszIcon = (PSZ)newtitle; |
10055 | 10061 |
10056 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED)); | 10062 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED)); |
10057 | 10063 |
10058 if(oldtitle) | 10064 if(oldtitle) |
10059 free(oldtitle); | 10065 free(oldtitle); |
10435 * Deletes the item with the data speficied. | 10441 * Deletes the item with the data speficied. |
10436 * Parameters: | 10442 * Parameters: |
10437 * handle: Handle to the window (widget). | 10443 * handle: Handle to the window (widget). |
10438 * data: Data usually returned by dw_container_query(). | 10444 * data: Data usually returned by dw_container_query(). |
10439 */ | 10445 */ |
10440 void API dw_container_delete_row(HWND handle, void *data) | 10446 void API dw_container_delete_row_by_data(HWND handle, void *data) |
10441 { | 10447 { |
10442 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | 10448 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
10443 int textcomp = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_textcomp")); | 10449 int textcomp = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_textcomp")); |
10444 | 10450 |
10445 while(pCore) | 10451 while(pCore) |