- Timestamp:
- Nov 21, 1999, 6:07:52 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibwin.cpp
r1739 r1801 1 /* $Id: oslibwin.cpp,v 1.4 5 1999-11-14 16:35:54 sandervlExp $ */1 /* $Id: oslibwin.cpp,v 1.46 1999-11-21 17:07:50 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 439 439 hwndClient = WinWindowFromID(hwnd, FID_CLIENT); 440 440 if(hwndClient) { 441 441 WinEnableWindow(hwndClient, fEnable); 442 442 } 443 443 return rc; … … 1058 1058 OSWinStyle); 1059 1059 1060 //CB: bug: it doesn't work with child windows!1061 1062 1060 if(OSFrameStyle & FCF_TITLEBAR) 1063 1061 { -
trunk/src/user32/static.cpp
r1797 r1801 1 /* $Id: static.cpp,v 1.1 0 1999-11-21 14:37:17 achimhaExp $ */1 /* $Id: static.cpp,v 1.11 1999-11-21 17:07:51 cbratschi Exp $ */ 2 2 /* 3 3 * Static control … … 14 14 15 15 #include <stdlib.h> 16 #include <string.h> 16 17 #include <os2win.h> 17 18 #include "controls.h" … … 321 322 UpdateWindow(hwnd); 322 323 323 return 0; 324 return TRUE; 325 } 326 327 LRESULT STATIC_GetText(HWND hwnd,WPARAM wParam,LPARAM lParam) 328 { 329 DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & SS_TYPEMASK; 330 331 if (style == SS_ICON) 332 { 333 STATICINFO* infoPtr = (STATICINFO*)GetInfoPtr(hwnd); 334 335 if (wParam < 4 || !lParam) return 0; 336 memcpy((VOID*)lParam,&infoPtr->hIcon,4); 337 338 return 4; 339 } else return DefWindowProcA(hwnd,WM_GETTEXT,wParam,lParam); 340 } 341 342 LRESULT STATIC_GetTextLength(HWND hwnd,WPARAM wParam,LPARAM lParam) 343 { 344 DWORD style = GetWindowLongA(hwnd,GWL_STYLE) & SS_TYPEMASK; 345 346 if (style == SS_ICON) return 4; 347 else return DefWindowProcA(hwnd,WM_GETTEXTLENGTH,wParam,lParam); 324 348 } 325 349 … … 479 503 case WM_SETTEXT: 480 504 return STATIC_SetText(hwnd,wParam,lParam); 505 506 case WM_GETTEXT: 507 return STATIC_GetText(hwnd,wParam,lParam); 508 509 case WM_GETTEXTLENGTH: 510 return STATIC_GetTextLength(hwnd,wParam,lParam); 481 511 482 512 case WM_SETFONT: … … 722 752 switch (dwStyle & SS_TYPEMASK) 723 753 { 724 725 726 727 728 729 754 case SS_ETCHEDHORZ: 755 DrawEdge(hdc,&rc,EDGE_ETCHED,BF_TOP|BF_BOTTOM); 756 break; 757 case SS_ETCHEDVERT: 758 DrawEdge(hdc,&rc,EDGE_ETCHED,BF_LEFT|BF_RIGHT); 759 break; 730 760 case SS_ETCHEDFRAME: 731 761 DrawEdge (hdc, &rc, EDGE_ETCHED, BF_RECT); -
trunk/src/user32/win32wbase.cpp
r1786 r1801 1 /* $Id: win32wbase.cpp,v 1.8 6 1999-11-21 09:43:18 achimhaExp $ */1 /* $Id: win32wbase.cpp,v 1.87 1999-11-21 17:07:51 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 1215 1215 ULONG Win32BaseWindow::MsgSetText(LPSTR lpsz, LONG cch) 1216 1216 { 1217 if(isUnicode) { 1218 return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz); 1219 } 1220 else return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz); 1217 return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz); 1221 1218 } 1222 1219 //****************************************************************************** … … 1231 1228 char *Win32BaseWindow::MsgGetText() 1232 1229 { 1233 if(isUnicode) { 1234 SendInternalMessageW(WM_GETTEXT, wndNameLength, (LPARAM)windowNameW); 1235 } 1236 else { 1237 SendInternalMessageA(WM_GETTEXT, wndNameLength, (LPARAM)windowNameA); 1238 } 1230 SendInternalMessageA(WM_GETTEXT, wndNameLength, (LPARAM)windowNameA); 1239 1231 return windowNameA; 1240 1232 } … … 1506 1498 return wndNameLength; 1507 1499 1508 case WM_GETTEXT: //TODO: SS_ICON controls 1500 case WM_GETTEXT: 1501 if (!lParam) return 0; 1509 1502 strncpy((LPSTR)lParam, windowNameA, wParam); 1510 1503 return min(wndNameLength, wParam); 1511 1504 1512 1505 case WM_SETTEXT: 1513 if(!fInternalMsg) { 1514 return SetWindowTextA((LPSTR)lParam); 1515 } 1516 else return 0; 1506 { 1507 LPCSTR lpsz = (LPCSTR)lParam; 1508 1509 if(windowNameA) free(windowNameA); 1510 if(windowNameW) free(windowNameW); 1511 1512 if (lParam) 1513 { 1514 windowNameA = (LPSTR)_smalloc(strlen(lpsz)+1); 1515 strcpy(windowNameA, lpsz); 1516 windowNameW = (LPWSTR)_smalloc((strlen(lpsz)+1)*sizeof(WCHAR)); 1517 lstrcpyAtoW(windowNameW, windowNameA); 1518 wndNameLength = strlen(windowNameA)+1; //including 0 terminator 1519 } else 1520 { 1521 windowNameA = NULL; 1522 windowNameW = NULL; 1523 wndNameLength = 1; 1524 } 1525 1526 if(OS2HwndFrame && dwStyle & WS_CAPTION) 1527 return OSLibWinSetWindowText(OS2HwndFrame,(LPSTR)windowNameA); 1528 1529 return TRUE; 1530 } 1517 1531 1518 1532 case WM_SETREDRAW: … … 1733 1747 return wndNameLength; 1734 1748 1735 case WM_GETTEXT: //TODO: SS_ICON controls 1736 { 1737 LRESULT result; 1738 char *str = (char *) malloc(wParam + 1); 1739 result = DefWindowProcA(Msg, wParam, (LPARAM)str ); 1740 lstrcpynAtoW( (LPWSTR)lParam, str, wParam ); 1741 free(str); 1742 return result; 1743 } 1749 case WM_GETTEXT: 1750 if (!lParam) return 0; 1751 lstrcpynW((LPWSTR)lParam,windowNameW,wParam); 1752 return min(wndNameLength,wParam); 1744 1753 1745 1754 case WM_SETTEXT: 1746 1755 { 1747 if(!fInternalMsg) 1748 { 1749 LRESULT result; 1750 char *aText = (char *) malloc((lstrlenW((LPWSTR)lParam)+1)*sizeof(WCHAR)); 1751 *aText = 0; 1752 lstrcpyWtoA(aText, (LPWSTR) lParam); 1753 result = SetWindowTextA(aText); 1754 free(aText); 1755 return result; 1756 } 1757 else return 0; 1756 LPWSTR lpsz = (LPWSTR)lParam; 1757 1758 if(windowNameA) free(windowNameA); 1759 if(windowNameW) free(windowNameW); 1760 1761 if (lParam) 1762 { 1763 windowNameA = (LPSTR)_smalloc(lstrlenW(lpsz)+1); 1764 lstrcpyWtoA(windowNameA,lpsz); 1765 windowNameW = (LPWSTR)_smalloc((lstrlenW(lpsz)+1)*sizeof(WCHAR)); 1766 lstrcpyW(windowNameW,lpsz); 1767 wndNameLength = strlen(windowNameA)+1; //including 0 terminator 1768 } else 1769 { 1770 windowNameA = NULL; 1771 windowNameW = NULL; 1772 wndNameLength = 1; 1773 } 1774 1775 if(OS2HwndFrame && dwStyle & WS_CAPTION) 1776 return OSLibWinSetWindowText(OS2HwndFrame,(LPSTR)windowNameA); 1777 1778 return TRUE; 1758 1779 } 1759 1780 … … 1916 1937 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0); 1917 1938 break; 1939 1918 1940 default: 1919 1941 rc = CallWindowProcA(win32wndproc, getWindowHandle(), Msg, wParam, lParam); … … 2625 2647 int Win32BaseWindow::GetWindowTextLength() 2626 2648 { 2627 return wndNameLength;2649 return SendInternalMessageA(WM_GETTEXTLENGTH,0,0); 2628 2650 } 2629 2651 //****************************************************************************** … … 2631 2653 int Win32BaseWindow::GetWindowTextA(LPSTR lpsz, int cch) 2632 2654 { 2633 if(windowNameA == NULL) { 2634 *lpsz = 0; 2635 return 0; 2636 } 2637 strncpy(lpsz, windowNameA, cch); 2638 return wndNameLength; 2655 return SendInternalMessageA(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz); 2639 2656 } 2640 2657 //****************************************************************************** … … 2642 2659 int Win32BaseWindow::GetWindowTextW(LPWSTR lpsz, int cch) 2643 2660 { 2644 if(windowNameW == NULL) { 2645 *lpsz = 0; 2646 return 0; 2647 } 2648 lstrcpynW((LPWSTR)lpsz, windowNameW, cch); 2649 return wndNameLength; 2661 return SendInternalMessageW(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz); 2650 2662 } 2651 2663 //****************************************************************************** … … 2653 2665 BOOL Win32BaseWindow::SetWindowTextA(LPSTR lpsz) 2654 2666 { 2655 if(lpsz == NULL) 2656 return FALSE; 2657 2658 if(windowNameA) free(windowNameA); 2659 if(windowNameW) free(windowNameW); 2660 2661 windowNameA = (LPSTR)_smalloc(strlen(lpsz)+1); 2662 strcpy(windowNameA, lpsz); 2663 windowNameW = (LPWSTR)_smalloc((strlen(lpsz)+1)*sizeof(WCHAR)); 2664 lstrcpyAtoW(windowNameW, windowNameA); 2665 wndNameLength = strlen(windowNameA)+1; //including 0 terminator 2666 2667 // Edit and static text controls also need a WM_SETTEXT message 2668 if (getWindowClass()->hasClassName("EDIT", FALSE) || 2669 getWindowClass()->hasClassName("STATIC", FALSE)) 2670 SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)windowNameA); 2671 2672 if(OS2HwndFrame) 2673 return OSLibWinSetWindowText(OS2HwndFrame, (LPSTR)windowNameA); 2674 2675 return TRUE; 2667 return SendInternalMessageA(WM_SETTEXT,0,(LPARAM)lpsz); 2676 2668 } 2677 2669 //****************************************************************************** … … 2679 2671 BOOL Win32BaseWindow::SetWindowTextW(LPWSTR lpsz) 2680 2672 { 2681 if(lpsz == NULL) 2682 return FALSE; 2683 2684 if(windowNameA) free(windowNameA); 2685 if(windowNameW) free(windowNameW); 2686 2687 windowNameW = (LPWSTR)_smalloc((lstrlenW((LPWSTR)lpsz)+1)*sizeof(WCHAR)); 2688 lstrcpyW(windowNameW, (LPWSTR)lpsz); 2689 windowNameA = (LPSTR)_smalloc(lstrlenW((LPWSTR)lpsz)+1); 2690 lstrcpyWtoA(windowNameA, windowNameW); 2691 wndNameLength = strlen(windowNameA)+1; //including 0 terminator 2692 2693 // Edit and static text controls also need a WM_SETTEXT message 2694 if (getWindowClass()->hasClassName("EDIT", FALSE) || 2695 getWindowClass()->hasClassName("STATIC", FALSE)) 2696 SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)windowNameA); 2697 2698 if(OS2HwndFrame) 2699 return OSLibWinSetWindowText(OS2HwndFrame, (LPSTR)windowNameA); 2700 2701 return TRUE; 2673 return SendInternalMessageW(WM_SETTEXT,0,(LPARAM)lpsz); 2674 } 2675 //****************************************************************************** 2676 //****************************************************************************** 2677 VOID Win32BaseWindow::updateWindowStyle(DWORD oldExStyle,DWORD oldStyle) 2678 { 2679 if(IsWindowDestroyed()) return; 2680 2681 /* 2682 if (isChild()) 2683 { 2684 DWORD dwOSWinStyle,dwOSFrameStyle,newBorderWidth,newBorderHeight; 2685 2686 OSLibWinConvertStyle(dwStyle,&dwExStyle,&dwOSWinStyle,&dwOSFrameStyle,&newBorderWidth,&newBorderHeight); 2687 if (newBorderWidth != borderWidth || newBorderHeight != borderHeight) 2688 { 2689 borderWidth = newBorderWidth; 2690 borderHeight = newBorderHeight; 2691 FrameSetBorderSize(this,TRUE); 2692 } 2693 } 2694 */ 2695 2696 if (dwStyle != oldStyle) OSLibSetWindowStyle(OS2HwndFrame,dwStyle); 2702 2697 } 2703 2698 //****************************************************************************** … … 2721 2716 SendMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss); 2722 2717 setExStyle(ss.styleNew); 2718 updateWindowStyle(ss.styleOld,dwStyle); 2723 2719 SendMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss); 2724 2720 return ss.styleOld; … … 2736 2732 SendMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss); 2737 2733 setStyle(ss.styleNew); 2738 if(!IsWindowDestroyed()) 2739 OSLibSetWindowStyle(OS2HwndFrame, ss.styleNew); 2734 updateWindowStyle(dwExStyle,ss.styleOld); 2740 2735 SendMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss); 2741 2736 return ss.styleOld; -
trunk/src/user32/win32wbase.h
r1704 r1801 1 /* $Id: win32wbase.h,v 1.4 3 1999-11-11 13:17:32 sandervlExp $ */1 /* $Id: win32wbase.h,v 1.44 1999-11-21 17:07:52 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 94 94 ULONG MsgContextMenu(ULONG x,ULONG y); 95 95 96 VOID updateWindowStyle(DWORD oldExStyle,DWORD oldStyle); 97 96 98 virtual LONG SetWindowLongA(int index, ULONG value); 97 99 virtual ULONG GetWindowLongA(int index); … … 108 110 Win32WndClass *getWindowClass() { return windowClass; }; 109 111 110 112 DWORD getWindowContextHelpId() { return contextHelpId; }; 111 113 void setWindowContextHelpId(DWORD id){ contextHelpId = id; }; 112 114 … … 271 273 HWND hwndLinkAfter; 272 274 DWORD flags; 273 275 DWORD contextHelpId; 274 276 LONG lastHitTestVal; //Last value returned by WM_NCHITTEST handler 275 277
Note:
See TracChangeset
for help on using the changeset viewer.