Mercurial > dwindows
comparison os2/dw.c @ 1371:896347a9be19
Initial versions of dw_menu_delete_item() on OS/2 and Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 22 Nov 2011 20:46:37 +0000 |
parents | a595e368a393 |
children | 8e27dd96a97e |
comparison
equal
deleted
inserted
replaced
1370:e705051d841c | 1371:896347a9be19 |
---|---|
4349 * Parameters: | 4349 * Parameters: |
4350 * handle: The window handle to destroy. | 4350 * handle: The window handle to destroy. |
4351 */ | 4351 */ |
4352 int API dw_window_destroy(HWND handle) | 4352 int API dw_window_destroy(HWND handle) |
4353 { | 4353 { |
4354 HWND frame, menu, parent = WinQueryWindow(handle, QW_PARENT); | 4354 HWND frame, menu, parent; |
4355 Box *thisbox = WinQueryWindowPtr(parent, QWP_USER); | 4355 Box *thisbox; |
4356 | 4356 |
4357 if(!handle) | 4357 if(!handle) |
4358 return -1; | 4358 return DW_ERROR_UNKNOWN; |
4359 | 4359 |
4360 /* Handle special case for menu handle */ | |
4361 if(handle < 65536) | |
4362 { | |
4363 char buffer[30]; | |
4364 | |
4365 sprintf(buffer, "_dw_id%ld", handle); | |
4366 menu = dw_window_get_data(hwndApp, buffer); | |
4367 | |
4368 if(menu && WinIsWindow(dwhab, menu)) | |
4369 return dw_menu_delete_item((HEMNUI)menu, handle); | |
4370 return DW_ERROR_UNKNOWN; | |
4371 } | |
4372 | |
4373 parent = WinQueryWindow(handle, QW_PARENT); | |
4374 thisbox = WinQueryWindowPtr(parent, QWP_USER); | |
4360 frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); | 4375 frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); |
4361 | 4376 |
4362 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) | 4377 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) |
4363 _free_menu_data(menu); | 4378 _free_menu_data(menu); |
4364 | 4379 |
5193 /* | 5208 /* |
5194 * Keep our internal checked state consistent | 5209 * Keep our internal checked state consistent |
5195 */ | 5210 */ |
5196 dw_window_set_data( hwndApp, buffer1, (void *)check ); | 5211 dw_window_set_data( hwndApp, buffer1, (void *)check ); |
5197 dw_window_set_data( hwndApp, buffer2, (void *)disabled ); | 5212 dw_window_set_data( hwndApp, buffer2, (void *)disabled ); |
5213 } | |
5214 | |
5215 /* | |
5216 * Deletes the menu item specified | |
5217 * Parameters: | |
5218 * menu: The handle to the menu in which the item was appended. | |
5219 * id: Menuitem id. | |
5220 * Returns: | |
5221 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. | |
5222 */ | |
5223 int API dw_menu_delete_item(HMENUI menux, unsigned long id) | |
5224 { | |
5225 if(id < 65536) | |
5226 { | |
5227 WinSendMsg(menux, MM_DELETEITEM, MPFROM2SHORT(id, FALSE), 0); | |
5228 return DW_ERROR_NONE; | |
5229 } | |
5230 return DW_ERROR_UNKNOWN; | |
5198 } | 5231 } |
5199 | 5232 |
5200 /* | 5233 /* |
5201 * Pops up a context menu at given x and y coordinates. | 5234 * Pops up a context menu at given x and y coordinates. |
5202 * Parameters: | 5235 * Parameters: |