Changeset 19094
- Timestamp:
- Jun 1, 2002, 7:26:32 PM (23 years ago)
- Location:
- tags/trunk/src/user32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tags/trunk/src/user32/pmwindow.cpp ¶
r18959 r19094 1 /* $Id: pmwindow.cpp,v 1.17 3 2002-05-14 09:06:49sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.174 2002-06-01 17:26:30 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 780 780 break; 781 781 782 case DM_DRAGOVER: 783 { 784 PDRAGINFO pDragInfo = (PDRAGINFO)mp1; 785 PDRAGITEM pDragItem; 786 USHORT sxDrop = SHORT1FROMMP(mp2); 787 USHORT syDrop = SHORT2FROMMP(mp2); 788 USHORT usIndicator, usOp; 789 ULONG ulBytes; 790 int i, cItems; 791 BOOL ret; 792 char szFileName[CCHMAXPATH]; 793 char szContainerName[CCHMAXPATH]; 794 795 dprintf(("OS2: DM_DRAGOVER %x (%d,%d)", win32wnd->getWindowHandle(), sxDrop, syDrop)); 796 797 //does this window accept dropped files? 798 if(!win32wnd->AcceptsDropFiles()) { 799 rc = (MRFROM2SHORT (DOR_NEVERDROP, 0)); 800 break; 801 } 802 /* Get access to the DRAGINFO data structure */ 803 if(!DrgAccessDraginfo(pDragInfo)) { 804 rc = (MRFROM2SHORT (DOR_NODROP, 0)); 805 break; 806 } 807 808 /* Can we accept this drop? */ 809 switch (pDragInfo->usOperation) { 810 /* Return DOR_NODROPOP if current operation */ 811 /* is link or unknown */ 812 case DO_LINK: 813 case DO_COPY: 814 case DO_UNKNOWN: 815 DrgFreeDraginfo(pDragInfo); 816 rc = (MRFROM2SHORT (DOR_NODROPOP, 0)); 817 break; 818 819 /* Our default operation is Move */ 820 case DO_MOVE: 821 case DO_DEFAULT: 822 pDragItem = DrgQueryDragitemPtr(pDragInfo, 0); 823 ulBytes = DrgQueryStrName(pDragItem->hstrContainerName, 824 sizeof(szContainerName), 825 szContainerName); 826 ulBytes = DrgQueryStrName(pDragItem->hstrSourceName, 827 sizeof(szFileName), 828 szFileName); 829 if (!ulBytes) { 830 rc = (MRFROM2SHORT (DOR_NODROPOP, 0)); 831 break; 832 } 833 else usOp = DO_MOVE; 834 835 dprintf(("dropped file %s%s", szContainerName, szFileName)); 836 break; 837 } 838 if(rc == MRFROM2SHORT (DOR_NODROPOP, 0)) { 839 break; 840 } 841 842 usIndicator = (USHORT)DOR_DROP; 843 cItems = DrgQueryDragitemCount(pDragInfo); 844 845 /* Now, we need to look at each item in turn */ 846 for (i = 0; i < cItems; i++) { 847 pDragItem = DrgQueryDragitemPtr(pDragInfo, i); 848 849 /* Make sure we can move for a Move request */ 850 if ((pDragItem->fsSupportedOps & DO_MOVEABLE) && 851 (usOp == (USHORT)DO_MOVE)) 852 { 853 usIndicator = DOR_DROP; 854 } 855 else { 856 dprintf(("item %d not accepted", i)); 857 usIndicator = DOR_NODROPOP; 858 break; 859 } 860 } 861 /* Release the draginfo data structure */ 862 DrgFreeDraginfo(pDragInfo); 863 864 dprintf(("return %x", MRFROM2SHORT(usIndicator, usOp))); 865 rc = (MRFROM2SHORT(usIndicator, usOp)); 866 break; 867 } 868 869 case DM_DRAGLEAVE: 870 { 871 dprintf(("OS2: DM_DRAGLEAVE %x", win32wnd->getWindowHandle())); 872 break; 873 } 874 875 case DM_DROP: 876 { 877 PDRAGINFO pDragInfo = (PDRAGINFO)mp1; 878 PDRAGITEM pDragItem; 879 USHORT sxDrop = SHORT1FROMMP(mp2); 880 USHORT syDrop = SHORT2FROMMP(mp2); 881 USHORT usIndicator, usOp; 882 ULONG ulBytes; 883 int i, cItems; 884 BOOL ret; 885 char szFileName[CCHMAXPATH]; 886 char szContainerName[CCHMAXPATH]; 887 888 dprintf(("OS2: DM_DROP %x (%d,%d)", win32wnd->getWindowHandle(), sxDrop, syDrop)); 889 890 //does this window accept dropped files? 891 if(!win32wnd->AcceptsDropFiles()) { 892 rc = 0; 893 break; 894 } 895 /* Get access to the DRAGINFO data structure */ 896 if(!DrgAccessDraginfo(pDragInfo)) { 897 rc = 0; 898 break; 899 } 900 901 usIndicator = (USHORT)DOR_DROP; 902 cItems = DrgQueryDragitemCount(pDragInfo); 903 904 //computer memory required to hold all filenames 905 int bufsize = 0; 906 for (i = 0; i < cItems; i++) { 907 pDragItem = DrgQueryDragitemPtr(pDragInfo, i); 908 909 bufsize += DrgQueryStrNameLen(pDragItem->hstrContainerName) + DrgQueryStrNameLen(pDragItem->hstrSourceName); 910 bufsize++; //0 terminator 911 bufsize++; //+ potential missing backslash 912 } 913 //copy all filenames 914 char *pszFiles = (char *)malloc(bufsize); 915 if(pszFiles == NULL) { 916 dprintf(("Out of memory!!")); 917 DebugInt3(); 918 break; 919 } 920 char *pszCurFile = pszFiles; 921 922 for (i = 0; i < cItems; i++) { 923 char *pszTemp = pszCurFile; 924 925 pDragItem = DrgQueryDragitemPtr(pDragInfo, i); 926 927 ulBytes = DrgQueryStrNameLen(pDragItem->hstrContainerName); 928 929 ulBytes = DrgQueryStrName(pDragItem->hstrContainerName, 930 ulBytes, pszCurFile); 931 if(pszCurFile[ulBytes-1] != '\\') { 932 pszCurFile[ulBytes] = '\\'; 933 pszCurFile++; 934 } 935 pszCurFile += ulBytes; 936 937 ulBytes = DrgQueryStrNameLen(pDragItem->hstrSourceName); 938 ulBytes = DrgQueryStrName(pDragItem->hstrSourceName, 939 ulBytes+1, pszCurFile); 940 pszCurFile += ulBytes + 1; //+ terminator 941 942 dprintf(("dropped file %s", pszTemp)); 943 } 944 POINT point = {sxDrop, syDrop}; 945 win32wnd->MsgDropFiles(cItems, point, pszFiles, bufsize); 946 free(pszFiles); 947 948 /* Release the draginfo data structure */ 949 DrgFreeDraginfo(pDragInfo); 950 951 rc = 0; 952 break; 953 } 954 782 955 case WM_DDE_INITIATE: 783 956 case WM_DDE_INITIATEACK: -
TabularUnified tags/trunk/src/user32/win32wbase.cpp ¶
r18930 r19094 1 /* $Id: win32wbase.cpp,v 1.32 4 2002-05-07 13:28:13sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.325 2002-06-01 17:26:31 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 1268 1268 //****************************************************************************** 1269 1269 //****************************************************************************** 1270 ULONG Win32BaseWindow::MsgDropFiles(UINT cFiles, POINT point, LPSTR pszFiles, UINT cbszFiles, BOOL fNonClient) 1271 { 1272 DROPFILES *pDropFile; 1273 HGLOBAL hDropFile; 1274 HWND hwnd; 1275 1276 hwnd = (getExStyle() & WS_EX_ACCEPTFILES) ? getWindowHandle() : ::GetParent(getWindowHandle()); 1277 cbszFiles++; //extra terminating 0 1278 1279 if(::IsWindowUnicode(hwnd)) { 1280 dprintf(("unicode dropfiles")); 1281 cbszFiles *= 2; 1282 } 1283 1284 hDropFile = GlobalAlloc(0, sizeof(DROPFILES)+cbszFiles); 1285 pDropFile = (DROPFILES *)GlobalLock(hDropFile); 1286 if(pDropFile == NULL) { 1287 DebugInt3(); 1288 return 0; 1289 } 1290 pDropFile->pFiles = sizeof(DROPFILES); 1291 pDropFile->fNC = fNonClient; 1292 pDropFile->fWide = ::IsWindowUnicode(hwnd); 1293 pDropFile->pt = point; 1294 if(::IsWindowUnicode(hwnd)) { 1295 LPWSTR lpszFilesW = (LPWSTR)(pDropFile+1); 1296 while(*pszFiles) { 1297 int len = strlen(pszFiles); 1298 MultiByteToWideChar(CP_ACP, 0, pszFiles, -1, lpszFilesW, len); 1299 pszFiles += len + 1; 1300 lpszFilesW += len + 1; 1301 } 1302 *lpszFilesW = 0; 1303 } 1304 else { 1305 //copy strings (excluding terminating 0) 1306 memcpy((pDropFile+1), pszFiles, cbszFiles-1); 1307 } 1308 GlobalUnlock(hDropFile); 1309 ::SendMessageA(hwnd, WM_DROPFILES, hDropFile, 0); 1310 return 0; 1311 } 1312 //****************************************************************************** 1313 //****************************************************************************** 1314 BOOL Win32BaseWindow::AcceptsDropFiles() 1315 { 1316 //Is it correct if the window or parent accepts files or must we check the topparent parent? 1317 if(getExStyle() & WS_EX_ACCEPTFILES) { 1318 return TRUE; 1319 } 1320 DWORD dwStyle = GetWindowLongA(::GetParent(getWindowHandle()), GWL_EXSTYLE); 1321 if(!(dwStyle & WS_EX_ACCEPTFILES)) { 1322 return FALSE; 1323 } 1324 return TRUE; 1325 } 1326 //****************************************************************************** 1327 //****************************************************************************** 1270 1328 ULONG Win32BaseWindow::MsgChar(MSG *msg) 1271 1329 { -
TabularUnified tags/trunk/src/user32/win32wbase.h ¶
r18570 r19094 1 /* $Id: win32wbase.h,v 1.14 0 2002-02-26 11:12:25sandervl Exp $ */1 /* $Id: win32wbase.h,v 1.141 2002-06-01 17:26:32 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 159 159 ULONG DispatchMsgA(MSG *msg); 160 160 ULONG DispatchMsgW(MSG *msg); 161 162 ULONG MsgDropFiles(UINT cFiles, POINT point, LPSTR pszFiles, UINT cbszFiles, BOOL fNonClient = FALSE); 163 BOOL AcceptsDropFiles(); 161 164 162 165 ULONG MsgSetText(LPSTR lpsz, LONG cch);
Note:
See TracChangeset
for help on using the changeset viewer.