- Timestamp:
- Nov 13, 1999, 5:42:43 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/button.cpp
r1525 r1724 1 /* $Id: button.cpp,v 1.1 6 1999-10-30 18:40:43cbratschi Exp $ */1 /* $Id: button.cpp,v 1.17 1999-11-13 16:42:40 cbratschi Exp $ */ 2 2 /* File: button.cpp -- Button type widgets 3 3 * … … 7 7 * Copyright (c) 1999 Christoph Bratschi 8 8 * 9 * WINE version: 99 09239 * WINE version: 991031 10 10 */ 11 11 … … 201 201 static LRESULT BUTTON_LButtonDown(HWND hwnd,WPARAM wParam,LPARAM lParam) 202 202 { 203 BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd); 204 203 205 SetCapture(hwnd); 204 206 SetFocus(hwnd); 205 207 SendMessageA(hwnd,BM_SETSTATE,TRUE,0); 208 infoPtr->state |= BUTTON_BTNPRESSED; 206 209 207 210 return 0; … … 217 220 pt.y = HIWORD(lParam); 218 221 222 if (!(infoPtr->state & BUTTON_BTNPRESSED)) return 0; 223 infoPtr->state &= BUTTON_NSTATES; 224 if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) 225 { 226 ReleaseCapture(); 227 return 0; 228 } 229 SendMessageA(hwnd,BM_SETSTATE,FALSE,0); 219 230 ReleaseCapture(); 220 if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) return 0;221 SendMessageA(hwnd,BM_SETSTATE,FALSE,0);222 231 GetClientRect(hwnd,&rect); 223 232 if (PtInRect(&rect,pt)) … … 246 255 } 247 256 257 static LRESULT BUTTON_CaptureChanged(HWND hwnd,WPARAM wParam,LPARAM lParam) 258 { 259 BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd); 260 261 if (infoPtr->state & BUTTON_BTNPRESSED) 262 { 263 infoPtr->state &= BUTTON_NSTATES; 264 if (infoPtr->state & BUTTON_HIGHLIGHTED) 265 SendMessageA( hwnd, BM_SETSTATE, FALSE, 0 ); 266 } 267 268 return 0; 269 } 270 248 271 static LRESULT BUTTON_MouseMove(HWND hwnd,WPARAM wParam,LPARAM lParam) 249 272 { … … 542 565 case WM_LBUTTONUP: 543 566 return BUTTON_LButtonUp(hwnd,wParam,lParam); 567 568 case WM_CAPTURECHANGED: 569 return BUTTON_CaptureChanged(hwnd,wParam,lParam); 544 570 545 571 case WM_MOUSEMOVE: … … 1074 1100 1075 1101 SetBkColor( hDC, GetSysColor( COLOR_BTNFACE ) ); 1076 FillRect( hDC, &dis.rcItem, GetSysColorBrush( COLOR_BTNFACE ) );1077 1102 1078 1103 dprintf(("OWNERDRAW button %x, enabled %d", hwnd, !(dwStyle & WS_DISABLED))); -
trunk/src/user32/combo.cpp
r1550 r1724 1 /* $Id: combo.cpp,v 1.1 1 1999-11-02 19:12:59 sandervlExp $ */1 /* $Id: combo.cpp,v 1.12 1999-11-13 16:42:41 cbratschi Exp $ */ 2 2 /* 3 3 * Combo controls … … 8 8 * FIXME: roll up in Netscape 3.01. 9 9 * 10 * WINE version: 99 092310 * WINE version: 991031 11 11 */ 12 12 … … 374 374 //SvL: Listbox size might have changed! 375 375 if(lphc->hWndLBox) 376 376 GetWindowRect(lphc->hWndLBox, lprLB); 377 377 378 378 /* … … 675 675 } 676 676 677 DrawFrameControl(hdc,&rectButton,DFC_SCROLL,buttonState); 677 DrawFrameControl(hdc,&rectButton,DFC_SCROLL,buttonState); 678 678 } 679 679 … … 688 688 RECT rectEdit) 689 689 { 690 INT 691 LPSTR 690 INT id, size = 0; 691 LPSTR pText = NULL; 692 692 693 693 if( lphc->wState & CBF_NOREDRAW ) return; … … 700 700 size = SendMessageA( lphc->hWndLBox, LB_GETTEXTLEN, id, 0); 701 701 if( (pText = (char*)HeapAlloc( GetProcessHeap(), 0, size + 1)) != NULL ) 702 703 704 pText[size] = '\0';/* just in case */705 702 { 703 SendMessageA( lphc->hWndLBox, LB_GETTEXT, (WPARAM)id, (LPARAM)pText ); 704 pText[size] = '\0'; /* just in case */ 705 } else return; 706 706 } 707 707 708 708 if( lphc->wState & CBF_EDIT ) 709 709 { 710 711 712 710 if( CB_HASSTRINGS(lphc) ) SetWindowTextA( lphc->hWndEdit, pText ? pText : "" ); 711 if( lphc->wState & CBF_FOCUSED ) 712 SendMessageA( lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1)); 713 713 } 714 714 else /* paint text field ourselves */ 715 715 { 716 UINT 717 HFONT 716 UINT itemState; 717 HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0; 718 718 719 719 /* … … 723 723 724 724 if ( (lphc->wState & CBF_FOCUSED) && 725 725 !(lphc->wState & CBF_DROPPED) ) 726 726 { 727 727 /* highlight */ … … 742 742 743 743 /* 744 745 746 747 744 * Save the current clip region. 745 * To retrieve the clip region, we need to create one "dummy" 746 * clip region. 747 */ 748 748 clipRegion = CreateRectRgnIndirect(&rectEdit); 749 749 750 750 if (GetClipRgn(hdc, clipRegion)!=1) 751 751 { 752 753 752 DeleteObject(clipRegion); 753 clipRegion=(HRGN)NULL; 754 754 } 755 755 756 756 if ( dwStyle & WS_DISABLED ) 757 758 759 dis.CtlType 760 dis.CtlID 761 dis.hwndItem 762 dis.itemAction 763 dis.itemID 764 dis.itemState 765 dis.hDC 766 dis.rcItem 767 dis.itemData 768 757 itemState |= ODS_DISABLED; 758 759 dis.CtlType = ODT_COMBOBOX; 760 dis.CtlID = GetWindowLongA(lphc->hwndself,GWL_ID); 761 dis.hwndItem = lphc->hwndself; 762 dis.itemAction = ODA_DRAWENTIRE; 763 dis.itemID = id; 764 dis.itemState = itemState; 765 dis.hDC = hdc; 766 dis.rcItem = rectEdit; 767 dis.itemData = SendMessageA( lphc->hWndLBox, LB_GETITEMDATA, 768 (WPARAM)id, 0 ); 769 769 770 770 /* 771 772 771 * Clip the DC and have the parent draw the item. 772 */ 773 773 IntersectClipRect(hdc, 774 775 774 rectEdit.left, rectEdit.top, 775 rectEdit.right, rectEdit.bottom); 776 776 777 777 SendMessageA(lphc->owner, WM_DRAWITEM, 778 778 GetWindowLongA(lphc->hwndself,GWL_ID), (LPARAM)&dis ); 779 779 780 780 /* 781 782 783 SelectClipRgn(hdc, clipRegion); 781 * Reset the clipping region. 782 */ 783 SelectClipRgn(hdc, clipRegion); 784 784 } 785 785 else 786 786 { 787 787 ExtTextOutA( hdc, 788 789 790 791 792 788 rectEdit.left + 1, 789 rectEdit.top + 1, 790 ETO_OPAQUE | ETO_CLIPPED, 791 &rectEdit, 792 pText ? pText : "" , size, NULL ); 793 793 794 794 if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED)) 795 795 DrawFocusRect( hdc, &rectEdit ); 796 796 } 797 797 … … 800 800 } 801 801 if (pText) 802 802 HeapFree( GetProcessHeap(), 0, pText ); 803 803 } 804 804 … … 849 849 { 850 850 hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLORSTATIC, 851 851 hDC, lphc->hwndself ); 852 852 853 853 /* … … 863 863 { 864 864 hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLOREDIT, 865 865 hDC, lphc->hwndself ); 866 866 } 867 867 else 868 868 { 869 869 hBkgBrush = SendMessageA( lphc->owner, WM_CTLCOLORLISTBOX, 870 870 hDC, lphc->hwndself ); 871 871 } 872 872 } … … 1845 1845 case WM_PASTE: 1846 1846 case WM_COPY: 1847 if ( lphc->wState & CBF_EDIT)1847 if ((message == WM_GETTEXTLENGTH) && !(lphc->wState & CBF_EDIT)) 1848 1848 { 1849 lphc->wState |= CBF_NOEDITNOTIFY;1850 1851 return SendMessageA( lphc->hWndEdit, message, wParam, lParam);1849 int j = SendMessageA( lphc->hWndLBox, LB_GETCURSEL, 0, 0 ); 1850 if (j == -1) return 0; 1851 return SendMessageA( lphc->hWndLBox, LB_GETTEXTLEN, j, 0); 1852 1852 } 1853 return CB_ERR; 1853 else if( lphc->wState & CBF_EDIT ) 1854 { 1855 lphc->wState |= CBF_NOEDITNOTIFY; 1856 1857 return SendMessageA( lphc->hWndEdit, message, wParam, lParam ); 1858 } 1859 else return CB_ERR; 1854 1860 case WM_DRAWITEM: 1855 1861 case WM_DELETEITEM: … … 1862 1868 EnableWindow( lphc->hWndLBox, (BOOL)wParam ); 1863 1869 1864 1865 1870 /* Force the control to repaint when the enabled state changes. */ 1871 InvalidateRect(CB_HWND(lphc), NULL, TRUE); 1866 1872 return TRUE; 1867 1873 case WM_SETREDRAW: -
trunk/src/user32/edit.cpp
r1717 r1724 1 /* $Id: edit.cpp,v 1.1 3 1999-11-12 17:16:36cbratschi Exp $ */1 /* $Id: edit.cpp,v 1.14 1999-11-13 16:42:41 cbratschi Exp $ */ 2 2 /* 3 3 * Edit control … … 9 9 * Copyright 1999 Christoph Bratschi 10 10 * 11 * WINE version: 99 092311 * WINE version: 991031 12 12 */ 13 13 … … 184 184 static BOOL EDIT_EM_FmtLines(HWND hwnd, EDITSTATE *es, BOOL add_eol); 185 185 static HLOCAL EDIT_EM_GetHandle(HWND hwnd, EDITSTATE *es); 186 static HLOCAL16 EDIT_EM_GetHandle16(HWND hwnd, EDITSTATE *es);187 186 static INT EDIT_EM_GetLine(HWND hwnd, EDITSTATE *es, INT line, LPSTR lpch); 188 187 static LRESULT EDIT_EM_GetSel(HWND hwnd, EDITSTATE *es, LPUINT start, LPUINT end); … … 1077 1076 EDIT_GetLineRect(hwnd, es, 0, start, end, &line_rect); 1078 1077 if (IntersectRect(&rc, &line_rect, &es->format_rect)) 1079 InvalidateRect(hwnd, &rc, FALSE); 1078 { 1079 if (es->flags & EF_FOCUSED) HideCaret(hwnd); 1080 InvalidateRect(hwnd, &rc, FALSE); 1081 if (es->flags & EF_FOCUSED) ShowCaret(hwnd); 1082 } 1080 1083 } 1081 1084 … … 1117 1120 GetClientRect(hwnd, &rc1); 1118 1121 IntersectRect(&rcWnd, &rc1, &es->format_rect); 1122 if (es->flags & EF_FOCUSED) HideCaret(hwnd); 1119 1123 if (sl == el) { 1120 1124 EDIT_GetLineRect(hwnd, es, sl, sc, ec, &rcLine); … … 1140 1144 InvalidateRect(hwnd, &rcUpdate, FALSE); 1141 1145 } 1146 if (es->flags & EF_FOCUSED) ShowCaret(hwnd); 1142 1147 } 1143 1148 … … 1181 1186 { 1182 1187 HLOCAL hNew32; 1183 HLOCAL16 hNew16;1184 1188 1185 1189 if (size <= es->buffer_size) … … 2623 2627 switch (c) { 2624 2628 case '\r': 2625 /* If the edit doesn't want the return, do nothing */2626 if(!(es->style & ES_WANTRETURN))2627 2629 /* If the edit doesn't want the return and it's not a multiline edit, do nothing */ 2630 if(!(es->style & ES_MULTILINE) && !(es->style & ES_WANTRETURN)) 2631 break; 2628 2632 case '\n': 2629 2633 if (es->style & ES_MULTILINE) { -
trunk/src/user32/listbox.cpp
r1433 r1724 1 /* $Id: listbox.cpp,v 1.1 1 1999-10-24 22:56:05 sandervlExp $ */1 /* $Id: listbox.cpp,v 1.12 1999-11-13 16:42:41 cbratschi Exp $ */ 2 2 /* 3 3 * Listbox controls … … 6 6 * Copyright 1999 Christoph Bratschi (ported from WINE) 7 7 * 8 * WINE version: 99 09238 * WINE version: 991031 9 9 */ 10 10 … … 507 507 // rect->left, rect->top, rect->right, rect->bottom ); 508 508 if (!item) 509 ExtTextOutA( hdc, rect->left + 1, rect->top + 1,509 ExtTextOutA( hdc, rect->left + 1, rect->top, 510 510 ETO_OPAQUE | ETO_CLIPPED, rect, NULL, 0, NULL ); 511 511 else if (!(descr->style & LBS_USETABSTOPS)) 512 ExtTextOutA( hdc, rect->left + 1, rect->top + 1,512 ExtTextOutA( hdc, rect->left + 1, rect->top, 513 513 ETO_OPAQUE | ETO_CLIPPED, rect, item->str, 514 514 strlen(item->str), NULL ); … … 516 516 { 517 517 /* Output empty string to paint background in the full width. */ 518 ExtTextOutA( hdc, rect->left + 1, rect->top + 1,518 ExtTextOutA( hdc, rect->left + 1, rect->top, 519 519 ETO_OPAQUE | ETO_CLIPPED, rect, NULL, 0, NULL ); 520 TabbedTextOutA( hdc, rect->left + 1 , rect->top + 1,520 TabbedTextOutA( hdc, rect->left + 1 , rect->top, 521 521 item->str, strlen(item->str), 522 522 descr->nb_tabs, descr->tabs, 0); -
trunk/src/user32/scroll.cpp
r1717 r1724 1 /* $Id: scroll.cpp,v 1.2 1 1999-11-12 17:16:37cbratschi Exp $ */1 /* $Id: scroll.cpp,v 1.22 1999-11-13 16:42:42 cbratschi Exp $ */ 2 2 /* 3 3 * Scrollbar control … … 8 8 * Copyright 1994, 1996 Alexandre Julliard 9 9 * 10 * WINE version: 99 092310 * WINE version: 991031 11 11 * 12 12 * Status: complete … … 1400 1400 if (info->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL)) 1401 1401 { 1402 new_flags = infoPtr->flags; 1403 if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 )) 1404 { 1405 /* Hide or disable scroll-bar */ 1406 if (info->fMask & SIF_DISABLENOSCROLL) 1407 { 1408 new_flags = ESB_DISABLE_BOTH; 1409 action |= SA_SSI_REFRESH; 1410 } 1411 else if (nBar != SB_CTL) 1412 { 1413 action = SA_SSI_HIDE; 1414 goto done; 1415 } 1416 } 1417 else /* Show and enable scroll-bar */ 1418 { 1419 new_flags = 0; 1420 if (nBar != SB_CTL) 1421 action |= SA_SSI_SHOW; 1422 } 1423 1424 if (infoPtr->flags != new_flags) /* check arrow flags */ 1425 { 1426 infoPtr->flags = new_flags; 1427 action |= SA_SSI_REPAINT_ARROWS; 1428 } 1402 new_flags = infoPtr->flags; 1403 if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 )) 1404 { 1405 /* Hide or disable scroll-bar */ 1406 if (info->fMask & SIF_DISABLENOSCROLL) 1407 { 1408 new_flags = ESB_DISABLE_BOTH; 1409 action |= SA_SSI_REFRESH; 1410 } else if (nBar != SB_CTL) 1411 { 1412 action = SA_SSI_HIDE; 1413 goto done; 1414 } 1415 } else /* Show and enable scroll-bar */ 1416 { 1417 new_flags = 0; 1418 if (nBar != SB_CTL) action |= SA_SSI_SHOW; 1419 if (infoPtr->flags) action |= SA_SSI_REFRESH; 1420 } 1421 1422 if (infoPtr->flags != new_flags) /* check arrow flags */ 1423 { 1424 infoPtr->flags = new_flags; 1425 action |= SA_SSI_REPAINT_ARROWS; 1426 } 1429 1427 } 1430 1428 … … 1439 1437 ShowScrollBar(hwnd,nBar,TRUE); 1440 1438 1441 if(bRedraw && (action & SA_SSI_REFRESH)) 1439 if (bRedraw) 1440 { 1441 if (action & SA_SSI_REFRESH) 1442 1442 SCROLL_RefreshScrollBar(hwndScroll,nBar,TRUE,TRUE); 1443 else 1444 { 1445 if (action & SA_SSI_REPAINT_INTERIOR || action & SA_SSI_MOVE_THUMB) 1446 SCROLL_RefreshScrollBar(hwndScroll,nBar,FALSE,TRUE); 1447 if (action & SA_SSI_REPAINT_ARROWS ) 1448 SCROLL_RefreshScrollBar(hwndScroll,nBar,TRUE,FALSE); 1443 else 1444 { 1445 if (action & (SA_SSI_REPAINT_INTERIOR | SA_SSI_MOVE_THUMB)) 1446 SCROLL_RefreshScrollBar(hwndScroll,nBar,FALSE,TRUE); 1447 if (action & SA_SSI_REPAINT_ARROWS) 1448 SCROLL_RefreshScrollBar(hwndScroll,nBar,TRUE,FALSE); 1449 } 1449 1450 } 1450 1451 } … … 1540 1541 return infoPtr->CurVal; 1541 1542 } 1543 1544 // CB: functions to get 32bit SB_THUMBTRACK position, for internal use 1545 1546 BOOL IsScrollBarTracking(HWND hwnd,INT nBar) 1547 { 1548 HWND hwndScroll = SCROLL_GetScrollHandle(hwnd,nBar); 1549 1550 return (SCROLL_MovingThumb && SCROLL_TrackingWin == hwnd && SCROLL_TrackingBar == nBar); 1551 } 1552 1553 INT GetScrollTrackPos(HWND hwnd,INT nBar) 1554 { 1555 SCROLLBAR_INFO *infoPtr; 1556 1557 infoPtr = SCROLL_GetInfoPtr(SCROLL_GetScrollHandle(hwnd,nBar),nBar); 1558 if (!infoPtr) return 0; 1559 1560 return (SCROLL_MovingThumb && SCROLL_TrackingWin == hwnd && SCROLL_TrackingBar == nBar) ? SCROLL_TrackingVal:infoPtr->CurVal; 1561 } 1562 1542 1563 /************************************************************************* 1543 1564 * SetScrollRange (USER32.503) -
trunk/src/user32/static.cpp
r1525 r1724 1 /* $Id: static.cpp,v 1. 8 1999-10-30 18:40:46cbratschi Exp $ */1 /* $Id: static.cpp,v 1.9 1999-11-13 16:42:42 cbratschi Exp $ */ 2 2 /* 3 3 * Static control … … 715 715 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 716 716 RECT rc; 717 HBRUSH hbrush;718 HPEN hpen;719 717 720 718 GetClientRect( hwnd, &rc ); 721 hbrush = SendMessageA( GetParent(hwnd), WM_CTLCOLORSTATIC,722 hdc, hwnd );723 FillRect( hdc, &rc, hbrush );724 725 719 switch (dwStyle & SS_TYPEMASK) 726 720 { 727 case SS_ETCHEDHORZ: 728 hpen = SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW)); 729 MoveToEx (hdc, rc.left, rc.bottom / 2 - 1, NULL); 730 LineTo (hdc, rc.right - 1, rc.bottom / 2 - 1); 731 SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT)); 732 MoveToEx (hdc, rc.left, rc.bottom / 2, NULL); 733 LineTo (hdc, rc.right, rc.bottom / 2); 734 LineTo (hdc, rc.right, rc.bottom / 2 - 1); 735 SelectObject (hdc, hpen); 736 break; 737 738 case SS_ETCHEDVERT: 739 hpen = SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW)); 740 MoveToEx (hdc, rc.right / 2 - 1, rc.top, NULL); 741 LineTo (hdc, rc.right / 2 - 1, rc.bottom - 1); 742 SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT)); 743 MoveToEx (hdc, rc.right / 2, rc.top, NULL); 744 LineTo (hdc, rc.right / 2, rc.bottom); 745 LineTo (hdc, rc.right / 2 -1 , rc.bottom); 746 SelectObject (hdc, hpen); 747 break; 748 721 case SS_ETCHEDHORZ: 722 DrawEdge(hdc,&rc,EDGE_ETCHED,BF_TOP|BF_BOTTOM); 723 break; 724 case SS_ETCHEDVERT: 725 DrawEdge(hdc,&rc,EDGE_ETCHED,BF_LEFT|BF_RIGHT); 726 break; 749 727 case SS_ETCHEDFRAME: 750 728 DrawEdge (hdc, &rc, EDGE_ETCHED, BF_RECT); -
trunk/src/user32/win32wbase.cpp
r1704 r1724 1 /* $Id: win32wbase.cpp,v 1.8 1 1999-11-11 13:17:31 sandervlExp $ */1 /* $Id: win32wbase.cpp,v 1.82 1999-11-13 16:42:43 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 1325 1325 horzScrollInfo->MaxVal = 100; 1326 1326 horzScrollInfo->flags = ESB_ENABLE_BOTH; 1327 dwStyle |= WS_HSCROLL;1328 1327 } 1329 1328 … … 1334 1333 vertScrollInfo->MaxVal = 100; 1335 1334 vertScrollInfo->flags = ESB_ENABLE_BOTH; 1336 dwStyle |= WS_VSCROLL;1337 1335 } 1338 1336
Note:
See TracChangeset
for help on using the changeset viewer.