- Timestamp:
- Feb 21, 2000, 6:25:33 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/edit.cpp
r2834 r2852 1 /* $Id: edit.cpp,v 1.3 4 2000-02-20 18:28:31cbratschi Exp $ */1 /* $Id: edit.cpp,v 1.35 2000-02-21 17:25:26 cbratschi Exp $ */ 2 2 /* 3 3 * Edit control … … 9 9 * Copyright 1999 Christoph Bratschi 10 10 * 11 * Corel version: 20000212 11 12 * WINE version: 991212 12 13 * … … 257 258 static void EDIT_WM_Timer(HWND hwnd, EDITSTATE *es, INT id, TIMERPROC timer_proc); 258 259 static LRESULT EDIT_WM_VScroll(HWND hwnd, EDITSTATE *es, INT action, INT pos, HWND scroll_bar); 259 260 static LRESULT EDIT_WM_MouseWheel(HWND hwnd,EDITSTATE *es,WPARAM wParam,LPARAM lParam); 260 261 261 262 /********************************************************************* … … 290 291 { 291 292 EDIT_EM_ReplaceSel(hwnd, es, TRUE, ""); 293 if (es->flags & EF_UPDATE) { 294 es->flags &= ~EF_UPDATE; 295 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 296 } 292 297 } 293 298 … … 693 698 */ 694 699 //DPRINTF_EDIT_MSG32("WM_MOUSEACTIVATE"); 695 SetFocus(hwnd);696 700 result = MA_ACTIVATE; 697 701 break; … … 748 752 //DPRINTF_EDIT_MSG32("WM_VSCROLL"); 749 753 result = EDIT_WM_VScroll(hwnd, es, LOWORD(wParam), SHIWORD(wParam), (HWND)(lParam)); 754 break; 755 756 case WM_MOUSEWHEEL: 757 result = EDIT_WM_MouseWheel(hwnd,es,wParam,lParam); 750 758 break; 751 759 … … 2436 2444 es->flags |= EF_UPDATE; 2437 2445 EDIT_EM_ScrollCaret(hwnd, es); 2438 EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE); 2446 2439 2447 /* FIXME: really inefficient */ 2440 2448 EDIT_Refresh(hwnd,es,TRUE); … … 2875 2883 // es->undo_insert_count, es->undo_text); 2876 2884 2885 if (es->flags & EF_UPDATE) { 2886 es->flags &= ~EF_UPDATE; 2887 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 2888 } 2889 2877 2890 return TRUE; 2878 2891 } … … 2917 2930 EDIT_MoveDown_ML(hwnd, es, FALSE); 2918 2931 } else 2932 { 2919 2933 EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\r\n"); 2934 if (es->flags & EF_UPDATE) { 2935 es->flags &= ~EF_UPDATE; 2936 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 2937 } 2938 } 2920 2939 } 2921 2940 break; 2922 2941 case '\t': 2923 2942 if ((es->style & ES_MULTILINE) && !(es->style & ES_READONLY)) 2943 { 2924 2944 EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\t"); 2945 if (es->flags & EF_UPDATE) { 2946 es->flags &= ~EF_UPDATE; 2947 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 2948 } 2949 } 2925 2950 break; 2926 2951 case VK_BACK: … … 2936 2961 } 2937 2962 break; 2963 //CB: are these three keys documented or Linux style??? 2964 case 0x03: /* ^C */ 2965 SendMessageA(hwnd, WM_COPY, 0, 0); 2966 break; 2967 case 0x16: /* ^V */ 2968 SendMessageA(hwnd, WM_PASTE, 0, 0); 2969 break; 2970 case 0x18: /* ^X */ 2971 SendMessageA(hwnd, WM_CUT, 0, 0); 2972 break; 2973 2938 2974 default: 2939 2975 if (!(es->style & ES_READONLY) && ((BYTE)c >= ' ') && (c != 127)) … … 2949 2985 str[1] = '\0'; 2950 2986 EDIT_EM_ReplaceSel(hwnd, es, TRUE, str); 2987 if (es->flags & EF_UPDATE) 2988 { 2989 es->flags &= ~EF_UPDATE; 2990 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 2991 } 2951 2992 } else MessageBeep(MB_ICONEXCLAMATION); 2952 2993 break; … … 3085 3126 es->selection_start = es->selection_end = 0; 3086 3127 EDIT_EM_ScrollCaret(hwnd, es); 3128 if (es->flags & EF_UPDATE) { 3129 es->flags &= ~EF_UPDATE; 3130 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 3131 } 3087 3132 } 3088 3133 return 0; … … 3097 3142 static void EDIT_WM_Destroy(HWND hwnd, EDITSTATE *es) 3098 3143 { 3144 if (!es) /* Protect against multiple destroy messages */ 3145 return; 3146 3099 3147 if (es->hloc) { 3100 3148 while (LocalUnlock(es->hloc)) ; … … 3311 3359 HWND hLBox; 3312 3360 3361 /******************************************************************** 3362 * This if statement used to check to see if the parent of the 3363 * edit control was a 'combobox' by comparing the ATOM of the parent 3364 * to a table of internal window control ATOMs. However, this check 3365 * would fail if the parent was a superclassed combobox (Although 3366 * having the same basic functionality of a combobox, it has a 3367 * different name and ATOM, thus defeating this check.) 3368 * 3369 * The safe way to determine if the parent is a combobox is to send it 3370 * a message only a combo box would understand. I send it a message 3371 * CB_GETCOUNT, if I get 0 then the parent is not a combobox - 3372 * return FALSE. If I get > 0, then the parent IS a combobox 3373 * (or sub/super classed derrivative thereof) 3374 ********************************************************************/ 3375 #if 0 //CB: our code 3313 3376 if (GetClassWord(GetParent(hwnd),GCW_ATOM) == GlobalFindAtomA(COMBOBOXCLASSNAME) && 3314 (hLBox = COMBO_GetLBWindow(GetParent(hwnd)))) { 3377 (hLBox = COMBO_GetLBWindow(GetParent(hwnd)))) 3378 #else 3379 if ( 3380 ((SendMessageA(GetParent(hwnd), CB_GETCOUNT, 0, 0)) > 0) && 3381 (hLBox = COMBO_GetLBWindow(GetParent(hwnd))) 3382 ) 3383 #endif 3384 { 3315 3385 HWND hCombo = GetParent(hwnd); 3316 3386 BOOL bUIFlip = TRUE; … … 3521 3591 3522 3592 if (!(es->flags & EF_FOCUSED)) 3523 return 0;3593 SetFocus(hwnd); 3524 3594 3525 3595 es->bCaptureState = TRUE; … … 3759 3829 3760 3830 ShowCaret(hwnd); 3831 } 3832 3833 static VOID EDIT_Refresh(HWND hwnd,EDITSTATE *es,BOOL useCache) 3834 { 3835 HDC hdc,hdcCompatible; 3836 HBITMAP bitmap,oldbmp; 3837 RECT rect; 3761 3838 3762 3839 if (es->flags & EF_UPDATE) 3763 3840 { 3764 3841 es->flags &= ~EF_UPDATE; 3765 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);3842 EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE); 3766 3843 } 3767 }3768 3769 static VOID EDIT_Refresh(HWND hwnd,EDITSTATE *es,BOOL useCache)3770 {3771 HDC hdc,hdcCompatible;3772 HBITMAP bitmap,oldbmp;3773 RECT rect;3774 3844 3775 3845 if (!IsWindowVisible(hwnd)) return; … … 3833 3903 EDIT_EM_ReplaceSel(hwnd, es, TRUE, src); 3834 3904 GlobalUnlock(hsrc); 3905 3906 if (es->flags & EF_UPDATE) { 3907 es->flags &= ~EF_UPDATE; 3908 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 3909 } 3835 3910 } 3836 3911 CloseClipboard(); … … 3923 3998 static void EDIT_WM_SetText(HWND hwnd, EDITSTATE *es, LPCSTR text) 3924 3999 { 3925 EDIT_EM_SetSel(hwnd, es, 0, -1, FALSE); 4000 es->selection_start = 0; 4001 es->selection_end = lstrlenA(es->text); 4002 if (es->flags & EF_FOCUSED) 4003 EDIT_SetCaretPos(hwnd, es, es->selection_end, FALSE); 4004 3926 4005 if (text) { 3927 4006 //TRACE_(edit)("\t'%s'\n", text); … … 3941 4020 EDIT_EM_ScrollCaret(hwnd, es); 3942 4021 EDIT_UpdateScrollBars(hwnd,es,TRUE,TRUE); 3943 if (es->flags & EF_UPDATE) EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE); 4022 if (es->flags & EF_UPDATE) 4023 { 4024 EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE); 4025 /* EN_CHANGE notification need to be sent too 4026 Windows doc says it's only done after the display, 4027 the doc is WRONG. EN_CHANGE notification is sent 4028 while processing WM_SETTEXT */ 4029 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 4030 es->flags &= EF_UPDATE; 4031 } 3944 4032 } 3945 4033 … … 4117 4205 } 4118 4206 4207 static LRESULT EDIT_WM_MouseWheel(HWND hwnd,EDITSTATE *es,WPARAM wParam,LPARAM lParam) 4208 { 4209 short gcWheelDelta = 0; 4210 UINT pulScrollLines = 3; 4211 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); 4212 4213 if (wParam & (MK_SHIFT | MK_CONTROL)) 4214 return DefWindowProcA(hwnd,WM_MOUSEWHEEL, wParam, lParam); 4215 gcWheelDelta -= (short) HIWORD(wParam); 4216 if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines) 4217 { 4218 int cLineScroll= (int) min((UINT) es->line_count, pulScrollLines); 4219 4220 cLineScroll *= (gcWheelDelta / WHEEL_DELTA); 4221 return EDIT_EM_LineScroll(hwnd, es, 0, cLineScroll); 4222 } 4223 4224 return 0; 4225 } 4226 4119 4227 BOOL EDIT_Register() 4120 4228 { -
trunk/src/user32/listbox.cpp
r2804 r2852 1 /* $Id: listbox.cpp,v 1. 19 2000-02-16 14:34:20 sandervlExp $ */1 /* $Id: listbox.cpp,v 1.20 2000-02-21 17:25:27 cbratschi Exp $ */ 2 2 /* 3 3 * Listbox controls … … 6 6 * Copyright 1999 Christoph Bratschi (ported from WINE) 7 7 * 8 * Corel version: 20000212 8 9 * WINE version: 991212 9 10 */ … … 18 19 #include <misc.h> 19 20 20 #define DBG_LOCALLOG 21 #define DBG_LOCALLOG DBG_listbox 21 22 #include "dbglocal.h" 22 23 … … 81 82 BOOL caret_on; /* Is caret on? */ 82 83 BOOL captured; /* Is mouse captured? */ 84 BOOL in_focus; 83 85 HFONT font; /* Current font */ 84 86 LCID locale; /* Current locale for string comparisons */ … … 172 174 SCROLLINFO info; 173 175 174 if (!(descr->style & WS_VSCROLL)) return; 176 /* Check the listbox scroll bar flags individually before we call 177 SetScrollInfo otherwise when the listbox style is WS_HSCROLL and 178 no WS_VSCROLL, we end up with an uninitialized, visible horizontal 179 scroll bar when we do not need one. 180 if (!(descr->style & WS_VSCROLL)) return; 181 */ 182 175 183 /* It is important that we check descr->style, and not wnd->dwStyle, 176 184 for WS_VSCROLL, as the former is exactly the one passed in … … 194 202 if (descr->style & LBS_DISABLENOSCROLL) 195 203 info.fMask |= SIF_DISABLENOSCROLL; 196 SetScrollInfo( hwnd, SB_HORZ, &info, TRUE ); 204 if (descr->style & WS_HSCROLL) 205 SetScrollInfo( hwnd, SB_HORZ, &info, TRUE ); 197 206 info.nMax = 0; 198 207 info.fMask = SIF_RANGE; 199 SetScrollInfo( hwnd, SB_VERT, &info, TRUE ); 208 if (descr->style & WS_VSCROLL) 209 SetScrollInfo( hwnd, SB_VERT, &info, TRUE ); 200 210 } 201 211 else … … 208 218 if (descr->style & LBS_DISABLENOSCROLL) 209 219 info.fMask |= SIF_DISABLENOSCROLL; 210 211 SetScrollInfo( hwnd, SB_VERT, &info, TRUE );220 if (descr->style & WS_VSCROLL) 221 SetScrollInfo( hwnd, SB_VERT, &info, TRUE ); 212 222 213 223 if (descr->horz_extent) … … 220 230 if (descr->style & LBS_DISABLENOSCROLL) 221 231 info.fMask |= SIF_DISABLENOSCROLL; 222 SetScrollInfo( hwnd, SB_HORZ, &info, TRUE ); 232 if (descr->style & WS_HSCROLL) 233 SetScrollInfo( hwnd, SB_HORZ, &info, TRUE ); 223 234 } 224 235 } … … 314 325 315 326 GetWindowRect( hwnd, &rectWindow ); 316 OffsetRect(&rectWindow, -rectWindow.left, -rectWindow.top);317 327 GetClientRect( hwnd, &rect ); 318 328 329 //CB: todo: doesn't works in ShellAbout dialog 319 330 descr->width = rect.right - rect.left; 320 331 descr->height = rect.bottom - rect.top; … … 479 490 if ((descr->focus_item == index) && 480 491 (descr->caret_on) && 481 ( GetFocus() == hwnd)) dis.itemState |= ODS_FOCUS;492 (descr->in_focus)) dis.itemState |= ODS_FOCUS; 482 493 if (dwStyle & WS_DISABLED) dis.itemState |= ODS_DISABLED; 483 494 dis.itemData = item ? item->data : 0; … … 532 543 if ((descr->focus_item == index) && 533 544 (descr->caret_on) && 534 ( GetFocus() == hwnd)) DrawFocusRect( hdc, rect );545 (descr->in_focus)) DrawFocusRect( hdc, rect ); 535 546 } 536 547 } … … 878 889 879 890 if (!descr->nb_items && (descr->focus_item != -1) && descr->caret_on && 880 ( GetFocus() == hwnd))891 (descr->in_focus)) 881 892 { 882 893 /* Special case for empty listbox: paint focus rect */ … … 1071 1082 static LRESULT LISTBOX_SetColumnWidth( HWND hwnd, LB_DESCR *descr, UINT width) 1072 1083 { 1073 width += 2; /* For left and right margin */1074 1084 if (width == descr->column_width) return LB_OKAY; 1075 1085 //TRACE("[%04x]: new column width = %d\n", … … 1203 1213 if (index == oldfocus) return LB_OKAY; 1204 1214 descr->focus_item = index; 1205 if ((oldfocus != -1) && descr->caret_on && ( GetFocus() == hwnd))1215 if ((oldfocus != -1) && descr->caret_on && (descr->in_focus)) 1206 1216 LISTBOX_RepaintItem( hwnd, descr, oldfocus, ODA_FOCUS ); 1207 1217 1208 1218 LISTBOX_MakeItemVisible( hwnd, descr, index, fully_visible ); 1209 if (descr->caret_on && ( GetFocus() == hwnd))1219 if (descr->caret_on && (descr->in_focus)) 1210 1220 LISTBOX_RepaintItem( hwnd, descr, index, ODA_FOCUS ); 1211 1221 … … 1235 1245 if (index != -1) descr->items[index].selected = TRUE; 1236 1246 descr->selected_item = index; 1237 if (oldsel != -1) LISTBOX_RepaintItem( hwnd, descr, oldsel, 0);1247 if (oldsel != -1) LISTBOX_RepaintItem( hwnd, descr, oldsel, ODA_SELECT); 1238 1248 if (index != -1) LISTBOX_RepaintItem( hwnd, descr, index, ODA_SELECT ); 1239 1249 if (send_notify && descr->nb_items) SEND_NOTIFICATION( hwnd, descr, … … 1440 1450 if (index == -1) index = descr->nb_items - 1; 1441 1451 else if ((index < 0) || (index >= descr->nb_items)) return LB_ERR; 1452 1453 /* We need to Invalidate the original rect intead of the updated one. */ 1454 LISTBOX_InvalidateItems( hwnd, descr, index ); 1455 1442 1456 LISTBOX_DeleteItem( hwnd, descr, index ); 1443 1457 … … 1480 1494 } 1481 1495 } 1482 LISTBOX_InvalidateItems( hwnd, descr, index ); 1496 1483 1497 if (descr->focus_item >= descr->nb_items) 1484 1498 { … … 1733 1747 } 1734 1748 1749 static LRESULT LISTBOX_HandleMouseWheel(HWND hwnd, LB_DESCR *descr,WPARAM wParam, LPARAM lParam ) 1750 { 1751 short gcWheelDelta = 0; 1752 UINT pulScrollLines = 3; 1753 1754 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); 1755 1756 gcWheelDelta -= (short) HIWORD(wParam); 1757 1758 if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines) 1759 { 1760 int cLineScroll = (int) min((UINT) descr->page_size, pulScrollLines); 1761 cLineScroll *= (gcWheelDelta / WHEEL_DELTA); 1762 LISTBOX_SetTopItem( hwnd, descr, descr->top_item + cLineScroll, TRUE ); 1763 } 1764 return 0; 1765 } 1735 1766 1736 1767 /*********************************************************************** … … 1743 1774 //TRACE("[%04x]: lbuttondown %d,%d item %d\n", 1744 1775 // wnd->hwndSelf, x, y, index ); 1745 if (!descr->caret_on && ( GetFocus() == hwnd)) return 0;1776 if (!descr->caret_on && (descr->in_focus)) return 0; 1746 1777 if (index != -1) 1747 1778 { … … 1768 1799 } 1769 1800 1770 if( !descr->lphc ) SetFocus( hwnd ); 1771 else SetFocus( (descr->lphc->hWndEdit) ? descr->lphc->hWndEdit 1801 if (!descr->in_focus) 1802 { 1803 if( !descr->lphc ) SetFocus( hwnd ); 1804 else SetFocus( (descr->lphc->hWndEdit) ? descr->lphc->hWndEdit 1772 1805 : descr->lphc->hwndself ) ; 1806 } 1773 1807 1774 1808 descr->captured = TRUE; … … 2191 2225 descr->tabs = NULL; 2192 2226 descr->caret_on = TRUE; 2227 descr->in_focus = FALSE; 2193 2228 descr->captured = FALSE; 2194 2229 descr->font = 0; … … 2483 2518 return LB_OKAY; 2484 2519 descr->caret_on = TRUE; 2485 if ((descr->focus_item != -1) && ( GetFocus() == hwnd))2520 if ((descr->focus_item != -1) && (descr->in_focus)) 2486 2521 LISTBOX_RepaintItem( hwnd, descr, descr->focus_item, ODA_FOCUS ); 2487 2522 return LB_OKAY; … … 2491 2526 return LB_OKAY; 2492 2527 descr->caret_on = FALSE; 2493 if ((descr->focus_item != -1) && ( GetFocus() == hwnd))2528 if ((descr->focus_item != -1) && (descr->in_focus)) 2494 2529 LISTBOX_RepaintItem( hwnd, descr, descr->focus_item, ODA_FOCUS ); 2495 2530 return LB_OKAY; … … 2528 2563 return 0; 2529 2564 case WM_SETFOCUS: 2565 descr->in_focus = TRUE; 2530 2566 descr->caret_on = TRUE; 2531 2567 if (descr->focus_item != -1) … … 2534 2570 return 0; 2535 2571 case WM_KILLFOCUS: 2572 descr->in_focus = FALSE; 2536 2573 if ((descr->focus_item != -1) && descr->caret_on) 2537 2574 LISTBOX_RepaintItem( hwnd, descr, descr->focus_item, ODA_FOCUS ); … … 2542 2579 case WM_VSCROLL: 2543 2580 return LISTBOX_HandleVScroll( hwnd, descr, wParam, lParam ); 2581 case WM_MOUSEACTIVATE: 2582 return MA_NOACTIVATE; 2583 case WM_MOUSEWHEEL: 2584 if (wParam & (MK_SHIFT | MK_CONTROL)) 2585 return DefWindowProcA( hwnd, msg, wParam, lParam ); 2586 return LISTBOX_HandleMouseWheel( hwnd, descr, wParam, lParam ); 2544 2587 case WM_LBUTTONDOWN: 2545 2588 return LISTBOX_HandleLButtonDown( hwnd, descr, wParam, … … 2650 2693 return LISTBOX_Create( hwnd, lphc ); 2651 2694 case WM_MOUSEMOVE: 2652 if ( CB_GETTYPE(lphc) != CBS_SIMPLE)2695 if (lphc && (CB_GETTYPE(lphc) != CBS_SIMPLE)) 2653 2696 { 2654 2697 POINT mousePos; … … 2691 2734 } 2692 2735 case WM_LBUTTONUP: 2736 if (lphc) 2737 { 2693 2738 POINT mousePos; 2694 2739 RECT clientRect; … … 2719 2764 } 2720 2765 return LISTBOX_HandleLButtonUp( hwnd, descr ); 2766 } 2721 2767 case WM_LBUTTONDOWN: 2722 2768 return LISTBOX_HandleLButtonDownCombo( hwnd, descr, wParam, … … 2727 2773 return FALSE; 2728 2774 case WM_KEYDOWN: 2729 if( CB_GETTYPE(lphc) != CBS_SIMPLE)2775 if(lphc && (CB_GETTYPE(lphc) != CBS_SIMPLE)) 2730 2776 { 2731 2777 /* for some reason(?) Windows makes it possible to … … 2746 2792 return lRet; 2747 2793 case WM_NCDESTROY: 2748 if( CB_GETTYPE(lphc) != CBS_SIMPLE)2794 if(lphc && (CB_GETTYPE(lphc) != CBS_SIMPLE)) 2749 2795 lphc->hWndLBox = 0; 2750 2796 /* fall through */ -
trunk/src/user32/menu.cpp
r2804 r2852 1 /* $Id: menu.cpp,v 1.1 7 2000-02-16 14:34:22 sandervlExp $*/1 /* $Id: menu.cpp,v 1.18 2000-02-21 17:25:28 cbratschi Exp $*/ 2 2 /* 3 3 * Menu functions … … 9 9 * Copyright 1999 Christoph Bratschi 10 10 * 11 * Corel version: 20000212 11 12 * WINE version: 20000130 12 13 * … … 30 31 #include "menu.h" 31 32 32 #define DBG_LOCALLOG 33 #define DBG_LOCALLOG DBG_menu 33 34 #include "dbglocal.h" 34 35 35 36 //DEFAULT_DEBUG_CHANNEL(menu) 37 //DECLARE_DEBUG_CHANNEL(winhelp) 36 38 37 39 … … 129 131 130 132 #define IS_STRING_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_STRING) 133 #define IS_SEPARATOR_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_SEPARATOR) 131 134 #define IS_BITMAP_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_BITMAP) 132 135 … … 175 178 static BOOL fEndMenu = FALSE; 176 179 180 /* 181 The following variables and defines are used to keep track of which 182 menu item the mouse is currently over. (Used to implement a pause before 183 popup menus are displayed. ) 184 185 See: MENU_MouseMove() 186 MENU_TrackMenu() 187 */ 188 #define SUBMENU_POPUP_TIMERID 100 189 #define POPUP_MENU_DELAY 500 190 static UINT mouseOverMenuID = -1; 191 static BOOL isTimerSet = FALSE; 177 192 178 193 /*********************************************************************** … … 1084 1099 rect = lpitem->rect; 1085 1100 1101 //CB: todo: does Win98 use DrawEdge for menubars? 1102 1086 1103 if ((lpitem->fState & MF_HILITE) && !(IS_BITMAP_ITEM(lpitem->fType))) 1087 1104 FillRect( hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT) ); … … 1123 1140 if (lpitem->fState & MF_GRAYED) 1124 1141 SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) ); 1142 #if 1 //CB: WINE's Win98 menubar -> to check 1143 1125 1144 else 1126 1145 SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) ); 1146 #else 1147 else 1148 { 1149 if (menuBar) 1150 SetTextColor(hdc,GetSysColor(COLOR_MENUTEXT)); 1151 else 1152 SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) ); 1153 } 1154 #endif 1127 1155 SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) ); 1128 1156 } … … 1761 1789 { 1762 1790 POPUPMENU *menu = MENU_GetMenu((UINT)id); 1763 if ( menu) menu->wFlags |= MF_POPUP;1791 if (IS_A_MENU(menu)) menu->wFlags |= MF_POPUP; 1764 1792 else 1765 1793 { … … 2102 2130 2103 2131 GetWindowRect(menu->hWnd,&rectWindow); 2104 rect.left = rectWindow.left + item->rect.right -arrow_bitmap_width;2132 rect.left = rectWindow.left + item->rect.right; 2105 2133 rect.top = rectWindow.top + item->rect.top; 2106 rect.right = item->rect.left - item->rect.right + 2*arrow_bitmap_width;2134 rect.right = item->rect.left - item->rect.right; 2107 2135 rect.bottom = item->rect.top - item->rect.bottom; 2108 2136 } … … 2339 2367 else if( ptmenu->FocusedItem != id ) 2340 2368 { 2341 MENU_SwitchTracking( pmt, hPtMenu, id ); 2342 pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags,&pmt->pt); 2369 POPUPMENU *menu; 2370 MENUITEM *item; 2371 2372 MENU_SwitchTracking( pmt, hPtMenu, id ); 2373 2374 2375 /* 2376 Test to see if we are trying to popup a submenu or not. 2377 If we aren't, don't change the current menu pointer 2378 and return. 2379 */ 2380 if (!(menu = (POPUPMENU *)MENU_GetMenu( hPtMenu ))) 2381 { 2382 pmt->hCurrentMenu = hPtMenu; 2383 return TRUE; 2384 } 2385 2386 if (!IsWindow( menu->hWnd ) || 2387 (menu->FocusedItem == NO_SELECTED_ITEM)) 2388 { 2389 pmt->hCurrentMenu = hPtMenu; 2390 return TRUE; 2391 } 2392 2393 item = &menu->items[menu->FocusedItem]; 2394 if (!(item->fType & MF_POPUP) || 2395 (item->fState & (MF_GRAYED | MF_DISABLED))) 2396 { 2397 pmt->hCurrentMenu = hPtMenu; 2398 return TRUE; 2399 } 2400 2401 2402 /* 2403 If we made it this far, we want to pop up a submenu. Before we pop it up, 2404 we want a slight delay. This is implemented by remembering the ID of the menu 2405 where the mouse is currently positioned, and setting up a timer. When the 2406 timer fires (handled in MENU_TrackMenu() ), if the mouse is over the same 2407 submenu item, we popup it up. Otherwise, we do nothing. 2408 */ 2409 KillTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID); /* Just in case another timer was set up and not fired yet... */ 2410 if ( (SetTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID, POPUP_MENU_DELAY, NULL)) != SUBMENU_POPUP_TIMERID) 2411 { 2412 /* 2413 For some reason the timer wasn't set up properly... Revert to old 2414 functionality. 2415 */ 2416 2417 pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags,&pmt->pt); 2418 return TRUE; 2419 } 2420 2421 mouseOverMenuID = id; 2422 isTimerSet = TRUE; 2343 2423 } 2344 2424 return TRUE; … … 2711 2791 } /* switch(msg.message) - mouse */ 2712 2792 } 2793 else if (msg.message == WM_TIMER) 2794 { 2795 UINT id = -1; 2796 POPUPMENU *ptmenu = NULL; 2797 2798 if (isTimerSet) 2799 { 2800 /* 2801 If we get here, an attempt was made to pop up a submenu. 2802 (See MENU_MouseMove() ) 2803 */ 2804 2805 /* Get the ID of the menu item the mouse is over now. */ 2806 if( hmenu ) 2807 { 2808 ptmenu = (POPUPMENU *)MENU_GetMenu( hmenu ); 2809 if( IS_SYSTEM_MENU(ptmenu) ) 2810 id = 0; 2811 else 2812 MENU_FindItemByCoords( ptmenu, mt.pt, &id ); 2813 } 2814 2815 /* If it is over the same item that set up the timer 2816 originally .... */ 2817 if (mouseOverMenuID == id) 2818 { 2819 /* .... Pop up the menu */ 2820 mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, hmenu, FALSE, wFlags,&mt.pt); 2821 } 2822 2823 /* Reset the timer so it doesn't fire again. (So we are ready for the next 2824 attempt to popup a submenu... ) */ 2825 KillTimer (mt.hOwnerWnd, 100); 2826 isTimerSet = FALSE; 2827 } 2828 } 2713 2829 else if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) 2714 2830 { … … 2750 2866 break; 2751 2867 2868 case VK_F1: 2869 { 2870 HELPINFO hi; 2871 hi.cbSize = sizeof(HELPINFO); 2872 hi.iContextType = HELPINFO_MENUITEM; 2873 if (menu->FocusedItem == NO_SELECTED_ITEM) 2874 hi.iCtrlId = 0; 2875 else 2876 hi.iCtrlId = menu->items[menu->FocusedItem].wID; 2877 hi.hItemHandle = hmenu; 2878 hi.dwContextId = menu->dwContextHelpID; 2879 hi.MousePos = msg.pt; 2880 //TRACE_(winhelp)("Sending HELPINFO_MENUITEM to 0x%08x\n", hwnd); 2881 SendMessageA(hwnd, WM_HELP, 0, (LPARAM)&hi); 2882 break; 2883 } 2884 2752 2885 default: 2753 2886 break; … … 2889 3022 } 2890 3023 3024 MENUITEM *MENU_HighlightedItem=NULL; 3025 UINT MENU_HighlightedItemID=NO_SELECTED_ITEM; 3026 POPUPMENU *MENU_HighlightedMenu=NULL; 3027 3028 void MENU_TrackMouseMenuBar_MouseMove(HWND hwnd,POINT pt,BOOL OnMenu) 3029 { 3030 HMENU hMenu = getMenu(hwnd); 3031 MENUITEM *item = NULL; 3032 RECT rect; 3033 HDC hdc; 3034 BOOL UnHighlight = (OnMenu==TRUE)?FALSE:TRUE; 3035 POPUPMENU *ptmenu = NULL; 3036 UINT id = NO_SELECTED_ITEM; 3037 3038 if (OnMenu == TRUE && IsMenu(hMenu)) { 3039 3040 ptmenu=(POPUPMENU *)MENU_GetMenu( hMenu ); 3041 3042 item=MENU_FindItemByCoords( ptmenu, pt, &id ); 3043 3044 if(!item) { 3045 /* No item selected, perhaps we are on the blank spot? */ 3046 UnHighlight = TRUE; 3047 /* Paranoid setting */ 3048 item=NULL; 3049 } else if(id == MENU_HighlightedItemID) { 3050 /* If it's already highlighted, don't do it again */ 3051 return; 3052 } else if(item->fState & MF_MOUSESELECT) { 3053 /* If it's dropped, we let the DrawMenuItem draw the sunken border */ 3054 return; 3055 } else if(item->fType & MF_BITMAP) { 3056 UnHighlight = TRUE; 3057 /* (Required) Paranoid setting */ 3058 item=NULL; 3059 } else { 3060 hdc = GetDCEx( ptmenu->hWnd, 0, DCX_CACHE | DCX_WINDOW); 3061 rect = item->rect; 3062 DrawEdge(hdc, &rect, BDR_RAISEDINNER, BF_RECT); 3063 ReleaseDC( ptmenu->hWnd, hdc ); 3064 3065 UnHighlight = TRUE; 3066 } 3067 } 3068 3069 if(UnHighlight == TRUE) { 3070 if(MENU_HighlightedItem) { 3071 if(!(MENU_HighlightedItem->fState & MF_MOUSESELECT)) { 3072 hdc = GetDCEx( MENU_HighlightedMenu->hWnd, 0, DCX_CACHE | DCX_WINDOW); 3073 rect = MENU_HighlightedItem->rect; 3074 3075 FrameRect(hdc, &rect, GetSysColorBrush(COLOR_MENU)); 3076 ReleaseDC( MENU_HighlightedMenu->hWnd, hdc ); 3077 } 3078 } 3079 3080 /* Sets to NULL, NO_SELECTED_ITEM, NULL, unless it found a new 3081 item, then it will be filled in with the proper values */ 3082 MENU_HighlightedItem = item; 3083 MENU_HighlightedItemID = id; 3084 MENU_HighlightedMenu= ptmenu; 3085 } 3086 } 2891 3087 2892 3088 /*********************************************************************** … … 3333 3529 dprintf(("USER32: GetMenuItemCount")); 3334 3530 3335 if (! menu) return -1;3531 if (!IS_A_MENU(menu)) return -1; 3336 3532 //TRACE("(%04x) returning %d\n", 3337 3533 // hMenu, menu->nItems ); … … 3348 3544 dprintf(("USER32: GetMenuItemID")); 3349 3545 3350 if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0 ;3351 if (lpmi->fType & MF_POPUP) return -1;3546 if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0xFFFFFFFF; 3547 if (lpmi->fType & MF_POPUP) return 0xFFFFFFFF; 3352 3548 return lpmi->wID; 3353 3549 … … 3544 3740 3545 3741 if (!(hmenu = CreateMenu())) return 0; 3546 menu = (POPUPMENU*)hmenu;3742 menu = MENU_GetMenu(hmenu); 3547 3743 menu->wFlags |= MF_POPUP; 3548 3744 menu->bTimeToHide = FALSE; … … 3633 3829 SetWindowLongA(pTPWnd,0,0); 3634 3830 3635 if (!IS_A_MENU(lppop)) lppop = NULL; 3636 if (lppop) 3831 if (IS_A_MENU(lppop)) 3637 3832 { 3638 3833 lppop->wMagic = 0; /* Mark it as destroyed */ … … 3945 4140 BOOL WINAPI IsMenu(HMENU hmenu) 3946 4141 { 3947 LPPOPUPMENU menu = (LPPOPUPMENU)hmenu;4142 LPPOPUPMENU menu = MENU_GetMenu(hmenu); 3948 4143 3949 4144 dprintf(("USER32: IsMenu")); … … 4112 4307 if (menu->hSubMenu) { 4113 4308 POPUPMENU *subMenu = MENU_GetMenu((UINT)menu->hSubMenu); 4114 if ( subMenu) {4309 if (IS_A_MENU(subMenu)) { 4115 4310 subMenu->wFlags |= MF_POPUP; 4116 4311 menu->fType |= MF_POPUP; … … 4465 4660 4466 4661 dprintf(("USER32: GetMenuContextHelpId")); 4467 //TRACE("(0x%04x)\n", hMenu);4468 4662 4469 4663 menu = MENU_GetMenu(hMenu); … … 4481 4675 { 4482 4676 dprintf(("USER32: MenuItemFromPoint not implemented!")); 4483 //FIXME("(0x%04x,0x%04x,(%ld,%ld)):stub\n", 4484 // hWnd, hMenu, ptScreen.x, ptScreen.y); 4677 4485 4678 return 0; 4679 } 4680 4681 /********************************************************************** 4682 * IsMenuActive (Internal) 4683 */ 4684 BOOL IsMenuActive() 4685 { 4686 return pTopPopupWnd && (GetWindowLongA(pTopPopupWnd,GWL_STYLE) & WS_VISIBLE); 4486 4687 } 4487 4688 -
trunk/src/user32/static.cpp
r2804 r2852 1 /* $Id: static.cpp,v 1.1 7 2000-02-16 14:34:34 sandervlExp $ */1 /* $Id: static.cpp,v 1.18 2000-02-21 17:25:29 cbratschi Exp $ */ 2 2 /* 3 3 * Static control … … 7 7 * Copyright David W. Metcalfe, 1993 8 8 * 9 * Corel version: 20000212 9 10 * WINE version: 990923 10 11 * … … 19 20 #include "static.h" 20 21 21 #define DBG_LOCALLOG 22 #define DBG_LOCALLOG DBG_static 22 23 #include "dbglocal.h" 23 24 … … 718 719 FillRect( hdc, &rc, hbrush ); 719 720 720 if (infoPtr->hIcon) { 721 if (infoPtr->hIcon) 722 { 721 723 BITMAP bm; 722 SIZE sz; 723 724 if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP) 725 return; 724 725 if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP) return; 726 726 if (!(hMemDC = CreateCompatibleDC( hdc ))) return; 727 GetObjectA(infoPtr->hIcon, sizeof(bm), &bm); 728 GetBitmapDimensionEx(infoPtr->hIcon, &sz); 729 oldbitmap = SelectObject(hMemDC, infoPtr->hIcon); 730 if (dwStyle & SS_CENTERIMAGE) 731 BitBlt(hdc,sz.cx,sz.cy,bm.bmWidth,bm.bmHeight,hMemDC,(rc.right-bm.bmWidth)/2,(rc.bottom-bm.bmHeight)/2,SRCCOPY); 727 728 GetObjectA(infoPtr->hIcon, sizeof(bm), &bm); 729 oldbitmap = SelectObject(hMemDC, infoPtr->hIcon); 730 731 // Paint the image in center area 732 if(dwStyle & SS_CENTERIMAGE) 733 { 734 SIZE szbm; 735 SIZE szdc; 736 737 if(bm.bmWidth > rc.right - rc.left) 738 { 739 szdc.cx = 0; 740 szbm.cx = (bm.bmWidth - (rc.right - rc.left)) / 2; 741 bm.bmWidth = rc.right - rc.left; 742 } 743 else 744 { 745 szbm.cx = 0; 746 szdc.cx = ((rc.right - rc.left) - bm.bmWidth) / 2; 747 } 748 if(bm.bmHeight > rc.bottom - rc.top) 749 { 750 szdc.cy = 0; 751 szbm.cy = (bm.bmHeight - (rc.bottom - rc.top)) / 2; 752 bm.bmWidth = rc.bottom - rc.top; 753 } 754 else 755 { 756 szbm.cy = 0; 757 szdc.cy = ((rc.bottom - rc.top) - bm.bmHeight) / 2; 758 } 759 BitBlt(hdc, szdc.cx, szdc.cy, bm.bmWidth, bm.bmHeight, hMemDC, 760 szbm.cx, szbm.cy, SRCCOPY); 761 } 732 762 else 733 BitBlt(hdc,sz.cx,sz.cy,bm.bmWidth,bm.bmHeight,hMemDC,0,0,SRCCOPY); 734 SelectObject(hMemDC, oldbitmap); 735 DeleteDC(hMemDC); 763 { 764 BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); 765 } 766 767 SelectObject(hMemDC, oldbitmap); 768 DeleteDC(hMemDC); 736 769 } 737 770 } … … 764 797 di.itemData = 0; 765 798 766 SendMessageA(GetParent(hwnd),WM_DRAWITEM,GetWindowLongA(hwnd,GWL_ID),(LPARAM)&di); 799 SendMessageA(GetParent(hwnd),WM_CTLCOLORSTATIC,hdc,hwnd); 800 SendMessageA(GetParent(hwnd),WM_DRAWITEM,di.CtlID,(LPARAM)&di); 767 801 } 768 802 -
trunk/src/user32/uitools.cpp
r2804 r2852 1 /* $Id: uitools.cpp,v 1.2 3 2000-02-16 14:34:37 sandervlExp $ */1 /* $Id: uitools.cpp,v 1.24 2000-02-21 17:25:29 cbratschi Exp $ */ 2 2 /* 3 3 * User Interface Functions … … 16 16 #include "win32wbase.h" 17 17 18 #define DBG_LOCALLOG 18 #define DBG_LOCALLOG DBG_uitools 19 19 #include "dbglocal.h" 20 20 … … 1826 1826 return (TRUE); 1827 1827 } 1828 1829 1830 /*****************************************************************************1831 * Name : VOID WIN32API DrawCaption1832 * Purpose : The DrawCaption function draws a window caption.1833 * Parameters: HDC hdc handle of device context1834 * LPRECT lprc address of bounding rectangle coordinates1835 * HFONT hfont handle of font for caption1836 * HICON hicon handle of icon in caption1837 * LPSTR lpszText address of caption string1838 * WORD wFlags drawing options1839 * Variables :1840 * Result :1841 * Remark :1842 * Status : UNTESTED STUB1843 *1844 * Author : Patrick Haller [Thu, 1998/02/26 11:55]1845 *****************************************************************************/1846 1847 BOOL WIN32API DrawCaption (HWND hwnd,1848 HDC hdc,1849 const RECT *lprc,1850 UINT wFlags)1851 {1852 dprintf(("USER32:DrawCaption (%08xh,%08xh,%08xh,%08xh) not implemented.\n",1853 hwnd,1854 hdc,1855 lprc,1856 wFlags));1857 1858 return FALSE;1859 }1860 /***********************************************************************1861 * DrawCaptionTemp32A [USER32.599]1862 *1863 * PARAMS1864 *1865 * RETURNS1866 * Success:1867 * Failure:1868 */1869 1870 BOOL WIN32API DrawCaptionTempA(HWND hwnd,1871 HDC hdc,1872 const RECT *rect,1873 HFONT hFont,1874 HICON hIcon,1875 LPCSTR str,1876 UINT uFlags)1877 {1878 RECT rc = *rect;1879 1880 dprintf(("USER32: DrawCaptionTempA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",1881 hwnd,1882 hdc,1883 rect,1884 hFont,1885 hIcon,1886 str,1887 uFlags));1888 1889 /* drawing background */1890 if (uFlags & DC_INBUTTON)1891 {1892 O32_FillRect (hdc,1893 &rc,1894 GetSysColorBrush (COLOR_3DFACE));1895 1896 if (uFlags & DC_ACTIVE)1897 {1898 HBRUSH hbr = O32_SelectObject (hdc,1899 GetSysColorBrush (COLOR_ACTIVECAPTION));1900 O32_PatBlt (hdc,1901 rc.left,1902 rc.top,1903 rc.right - rc.left,1904 rc.bottom - rc.top,1905 0xFA0089);1906 1907 O32_SelectObject (hdc,1908 hbr);1909 }1910 }1911 else1912 {1913 O32_FillRect (hdc,1914 &rc,1915 GetSysColorBrush ((uFlags & DC_ACTIVE) ?1916 COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));1917 }1918 1919 1920 /* drawing icon */1921 if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP))1922 {1923 POINT pt;1924 1925 pt.x = rc.left + 2;1926 pt.y = (rc.bottom + rc.top - O32_GetSystemMetrics(SM_CYSMICON)) / 2;1927 1928 if (hIcon)1929 {1930 DrawIconEx (hdc,1931 pt.x,1932 pt.y,1933 hIcon,1934 O32_GetSystemMetrics(SM_CXSMICON),1935 O32_GetSystemMetrics(SM_CYSMICON),1936 0,1937 0,1938 DI_NORMAL);1939 }1940 else1941 {1942 /* @@@PH 1999/06/08 not ported yet, just don't draw any icon1943 WND *wndPtr = WIN_FindWndPtr(hwnd);1944 HICON hAppIcon = 0;1945 1946 if (wndPtr->class->hIconSm)1947 hAppIcon = wndPtr->class->hIconSm;1948 else1949 if (wndPtr->class->hIcon)1950 hAppIcon = wndPtr->class->hIcon;1951 1952 DrawIconEx (hdc,1953 pt.x,1954 pt.y,1955 hAppIcon,1956 GetSystemMetrics(SM_CXSMICON),1957 GetSystemMetrics(SM_CYSMICON),1958 0,1959 0,1960 DI_NORMAL);1961 1962 WIN_ReleaseWndPtr(wndPtr);1963 */1964 }1965 1966 rc.left += (rc.bottom - rc.top);1967 }1968 1969 /* drawing text */1970 if (uFlags & DC_TEXT)1971 {1972 HFONT hOldFont;1973 1974 if (uFlags & DC_INBUTTON)1975 O32_SetTextColor (hdc,1976 O32_GetSysColor (COLOR_BTNTEXT));1977 else1978 if (uFlags & DC_ACTIVE)1979 O32_SetTextColor (hdc,1980 O32_GetSysColor (COLOR_CAPTIONTEXT));1981 else1982 O32_SetTextColor (hdc,1983 O32_GetSysColor (COLOR_INACTIVECAPTIONTEXT));1984 1985 O32_SetBkMode (hdc,1986 TRANSPARENT);1987 1988 if (hFont)1989 hOldFont = O32_SelectObject (hdc,1990 hFont);1991 else1992 {1993 NONCLIENTMETRICSA nclm;1994 HFONT hNewFont;1995 1996 nclm.cbSize = sizeof(NONCLIENTMETRICSA);1997 O32_SystemParametersInfo (SPI_GETNONCLIENTMETRICS,1998 0,1999 &nclm,2000 0);2001 hNewFont = O32_CreateFontIndirect ((uFlags & DC_SMALLCAP) ?2002 &nclm.lfSmCaptionFont : &nclm.lfCaptionFont);2003 hOldFont = O32_SelectObject (hdc,2004 hNewFont);2005 }2006 2007 if (str)2008 DrawTextA (hdc,2009 str,2010 -1,2011 &rc,2012 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);2013 else2014 {2015 CHAR szText[128];2016 INT nLen;2017 2018 nLen = O32_GetWindowText (Win32BaseWindow::Win32ToOS2FrameHandle(hwnd),2019 szText,2020 128);2021 2022 DrawTextA (hdc,2023 szText,2024 nLen,2025 &rc,2026 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);2027 }2028 2029 if (hFont)2030 O32_SelectObject (hdc,2031 hOldFont);2032 else2033 O32_DeleteObject (O32_SelectObject (hdc,2034 hOldFont));2035 }2036 2037 /* drawing focus ??? */2038 if (uFlags & 0x2000)2039 {2040 dprintf(("USER32: DrawCaptionTempA undocumented flag (0x2000)!\n"));2041 }2042 2043 return 0;2044 }2045 2046 2047 /***********************************************************************2048 * DrawCaptionTemp32W [USER32.602]2049 *2050 * PARAMS2051 *2052 * RETURNS2053 * Success:2054 * Failure:2055 */2056 2057 BOOL WIN32API DrawCaptionTempW (HWND hwnd,2058 HDC hdc,2059 const RECT *rect,2060 HFONT hFont,2061 HICON hIcon,2062 LPCWSTR str,2063 UINT uFlags)2064 {2065 LPSTR strAscii = UnicodeToAsciiString((LPWSTR)str);2066 2067 BOOL res = DrawCaptionTempA (hwnd,2068 hdc,2069 rect,2070 hFont,2071 hIcon,2072 strAscii,2073 uFlags);2074 2075 FreeAsciiString(strAscii);2076 2077 return res;2078 }2079 2080 1828 //****************************************************************************** 2081 1829 //****************************************************************************** -
trunk/src/user32/user32.cpp
r2804 r2852 1 /* $Id: user32.cpp,v 1.7 3 2000-02-16 14:34:39 sandervlExp $ */1 /* $Id: user32.cpp,v 1.74 2000-02-21 17:25:29 cbratschi Exp $ */ 2 2 3 3 /* … … 42 42 #include <winuser.h> 43 43 44 #define DBG_LOCALLOG 44 #define DBG_LOCALLOG DBG_user32 45 45 #include "dbglocal.h" 46 46 … … 705 705 706 706 case SM_CYCAPTION: 707 rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYTITLEBAR); 707 rc = 19; 708 //rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYTITLEBAR); 708 709 break; 709 710 -
trunk/src/user32/win32wbase.cpp
r2834 r2852 1 /* $Id: win32wbase.cpp,v 1.16 5 2000-02-20 18:28:34cbratschi Exp $ */1 /* $Id: win32wbase.cpp,v 1.166 2000-02-21 17:25:31 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 8 8 * 9 9 * Parts based on Wine Windows code (windows\win.c) 10 * Corel version: corel20000212 10 11 * 11 12 * Copyright 1993, 1994, 1996 Alexandre Julliard … … 53 54 #include "dbglocal.h" 54 55 55 #define SC_ABOUTWINE (SC_SCREENSAVE+1)56 #define SC_PUTMARK (SC_SCREENSAVE+2)57 58 56 /* bits in the dwKeyData */ 59 57 #define KEYDATA_ALT 0x2000 … … 138 136 windowClass = 0; 139 137 140 iconResource = NULL; 138 hIcon = 0; 139 hIconSm = 0; 141 140 142 141 EraseBkgndFlag = TRUE; … … 581 580 fakeWinBase.pWindowClass = windowClass; 582 581 583 //Set icon from class 584 if(windowClass->getIcon()) 585 SetIcon(windowClass->getIcon()); 582 //Set icon from window or class 583 if (hIcon) 584 OSLibWinSetIcon(OS2HwndFrame,hIcon); 585 else if (windowClass->getIcon()) 586 OSLibWinSetIcon(OS2HwndFrame,windowClass->getIcon()); 587 586 588 /* Get class or window DC if needed */ 587 589 if(windowClass->getStyle() & CS_OWNDC) { … … 1479 1481 if( hdc ) 1480 1482 { 1481 if( (getStyle() & WS_MINIMIZE) && getWindowClass()->getIcon())1483 if( (getStyle() & WS_MINIMIZE) && (getWindowClass()->getIcon() && hIcon)) 1482 1484 { 1483 1485 int x = (rectWindow.right - rectWindow.left - GetSystemMetrics(SM_CXICON))/2; 1484 1486 int y = (rectWindow.bottom - rectWindow.top - GetSystemMetrics(SM_CYICON))/2; 1485 1487 dprintf(("Painting class icon: vis rect=(%i,%i - %i,%i)\n", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom )); 1486 DrawIcon(hdc, x, y, getWindowClass()->getIcon() );1488 DrawIcon(hdc, x, y, hIcon ? hIcon:getWindowClass()->getIcon() ); 1487 1489 } 1488 1490 EndPaint(getWindowHandle(), &ps ); … … 1532 1534 { 1533 1535 POINT point; 1536 LRESULT retvalue; 1534 1537 1535 1538 point.x = (SHORT)LOWORD(lParam); 1536 1539 point.y = (SHORT)HIWORD(lParam); 1537 1540 1538 return HandleNCHitTest(point); 1541 retvalue = HandleNCHitTest(point); 1542 #if 0 //CB: let the Corel people fix the bugs first 1543 if(retvalue == HTMENU) 1544 MENU_TrackMouseMenuBar_MouseMove(Win32Hwnd,point,TRUE); 1545 else 1546 MENU_TrackMouseMenuBar_MouseMove(Win32Hwnd,point,FALSE); 1547 #endif 1548 return retvalue; 1539 1549 } 1540 1550 … … 1636 1646 if ((dwStyle & WS_VISIBLE) && wParam) return 0; 1637 1647 else if (!(dwStyle & WS_VISIBLE) && !wParam) return 0; 1638 ShowWindow(wParam ? SW_SHOW NOACTIVATE :SW_HIDE);1648 ShowWindow(wParam ? SW_SHOW:SW_HIDE); 1639 1649 return 0; 1640 1650 … … 1652 1662 case WM_QUERYDRAGICON: 1653 1663 { 1654 HICON h Icon = windowClass->getCursor();1664 HICON hDragIcon = windowClass->getCursor(); 1655 1665 UINT len; 1656 1666 1657 if(h Icon) return (LRESULT)hIcon;1667 if(hDragIcon) return (LRESULT)hDragIcon; 1658 1668 for(len = 1; len < 64; len++) 1659 1669 { 1660 h Icon = LoadIconA(hInstance,MAKEINTRESOURCEA(len));1661 if(h Icon)1662 return (LRESULT)h Icon;1670 hDragIcon = LoadIconA(hInstance,MAKEINTRESOURCEA(len)); 1671 if(hDragIcon) 1672 return (LRESULT)hDragIcon; 1663 1673 } 1664 1674 return (LRESULT)LoadIconA(0,IDI_APPLICATIONA); … … 1674 1684 case WM_SETICON: 1675 1685 case WM_GETICON: 1676 { 1677 LRESULT result = 0; 1678 if (!windowClass) return result; 1679 int index = GCL_HICON; 1680 1681 if (wParam == ICON_SMALL) 1682 index = GCL_HICONSM; 1683 1684 result = windowClass->getClassLongA(index); 1685 1686 { 1687 LRESULT result = 0; 1688 if (!windowClass) return result; 1689 /* Set the appropriate icon members in the window structure. */ 1690 if (wParam == ICON_SMALL) 1691 { 1692 result = hIconSm; 1686 1693 if (Msg == WM_SETICON) 1687 windowClass->setClassLongA(index, lParam); 1688 1689 return result; 1690 } 1694 hIconSm = (HICON)lParam; 1695 } 1696 else 1697 { 1698 result = hIcon; 1699 if (Msg == WM_SETICON) 1700 { 1701 hIcon = (HICON)lParam; 1702 OSLibWinSetIcon(OS2HwndFrame,hIcon); 1703 } 1704 } 1705 return result; 1706 } 1707 1708 case WM_HELP: 1709 if (getParent()) getParent()->SendInternalMessageA(Msg,wParam,lParam); 1710 break; 1691 1711 1692 1712 case WM_NOTIFY: … … 1957 1977 window = parentwindow; 1958 1978 } 1959 }1960 //******************************************************************************1961 //******************************************************************************1962 BOOL Win32BaseWindow::SetIcon(HICON hIcon)1963 {1964 dprintf(("Win32BaseWindow::SetIcon %x", hIcon));1965 if(OSLibWinSetIcon(OS2HwndFrame, hIcon) == TRUE) {1966 //TODO: Wine does't send these. Correct?1967 // SendInternalMessageA(WM_SETICON, ICON_BIG, hIcon);1968 return TRUE;1969 }1970 return FALSE;1971 1979 } 1972 1980 //****************************************************************************** -
trunk/src/user32/win32wbase.h
r2677 r2852 1 /* $Id: win32wbase.h,v 1.8 3 2000-02-07 20:32:43cbratschi Exp $ */1 /* $Id: win32wbase.h,v 1.84 2000-02-21 17:25:31 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 193 193 HMENU GetSysMenu() { return hSysMenu; } 194 194 195 BOOL SetIcon(HICON hIcon);196 HICON Get Icon() { return (HICON) iconResource; };195 HICON GetIcon() { return hIcon; } 196 HICON GetSmallIcon() { return hIconSm; } 197 197 198 198 void SetWindowRegion(HRGN hRegion) { hWindowRegion = hRegion; }; … … 357 357 358 358 Win32BaseWindow *owner; 359 Win32Resource *iconResource;359 HICON hIcon,hIconSm; 360 360 361 361 char *windowNameA; -
trunk/src/user32/win32wbasenonclient.cpp
r2834 r2852 1 /* $Id: win32wbasenonclient.cpp,v 1.1 2 2000-02-20 18:28:35cbratschi Exp $ */1 /* $Id: win32wbasenonclient.cpp,v 1.13 2000-02-21 17:25:32 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (non-client methods) … … 6 6 * 7 7 * Based on Wine code (windows\nonclient.c) 8 * Corel Version 20000212 8 9 * 9 10 * Copyright 1994 Alexandre Julliard … … 42 43 #include "dbglocal.h" 43 44 44 #define SC_ABOUTODIN (SC_SCREENSAVE+1)45 #define SC_PUTMARK (SC_SCREENSAVE+2)46 47 45 /* bits in the dwKeyData */ 48 46 #define KEYDATA_ALT 0x2000 49 47 #define KEYDATA_PREVSTATE 0x4000 50 48 51 static INT bitmapW = 16,bitmapH = 14; //CB: todo: use these values49 static INT bitmapW = 16,bitmapH = 14; 52 50 static HBITMAP hbitmapClose = 0; 53 51 static HBITMAP hbitmapCloseD = 0; … … 479 477 { 480 478 /* Check if there is an user icon */ 481 HICON h Icon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);482 if(!h Icon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);479 HICON hSysIcon = hIconSm; 480 if(!hSysIcon) hSysIcon = (HICON) GetClassLongA(Win32Hwnd,GCL_HICONSM); 483 481 484 482 /* If there is an icon associated with the window OR */ 485 483 /* If there is no hIcon specified and this is not a modal dialog, */ 486 484 /* there is a system menu icon. */ 487 if((h Icon != 0) || (!(dwStyle & DS_MODALFRAME)))488 rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;485 if((hSysIcon != 0) || (!(dwStyle & DS_MODALFRAME))) 486 rect.left += GetSystemMetrics(SM_CYCAPTION) - 1; 489 487 } 490 488 if (pt.x < rect.left) return HTSYSMENU; … … 492 490 /* Check close button */ 493 491 if (dwStyle & WS_SYSMENU) 494 rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;492 rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1; 495 493 if (pt.x > rect.right) return HTCLOSE; 494 495 //Check context help 496 if (dwExStyle & WS_EX_CONTEXTHELP) 497 rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; 498 if (pt.x > rect.right) return HTHELP; 496 499 497 500 /* Check maximize box */ 498 501 /* In win95 there is automatically a Maximize button when there is a minimize one*/ 499 502 if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX)) 500 rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;503 rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; 501 504 if (pt.x > rect.right) return HTMAXBUTTON; 502 505 … … 548 551 } 549 552 550 /* Should never get here */ 551 return HTERROR; 553 /* Has to return HTNOWHERE if nothing was found 554 Could happen when a window has a customized non client area */ 555 return HTNOWHERE; 552 556 } 553 557 … … 621 625 BOOL Win32BaseWindow::DrawSysButton(HDC hdc,RECT *rect) 622 626 { 623 HICON h Icon;627 HICON hSysIcon; 624 628 RECT r; 625 629 … … 627 631 else r = *rect; 628 632 629 hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM); 630 if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON); 633 hSysIcon = hIconSm; 634 635 /* if no small icon and no large icon, use class small icon */ 636 if (!hSysIcon && !hIcon) 637 hSysIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM); 638 639 /* otherwise use the large icon */ 640 if (!hSysIcon) hSysIcon = hIcon; 641 642 /* if all else fails, use the application icon. */ 643 if(!hSysIcon) hSysIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON); 631 644 632 645 /* If there is no hIcon specified or this is not a modal dialog, */ 633 646 /* get the default one. */ 634 if(h Icon == 0)647 if(hSysIcon == 0) 635 648 if (!(dwStyle & DS_MODALFRAME)) 636 h Icon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);649 hSysIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); 637 650 //CB: todo: add icons (including Odin icon) to user32.rc 638 if (h Icon)639 DrawIconEx(hdc,r.left+2,r.top+2,h Icon,651 if (hSysIcon) 652 DrawIconEx(hdc,r.left+2,r.top+2,hSysIcon, 640 653 GetSystemMetrics(SM_CXSMICON), 641 654 GetSystemMetrics(SM_CYSMICON), 642 655 0, 0, DI_NORMAL); 643 656 644 return (h Icon != 0);657 return (hSysIcon != 0); 645 658 } 646 659 //****************************************************************************** … … 701 714 else r = *rect; 702 715 703 hdcMem = CreateCompatibleDC( hdc ); 704 hBmp = down ? hbitmapCloseD : hbitmapClose; 705 hOldBmp = SelectObject (hdcMem, hBmp); 706 GetObjectA (hBmp, sizeof(BITMAP), &bmp); 707 708 BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2, 709 r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, 710 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY); 711 712 if(bGrayed) 713 DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2, 714 r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); 715 716 SelectObject (hdcMem, hOldBmp); 717 DeleteDC (hdcMem); 716 /* A tool window has a smaller Close button */ 717 if (dwExStyle & WS_EX_TOOLWINDOW) 718 { 719 RECT toolRect; 720 INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE */ 721 INT iBmpWidth = 11; /* it uses 11x11 for the close button in tool window */ 722 INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION); 723 724 725 toolRect.top = r.top + (iCaptionHeight - 1 - iBmpHeight) / 2; 726 toolRect.left = r.right - (iCaptionHeight + 1 + iBmpWidth) / 2; 727 toolRect.bottom = toolRect.top + iBmpHeight; 728 toolRect.right = toolRect.left + iBmpWidth; 729 DrawFrameControl(hdc,&toolRect, 730 DFC_CAPTION,DFCS_CAPTIONCLOSE | 731 down ? DFCS_PUSHED : 0 | 732 bGrayed ? DFCS_INACTIVE : 0); 733 } else 734 { 735 hdcMem = CreateCompatibleDC( hdc ); 736 hBmp = down ? hbitmapCloseD : hbitmapClose; 737 hOldBmp = SelectObject (hdcMem, hBmp); 738 GetObjectA (hBmp, sizeof(BITMAP), &bmp); 739 740 BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2, 741 r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, 742 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY); 743 744 if(bGrayed) 745 DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2, 746 r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); 747 748 SelectObject (hdcMem, hOldBmp); 749 DeleteDC (hdcMem); 750 } 718 751 } 719 752 //****************************************************************************** … … 738 771 r.right -= GetSystemMetrics(SM_CYCAPTION) + 1; 739 772 773 if (dwExStyle & WS_EX_CONTEXTHELP) 774 r.right -= bmp.bmWidth; 775 740 776 BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2, 741 777 r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, … … 769 805 r.right -= GetSystemMetrics(SM_CYCAPTION) + 1; 770 806 807 if (dwExStyle & WS_EX_CONTEXTHELP) 808 r.right -= bmp.bmWidth; 809 771 810 /* In win 95 there is always a Maximize box when there is a Minimize one */ 772 811 if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX)) … … 796 835 if (!rect) GetInsideRect(&r); 797 836 else r = *rect; 798 #if 0 //CB: todo 799 hdcMem = CreateCompatibleDC( hdc);800 hBmp = down ? hbitmap MinimizeD : hbitmapMinimize;801 hOldBmp = SelectObject( hdcMem, hBmp);802 GetObjectA (hBmp, sizeof(BITMAP),&bmp);837 838 hdcMem = CreateCompatibleDC(hdc); 839 hBmp = down ? hbitmapHelpD : hbitmapHelp; 840 hOldBmp = SelectObject(hdcMem,hBmp); 841 GetObjectA(hBmp,sizeof(BITMAP),&bmp); 803 842 804 843 if (dwStyle & WS_SYSMENU) 805 r.right -= GetSystemMetrics(SM_CYCAPTION) + 1; 806 807 /* In win 95 there is always a Maximize box when there is a Minimize one */ 808 if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX)) 809 r.right -= bmp.bmWidth; 844 r.right -= GetSystemMetrics(SM_CYCAPTION)+1; 810 845 811 846 BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2, … … 820 855 SelectObject (hdcMem, hOldBmp); 821 856 DeleteDC( hdcMem ); 822 #endif823 857 } 824 858 //****************************************************************************** … … 912 946 if (dwExStyle & WS_EX_CONTEXTHELP) 913 947 { 914 #if 0 //CB: todo: integrate help button 915 DrawHelpButton(memDC,&r2,FALSE); 916 r.right -= bitmapW; 917 #endif 948 DrawHelpButton(memDC,&r2,FALSE,FALSE); 949 r.right -= GetSystemMetrics(SM_CXSIZE) + 1; 918 950 } 919 951 … … 1288 1320 return 0; 1289 1321 } 1290 //****************************************************************************** 1291 //****************************************************************************** 1322 /***************************************************************************** 1323 * Name : VOID WIN32API DrawCaption 1324 * Purpose : The DrawCaption function draws a window caption. 1325 * Parameters: HDC hdc handle of device context 1326 * LPRECT lprc address of bounding rectangle coordinates 1327 * HFONT hfont handle of font for caption 1328 * HICON hicon handle of icon in caption 1329 * LPSTR lpszText address of caption string 1330 * WORD wFlags drawing options 1331 * Variables : 1332 * Result : 1333 * Remark : 1334 * Status : UNTESTED STUB 1335 * 1336 * Author : Patrick Haller [Thu, 1998/02/26 11:55] 1337 *****************************************************************************/ 1338 1339 BOOL WIN32API DrawCaption (HWND hwnd, 1340 HDC hdc, 1341 const RECT *lprc, 1342 UINT wFlags) 1343 { 1344 dprintf(("USER32:DrawCaption (%08xh,%08xh,%08xh,%08xh) not implemented.\n", 1345 hwnd, 1346 hdc, 1347 lprc, 1348 wFlags)); 1349 1350 return FALSE; 1351 } 1352 /*********************************************************************** 1353 * DrawCaptionTemp32A [USER32.599] 1354 * 1355 * PARAMS 1356 * 1357 * RETURNS 1358 * Success: 1359 * Failure: 1360 */ 1361 1362 BOOL WIN32API DrawCaptionTempA(HWND hwnd, 1363 HDC hdc, 1364 const RECT *rect, 1365 HFONT hFont, 1366 HICON hIcon, 1367 LPCSTR str, 1368 UINT uFlags) 1369 { 1370 RECT rc = *rect; 1371 1372 dprintf(("USER32: DrawCaptionTempA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n", 1373 hwnd, 1374 hdc, 1375 rect, 1376 hFont, 1377 hIcon, 1378 str, 1379 uFlags)); 1380 1381 /* drawing background */ 1382 if (uFlags & DC_INBUTTON) 1383 { 1384 O32_FillRect (hdc, 1385 &rc, 1386 GetSysColorBrush (COLOR_3DFACE)); 1387 1388 if (uFlags & DC_ACTIVE) 1389 { 1390 HBRUSH hbr = O32_SelectObject (hdc, 1391 GetSysColorBrush (COLOR_ACTIVECAPTION)); 1392 O32_PatBlt (hdc, 1393 rc.left, 1394 rc.top, 1395 rc.right - rc.left, 1396 rc.bottom - rc.top, 1397 0xFA0089); 1398 1399 O32_SelectObject (hdc, 1400 hbr); 1401 } 1402 } 1403 else 1404 { 1405 O32_FillRect (hdc, 1406 &rc, 1407 GetSysColorBrush ((uFlags & DC_ACTIVE) ? 1408 COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)); 1409 } 1410 1411 1412 /* drawing icon */ 1413 if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP)) 1414 { 1415 POINT pt; 1416 1417 pt.x = rc.left + 2; 1418 pt.y = (rc.bottom + rc.top - O32_GetSystemMetrics(SM_CYSMICON)) / 2; 1419 1420 if (hIcon) 1421 { 1422 DrawIconEx (hdc, 1423 pt.x, 1424 pt.y, 1425 hIcon, 1426 O32_GetSystemMetrics(SM_CXSMICON), 1427 O32_GetSystemMetrics(SM_CYSMICON), 1428 0, 1429 0, 1430 DI_NORMAL); 1431 } 1432 else 1433 { 1434 /* @@@PH 1999/06/08 not ported yet, just don't draw any icon 1435 WND *wndPtr = WIN_FindWndPtr(hwnd); 1436 HICON hAppIcon = 0; 1437 1438 if (wndPtr->class->hIconSm) 1439 hAppIcon = wndPtr->class->hIconSm; 1440 else 1441 if (wndPtr->class->hIcon) 1442 hAppIcon = wndPtr->class->hIcon; 1443 1444 DrawIconEx (hdc, 1445 pt.x, 1446 pt.y, 1447 hAppIcon, 1448 GetSystemMetrics(SM_CXSMICON), 1449 GetSystemMetrics(SM_CYSMICON), 1450 0, 1451 0, 1452 DI_NORMAL); 1453 1454 WIN_ReleaseWndPtr(wndPtr); 1455 */ 1456 } 1457 1458 rc.left += (rc.bottom - rc.top); 1459 } 1460 1461 /* drawing text */ 1462 if (uFlags & DC_TEXT) 1463 { 1464 HFONT hOldFont; 1465 1466 if (uFlags & DC_INBUTTON) 1467 O32_SetTextColor (hdc, 1468 O32_GetSysColor (COLOR_BTNTEXT)); 1469 else 1470 if (uFlags & DC_ACTIVE) 1471 O32_SetTextColor (hdc, 1472 O32_GetSysColor (COLOR_CAPTIONTEXT)); 1473 else 1474 O32_SetTextColor (hdc, 1475 O32_GetSysColor (COLOR_INACTIVECAPTIONTEXT)); 1476 1477 O32_SetBkMode (hdc, 1478 TRANSPARENT); 1479 1480 if (hFont) 1481 hOldFont = O32_SelectObject (hdc, 1482 hFont); 1483 else 1484 { 1485 NONCLIENTMETRICSA nclm; 1486 HFONT hNewFont; 1487 1488 nclm.cbSize = sizeof(NONCLIENTMETRICSA); 1489 O32_SystemParametersInfo (SPI_GETNONCLIENTMETRICS, 1490 0, 1491 &nclm, 1492 0); 1493 hNewFont = O32_CreateFontIndirect ((uFlags & DC_SMALLCAP) ? 1494 &nclm.lfSmCaptionFont : &nclm.lfCaptionFont); 1495 hOldFont = O32_SelectObject (hdc, 1496 hNewFont); 1497 } 1498 1499 if (str) 1500 DrawTextA (hdc, 1501 str, 1502 -1, 1503 &rc, 1504 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT); 1505 else 1506 { 1507 CHAR szText[128]; 1508 INT nLen; 1509 1510 nLen = O32_GetWindowText (Win32BaseWindow::Win32ToOS2FrameHandle(hwnd), 1511 szText, 1512 128); 1513 1514 DrawTextA (hdc, 1515 szText, 1516 nLen, 1517 &rc, 1518 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT); 1519 } 1520 1521 if (hFont) 1522 O32_SelectObject (hdc, 1523 hOldFont); 1524 else 1525 O32_DeleteObject (O32_SelectObject (hdc, 1526 hOldFont)); 1527 } 1528 1529 /* drawing focus ??? */ 1530 if (uFlags & 0x2000) 1531 { 1532 dprintf(("USER32: DrawCaptionTempA undocumented flag (0x2000)!\n")); 1533 } 1534 1535 return 0; 1536 } 1537 /*********************************************************************** 1538 * DrawCaptionTemp32W [USER32.602] 1539 * 1540 * PARAMS 1541 * 1542 * RETURNS 1543 * Success: 1544 * Failure: 1545 */ 1546 1547 BOOL WIN32API DrawCaptionTempW (HWND hwnd, 1548 HDC hdc, 1549 const RECT *rect, 1550 HFONT hFont, 1551 HICON hIcon, 1552 LPCWSTR str, 1553 UINT uFlags) 1554 { 1555 LPSTR strAscii = UnicodeToAsciiString((LPWSTR)str); 1556 1557 BOOL res = DrawCaptionTempA (hwnd, 1558 hdc, 1559 rect, 1560 hFont, 1561 hIcon, 1562 strAscii, 1563 uFlags); 1564 1565 FreeAsciiString(strAscii); 1566 1567 return res; 1568 } 1569 -
trunk/src/user32/win32wmdiclient.cpp
r2803 r2852 1 /* $Id: win32wmdiclient.cpp,v 1.2 4 2000-02-16 14:28:24 sandervlExp $ */1 /* $Id: win32wmdiclient.cpp,v 1.25 2000-02-21 17:25:32 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 36 36 #include "win32wndhandle.h" 37 37 38 #define DBG_LOCALLOG 38 #define DBG_LOCALLOG DBG_win32wmdiclient 39 39 #include "dbglocal.h" 40 40 … … 857 857 // In Win 95 look, the system menu is replaced by the child icon 858 858 859 HICON hIcon = GetClassLongA(child->getWindowHandle(), GCL_HICONSM); 860 if (!hIcon) 861 hIcon = GetClassLongA(child->getWindowHandle(), GCL_HICON); 859 /* Find small icon */ 860 HICON hIcon = child->GetSmallIcon(); 861 862 /* If no small icon or overwridden large icon, use class small icon.. */ 863 if (!hIcon && !child->GetIcon()) 864 hIcon = GetClassLongA(child->getWindowHandle(),GCL_HICONSM); 865 866 /* Use large icon */ 867 if (!hIcon) hIcon = child->GetIcon(); 868 869 /* If all else fails, use large class icon. */ 870 if (!hIcon) hIcon = GetClassLongA(child->getWindowHandle(),GCL_HICON); 871 862 872 if (hIcon) 863 873 { -
trunk/src/user32/window.cpp
r2803 r2852 1 /* $Id: window.cpp,v 1.5 5 2000-02-16 14:28:26 sandervlExp $ */1 /* $Id: window.cpp,v 1.56 2000-02-21 17:25:33 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 32 32 #include <win\winpos.h> 33 33 34 #define DBG_LOCALLOG 34 #define DBG_LOCALLOG DBG_window 35 35 #include "dbglocal.h" 36 36 … … 670 670 671 671 if(hwnd == 0x68000034) { 672 672 window = 0; 673 673 } 674 674 dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom)); … … 857 857 858 858 dprintf(("AdjustWindowRectEx returned (%d,%d)(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom)); 859 859 860 return TRUE; 860 861 } … … 929 930 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 930 931 if (!wnd) { 931 932 932 dprintf(("warning: ScreenToClient: window %x not found!", hwnd)); 933 return (TRUE); 933 934 } 934 935 #ifdef DEBUG … … 1057 1058 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1058 1059 if (!wnd) { 1059 1060 dprintf(("warning: ClientToScreen window %x not found!", hwnd)); 1060 1061 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 1061 1062 return (FALSE); … … 1066 1067 rc = mapWin32Point(wnd->getOS2WindowHandle(),OSLIB_HWND_DESKTOP,(OSLIBPOINT*)pt); 1067 1068 dprintf(("ClientToScreen %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y)); 1068 1069 1069 1070 return rc; 1070 1071 } … … 1078 1079 if (count <= 0) 1079 1080 { 1080 1081 dprintf(("USER32: BeginDeferWindowPos invalid param %d", count)); 1081 1082 SetLastError(ERROR_INVALID_PARAMETER); 1082 1083 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.