Changeset 500 for trunk/src/user32/new/combo.cpp
- Timestamp:
- Aug 15, 1999, 9:11:02 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/combo.cpp
r387 r500 1 /* $Id: combo.cpp,v 1. 2 1999-07-24 17:10:24cbratschi Exp $ */1 /* $Id: combo.cpp,v 1.3 1999-08-15 19:11:00 cbratschi Exp $ */ 2 2 /* 3 3 * Combo controls … … 39 39 * Look and feel dependant "constants" 40 40 */ 41 #define COMBO_YBORDERGAP 5 41 42 #define COMBO_XBORDERSIZE() ( 2 ) 42 43 #define COMBO_YBORDERSIZE() ( 2 ) … … 484 485 if( lphc->owner || !(lpcs->style & WS_VISIBLE) ) 485 486 { 486 UINT lbeStyle; 487 UINT lbeStyle = 0; 488 UINT lbeExStyle = 0; 487 489 488 490 /* … … 530 532 lbeStyle |= LBS_DISABLENOSCROLL; 531 533 532 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */ 533 lbeStyle |= WS_CHILD | WS_VISIBLE; 534 else /* popup listbox */ 535 lbeStyle |= WS_POPUP; 534 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */ 535 { 536 lbeStyle |= WS_CHILD | WS_VISIBLE; 537 538 /* 539 * In win 95 look n feel, the listbox in the simple combobox has 540 * the WS_EXCLIENTEDGE style instead of the WS_BORDER style. 541 */ 542 lbeStyle &= ~WS_BORDER; 543 lbeExStyle |= WS_EX_CLIENTEDGE; 544 } 545 else /* popup listbox */ 546 lbeStyle |= WS_POPUP; 536 547 537 548 /* Dropdown ComboLBox is not a child window and we cannot pass 538 549 * ID_CB_LISTBOX directly because it will be treated as a menu handle. 539 550 */ 540 lphc->hWndLBox = CreateWindowExA( 0,551 lphc->hWndLBox = CreateWindowExA(lbeExStyle, 541 552 clbName, 542 553 NULL, … … 1063 1074 { 1064 1075 RECT rect; 1076 int nItems = 0; 1077 int i; 1078 int nHeight; 1079 int nDroppedHeight; 1065 1080 1066 1081 //TRACE("[%04x]: drop down\n", CB_HWND(lphc)); … … 1091 1106 /* now set popup position */ 1092 1107 GetWindowRect( lphc->hwndself, &rect ); 1093 1094 1108 1095 1109 /* … … 1099 1113 rect.left += COMBO_EDITBUTTONSPACE(); 1100 1114 1115 /* if the dropped height is greater than the total height of the dropped 1116 items list, then force the drop down list height to be the total height 1117 of the items in the dropped list */ 1118 1119 nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top; 1120 nItems = (int)SendMessageA (lphc->hWndLBox, LB_GETCOUNT, 0, 0); 1121 nHeight = COMBO_YBORDERGAP; 1122 for (i = 0; i < nItems; i++) 1123 { 1124 nHeight += (int)SendMessageA (lphc->hWndLBox, LB_GETITEMHEIGHT, i, 0); 1125 1126 if (nHeight >= nDroppedHeight) 1127 break; 1128 } 1129 1130 if (nHeight < nDroppedHeight) 1131 nDroppedHeight = nHeight; 1132 1101 1133 SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom, 1102 lphc->droppedRect.right - lphc->droppedRect.left, 1103 lphc->droppedRect.bottom - lphc->droppedRect.top, 1104 SWP_NOACTIVATE | SWP_NOREDRAW); 1134 lphc->droppedRect.right - lphc->droppedRect.left, 1135 nDroppedHeight, 1136 SWP_NOACTIVATE | SWP_NOREDRAW); 1137 1105 1138 1106 1139 if( !(lphc->wState & CBF_NOREDRAW) ) … … 1127 1160 //TRACE("[%04x]: roll up [%i]\n", CB_HWND(lphc), (INT)ok ); 1128 1161 1129 /*1130 * It seems useful to send the WM_LBUTTONUP with (-1,-1) when cancelling1131 * and with (0,0) (anywhere in the listbox) when Oking.1132 */1133 SendMessageA( lphc->hWndLBox, WM_LBUTTONUP, 0, ok ? (LPARAM)0 : (LPARAM)(-1) );1134 1135 1162 if( lphc->wState & CBF_DROPPED ) 1136 1163 { 1137 1164 RECT rect; 1165 1166 /* 1167 * It seems useful to send the WM_LBUTTONUP with (-1,-1) when cancelling 1168 * and with (0,0) (anywhere in the listbox) when Oking. 1169 */ 1170 SendMessageA( lphc->hWndLBox, WM_LBUTTONUP, 0, ok ? (LPARAM)0 : (LPARAM)(-1) ); 1138 1171 1139 1172 lphc->wState &= ~CBF_DROPPED;
Note:
See TracChangeset
for help on using the changeset viewer.