- Timestamp:
- Sep 18, 1999, 2:21:26 PM (26 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/header.c
r496 r968 1 /* $Id: header.c,v 1. 8 1999-08-14 16:13:10cbratschi Exp $ */1 /* $Id: header.c,v 1.9 1999-09-18 12:21:25 cbratschi Exp $ */ 2 2 /* 3 3 * Header control … … 422 422 INT oldRop; 423 423 424 GetClientRect (hwnd, &rect); 425 424 GetClientRect (hwnd, &rect); //CB: Odin bug!!! 426 425 hOldPen = SelectObject (hdc, GetStockObject (BLACK_PEN)); 427 426 oldRop = SetROP2 (hdc, R2_XORPEN); 428 427 MoveToEx (hdc, x, rect.top, NULL); 429 LineTo (hdc, x, rect.bottom );428 LineTo (hdc, x, rect.bottom-1); 430 429 SetROP2 (hdc, oldRop); 431 430 SelectObject (hdc, hOldPen); … … 1303 1302 HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem); 1304 1303 1305 if ((dwStyle & HDS_BUTTONS) && (dwStyle & HDS_HOTTRACK)) { 1304 if ((dwStyle & HDS_BUTTONS) && (dwStyle & HDS_HOTTRACK)) 1305 { 1306 INT newItem; 1307 1306 1308 if (flags & (HHT_ONHEADER | HHT_ONDIVIDER | HHT_ONDIVOPEN)) 1307 infoPtr->iHotItem = nItem;1309 newItem = nItem; 1308 1310 else 1309 infoPtr->iHotItem = -1; 1310 hdc = GetDC (hwnd); 1311 HEADER_Refresh (hwnd, hdc); 1312 ReleaseDC (hwnd, hdc); 1311 newItem = -1; 1312 if (newItem != infoPtr->iHotItem) 1313 { 1314 infoPtr->iHotItem = newItem; 1315 hdc = GetDC (hwnd); 1316 HEADER_Refresh (hwnd, hdc); 1317 ReleaseDC (hwnd, hdc); 1318 } 1313 1319 } 1314 1320 1315 1321 if (infoPtr->bCaptured) { 1316 if (infoPtr->bPressed) { 1322 if (infoPtr->bPressed) 1323 { 1324 BOOL newDown; 1325 1317 1326 if ((nItem == infoPtr->iMoveItem) && (flags == HHT_ONHEADER)) 1318 infoPtr->items[infoPtr->iMoveItem].bDown = TRUE;1327 newDown = TRUE; 1319 1328 else 1320 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE; 1321 hdc = GetDC (hwnd); 1322 HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem); 1323 ReleaseDC (hwnd, hdc); 1324 1329 newDown = FALSE; 1330 1331 if (newDown != infoPtr->items[infoPtr->iMoveItem].bDown) 1332 { 1333 infoPtr->items[infoPtr->iMoveItem].bDown = newDown; 1334 hdc = GetDC (hwnd); 1335 HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem); 1336 ReleaseDC (hwnd, hdc); 1337 } 1325 1338 // TRACE (header, "Moving pressed item %d!\n", infoPtr->iMoveItem); 1326 1339 } -
trunk/src/comctl32/hotkey.c
r496 r968 1 /* $Id: hotkey.c,v 1. 4 1999-08-14 16:13:10cbratschi Exp $ */1 /* $Id: hotkey.c,v 1.5 1999-09-18 12:21:26 cbratschi Exp $ */ 2 2 /* 3 3 * Hotkey control … … 5 5 * Copyright 1998, 1999 Eric Kohl 6 6 * Copyright 1999 Achim Hasenmueller 7 * Copyright 1999 Christoph Bratschi 7 8 * 8 9 * NOTES 9 * Development in progress. An author is needed! Any volunteers? 10 * I will only improve this control once in a while. 11 * Eric <ekohl@abo.rhein-zeitung.de> 10 * Development in progress. 11 * CB: difficult with new User32 12 12 * 13 13 * TODO: 14 * - Some messages. 15 * - Display code. 14 * - keyboard messages 16 15 */ 17 16 … … 19 18 #include "commctrl.h" 20 19 #include "hotkey.h" 21 22 23 #define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongA (hwnd, 0)) 24 25 26 /* << HOTHEY_GetHotKey >> */ 27 /* << HOTHEY_SetHotKey >> */ 28 /* << HOTHEY_SetRules >> */ 29 30 31 32 /* << HOTKEY_Char >> */ 20 #include <string.h> 21 22 #define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO*)GetWindowLongA(hwnd,0)) 23 24 static VOID 25 HOTKEY_UpdateHotKey(HWND hwnd); 26 27 static BYTE 28 HOTKEY_Check(HOTKEY_INFO *infoPtr,BYTE bfMods) 29 { 30 if ((infoPtr->fwCombInv & HKCOMB_A && bfMods == HOTKEYF_ALT) || 31 (infoPtr->fwCombInv & HKCOMB_C && bfMods == HOTKEYF_CONTROL) || 32 (infoPtr->fwCombInv & HKCOMB_CA && bfMods == HOTKEYF_CONTROL | HOTKEYF_ALT) || 33 (infoPtr->fwCombInv & HKCOMB_NONE && bfMods == 0) || 34 (infoPtr->fwCombInv & HKCOMB_S && bfMods == HOTKEYF_SHIFT) || 35 (infoPtr->fwCombInv & HKCOMB_SA && bfMods == HOTKEYF_SHIFT | HOTKEYF_ALT) || 36 (infoPtr->fwCombInv & HKCOMB_SC && bfMods == HOTKEYF_SHIFT | HOTKEYF_CONTROL) || 37 (infoPtr->fwCombInv & HKCOMB_SCA && bfMods == HOTKEYF_SHIFT | HOTKEYF_CONTROL | HOTKEYF_ALT)) 38 return infoPtr->fwModInv; 39 else 40 return bfMods; 41 } 42 43 44 static LRESULT 45 HOTKEY_SetHotKey(HWND hwnd,WPARAM wParam,LPARAM lParam) 46 { 47 HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(hwnd); 48 49 infoPtr->bVKHotKey = wParam & 0xFF; 50 infoPtr->bfMods = HOTKEY_Check(infoPtr,wParam & 0xFF00); 51 52 HOTKEY_UpdateHotKey(hwnd); 53 54 return 0; 55 } 56 57 58 static LRESULT 59 HOTKEY_GetHotKey(HWND hwnd,WPARAM wParam,LPARAM lParam) 60 { 61 HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(hwnd); 62 63 return MAKEWORD(infoPtr->bVKHotKey,infoPtr->bfMods); 64 } 65 66 67 static LRESULT 68 HOTKEY_SetRules(HWND hwnd,WPARAM wParam,LPARAM lParam) 69 { 70 HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(hwnd); 71 BYTE oldMods = infoPtr->bfMods; 72 73 infoPtr->fwCombInv = wParam; 74 infoPtr->fwModInv = lParam; 75 76 infoPtr->bfMods = HOTKEY_Check(infoPtr,infoPtr->bfMods); 77 if (infoPtr->bfMods != oldMods) HOTKEY_UpdateHotKey(hwnd); 78 79 return 0; 80 } 81 82 83 static LRESULT 84 HOTKEY_Char(HWND hwnd,WPARAM wParam,LPARAM lParam) 85 { 86 //CB: 87 return 0; 88 } 89 90 91 static LRESULT 92 HOTKEY_SysChar(HWND hwnd,WPARAM wParam,LPARAM lParam) 93 { 94 //CB: 95 return 0; 96 } 33 97 34 98 … … 42 106 /* allocate memory for info structure */ 43 107 infoPtr = (HOTKEY_INFO *)COMCTL32_Alloc (sizeof(HOTKEY_INFO)); 44 SetWindowLongA (hwnd, 0,(DWORD)infoPtr);108 SetWindowLongA(hwnd,0,(DWORD)infoPtr); 45 109 46 110 /* initialize info structure */ 47 111 112 infoPtr->hFont = 0; 113 infoPtr->bFocus = FALSE; 114 infoPtr->bVKHotKey = 0; 115 infoPtr->bfMods = 0; 116 infoPtr->fwCombInv = 0; 117 infoPtr->fwModInv = 0; 48 118 49 119 /* get default font height */ … … 62 132 HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); 63 133 64 65 66 134 /* free hotkey info data */ 67 135 COMCTL32_Free (infoPtr); … … 74 142 HOTKEY_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) 75 143 { 76 /* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); */77 144 HBRUSH hBrush; 78 145 RECT rc; 79 146 80 hBrush = 81 (HBRUSH)SendMessageA (GetParent (hwnd), WM_CTLCOLOREDIT, 82 wParam, (LPARAM)hwnd); 83 if (hBrush) 84 hBrush = (HBRUSH)GetStockObject (WHITE_BRUSH); 85 GetClientRect (hwnd, &rc); 86 87 FillRect ((HDC)wParam, &rc, hBrush); 147 hBrush = (HBRUSH)SendMessageA(GetParent(hwnd),WM_CTLCOLOREDIT,wParam,(LPARAM)hwnd); 148 if (!hBrush) hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH); 149 GetClientRect(hwnd,&rc); 150 FillRect((HDC)wParam,&rc,hBrush); 88 151 89 152 return -1; … … 172 235 173 236 174 175 237 static VOID 238 HOTKEY_Draw(HWND hwnd,HDC hdc) 239 { 240 HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(hwnd); 241 RECT rect; 242 char text[50]; 243 HFONT oldFont; 244 245 GetClientRect(hwnd,&rect); 246 DrawEdge(hdc,&rect,EDGE_SUNKEN,BF_RECT | BF_ADJUST); 247 248 //draw string 249 text[0] = 0; 250 if (infoPtr->bfMods & HOTKEYF_ALT) strcat(text,"ALT"); 251 if (infoPtr->bfMods & HOTKEYF_CONTROL) 252 { 253 if (text[0]) strcat(text,"+"); 254 strcat(text,"CONTROL"); 255 } 256 if (infoPtr->bfMods & HOTKEYF_SHIFT) 257 { 258 if (text[0]) strcat(text,"+"); 259 strcat(text,"SHIFT"); 260 } 261 262 if (infoPtr->bVKHotKey) 263 { 264 char char2[2]; 265 266 if (text[0]) strcat(text,"+"); 267 char2[0] = (char)infoPtr->bVKHotKey; 268 char2[1] = 0; 269 strcat(text,char2); 270 } 271 if(infoPtr->hFont) oldFont = SelectObject(hdc,infoPtr->hFont); 272 SetBkMode(hdc,TRANSPARENT); 273 DrawTextA(hdc,text,strlen(text),&rect,DT_LEFT | DT_BOTTOM | DT_SINGLELINE); 274 if (infoPtr->hFont) SelectObject(hdc,oldFont); 275 } 276 277 278 static LRESULT 279 HOTKEY_Paint(HWND hwnd,WPARAM wParam,LPARAM lParam) 280 { 281 PAINTSTRUCT ps; 282 HDC hdc; 283 284 if (wParam == 0) hdc = BeginPaint(hwnd,&ps); 285 else hdc = wParam; 286 287 HOTKEY_Draw(hwnd,hdc); 288 289 if (wParam == 0) EndPaint(hwnd,&ps); 290 291 return 0; 292 } 293 294 295 static VOID 296 HOTKEY_UpdateHotKey(HWND hwnd) 297 { 298 HDC hdc; 299 RECT rect; 300 HBRUSH hBrush; 301 302 GetClientRect(hwnd,&rect); 303 InflateRect(&rect,2,2); 304 hdc = GetDC(hwnd); 305 hBrush = (HBRUSH)SendMessageA(GetParent(hwnd),WM_CTLCOLOREDIT,hdc,(LPARAM)hwnd); 306 if (!hBrush) hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH); 307 FillRect(hdc,&rect,hBrush); 308 HOTKEY_Draw(hwnd,hdc); 309 ReleaseDC(hwnd,hdc); 310 } 176 311 177 312 static LRESULT … … 182 317 infoPtr->bFocus = TRUE; 183 318 184 185 319 CreateCaret (hwnd, (HBITMAP)0, 1, infoPtr->nHeight); 186 187 SetCaretPos (1, 1); 188 320 SetCaretPos (3,3); 189 321 ShowCaret (hwnd); 190 191 322 192 323 return 0; … … 215 346 ReleaseDC (hwnd, hdc); 216 347 217 if (LOWORD(lParam)) { 218 219 // FIXME (hotkey, "force redraw!\n"); 220 221 } 348 if (LOWORD(lParam)) HOTKEY_UpdateHotKey(hwnd); 222 349 223 350 return 0; … … 271 398 switch (uMsg) 272 399 { 273 /* case HKM_GETHOTKEY: */ 274 /* case HKM_SETHOTKEY: */ 275 /* case HKM_SETRULES: */ 276 277 /* case WM_CHAR: */ 400 case HKM_GETHOTKEY: 401 return HOTKEY_GetHotKey(hwnd,wParam,lParam); 402 403 case HKM_SETHOTKEY: 404 return HOTKEY_SetHotKey(hwnd,wParam,lParam); 405 406 case HKM_SETRULES: 407 return HOTKEY_SetRules(hwnd,wParam,lParam); 408 409 case WM_CHAR: 410 return HOTKEY_Char(hwnd,wParam,lParam); 278 411 279 412 case WM_CREATE: … … 293 426 294 427 case WM_KEYDOWN: 428 return HOTKEY_KeyDown(hwnd,wParam,lParam); 429 295 430 case WM_SYSKEYDOWN: 296 return HOTKEY_ KeyDown (hwnd, wParam, lParam);431 return HOTKEY_SysKeyDown (hwnd, wParam, lParam); 297 432 298 433 case WM_KEYUP: 434 return HOTKEY_KeyUp(hwnd,wParam,lParam); 435 299 436 case WM_SYSKEYUP: 300 return HOTKEY_ KeyUp (hwnd, wParam, lParam);437 return HOTKEY_SysKeyUp (hwnd, wParam, lParam); 301 438 302 439 case WM_KILLFOCUS: … … 309 446 return HOTKEY_NCCreate (hwnd, wParam, lParam); 310 447 311 /* case WM_PAINT: */ 448 case WM_PAINT: 449 return HOTKEY_Paint(hwnd,wParam,lParam); 312 450 313 451 case WM_SETFOCUS: … … 317 455 return HOTKEY_SetFont (hwnd, wParam, lParam); 318 456 319 /* case WM_SYSCHAR: */ 457 case WM_SYSCHAR: 458 return HOTKEY_SysChar(hwnd,wParam,lParam); 320 459 321 460 default: -
trunk/src/comctl32/updown.c
r942 r968 1 /* $Id: updown.c,v 1. 8 1999-09-15 16:31:49cbratschi Exp $ */1 /* $Id: updown.c,v 1.9 1999-09-18 12:21:26 cbratschi Exp $ */ 2 2 /* 3 3 * Updown control … … 18 18 * - listbox as buddy window 19 19 * - acceleration 20 * - base 16 -> bug: 9->B (should be A)21 20 * - UDS_ALIGNLEFT, ~UDS_WRAP 22 21 * (tested - they work) … … 897 896 if (wParam==10 || wParam==16) 898 897 { 898 UPDOWN_GetBuddyInt(hwnd); 899 899 900 temp = infoPtr->Base; 900 901 infoPtr->Base = wParam; 902 903 UPDOWN_SetBuddyInt(hwnd); 904 901 905 return temp; /* return the prev base */ 902 906 }
Note:
See TracChangeset
for help on using the changeset viewer.