Changeset 5935 for trunk/src/user32/windlgmsg.cpp
- Timestamp:
- Jun 9, 2001, 4:50:26 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/windlgmsg.cpp
r5496 r5935 1 /* $Id: windlgmsg.cpp,v 1. 8 2001-04-12 14:04:33sandervl Exp $ */1 /* $Id: windlgmsg.cpp,v 1.9 2001-06-09 14:50:25 sandervl Exp $ */ 2 2 /* 3 3 * Win32 dialog message APIs for OS/2 … … 30 30 { 31 31 Win32Dialog *dialog; 32 Win32BaseWindow *dlgcontrol;32 HWND hwndDlgItem; 33 33 34 34 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 37 37 return 0; 38 38 } 39 dlgcontrol = dialog->getDlgItem(id); 40 if(dlgcontrol) { 41 return dlgcontrol->SendMessageA(Msg, wParam, lParam); 39 hwndDlgItem = dialog->getDlgItem(id); 40 RELEASE_WNDOBJ(dialog); 41 if(hwndDlgItem) { 42 return SendMessageA(hwndDlgItem, Msg, wParam, lParam); 42 43 } 43 44 return 0; … … 48 49 { 49 50 Win32Dialog *dialog; 50 Win32BaseWindow *dlgcontrol;51 HWND hwndDlgItem; 51 52 52 53 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd); … … 55 56 return 0; 56 57 } 57 dlgcontrol = dialog->getDlgItem(id); 58 if(dlgcontrol) { 59 return dlgcontrol->SendMessageW(Msg, wParam, lParam); 58 hwndDlgItem = dialog->getDlgItem(id); 59 RELEASE_WNDOBJ(dialog); 60 if(hwndDlgItem) { 61 return SendMessageW(hwndDlgItem, Msg, wParam, lParam); 60 62 } 61 63 return 0; … … 90 92 ((win32wnd->getStyle() & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE) ) 91 93 { 92 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 ); 93 if (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) 94 { 95 INT textLen = win32wnd->GetWindowTextLengthA(); 96 97 if (textLen > 0) 98 { 99 /* find the accelerator key */ 100 char* text; 101 LPSTR p; 102 103 text = (char*)malloc(textLen+1); 104 win32wnd->GetWindowTextA(text,textLen); 105 p = text - 2; 106 do 94 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 ); 95 if (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) 96 { 97 INT textLen = win32wnd->GetWindowTextLengthA(); 98 99 if (textLen > 0) 107 100 { 108 p = strchr( p + 2, '&' ); 101 /* find the accelerator key */ 102 char* text; 103 LPSTR p; 104 105 text = (char*)malloc(textLen+1); 106 win32wnd->GetWindowTextA(text,textLen); 107 p = text - 2; 108 do 109 { 110 p = strchr( p + 2, '&' ); 111 } 112 while (p != NULL && p[1] == '&'); 113 114 /* and check if it's the one we're looking for */ 115 if (p != NULL && toupper( p[1] ) == toupper( vKey ) ) 116 { 117 if ((dlgCode & DLGC_STATIC) || 118 (win32wnd->getStyle() & 0x0f) == BS_GROUPBOX ) 119 { 120 /* set focus to the control */ 121 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 122 hwndControl, 1); 123 /* and bump it on to next */ 124 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0); 125 } 126 else 127 //TODO: this else part was removed in Wine and above if rules out this possibility (if (dlgCode & (DLGC_BUTTON | DLGC_STATIC))) 128 if (dlgCode & (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON)) 129 { 130 /* send command message as from the control */ 131 SendMessageA( hwndDlg, WM_COMMAND, MAKEWPARAM( LOWORD(win32wnd->getWindowId()), BN_CLICKED ), 132 (LPARAM)hwndControl ); 133 } 134 else if (dlgCode & DLGC_BUTTON) 135 { 136 /* send BM_CLICK message to the control */ 137 SendMessageA( hwndControl, BM_CLICK, 0, 0 ); 138 } 139 RetVal = TRUE; 140 free(text); 141 RELEASE_WNDOBJ(win32wnd); 142 break; 143 } 144 free(text); 109 145 } 110 while (p != NULL && p[1] == '&'); 111 112 /* and check if it's the one we're looking for */ 113 if (p != NULL && toupper( p[1] ) == toupper( vKey ) ) 114 { 115 if ((dlgCode & DLGC_STATIC) || 116 (win32wnd->getStyle() & 0x0f) == BS_GROUPBOX ) 117 { 118 /* set focus to the control */ 119 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 120 hwndControl, 1); 121 /* and bump it on to next */ 122 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0); 123 } 124 else if (dlgCode & 125 (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON)) 126 { 127 /* send command message as from the control */ 128 SendMessageA( hwndDlg, WM_COMMAND, 129 MAKEWPARAM( LOWORD(win32wnd->getWindowId()), 130 BN_CLICKED ), 131 (LPARAM)hwndControl ); 132 } 133 else 134 { 135 /* click the control */ 136 SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0); 137 SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0); 138 } 139 RetVal = TRUE; 140 free(text); 146 } 147 hwndNext = GetWindow( hwndControl, GW_CHILD ); 148 } 149 else 150 { 151 hwndNext = 0; 152 } 153 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 154 155 if (!hwndNext) 156 { 157 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT ); 158 } 159 while (!hwndNext) 160 { 161 hwndControl = GetParent( hwndControl ); 162 if (hwndControl == hwndDlg) 163 { 164 if(hwnd==hwndDlg){ /* prevent endless loop */ 165 hwndNext=hwnd; 141 166 break; 142 167 } 143 free(text); 144 } 145 } 146 hwndNext = GetWindow( hwndControl, GW_CHILD ); 147 } 148 else 149 { 150 hwndNext = 0; 151 } 152 if (!hwndNext) 153 { 154 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT ); 155 } 156 while (!hwndNext) 157 { 158 hwndControl = GetParent( hwndControl ); 159 if (hwndControl == hwndDlg) 160 { 161 if(hwnd==hwndDlg){ /* prevent endless loop */ 162 hwndNext=hwnd; 163 break; 164 } 165 hwndNext = GetWindow( hwndDlg, GW_CHILD ); 166 } 167 else 168 { 169 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT ); 170 } 171 } 168 hwndNext = GetWindow( hwndDlg, GW_CHILD ); 169 } 170 else 171 { 172 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT ); 173 } 174 } 172 175 hwndControl = hwndNext; 173 176 } … … 184 187 * We propagate up until we hit a that does not have DS_CONTROL, or 185 188 * whose parent is not a dialog. 189 * 190 * This is undocumented behaviour. 186 191 */ 187 192 static HWND DIALOG_FindMsgDestination( HWND hwndDlg ) … … 196 201 if (!pParent) break; 197 202 198 if (!pParent->IsDialog()) 199 break; 200 203 if (!pParent->IsDialog()) { 204 RELEASE_WNDOBJ(pParent); 205 break; 206 } 207 RELEASE_WNDOBJ(pParent); 201 208 hwndDlg = hParent; 202 209 }
Note:
See TracChangeset
for help on using the changeset viewer.