Changeset 3153 for trunk/src/user32/listbox.cpp
- Timestamp:
- Mar 18, 2000, 5:13:41 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/listbox.cpp
r3144 r3153 1 /* $Id: listbox.cpp,v 1.2 3 2000-03-17 17:12:07cbratschi Exp $ */1 /* $Id: listbox.cpp,v 1.24 2000-03-18 16:13:30 cbratschi Exp $ */ 2 2 /* 3 3 * Listbox controls … … 6 6 * Copyright 1999 Christoph Bratschi (ported from WINE) 7 7 * 8 * Corel version: 20000 2129 * WINE version: 9912128 * Corel version: 20000317 9 * (WINE version: 991212) 10 10 * 11 11 * Status: ??? … … 26 26 #include "dbglocal.h" 27 27 28 /* Unimplemented yet:28 /* bugs: 29 29 - LBS_NOSEL 30 30 - LBS_USETABSTOPS … … 34 34 - VK_LINEDOWN -> bottom most item not always visible 35 35 - performance not optimized 36 - ownerdraw is broken -> toolbar customize dialog 37 - first item selection mark not redrawn on new selection 36 38 */ 37 39 … … 340 342 descr->width = rect.right - rect.left; 341 343 descr->height = rect.bottom - rect.top; 342 if (!(descr->style & LBS_NOINTEGRALHEIGHT) && ! IS_OWNERDRAW(descr))344 if (!(descr->style & LBS_NOINTEGRALHEIGHT) && !(descr->style & LBS_OWNERDRAWVARIABLE)) 343 345 { 344 346 if ((descr->height > descr->item_height) && … … 480 482 { 481 483 DRAWITEMSTRUCT dis; 482 UINT 484 UINT id = (descr->lphc) ? ID_CB_LISTBOX : GetWindowLongA(hwnd,GWL_ID); 483 485 484 486 if (!item) … … 879 881 INT i, col_pos = descr->page_size - 1; 880 882 RECT rect; 883 RECT focusRect = {-1, -1, -1, -1}; 881 884 HFONT oldFont = 0; 882 885 HBRUSH hbrush, oldBrush = 0; 883 886 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 887 INT focusItem; 884 888 885 889 SetRect( &rect, 0, 0, descr->width, descr->height ); … … 910 914 } 911 915 916 /* Paint all the item, regarding the selection 917 Focus state will be painted after */ 918 focusItem = descr->focus_item; 919 descr->focus_item = -1; 920 912 921 for (i = descr->top_item; i < descr->nb_items; i++) 913 922 { … … 917 926 rect.bottom = rect.top + descr->items[i].height; 918 927 928 if (i == focusItem) 929 { 930 /* keep the focus rect, to paint the focus item after */ 931 focusRect.left = rect.left; 932 focusRect.right = rect.right; 933 focusRect.top = rect.top; 934 focusRect.bottom = rect.bottom; 935 } 919 936 LISTBOX_DrawItem( hwnd, descr, hdc, &rect, i, ODA_DRAWENTIRE ); 920 937 rect.top = rect.bottom; … … 946 963 } 947 964 } 965 966 /* Paint the focus item now */ 967 descr->focus_item = focusItem; 968 if (focusRect.top != focusRect.bottom) 969 LISTBOX_DrawItem( hwnd, descr, hdc, &focusRect, descr->focus_item, ODA_FOCUS ); 948 970 949 971 if (!IS_OWNERDRAW(descr)) … … 1285 1307 BOOL fully_visible ) 1286 1308 { 1287 LISTBOX_SetCaretIndex( hwnd, descr, index, fully_visible ); 1309 INT oldfocus = descr->focus_item; 1310 1311 if ((index < 0) || (index >= descr->nb_items) || (oldfocus == index)) 1312 return; 1313 1314 /* Important, repaint need ot be done in this order if 1315 you want to mimic Windows behavior: 1316 1. Remove the focus and paint the item 1317 2. Remove the selection and paint the item(s) 1318 3. Set the selection and repaint the item(s) 1319 4. Set the focus to 'index' and repaint the item */ 1320 1321 /* 1. remove the focus and repaint the item */ 1322 descr->focus_item = -1; 1323 if ((oldfocus != -1) && descr->caret_on && (descr->in_focus)) 1324 LISTBOX_RepaintItem( hwnd, descr, oldfocus, ODA_FOCUS ); 1325 1326 /* 2. then turn off the previous selection */ 1327 /* 3. repaint the new selected item */ 1288 1328 if (descr->style & LBS_EXTENDEDSEL) 1289 1329 { 1290 1330 if (descr->anchor_item != -1) 1291 1331 { 1292 INT first = MIN( descr->focus_item, descr->anchor_item );1293 INT last = MAX( descr->focus_item, descr->anchor_item );1332 INT first = MIN( index, descr->anchor_item ); 1333 INT last = MAX( index, descr->anchor_item ); 1294 1334 if (first > 0) 1295 1335 LISTBOX_SelectItemRange( hwnd, descr, 0, first - 1, FALSE ); … … 1303 1343 LISTBOX_SetSelection( hwnd, descr, index, TRUE, FALSE ); 1304 1344 } 1345 1346 /* 4. repaint the new item with the focus */ 1347 descr->focus_item = index; 1348 LISTBOX_MakeItemVisible( hwnd, descr, index, fully_visible ); 1349 if (descr->caret_on && (descr->in_focus)) 1350 LISTBOX_RepaintItem( hwnd, descr, index, ODA_FOCUS ); 1305 1351 } 1306 1352
Note:
See TracChangeset
for help on using the changeset viewer.