- Timestamp:
- Mar 21, 2000, 6:30:46 PM (25 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/CCBase.cpp
r3154 r3182 1 /* $Id: CCBase.cpp,v 1. 4 2000-03-18 16:17:20 cbratschi Exp $ */1 /* $Id: CCBase.cpp,v 1.5 2000-03-21 17:30:40 cbratschi Exp $ */ 2 2 /* 3 3 * COMCTL32 Base Functions and Macros for all Controls … … 251 251 if (hwndToolTip) DestroyWindow(hwndToolTip); 252 252 } 253 254 //stub control 255 256 VOID drawStubControl(HWND hwnd,HDC hdc) 257 { 258 RECT rect; 259 HBRUSH brush = CreateSolidBrush(RGB(0,0,255)); 260 HPEN pen = CreatePen(PS_SOLID,0,RGB(255,0,0)),oldPen; 261 COLORREF oldColor; 262 263 GetClientRect(hwnd,&rect); 264 FillRect(hdc,&rect,brush); 265 oldPen = SelectObject(hdc,pen); 266 MoveToEx(hdc,0,0,NULL); 267 LineTo(hdc,rect.right,rect.bottom); 268 MoveToEx(hdc,rect.right,0,NULL); 269 LineTo(hdc,0,rect.bottom); 270 SelectObject(hdc,oldPen); 271 oldColor = SetTextColor(hdc,RGB(255,255,255)); 272 DrawTextA(hdc,"Unimplemented Control!",-1,&rect,DT_CENTER | DT_SINGLELINE | DT_VCENTER); 273 SetTextColor(hdc,oldColor); 274 275 DeleteObject(brush); 276 DeleteObject(pen); 277 } -
trunk/src/comctl32/CCBase.h
r3154 r3182 1 /* $Id: CCBase.h,v 1. 5 2000-03-18 16:17:21cbratschi Exp $ */1 /* $Id: CCBase.h,v 1.6 2000-03-21 17:30:40 cbratschi Exp $ */ 2 2 /* 3 3 * COMCTL32 Base Functions and Macros for all Controls … … 42 42 VOID destroyToolTip(HWND hwndToolTip); 43 43 44 VOID drawStubControl(HWND hwnd,HDC hdc); 45 44 46 #endif -
trunk/src/comctl32/comboex.cpp
r2895 r3182 1 /* $Id: comboex.cpp,v 1. 2 2000-02-25 17:00:15cbratschi Exp $ */1 /* $Id: comboex.cpp,v 1.3 2000-03-21 17:30:40 cbratschi Exp $ */ 2 2 /* 3 3 * ComboBoxEx control … … 39 39 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 40 40 41 // TRACE (comboex, "\n");42 43 41 return (LRESULT)infoPtr->hwndCombo; 44 42 } … … 53 51 return 0; 54 52 55 // TRACE (comboex, "-- 0x%x\n", GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT));56 57 53 return (LRESULT)GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT); 58 54 } … … 73 69 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 74 70 75 // TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);76 77 71 return (LRESULT)infoPtr->himl; 78 72 } … … 81 75 82 76 83 static LRESULT 84 COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 77 static LRESULT COMBOEX_InsertItem(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode) 85 78 { 86 79 /* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); */ … … 98 91 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 99 92 DWORD dwTemp; 100 101 // TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);102 93 103 94 dwTemp = infoPtr->dwExtStyle; … … 121 112 HIMAGELIST himlTemp; 122 113 123 // TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);124 125 114 himlTemp = infoPtr->himl; 126 115 infoPtr->himl = (HIMAGELIST)lParam; … … 130 119 131 120 132 static LRESULT 133 COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 121 static LRESULT COMBOEX_SetItem(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode) 134 122 { 135 123 /* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); */ … … 139 127 return TRUE; 140 128 } 141 142 143 /* << COMBOEX_SetItem32W >> */144 129 145 130 … … 242 227 /* case CBEM_GETITEM32A: 243 228 case CBEM_GETITEM32W: 244 case CBEM_GETUNICODEFORMAT:245 229 case CBEM_HASEDITCHANGED: 246 230 */ 247 231 248 232 case CBEM_INSERTITEMA: 249 return COMBOEX_InsertItemA (hwnd, wParam, lParam); 250 251 /* case CBEM_INSERTITEM32W: */ 233 return COMBOEX_InsertItem(hwnd,wParam,lParam,FALSE); 234 235 case CBEM_INSERTITEMW: 236 return COMBOEX_InsertItem(hwnd,wParam,lParam,TRUE); 252 237 253 238 case CBEM_SETEXTENDEDSTYLE: … … 258 243 259 244 case CBEM_SETITEMA: 260 return COMBOEX_SetItemA (hwnd, wParam, lParam); 261 262 /* case CBEM_SETITEM32W: 263 case CBEM_SETUNICODEFORMAT: 264 */ 245 return COMBOEX_SetItem(hwnd,wParam,lParam,FALSE); 246 247 case CBEM_SETITEMW: 248 return COMBOEX_SetItem(hwnd,wParam,lParam,TRUE); 265 249 266 250 case CB_DELETESTRING: -
trunk/src/comctl32/draglist.cpp
r2875 r3182 1 /* $Id: draglist.cpp,v 1.2 2000-03-21 17:30:41 cbratschi Exp $ */ 1 2 /* 2 3 * Drag List control … … 23 24 BOOL WINAPI MakeDragList (HWND hwndLB) 24 25 { 25 26 dprintf(("COMCTL32: MakeDragList - empty stub!")); 26 27 27 28 return FALSE; 28 29 } 29 30 … … 31 32 VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem) 32 33 { 33 34 dprintf(("COMCTL32: DrawInsert - empty stub!")); 34 35 } 35 36 … … 93 94 { 94 95 95 96 return FALSE; 96 97 } -
trunk/src/comctl32/flatsb.cpp
r2895 r3182 1 /* $Id: flatsb.cpp,v 1. 2 2000-02-25 17:00:15cbratschi Exp $ */1 /* $Id: flatsb.cpp,v 1.3 2000-03-21 17:30:41 cbratschi Exp $ */ 2 2 /* 3 3 * Flat Scrollbar control … … 22 22 #include "ccbase.h" 23 23 #include "flatsb.h" 24 24 #include <misc.h> 25 25 26 26 #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)getInfoPtr(hwnd)) 27 27 28 28 29 BOOL WINAPI 30 FlatSB_EnableScrollBar(HWND hwnd, INT dummy, UINT dummy2) 29 BOOL WINAPI FlatSB_EnableScrollBar(HWND hwnd, INT dummy, UINT dummy2) 31 30 { 32 // FIXME_(commctrl)("stub\n"); 33 return 0; 31 dprintf(("COMCTL32: FlatSB_EnableScrollBar - empty stub!!!")); 32 33 return 0; 34 34 } 35 35 36 BOOL WINAPI 37 FlatSB_ShowScrollBar(HWND hwnd, INT code, BOOL flag) 36 BOOL WINAPI FlatSB_ShowScrollBar(HWND hwnd, INT code, BOOL flag) 38 37 { 39 // FIXME_(commctrl)("stub\n"); 40 return 0; 38 dprintf(("COMCTL32: FlatSB_ShowScrollBar - empty stub!!!")); 39 40 return 0; 41 41 } 42 42 43 BOOL WINAPI 44 FlatSB_GetScrollRange(HWND hwnd, INT code, LPINT min, LPINT max) 43 BOOL WINAPI FlatSB_GetScrollRange(HWND hwnd, INT code, LPINT min, LPINT max) 45 44 { 46 // FIXME_(commctrl)("stub\n"); 47 return 0; 45 dprintf(("COMCTL32: FlatSB_GetScrollRange - empty stub!!!")); 46 47 return 0; 48 48 } 49 49 50 BOOL WINAPI 51 FlatSB_GetScrollInfo(HWND hwnd, INT code, LPSCROLLINFO info) 50 BOOL WINAPI FlatSB_GetScrollInfo(HWND hwnd, INT code, LPSCROLLINFO info) 52 51 { 53 // FIXME_(commctrl)("stub\n"); 54 return 0; 52 dprintf(("COMCTL32: FlatSB_GetScrollInfo - empty stub!!!")); 53 54 return 0; 55 55 } 56 56 57 INT WINAPI 58 FlatSB_GetScrollPos(HWND hwnd, INT code) 57 INT WINAPI FlatSB_GetScrollPos(HWND hwnd, INT code) 59 58 { 60 // FIXME_(commctrl)("stub\n"); 61 return 0; 59 dprintf(("COMCTL32: FlatSB_GetScrollPos - empty stub!!!")); 60 61 return 0; 62 62 } 63 63 64 BOOL WINAPI 65 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop) 64 BOOL WINAPI FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop) 66 65 { 67 // FIXME_(commctrl)("stub\n"); 68 return 0; 66 dprintf(("COMCTL32: FlatSB_GetScrollProp - empty stub!!!")); 67 68 return 0; 69 69 } 70 70 71 71 72 INT WINAPI 73 FlatSB_SetScrollPos(HWND hwnd, INT code, INT pos, BOOL fRedraw) 72 INT WINAPI FlatSB_SetScrollPos(HWND hwnd, INT code, INT pos, BOOL fRedraw) 74 73 { 75 // FIXME_(commctrl)("stub\n"); 76 return 0; 74 dprintf(("COMCTL32: FlatSB_SetScrollPos - empty stub!!!")); 75 76 return 0; 77 77 } 78 78 79 INT WINAPI 80 FlatSB_SetScrollInfo(HWND hwnd, INT code, LPSCROLLINFO info, BOOL fRedraw) 79 INT WINAPI FlatSB_SetScrollInfo(HWND hwnd, INT code, LPSCROLLINFO info, BOOL fRedraw) 81 80 { 82 // FIXME_(commctrl)("stub\n"); 83 return 0; 81 dprintf(("COMCTL32: FlatSB_EnableScrollBar - empty stub!!!")); 82 83 return 0; 84 84 } 85 85 86 INT WINAPI 87 FlatSB_SetScrollRange(HWND hwnd, INT code, INT min, INT max, BOOL fRedraw) 86 INT WINAPI FlatSB_SetScrollRange(HWND hwnd, INT code, INT min, INT max, BOOL fRedraw) 88 87 { 89 // FIXME_(commctrl)("stub\n"); 90 return 0; 88 dprintf(("COMCTL32: FlatSB_SetScrollRange - empty stub!!!")); 89 90 return 0; 91 91 } 92 92 93 BOOL WINAPI 94 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag) 93 BOOL WINAPI FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag) 95 94 { 96 // FIXME_(commctrl)("stub\n"); 97 return 0; 95 dprintf(("COMCTL32: FlatSB_SetScrollProp - empty stub!!!")); 96 97 return 0; 98 98 } 99 99 … … 101 101 BOOL WINAPI InitializeFlatSB(HWND hwnd) 102 102 { 103 // FIXME_(commctrl)("stub\n"); 104 return 0; 103 dprintf(("COMCTL32: FlatSB_InitializeFlatSB - empty stub!!!")); 104 105 return 0; 105 106 } 106 107 107 108 HRESULT WINAPI UninitializeFlatSB(HWND hwnd) 108 109 { 109 // FIXME_(commctrl)("stub\n"); 110 return 0; 110 dprintf(("COMCTL32: FlatSB_UninitializeFlatSB - empty stub!!!")); 111 112 return 0; 111 113 } 112 114 113 115 114 116 115 static LRESULT 116 FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) 117 static LRESULT FLATSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) 117 118 { 118 119 return 0; 119 120 } 120 121 121 122 static LRESULT 123 FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 122 static LRESULT FLATSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 124 123 { 125 124 return 0; 126 125 } 127 126 127 static VOID FLATSB_Draw(HWND hwnd,HDC hdc,RECT *updateRect) 128 { 129 drawStubControl(hwnd,hdc); 130 } 128 131 132 static LRESULT FLATSB_Paint(HWND hwnd,WPARAM wParam,LPARAM lParam) 133 { 134 HDC hdc = (HDC)wParam; 129 135 136 if (!hdc) 137 { 138 PAINTSTRUCT ps; 130 139 131 static LRESULT WINAPI 132 FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 140 hdc = BeginPaint(hwnd,&ps); 141 FLATSB_Draw(hwnd, hdc,&ps.rcPaint); 142 EndPaint(hwnd,&ps); 143 } else 144 FLATSB_Draw(hwnd,hdc,NULL); 145 146 return 0; 147 } 148 149 static LRESULT WINAPI FLATSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 133 150 { 134 switch (uMsg) 135 { 151 switch (uMsg) 152 { 153 case WM_CREATE: 154 return FLATSB_Create (hwnd, wParam, lParam); 136 155 137 case WM_CREATE:138 return FlatSB_Create(hwnd, wParam, lParam);156 case WM_DESTROY: 157 return FLATSB_Destroy (hwnd, wParam, lParam); 139 158 140 case WM_DESTROY:141 return FlatSB_Destroy (hwnd, wParam,lParam);159 case WM_PAINT: 160 return FLATSB_Paint(hwnd,wParam,lParam); 142 161 143 144 //if (uMsg >= WM_USER)145 //ERR_(datetime)("unknown msg %04x wp=%08x lp=%08lx\n",146 //uMsg, wParam, lParam);147 148 149 162 default: 163 //if (uMsg >= WM_USER) 164 // ERR_(datetime)("unknown msg %04x wp=%08x lp=%08lx\n", 165 // uMsg, wParam, lParam); 166 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 167 } 168 return 0; 150 169 } 151 170 … … 158 177 ZeroMemory (&wndClass, sizeof(WNDCLASSA)); 159 178 wndClass.style = CS_GLOBALCLASS; 160 wndClass.lpfnWndProc = (WNDPROC)F latSB_WindowProc;179 wndClass.lpfnWndProc = (WNDPROC)FLATSB_WindowProc; 161 180 wndClass.cbClsExtra = 0; 162 181 wndClass.cbWndExtra = sizeof(FLATSB_INFO *); -
trunk/src/comctl32/header.cpp
r3154 r3182 1 /* $Id: header.cpp,v 1. 3 2000-03-18 16:17:23cbratschi Exp $ */1 /* $Id: header.cpp,v 1.4 2000-03-21 17:30:41 cbratschi Exp $ */ 2 2 /* 3 3 * Header control … … 252 252 { 253 253 UINT uTextJustify; 254 WCHAR * pszText = phdi->pszText;254 WCHAR *pszText = phdi->pszText,*orgPtr; 255 255 256 256 if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_CENTER) … … 269 269 if (isUnicodeNotify(&infoPtr->header)) 270 270 { 271 nmhdr.pszText = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(WCHAR)); 271 orgPtr = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(WCHAR)); 272 nmhdr.pszText = orgPtr; 272 273 if (nmhdr.pszText) nmhdr.pszText[0] = 0; 273 274 } else 274 275 { 275 nmhdr.pszText = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(CHAR)); 276 orgPtr = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(CHAR)); 277 nmhdr.pszText = orgPtr; 276 278 if (nmhdr.pszText) ((LPSTR)nmhdr.pszText)[0] = 0; 277 279 } … … 291 293 lstrcpyW(phdi->pszText,pszText); 292 294 } else phdi->pszText = NULL; 293 COMCTL32_Free(pszText);295 if (pszText == orgPtr) COMCTL32_Free(pszText); 294 296 pszText = phdi->pszText; 295 297 } else … … 302 304 lstrcpyAtoW(pszText,(LPSTR)nmhdr.pszText); 303 305 } else pszText = NULL; 304 COMCTL32_Free(nmhdr.pszText); 305 306 if (nmhdr.mask & HDI_DI_SETITEM) 307 phdi->pszText = pszText; 306 if (nmhdr.pszText == orgPtr) COMCTL32_Free(nmhdr.pszText); 307 308 phdi->pszText = pszText; 308 309 } 309 310 } … … 329 330 } 330 331 } 331 if ( phdi->pszText == LPSTR_TEXTCALLBACKW) COMCTL32_Free(pszText);332 if ((phdi->pszText == LPSTR_TEXTCALLBACKW) && (pszText == orgPtr)) COMCTL32_Free(pszText); 332 333 } 333 334 … … 1642 1643 HEADER_SendItemClick(hwnd,infoPtr->iMoveItem,0); 1643 1644 } 1644 // TRACE (header, "Released item %d!\n", infoPtr->iMoveItem);1645 1645 infoPtr->bPressed = FALSE; 1646 1646 } else if (infoPtr->bTracking) 1647 1647 { 1648 // TRACE (header, "End tracking item %d!\n", infoPtr->iMoveItem);1649 1648 infoPtr->bTracking = FALSE; 1650 1649 … … 1666 1665 { 1667 1666 infoPtr->items[infoPtr->iMoveItem].cxy = nWidth; 1667 1668 HEADER_SetItemBounds (hwnd,infoPtr->iMoveItem); 1669 HEADER_Refresh(hwnd); 1668 1670 HEADER_SendItemChanged(hwnd,infoPtr->iMoveItem); 1669 1670 HEADER_SetItemBounds (hwnd,infoPtr->iMoveItem);1671 1672 HEADER_Refresh(hwnd);1673 1671 } 1674 1672 } … … 1816 1814 1817 1815 HEADER_SendTrack(hwnd,infoPtr->iMoveItem); 1818 // TRACE (header, "Tracking item %d!\n", infoPtr->iMoveItem);1819 1816 } 1820 1817 } -
trunk/src/comctl32/listview.cpp
r3154 r3182 1 /*$Id: listview.cpp,v 1. 3 2000-03-18 16:17:24cbratschi Exp $*/1 /*$Id: listview.cpp,v 1.4 2000-03-21 17:30:42 cbratschi Exp $*/ 2 2 /* 3 3 * Listview control … … 6 6 * Copyright 1999 Luc Tourangeau 7 7 * Copyright 1999 Achim Hasenmueller 8 * Copyright 1999 Christoph Bratschi8 * Copyright 1999-2000 Christoph Bratschi (cbratschi@datacomm.ch) 9 9 * 10 10 * NOTES … … 36 36 * LISTVIEW_Update : not completed 37 37 * WM_SETREDRAW not implemented 38 * 39 * the sort algorithm isn't stable (order of same items isn't fixed)!!! 38 40 */ 39 41 … … 107 109 */ 108 110 109 static INT LISTVIEW_HitTestItem(HWND, LPLVHITTESTINFO); 110 static INT LISTVIEW_GetCountPerRow(HWND); 111 static INT LISTVIEW_GetCountPerColumn(HWND); 112 static VOID LISTVIEW_AlignLeft(HWND); 113 static VOID LISTVIEW_AlignTop(HWND); 114 static VOID LISTVIEW_AddGroupSelection(HWND, INT); 115 static VOID LISTVIEW_AddSelection(HWND, INT); 116 static BOOL LISTVIEW_AddSubItem(HWND, LPLVITEMW,BOOL); 117 static INT LISTVIEW_FindInsertPosition(HDPA, INT); 118 static INT LISTVIEW_GetItemHeight(HWND); 119 static BOOL LISTVIEW_GetItemPosition(HWND, INT, LPPOINT); 111 static INT LISTVIEW_HitTestItem(HWND, LPLVHITTESTINFO); 112 static INT LISTVIEW_GetCountPerRow(HWND); 113 static INT LISTVIEW_GetCountPerColumn(HWND); 114 static VOID LISTVIEW_AlignLeft(HWND); 115 static VOID LISTVIEW_AlignTop(HWND); 116 static VOID LISTVIEW_AddGroupSelection(HWND, INT); 117 static VOID LISTVIEW_AddSelection(HWND, INT); 118 static BOOL LISTVIEW_AddSubItem(HWND, LPLVITEMW,BOOL); 119 static INT LISTVIEW_FindInsertPosition(HDPA, INT); 120 static INT LISTVIEW_GetItemHeight(HWND); 121 static BOOL LISTVIEW_GetItemPosition(HWND, INT, LPPOINT); 122 static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code); 120 123 static LRESULT LISTVIEW_GetItemRect(HWND, INT, LPRECT); 121 static INT LISTVIEW_GetItemWidth(HWND);122 static INT LISTVIEW_GetLabelWidth(HWND, INT);124 static INT LISTVIEW_GetItemWidth(HWND); 125 static INT LISTVIEW_GetLabelWidth(HWND, INT); 123 126 static LRESULT LISTVIEW_GetOrigin(HWND, LPPOINT); 124 static INT LISTVIEW_CalculateWidth(HWND hwnd, INT nItem);127 static INT LISTVIEW_CalculateWidth(HWND hwnd, INT nItem); 125 128 static LISTVIEW_SUBITEM* LISTVIEW_GetSubItem(HDPA, INT); 126 129 static LRESULT LISTVIEW_GetViewRect(HWND, LPRECT); 127 static BOOL LISTVIEW_InitItem(HWND, LISTVIEW_ITEM *, LPLVITEMW,BOOL);128 static BOOL LISTVIEW_InitSubItem(HWND,LISTVIEW_SUBITEM*,LPLVITEMW,BOOL);130 static BOOL LISTVIEW_InitItem(HWND, LISTVIEW_ITEM *, LPLVITEMW,BOOL); 131 static BOOL LISTVIEW_InitSubItem(HWND,LISTVIEW_SUBITEM*,LPLVITEMW,BOOL); 129 132 static LRESULT LISTVIEW_MouseSelection(HWND, POINT); 130 static BOOL LISTVIEW_RemoveColumn(HDPA, INT);131 static VOID LISTVIEW_RemoveSelections(HWND, INT, INT);132 static BOOL LISTVIEW_RemoveSubItem(HDPA, INT);133 static VOID LISTVIEW_SetGroupSelection(HWND, INT);134 static BOOLLISTVIEW_SetItem(HWND, LPLVITEMW,BOOL);135 static BOOL LISTVIEW_SetItemFocus(HWND, INT);136 static BOOL LISTVIEW_SetItemPosition(HWND, INT, INT, INT);137 static VOID LISTVIEW_UpdateScroll(HWND);138 static VOID LISTVIEW_SetSelection(HWND, INT);139 static VOID LISTVIEW_UpdateSize(HWND);140 static BOOL LISTVIEW_SetSubItem(HWND, LPLVITEMW,BOOL);133 static BOOL LISTVIEW_RemoveColumn(HDPA, INT); 134 static VOID LISTVIEW_RemoveSelections(HWND, INT, INT); 135 static BOOL LISTVIEW_RemoveSubItem(HDPA, INT); 136 static VOID LISTVIEW_SetGroupSelection(HWND, INT); 137 static LRESULT LISTVIEW_SetItem(HWND, LPLVITEMW,BOOL); 138 static BOOL LISTVIEW_SetItemFocus(HWND, INT); 139 static BOOL LISTVIEW_SetItemPosition(HWND, INT, INT, INT); 140 static VOID LISTVIEW_UpdateScroll(HWND); 141 static VOID LISTVIEW_SetSelection(HWND, INT); 142 static VOID LISTVIEW_UpdateSize(HWND); 143 static BOOL LISTVIEW_SetSubItem(HWND, LPLVITEMW,BOOL); 141 144 static LRESULT LISTVIEW_SetViewRect(HWND, LPRECT); 142 static BOOL LISTVIEW_ToggleSelection(HWND, INT);143 static VOID LISTVIEW_UnsupportedStyles(LONG lStyle);144 static HWND LISTVIEW_EditLabel(HWND hwnd,INT nItem,BOOL unicode);145 static BOOL LISTVIEW_EndEditLabel(HWND hwnd,LPSTR pszText,DWORD nItem);145 static BOOL LISTVIEW_ToggleSelection(HWND, INT); 146 static VOID LISTVIEW_UnsupportedStyles(LONG lStyle); 147 static HWND LISTVIEW_EditLabel(HWND hwnd,INT nItem,BOOL unicode); 148 static BOOL LISTVIEW_EndEditLabel(HWND hwnd,LPSTR pszText,DWORD nItem); 146 149 static LRESULT LISTVIEW_Command(HWND hwnd, WPARAM wParam, LPARAM lParam); 147 150 static LRESULT LISTVIEW_SortItems(HWND hwnd, WPARAM wParam, LPARAM lParam); 151 static LRESULT LISTVIEW_GetItem(HWND hwnd,LPLVITEMW lpLVItem,BOOL unicode,BOOL internal); 152 static INT LISTVIEW_GetTopIndex(HWND hwnd); 153 static LRESULT LISTVIEW_GetItemState(HWND hwnd, INT nItem, UINT uMask); 154 static LRESULT LISTVIEW_SetItemState(HWND hwnd,INT nItem,DWORD data,DWORD mask); 155 static BOOL LISTVIEW_SetItemPosition(HWND hwnd, INT nItem, INT nPosX, INT nPosY); 156 static LRESULT LISTVIEW_GetStringWidth(HWND hwnd,LPWSTR lpszText,BOOL unicode); 157 static BOOL LISTVIEW_EnsureVisible(HWND hwnd,INT nItem,BOOL bPartial); 158 159 static VOID LISTVIEW_Refresh(HWND hwnd) 160 { 161 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 162 DWORD dwStyle; 163 UINT uView; 164 165 if (infoPtr->refreshFlags & RF_REFRESH) return; 166 167 dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 168 uView = dwStyle & LVS_TYPEMASK; 169 170 if (uView == LVS_REPORT) 171 { 172 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 173 RECT rect,rect2; 174 175 GetClientRect(hwnd,&rect); 176 GetClientRect(infoPtr->hwndHeader,&rect2); 177 rect.top += rect2.bottom; 178 InvalidateRect(hwnd,&rect,TRUE); 179 } else InvalidateRect(hwnd,NULL,TRUE); 180 } 181 182 static VOID LISTVIEW_QueueRefresh(HWND hwnd) 183 { 184 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 185 186 if (infoPtr->refreshFlags & RF_REFRESH) 187 KillTimer (hwnd,LV_REFRESH_TIMER); 188 infoPtr->refreshFlags |= RF_REFRESH; 189 SetTimer(hwnd,LV_REFRESH_TIMER,LV_REFRESH_DELAY,0); 190 } 191 192 static LRESULT LISTVIEW_Timer(HWND hwnd,WPARAM wParam,LPARAM lParam) 193 { 194 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 195 196 switch (wParam) 197 { 198 case LV_REFRESH_TIMER: 199 KillTimer(hwnd,LV_REFRESH_TIMER); 200 if (infoPtr->refreshFlags & RF_UPDATESCROLL) 201 { 202 LISTVIEW_UpdateScroll(hwnd); 203 infoPtr->refreshFlags &= ~RF_UPDATESCROLL; 204 } 205 if (infoPtr->refreshFlags & RF_REFRESH) 206 { 207 infoPtr->refreshFlags &= ~RF_REFRESH; 208 LISTVIEW_Refresh(hwnd); 209 } 210 return 0; 211 } 212 213 return 1; 214 } 215 216 static VOID LISTVIEW_RefreshItem(HWND hwnd,INT nItem) 217 { 218 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 219 RECT rect; 220 221 if (infoPtr->refreshFlags & RF_REFRESH) return; 222 LISTVIEW_GetItemRect(hwnd,nItem,&rect,LVIR_SELECTBOUNDS); 223 InvalidateRect(hwnd,&rect,TRUE); 224 } 225 226 static VOID LISTVIEW_RefreshSubItem(HWND hwnd,INT nItem,INT nSubItem) 227 { 228 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 229 RECT rect; 230 231 //CB: todo 232 if (infoPtr->refreshFlags & RF_REFRESH) return; 233 LISTVIEW_GetItemRect(hwnd,nItem,&rect,LVIR_SELECTBOUNDS); 234 InvalidateRect(hwnd,&rect,TRUE); 235 } 236 237 static VOID LISTVIEW_ScrollWindow(HWND hwnd,INT xScroll,INT yScroll,UINT uView) 238 { 239 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 240 241 if (infoPtr->refreshFlags & RF_REFRESH) return; 242 243 if (uView == LVS_REPORT) 244 { 245 RECT rect,header; 246 247 //clip header 248 GetClientRect(hwnd,&rect); 249 GetClientRect(infoPtr->hwndHeader,&header); 250 if (yScroll < 0) 251 { 252 //up 253 rect.top += header.bottom-yScroll; 254 ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,0); 255 rect.top = rect.bottom+yScroll; 256 if (rect.top < header.bottom) rect.top = header.bottom; 257 InvalidateRect(hwnd,&rect,TRUE);//CB: still wrong pixels 258 } else if (yScroll > 0) 259 { //down 260 rect.top += header.bottom; 261 ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,SW_INVALIDATE); 262 } 263 if (yScroll == 0) 264 { 265 rect.top += header.bottom; 266 ScrollWindowEx(hwnd,xScroll,yScroll,&rect,NULL,0,NULL,SW_INVALIDATE); 267 } 268 } else ScrollWindowEx(hwnd,xScroll,yScroll,NULL,NULL,0,NULL,SW_INVALIDATE); 269 } 148 270 149 271 /************************************************************************* … … 163 285 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos) 164 286 { 165 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 287 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 166 288 RECT winRect; 167 289 POINT point[2]; … … 196 318 { 197 319 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 198 LONG lStyle = GetWindowLongA(hwnd,GWL_STYLE);199 UINT uView = lStyle & LVS_TYPEMASK;320 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 321 UINT uView = dwStyle & LVS_TYPEMASK; 200 322 INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; 201 323 INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left; 202 324 SCROLLINFO scrollInfo; 203 325 326 if (dwStyle & LVS_NOSCROLL) 327 { 328 ShowScrollBar(hwnd,SB_BOTH,FALSE); 329 return; 330 } 331 204 332 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 205 333 scrollInfo.cbSize = sizeof(SCROLLINFO); … … 208 336 { 209 337 /* update horizontal scrollbar */ 210 211 338 INT nCountPerColumn = LISTVIEW_GetCountPerColumn(hwnd); 212 339 INT nCountPerRow = LISTVIEW_GetCountPerRow(hwnd); 213 340 INT nNumOfItems = GETITEMCOUNT(infoPtr); 214 341 215 scrollInfo.nMax = nNumOfItems / nCountPerColumn; 216 if((nNumOfItems % nCountPerColumn) == 0) 217 { 218 scrollInfo.nMax--; 219 } 220 scrollInfo.nPos = ListView_GetTopIndex(hwnd) / nCountPerColumn; 221 scrollInfo.nPage = nCountPerRow; 342 infoPtr->maxScroll.x = nNumOfItems / nCountPerColumn+1; 343 if ((nNumOfItems % nCountPerColumn) == 0) 344 infoPtr->maxScroll.x--; 345 346 infoPtr->lefttop.x = LISTVIEW_GetTopIndex(hwnd) / nCountPerColumn; 347 infoPtr->scrollPage.x = nCountPerRow; 348 349 scrollInfo.nMin = 0; 350 scrollInfo.nMax = infoPtr->maxScroll.x-1; 351 scrollInfo.nPos = infoPtr->lefttop.x; 352 scrollInfo.nPage = infoPtr->scrollPage.x; 222 353 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 223 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 224 } 225 else if (uView == LVS_REPORT) 354 SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE); 355 } else if (uView == LVS_REPORT) 226 356 { 227 357 /* update vertical scrollbar */ 228 scrollInfo.nMin = 0; 229 scrollInfo.nMax = GETITEMCOUNT(infoPtr) - 1; 230 scrollInfo.nPos = ListView_GetTopIndex(hwnd); 231 scrollInfo.nPage = LISTVIEW_GetCountPerColumn(hwnd); 358 infoPtr->maxScroll.y = GETITEMCOUNT(infoPtr); 359 infoPtr->lefttop.y = LISTVIEW_GetTopIndex(hwnd); 360 infoPtr->scrollPage.y = LISTVIEW_GetCountPerColumn(hwnd); 361 362 scrollInfo.nMin = 0; 363 scrollInfo.nMax = infoPtr->maxScroll.y-1; 364 scrollInfo.nPos = infoPtr->lefttop.y; 365 scrollInfo.nPage = infoPtr->scrollPage.y; 232 366 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 233 SetScrollInfo(hwnd, SB_VERT, &scrollInfo,TRUE);367 SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE); 234 368 235 369 /* update horizontal scrollbar */ 236 370 nListWidth = infoPtr->rcList.right - infoPtr->rcList.left; 237 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE 238 || GETITEMCOUNT(infoPtr) == 0) 239 { 240 scrollInfo.nPos = 0; 241 } 242 scrollInfo.nMin = 0; 243 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE ; 244 scrollInfo.nPage = nListWidth / LISTVIEW_SCROLL_DIV_SIZE; 245 scrollInfo.nMax = max(infoPtr->nItemWidth / LISTVIEW_SCROLL_DIV_SIZE, 0)-1; 246 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 371 if (!(dwStyle & WS_HSCROLL) || !GETITEMCOUNT(infoPtr)) 372 infoPtr->lefttop.x = 0; 373 374 infoPtr->scrollPage.x = nListWidth / LISTVIEW_SCROLL_DIV_SIZE; 375 infoPtr->maxScroll.x = max(infoPtr->nItemWidth / LISTVIEW_SCROLL_DIV_SIZE, 0); 376 377 scrollInfo.nMin = 0; 378 scrollInfo.nMax = infoPtr->maxScroll.x-1; 379 scrollInfo.nPos = infoPtr->lefttop.x; 380 scrollInfo.nPage = infoPtr->scrollPage.x; 381 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 382 SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE); 247 383 248 384 /* Update the Header Control */ 249 scrollInfo.fMask = SIF_POS; 250 GetScrollInfo(hwnd, SB_HORZ, &scrollInfo); 251 LISTVIEW_UpdateHeaderSize(hwnd, scrollInfo.nPos); 252 253 } 254 else 385 LISTVIEW_UpdateHeaderSize(hwnd,infoPtr->lefttop.x); 386 } else 255 387 { 256 388 RECT rcView; 257 389 258 if (LISTVIEW_GetViewRect(hwnd, &rcView) != FALSE)390 if (LISTVIEW_GetViewRect(hwnd,&rcView)) 259 391 { 260 392 INT nViewWidth = rcView.right - rcView.left; … … 262 394 263 395 /* Update Horizontal Scrollbar */ 264 scrollInfo.fMask = SIF_POS;265 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE266 || GETITEMCOUNT(infoPtr) == 0)267 {268 scrollInfo.nPos = 0; 269 }270 scrollInfo.nMax = max(nViewWidth / LISTVIEW_SCROLL_DIV_SIZE, 0)-1;271 scrollInfo.n Min = 0;272 scrollInfo.nPage = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;396 if (!(dwStyle & WS_HSCROLL) || !GETITEMCOUNT(infoPtr)) 397 infoPtr->lefttop.x = 0; 398 infoPtr->maxScroll.x = max(nViewWidth / LISTVIEW_SCROLL_DIV_SIZE, 0); 399 infoPtr->scrollPage.x = nListWidth / LISTVIEW_SCROLL_DIV_SIZE; 400 401 scrollInfo.nMin = 0; 402 scrollInfo.nMax = infoPtr->maxScroll.x-1; 403 scrollInfo.nPos = infoPtr->lefttop.x; 404 scrollInfo.nPage = infoPtr->scrollPage.x; 273 405 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 274 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo,TRUE);406 SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE); 275 407 276 408 /* Update Vertical Scrollbar */ 277 409 nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top; 278 scrollInfo.fMask = SIF_POS;279 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) == FALSE280 || GETITEMCOUNT(infoPtr) == 0)281 {282 scrollInfo.nPos = 0; 283 }284 scrollInfo.nMax = max(nViewHeight / LISTVIEW_SCROLL_DIV_SIZE,0)-1;285 scrollInfo.n Min = 0;286 scrollInfo.nPage = nListHeight / LISTVIEW_SCROLL_DIV_SIZE;410 if (!(dwStyle & WS_VSCROLL) || !GETITEMCOUNT(infoPtr)) 411 infoPtr->lefttop.x = 0; 412 infoPtr->maxScroll.y = max(nViewHeight / LISTVIEW_SCROLL_DIV_SIZE,0); 413 infoPtr->scrollPage.y = nListHeight / LISTVIEW_SCROLL_DIV_SIZE; 414 415 scrollInfo.nMin = 0; 416 scrollInfo.nMax = infoPtr->maxScroll.y-1; 417 scrollInfo.nPos = infoPtr->lefttop.y; 418 scrollInfo.nPage = infoPtr->scrollPage.y; 287 419 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 288 SetScrollInfo(hwnd, SB_VERT, &scrollInfo,TRUE);420 SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE); 289 421 } 290 422 } … … 312 444 { 313 445 //FIXME(" LVS_NOLABELWRAP\n"); 314 }315 316 if ((LVS_TYPEMASK & lStyle) == LVS_NOSCROLL)317 {318 //FIXME(" LVS_NOSCROLL\n");319 446 } 320 447 … … 374 501 } 375 502 376 L istView_SetItemPosition(hwnd, i, ptItem.x, ptItem.y);503 LISTVIEW_SetItemPosition(hwnd, i, ptItem.x, ptItem.y); 377 504 ptItem.x += infoPtr->nItemWidth; 378 505 rcView.right = max(rcView.right, ptItem.x); … … 385 512 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) 386 513 { 387 L istView_SetItemPosition(hwnd, i, ptItem.x, ptItem.y);514 LISTVIEW_SetItemPosition(hwnd, i, ptItem.x, ptItem.y); 388 515 ptItem.y += infoPtr->nItemHeight; 389 516 } … … 431 558 } 432 559 433 L istView_SetItemPosition(hwnd, i, ptItem.x, ptItem.y);560 LISTVIEW_SetItemPosition(hwnd, i, ptItem.x, ptItem.y); 434 561 ptItem.y += infoPtr->nItemHeight; 435 562 rcView.bottom = max(rcView.bottom, ptItem.y); … … 442 569 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) 443 570 { 444 L istView_SetItemPosition(hwnd, i, ptItem.x, ptItem.y);571 LISTVIEW_SetItemPosition(hwnd, i, ptItem.x, ptItem.y); 445 572 ptItem.x += infoPtr->nItemWidth; 446 573 } … … 772 899 for (i = nFirst; i <= nLast; i++) 773 900 { 774 L istView_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED);901 LISTVIEW_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 775 902 } 776 903 … … 794 921 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 795 922 796 L istView_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED);923 LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED); 797 924 798 925 LISTVIEW_SetItemFocus(hwnd, nItem); … … 817 944 BOOL bResult; 818 945 819 if (L istView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED)820 { 821 L istView_SetItemState(hwnd,nItem,0,LVIS_SELECTED);946 if (LISTVIEW_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) 947 { 948 LISTVIEW_SetItemState(hwnd,nItem,0,LVIS_SELECTED); 822 949 bResult = FALSE; 823 950 } 824 951 else 825 952 { 826 L istView_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED);953 LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED,LVIS_SELECTED); 827 954 bResult = TRUE; 828 955 } … … 856 983 if (PtInRect(&rcSelRect, ptItem) != FALSE) 857 984 { 858 L istView_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED);985 LISTVIEW_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 859 986 } 860 987 else 861 988 { 862 L istView_SetItemState(hwnd,i,0,LVIS_SELECTED);989 LISTVIEW_SetItemState(hwnd,i,0,LVIS_SELECTED); 863 990 } 864 991 } … … 891 1018 if ((i < nFirst) || (i > nLast)) 892 1019 { 893 L istView_SetItemState(hwnd,i,0,LVIS_SELECTED);1020 LISTVIEW_SetItemState(hwnd,i,0,LVIS_SELECTED); 894 1021 } 895 1022 else 896 1023 { 897 L istView_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED);1024 LISTVIEW_SetItemState(hwnd,i,LVIS_SELECTED,LVIS_SELECTED); 898 1025 } 899 1026 } … … 937 1064 bResult = TRUE; 938 1065 939 L istView_SetItemState(hwnd,infoPtr->nFocusedItem,0,LVIS_FOCUSED);940 L istView_SetItemState(hwnd,nItem,LVIS_FOCUSED,LVIS_FOCUSED);1066 LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,LVIS_FOCUSED); 1067 LISTVIEW_SetItemState(hwnd,nItem,LVIS_FOCUSED,LVIS_FOCUSED); 941 1068 942 1069 infoPtr->nFocusedItem = nItem; 943 L istView_EnsureVisible(hwnd, nItem, FALSE);1070 LISTVIEW_EnsureVisible(hwnd, nItem, FALSE); 944 1071 } 945 1072 … … 972 1099 } 973 1100 974 L istView_SetItemState(hwnd,infoPtr->nFocusedItem,0,LVIS_FOCUSED);975 L istView_SetItemState(hwnd,nItem,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED);1101 LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,LVIS_FOCUSED); 1102 LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED); 976 1103 977 1104 infoPtr->nFocusedItem = nItem; … … 991 1118 * FAILURE : FALSE (nothing has changed) 992 1119 */ 993 static BOOLLISTVIEW_KeySelection(HWND hwnd, INT nItem)1120 static VOID LISTVIEW_KeySelection(HWND hwnd, INT nItem) 994 1121 { 995 1122 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); … … 997 1124 WORD wShift = HIWORD(GetKeyState(VK_SHIFT)); 998 1125 WORD wCtrl = HIWORD(GetKeyState(VK_CONTROL)); 999 BOOL bResult = FALSE;1000 1126 1001 1127 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr))) … … 1003 1129 if (lStyle & LVS_SINGLESEL) 1004 1130 { 1005 bResult = TRUE;1006 1131 LISTVIEW_SetSelection(hwnd, nItem); 1007 L istView_EnsureVisible(hwnd, nItem, FALSE);1132 LISTVIEW_EnsureVisible(hwnd, nItem, FALSE); 1008 1133 } 1009 1134 else … … 1011 1136 if (wShift) 1012 1137 { 1013 bResult = TRUE;1014 1138 LISTVIEW_SetGroupSelection(hwnd, nItem); 1015 1139 } 1016 1140 else if (wCtrl) 1017 1141 { 1018 bResult =LISTVIEW_SetItemFocus(hwnd, nItem);1142 LISTVIEW_SetItemFocus(hwnd, nItem); 1019 1143 } 1020 1144 else 1021 1145 { 1022 bResult = TRUE;1023 1146 LISTVIEW_SetSelection(hwnd, nItem); 1024 ListView_EnsureVisible(hwnd, nItem, FALSE); 1025 } 1026 } 1027 } 1028 1029 return bResult; 1147 LISTVIEW_EnsureVisible(hwnd, nItem, FALSE); 1148 } 1149 } 1150 } 1030 1151 } 1031 1152 … … 1081 1202 for (i = nFirst; i <= nLast; i++) 1082 1203 { 1083 L istView_SetItemState(hwnd,i,0,LVIS_SELECTED);1204 LISTVIEW_SetItemState(hwnd,i,0,LVIS_SELECTED); 1084 1205 } 1085 1206 } … … 1291 1412 uChanged |= LVIF_TEXT; 1292 1413 } 1293 FreeAsciiString((LPSTR)textW);1414 HeapFree(GetProcessHeap(),0,textW); 1294 1415 } 1295 1416 else … … 1450 1571 { 1451 1572 bResult = TRUE; 1452 ZeroMemory(lpSubItem, 1573 ZeroMemory(lpSubItem,sizeof(LISTVIEW_SUBITEM)); 1453 1574 1454 1575 lpSubItem->iSubItem = lpLVItem->iSubItem; 1455 1576 1456 1577 if (lpLVItem->mask & LVIF_IMAGE) 1457 {1458 1578 lpSubItem->iImage = lpLVItem->iImage; 1459 }1460 1579 1461 1580 if (lpLVItem->mask & LVIF_TEXT) … … 1466 1585 { 1467 1586 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 1468 {1469 1587 return FALSE; 1470 } 1471 1472 if ((lpSubItem->pszText != NULL) && 1473 (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 1474 { 1588 1589 if ((lpSubItem->pszText != NULL) && (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 1475 1590 COMCTL32_Free(lpSubItem->pszText); 1476 }1477 1591 1478 1592 lpSubItem->pszText = LPSTR_TEXTCALLBACKW; 1479 } 1480 else 1593 } else 1481 1594 { 1482 1595 if (lpSubItem->pszText == LPSTR_TEXTCALLBACKW) 1483 {1484 1596 lpSubItem->pszText = NULL; 1485 } 1486 1487 bResult = Str_SetPtrW(&lpSubItem->pszText, lpLVItem->pszText); 1597 1598 bResult = Str_SetPtrW(&lpSubItem->pszText,lpLVItem->pszText); 1488 1599 } 1489 1600 } else //!unicode … … 1492 1603 { 1493 1604 if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING)) 1494 {1495 1605 return FALSE; 1496 } 1497 1498 if ((lpSubItem->pszText != NULL) && 1499 (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 1500 { 1606 1607 if ((lpSubItem->pszText != NULL) && (lpSubItem->pszText != LPSTR_TEXTCALLBACKW)) 1501 1608 COMCTL32_Free(lpSubItem->pszText); 1502 }1503 1609 1504 1610 lpSubItem->pszText = LPSTR_TEXTCALLBACKW; 1505 } 1506 else 1611 } else 1507 1612 { 1508 1613 INT len; 1509 1614 1510 1615 if (lpSubItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpSubItem->pszText); 1511 len = (lpLVItem->pszText != NULL)? lstrlenA((LPSTR)lpLVItem->pszText):0;1616 len = lpLVItem->pszText ? lstrlenA((LPSTR)lpLVItem->pszText):0; 1512 1617 1513 1618 if (len > 0) … … 1649 1754 /*** 1650 1755 * DESCRIPTION: 1651 * Sets item attributes. 1652 * 1653 * PARAMETER(S): 1654 * [I] HWND : window handle 1655 * [I] LPLVITEM : new item atttributes 1656 * 1657 * RETURN: 1658 * SUCCESS : TRUE 1659 * FAILURE : FALSE 1660 */ 1661 static BOOL LISTVIEW_SetItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode) 1756 * Retrieves the index of the item at coordinate (0, 0) of the client area. 1757 * 1758 * PARAMETER(S): 1759 * [I] HWND : window handle 1760 * 1761 * RETURN: 1762 * item index 1763 */ 1764 static INT LISTVIEW_GetTopIndex(HWND hwnd) 1662 1765 { 1663 1766 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1664 BOOL bResult = FALSE; 1665 HDPA hdpaSubItems; 1666 LISTVIEW_ITEM *lpItem; 1667 NMLISTVIEW nmlv; 1668 UINT uChanged; 1669 LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); 1670 1671 if (lpLVItem != NULL) 1672 { 1673 if (lpLVItem->iSubItem == 0) 1674 { 1675 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); 1676 if (hdpaSubItems != NULL) 1677 { 1678 lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, lpLVItem->iSubItem); 1679 if (lpItem != NULL) 1680 { 1681 ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); 1682 nmlv.lParam = lpItem->lParam; 1683 uChanged = LISTVIEW_GetItemChanges(lpItem, lpLVItem,unicode); 1684 if (uChanged != 0) 1685 { 1686 if (uChanged & LVIF_STATE) 1687 { 1688 nmlv.uNewState = lpLVItem->state & lpLVItem->stateMask; 1689 nmlv.uOldState = lpItem->state & lpLVItem->stateMask; 1690 } 1691 1692 nmlv.uChanged = uChanged; 1693 nmlv.iItem = lpLVItem->iItem; 1694 nmlv.lParam = lpItem->lParam; 1695 /* send LVN_ITEMCHANGING notification */ 1696 sendNotify(hwnd,LVN_ITEMCHANGING,&nmlv.hdr); 1697 1698 /* copy information */ 1699 bResult = LISTVIEW_InitItem(hwnd, lpItem, lpLVItem,unicode); 1700 1701 /* send LVN_ITEMCHANGED notification */ 1702 sendNotify(hwnd,LVN_ITEMCHANGED,&nmlv.hdr); 1703 } 1704 else 1705 { 1706 bResult = TRUE; 1707 } 1708 1709 InvalidateRect(hwnd, NULL, TRUE); 1710 } 1711 } 1712 } 1713 } 1714 1715 return bResult; 1716 } 1717 1718 /*** 1719 * DESCRIPTION: 1720 * Sets subitem attributes. 1721 * 1722 * PARAMETER(S): 1723 * [I] HWND : window handle 1724 * [I] LPLVITEM : new subitem atttributes 1725 * 1726 * RETURN: 1727 * SUCCESS : TRUE 1728 * FAILURE : FALSE 1729 */ 1730 static BOOL LISTVIEW_SetSubItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode) 1731 { 1732 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1733 BOOL bResult = FALSE; 1734 HDPA hdpaSubItems; 1735 LISTVIEW_SUBITEM *lpSubItem; 1736 1737 if (lpLVItem != NULL) 1738 { 1739 if (lpLVItem->iSubItem > 0) 1740 { 1741 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); 1742 if (hdpaSubItems != NULL) 1743 { 1744 /* set subitem only if column is present */ 1745 if (Header_GetItemCount(infoPtr->hwndHeader) > lpLVItem->iSubItem) 1746 { 1747 lpSubItem = LISTVIEW_GetSubItem(hdpaSubItems, lpLVItem->iSubItem); 1748 if (lpSubItem != NULL) 1749 { 1750 bResult = LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem,unicode); 1751 } 1752 else 1753 { 1754 bResult = LISTVIEW_AddSubItem(hwnd, lpLVItem,unicode); 1755 } 1756 1757 InvalidateRect(hwnd, NULL, TRUE); 1758 } 1759 } 1760 } 1761 } 1762 1763 return bResult; 1764 } 1765 1766 /*** 1767 * DESCRIPTION: 1768 * Retrieves the index of the item at coordinate (0, 0) of the client area. 1769 * 1770 * PARAMETER(S): 1771 * [I] HWND : window handle 1772 * 1773 * RETURN: 1774 * item index 1775 */ 1776 static INT LISTVIEW_GetTopIndex(HWND hwnd) 1777 { 1778 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 1779 UINT uView = lStyle & LVS_TYPEMASK; 1767 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 1768 UINT uView = dwStyle & LVS_TYPEMASK; 1780 1769 INT nItem = 0; 1781 SCROLLINFO scrollInfo;1782 1783 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO));1784 scrollInfo.cbSize = sizeof(SCROLLINFO);1785 scrollInfo.fMask = SIF_POS;1786 1770 1787 1771 if (uView == LVS_LIST) 1788 1772 { 1789 if (lStyle & WS_HSCROLL) 1790 { 1791 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 1792 { 1793 nItem = scrollInfo.nPos * LISTVIEW_GetCountPerColumn(hwnd); 1794 } 1795 } 1796 } 1797 else if (uView == LVS_REPORT) 1798 { 1799 if (lStyle & WS_VSCROLL) 1800 { 1801 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE) 1802 { 1803 nItem = scrollInfo.nPos; 1804 } 1805 } 1773 if (dwStyle & WS_HSCROLL) 1774 nItem = infoPtr->lefttop.x*LISTVIEW_GetCountPerColumn(hwnd); 1775 } else if (uView == LVS_REPORT) 1776 { 1777 if (dwStyle & WS_VSCROLL) 1778 nItem = infoPtr->lefttop.y; 1806 1779 } 1807 1780 … … 1823 1796 * None 1824 1797 */ 1825 static VOID LISTVIEW_DrawSubItem(HWND hwnd, HDC hdc, INT nItem, INT nSubItem, 1826 RECT rcItem) 1827 { 1828 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1829 WCHAR szDispText[DISP_TEXT_SIZE]; 1830 LVITEMW lvItem; 1831 1832 // TRACE("(hwnd=%x, hdc=%x, nItem=%d, nSubItem=%d\n", hwnd, hdc, 1833 // nItem, nSubItem); 1798 static VOID LISTVIEW_DrawSubItem(HWND hwnd,HDC hdc,INT nItem,INT nSubItem,RECT rcItem) 1799 { 1800 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 1801 LVINTERNALITEMW lvItem; 1834 1802 1835 1803 /* get information needed for drawing the item */ 1836 1804 ZeroMemory(&lvItem, sizeof(LVITEMW)); 1837 lvItem.mask = LVIF_TEXT; 1838 lvItem.iItem = nItem; 1839 lvItem.iSubItem = nSubItem; 1840 lvItem.cchTextMax = DISP_TEXT_SIZE; 1841 lvItem.pszText = szDispText; 1842 ListView_GetItemW(hwnd,&lvItem); 1805 lvItem.header.mask = LVIF_TEXT; 1806 lvItem.header.iItem = nItem; 1807 lvItem.header.iSubItem = nSubItem; 1808 lvItem.header.cchTextMax = DISP_TEXT_SIZE; 1809 lvItem.header.pszText = NULL; 1810 lvItem.mustFree = FALSE; 1811 LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE); 1843 1812 1844 1813 /* set item colors */ … … 1846 1815 SetTextColor(hdc, infoPtr->clrText); 1847 1816 1848 ExtTextOutW(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1849 &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL); 1817 if (lvItem.unicode) 1818 ExtTextOutW(hdc,rcItem.left,rcItem.top,ETO_OPAQUE | ETO_CLIPPED,&rcItem,lvItem.header.pszText,lstrlenW(lvItem.header.pszText),NULL); 1819 else 1820 ExtTextOutA(hdc,rcItem.left,rcItem.top,ETO_OPAQUE | ETO_CLIPPED,&rcItem,(LPSTR)lvItem.header.pszText,lstrlenA((LPSTR)lvItem.header.pszText),NULL); 1821 1822 if (lvItem.mustFree) COMCTL32_Free(lvItem.header.pszText); 1850 1823 } 1851 1824 … … 1864 1837 * None 1865 1838 */ 1866 static VOID LISTVIEW_DrawItem(HWND hwnd, HDC hdc, INT nItem,RECT rcItem)1839 static VOID LISTVIEW_DrawItem(HWND hwnd,HDC hdc,INT nItem,RECT rcItem) 1867 1840 { 1868 1841 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 1869 WCHAR szDispText[DISP_TEXT_SIZE];1870 1842 INT nLabelWidth; 1871 LVI TEMW lvItem;1843 LVINTERNALITEMW lvItem; 1872 1844 INT nMixMode; 1873 1845 DWORD dwBkColor; 1874 1846 DWORD dwTextColor; 1875 1847 1876 // TRACE("(hwnd=%x, hdc=%x, nItem=%d\n", hwnd, hdc, nItem);1877 1878 1848 /* get information needed for drawing the item */ 1879 1849 ZeroMemory(&lvItem, sizeof(LVITEMW)); 1880 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_INDENT; 1881 lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED | LVIS_STATEIMAGEMASK; 1882 lvItem.iItem = nItem; 1883 lvItem.iSubItem = 0; 1884 lvItem.cchTextMax = DISP_TEXT_SIZE; 1885 lvItem.pszText = szDispText; 1886 ListView_GetItemW(hwnd,&lvItem); 1850 lvItem.header.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_INDENT; 1851 lvItem.header.stateMask = LVIS_SELECTED | LVIS_FOCUSED | LVIS_STATEIMAGEMASK; 1852 lvItem.header.iItem = nItem; 1853 lvItem.header.iSubItem = 0; 1854 lvItem.header.cchTextMax = DISP_TEXT_SIZE; 1855 lvItem.header.pszText = NULL; 1856 lvItem.mustFree = FALSE; 1857 LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE); 1887 1858 1888 1859 /* state icons */ 1889 1860 if (infoPtr->himlState != NULL) 1890 1861 { 1891 UINT uStateImage = (lvItem. state & LVIS_STATEIMAGEMASK) >> 12;1862 UINT uStateImage = (lvItem.header.state & LVIS_STATEIMAGEMASK) >> 12; 1892 1863 if (uStateImage != 0) 1893 1864 { … … 1902 1873 if (infoPtr->himlSmall != NULL) 1903 1874 { 1904 if (lvItem. state & LVIS_SELECTED)1875 if (lvItem.header.state & LVIS_SELECTED) 1905 1876 { 1906 1877 ImageList_SetBkColor(infoPtr->himlSmall, CLR_NONE); 1907 ImageList_Draw(infoPtr->himlSmall, lvItem. iImage, hdc, rcItem.left,1878 ImageList_Draw(infoPtr->himlSmall, lvItem.header.iImage, hdc, rcItem.left, 1908 1879 rcItem.top, ILD_SELECTED); 1909 1880 } … … 1911 1882 { 1912 1883 ImageList_SetBkColor(infoPtr->himlSmall, CLR_NONE); 1913 ImageList_Draw(infoPtr->himlSmall, lvItem. iImage, hdc, rcItem.left,1884 ImageList_Draw(infoPtr->himlSmall, lvItem.header.iImage, hdc, rcItem.left, 1914 1885 rcItem.top, ILD_NORMAL); 1915 1886 } … … 1919 1890 1920 1891 /* Don't bother painting item being edited */ 1921 if (infoPtr->hwndEdit && lvItem.state & LVIS_FOCUSED) 1922 return; 1923 1924 if ((lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus != FALSE)) 1892 if (infoPtr->hwndEdit && (lvItem.header.state & LVIS_FOCUSED)) 1893 { 1894 if (lvItem.mustFree) COMCTL32_Free(lvItem.header.pszText); 1895 return; 1896 } 1897 1898 if ((lvItem.header.state & LVIS_SELECTED) && infoPtr->bFocus) 1925 1899 { 1926 1900 /* set item colors */ … … 1931 1905 } 1932 1906 else if ((GetWindowLongA(hwnd, GWL_STYLE) & LVS_SHOWSELALWAYS) && 1933 (lvItem. state & LVIS_SELECTED) && (infoPtr->bFocus == FALSE))1907 (lvItem.header.state & LVIS_SELECTED) && !infoPtr->bFocus) 1934 1908 { 1935 1909 dwBkColor = SetBkColor(hdc, GetSysColor(COLOR_3DFACE)); … … 1947 1921 } 1948 1922 1949 nLabelWidth = L istView_GetStringWidthW(hwnd, lvItem.pszText);1923 nLabelWidth = LISTVIEW_GetStringWidth(hwnd,lvItem.header.pszText,lvItem.unicode); 1950 1924 if (rcItem.left + nLabelWidth < rcItem.right) 1951 1925 rcItem.right = rcItem.left + nLabelWidth; 1952 1926 1953 1927 /* draw label */ 1954 ExtTextOutW(hdc, rcItem.left, rcItem.top, ETO_OPAQUE | ETO_CLIPPED, 1955 &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL); 1956 1957 if ((lvItem.state & LVIS_FOCUSED) && (infoPtr->bFocus == TRUE)) 1928 if (lvItem.unicode) 1929 ExtTextOutW(hdc,rcItem.left,rcItem.top,ETO_OPAQUE | ETO_CLIPPED,&rcItem,lvItem.header.pszText,lstrlenW(lvItem.header.pszText),NULL); 1930 else 1931 ExtTextOutA(hdc,rcItem.left,rcItem.top,ETO_OPAQUE | ETO_CLIPPED,&rcItem,(LPSTR)lvItem.header.pszText,lstrlenA((LPSTR)lvItem.header.pszText),NULL); 1932 1933 if ((lvItem.header.state & LVIS_FOCUSED) && infoPtr->bFocus) 1958 1934 { 1959 1935 Rectangle(hdc, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom); … … 1966 1942 SetTextColor(hdc, infoPtr->clrText); 1967 1943 } 1944 if (lvItem.mustFree) COMCTL32_Free(lvItem.header.pszText); 1968 1945 } 1969 1946 … … 2003 1980 lvItem.cchTextMax = DISP_TEXT_SIZE; 2004 1981 lvItem.pszText = szDispText; 2005 L istView_GetItemW(hwnd, &lvItem);1982 LISTVIEW_GetItem(hwnd,&lvItem,TRUE,FALSE);//CB:todo 2006 1983 2007 1984 if (lvItem.state & LVIS_SELECTED) … … 2043 2020 2044 2021 rcItem.top += infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; 2045 nLabelWidth = L istView_GetStringWidthW(hwnd, lvItem.pszText);2022 nLabelWidth = LISTVIEW_GetStringWidth(hwnd,lvItem.pszText,TRUE); 2046 2023 nDrawPosX = infoPtr->iconSpacing.cx - nLabelWidth; 2047 2024 if (nDrawPosX > 1) … … 2079 2056 * None 2080 2057 */ 2081 static VOID LISTVIEW_DrawReport(HWND hwnd, HDC hdc)2058 static VOID LISTVIEW_DrawReport(HWND hwnd,HDC hdc,RECT *updateRect) 2082 2059 { 2083 2060 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2084 SCROLLINFO scrollInfo;2061 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 2085 2062 INT nDrawPosY = infoPtr->rcList.top; 2086 2063 INT nColumnCount; 2087 RECT rcItem ;2064 RECT rcItem,rcClient; 2088 2065 INT j; 2089 2066 INT nItem; 2090 2067 INT nLast; 2091 2068 2092 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 2093 scrollInfo.cbSize = sizeof(SCROLLINFO); 2094 scrollInfo.fMask = SIF_POS; 2095 2096 nItem = ListView_GetTopIndex(hwnd); 2069 nItem = LISTVIEW_GetTopIndex(hwnd); 2097 2070 2098 2071 /* add 1 for displaying a partial item at the bottom */ … … 2101 2074 2102 2075 /* send cache hint notification */ 2103 if ( GetWindowLongA(hwnd,GWL_STYLE)& LVS_OWNERDATA)2076 if (dwStyle & LVS_OWNERDATA) 2104 2077 { 2105 2078 NMLVCACHEHINT nmlv; … … 2110 2083 sendNotify(hwnd,LVN_ODCACHEHINT,&nmlv.hdr); 2111 2084 } 2085 2086 GetClientRect(hwnd,&rcClient); 2112 2087 2113 2088 for (; nItem < nLast; nItem++) … … 2122 2097 rcItem.bottom = rcItem.top + infoPtr->nItemHeight; 2123 2098 2099 if (rcItem.top >= rcClient.bottom) return; 2100 2124 2101 /* Offset the Scroll Bar Pos */ 2125 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 2126 { 2127 rcItem.left -= (scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE); 2128 rcItem.right -= (scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE); 2129 } 2130 2131 if (j == 0) 2132 { 2133 LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem); 2134 } 2135 else 2136 { 2137 LISTVIEW_DrawSubItem(hwnd, hdc, nItem, j, rcItem); 2102 if (dwStyle & WS_HSCROLL) 2103 { 2104 rcItem.left -= (infoPtr->lefttop.x * LISTVIEW_SCROLL_DIV_SIZE); 2105 rcItem.right -= (infoPtr->lefttop.x * LISTVIEW_SCROLL_DIV_SIZE); 2106 } 2107 2108 if (!updateRect || IntersectRect(NULL,&rcItem,updateRect)) 2109 { 2110 if (j == 0) 2111 LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem); 2112 else 2113 LISTVIEW_DrawSubItem(hwnd, hdc, nItem, j, rcItem); 2138 2114 } 2139 2115 } … … 2252 2228 * None 2253 2229 */ 2254 static VOID LISTVIEW_DrawList(HWND hwnd, HDC hdc)2230 static VOID LISTVIEW_DrawList(HWND hwnd,HDC hdc,RECT *updateRect) 2255 2231 { 2256 2232 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); … … 2266 2242 nColumnCount = LISTVIEW_GetColumnCount(hwnd); 2267 2243 nCountPerColumn = LISTVIEW_GetCountPerColumn(hwnd); 2268 nItem = L istView_GetTopIndex(hwnd);2244 nItem = LISTVIEW_GetTopIndex(hwnd); 2269 2245 2270 2246 for (i = 0; i < nColumnCount; i++) … … 2295 2271 * None 2296 2272 */ 2297 static VOID LISTVIEW_DrawIcon(HWND hwnd, HDC hdc, BOOL bSmall)2273 static VOID LISTVIEW_DrawIcon(HWND hwnd,HDC hdc,BOOL bSmall,RECT *updateRect) 2298 2274 { 2299 2275 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); … … 2348 2324 * NoneX 2349 2325 */ 2350 static VOID LISTVIEW_Draw(HWND hwnd, HDC hdc)2326 static VOID LISTVIEW_Draw(HWND hwnd,HDC hdc,RECT *updateRect) 2351 2327 { 2352 2328 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); … … 2367 2343 if (uView == LVS_LIST) 2368 2344 { 2369 LISTVIEW_DrawList(hwnd, hdc);2345 LISTVIEW_DrawList(hwnd,hdc,updateRect); 2370 2346 } 2371 2347 else if (uView == LVS_REPORT) 2372 2348 { 2373 LISTVIEW_DrawReport(hwnd, hdc);2349 LISTVIEW_DrawReport(hwnd,hdc,updateRect); 2374 2350 } 2375 2351 else if (uView == LVS_SMALLICON) 2376 2352 { 2377 LISTVIEW_DrawIcon(hwnd, hdc, TRUE);2353 LISTVIEW_DrawIcon(hwnd,hdc,TRUE,updateRect); 2378 2354 } 2379 2355 else if (uView == LVS_ICON) 2380 2356 { 2381 LISTVIEW_DrawIcon(hwnd, hdc, FALSE);2357 LISTVIEW_DrawIcon(hwnd,hdc,FALSE,updateRect); 2382 2358 } 2383 2359 … … 2622 2598 2623 2599 /* invalidate client area (optimization needed) */ 2624 InvalidateRect(hwnd, NULL, TRUE);2600 LISTVIEW_Refresh(hwnd); 2625 2601 } 2626 2602 … … 2660 2636 2661 2637 /* refresh client area */ 2662 InvalidateRect(hwnd, NULL, TRUE);2638 LISTVIEW_Refresh(hwnd); 2663 2639 } 2664 2640 } … … 2763 2739 infoPtr->nFocusedItem = -1; 2764 2740 2765 LISTVIEW_UpdateScroll(hwnd);2766 2767 2741 /* refresh client area */ 2768 InvalidateRect(hwnd, NULL, TRUE); 2742 infoPtr->refreshFlags |= RF_UPDATESCROLL; 2743 LISTVIEW_QueueRefresh(hwnd); 2769 2744 } 2770 2745 … … 2858 2833 } 2859 2834 2860 if (textW) COMCTL32_Free(textW);2835 if (textW) HeapFree(GetProcessHeap(),0,textW); 2861 2836 2862 2837 return TRUE; … … 2889 2864 WCHAR* textW = NULL; 2890 2865 2891 2892 if (~GetWindowLongA(hwnd, GWL_STYLE) & LVS_EDITLABELS) 2893 return FALSE; 2866 if (!(GetWindowLongA(hwnd, GWL_STYLE) & LVS_EDITLABELS)) 2867 return FALSE; 2894 2868 2895 2869 /* Is the EditBox still there, if so remove it */ 2896 if(infoPtr->hwndEdit != 0) 2897 { 2898 SetFocus(hwnd); 2899 } 2900 2901 LISTVIEW_SetSelection(hwnd, nItem); 2902 LISTVIEW_SetItemFocus(hwnd, nItem); 2870 if (infoPtr->hwndEdit) 2871 SetFocus(hwnd); 2872 2873 LISTVIEW_SetSelection(hwnd,nItem); 2874 LISTVIEW_SetItemFocus(hwnd,nItem); 2903 2875 2904 2876 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); 2905 2877 if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem))) 2906 2878 return 0; 2907 2879 2908 2880 if (NULL == (lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0))) 2909 2881 return 0; 2910 2882 2911 2883 /* get information needed for drawing the item */ … … 2919 2891 textW = (WCHAR*)COMCTL32_Alloc(DISP_TEXT_SIZE*sizeof(WCHAR)); 2920 2892 lvItem.pszText = textW; 2921 L istView_GetItemW(hwnd,&lvItem);2893 LISTVIEW_GetItem(hwnd,&lvItem,TRUE,FALSE); 2922 2894 dispInfo.item.cchTextMax = lstrlenW(lvItem.pszText); 2923 2895 } else … … 2925 2897 textA = (CHAR*)COMCTL32_Alloc(DISP_TEXT_SIZE*sizeof(CHAR)); 2926 2898 lvItem.pszText = (LPWSTR)textA; 2927 L istView_GetItemA(hwnd, &lvItem);2899 LISTVIEW_GetItem(hwnd,&lvItem,FALSE,FALSE); 2928 2900 dispInfo.item.cchTextMax = lstrlenA((LPSTR)lvItem.pszText); 2929 2901 } … … 2938 2910 2939 2911 if (sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? LVN_BEGINLABELEDITW:LVN_BEGINLABELEDITA,&dispInfo.hdr)) 2940 2912 return 0; 2941 2913 2942 2914 rect.left = LVIR_LABEL; 2943 2915 if (!LISTVIEW_GetItemRect(hwnd, nItem, &rect)) 2944 2916 return 0; 2945 2917 2946 2918 //Edit uses ANSI by default -> convert 2947 2919 if (isUnicodeNotify(&infoPtr->header)) 2948 {2949 2920 textA = UnicodeToAsciiString(textW); 2950 }2951 2921 2952 2922 if (!(hedit = CreateEditLabel(textA , WS_VISIBLE, … … 2979 2949 * FAILURE : FALSE 2980 2950 */ 2981 static BOOL LISTVIEW_EnsureVisible(HWND hwnd, INT nItem,BOOL bPartial)2951 static BOOL LISTVIEW_EnsureVisible(HWND hwnd,INT nItem,BOOL bPartial) 2982 2952 { 2983 2953 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 2984 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2954 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 2955 UINT uView = dwStyle & LVS_TYPEMASK; 2956 SCROLLINFO scrollInfo; 2985 2957 INT nScrollPosHeight = 0; 2986 2958 INT nScrollPosWidth = 0; 2987 SCROLLINFO scrollInfo;2988 2959 RECT rcItem; 2989 2990 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 2960 POINT oldlefttop = infoPtr->lefttop; 2961 2962 ZeroMemory(&scrollInfo,sizeof(SCROLLINFO)); 2991 2963 scrollInfo.cbSize = sizeof(SCROLLINFO); 2992 scrollInfo.fMask = SIF_POS;2964 scrollInfo.fMask = SIF_POS; 2993 2965 2994 2966 /* ALWAYS bPartial == FALSE, FOR NOW! */ … … 2999 2971 if (rcItem.left < infoPtr->rcList.left) 3000 2972 { 3001 if ( GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE)2973 if (dwStyle & WS_HSCROLL) 3002 2974 { 3003 2975 /* scroll left */ … … 3006 2978 nScrollPosWidth = infoPtr->nItemWidth; 3007 2979 rcItem.left += infoPtr->rcList.left; 3008 } 3009 else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 2980 } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 3010 2981 { 3011 2982 nScrollPosWidth = LISTVIEW_SCROLL_DIV_SIZE; … … 3018 2989 { 3019 2990 if (rcItem.left % nScrollPosWidth == 0) 2991 infoPtr->lefttop.x += rcItem.left / nScrollPosWidth; 2992 else 2993 infoPtr->lefttop.x += rcItem.left / nScrollPosWidth - 1; 2994 2995 if (infoPtr->lefttop.x != oldlefttop.x) 3020 2996 { 3021 scrollInfo.nPos += rcItem.left / nScrollPosWidth; 2997 scrollInfo.nPos = infoPtr->lefttop.x; 2998 SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE); 3022 2999 } 3023 else 3024 { 3025 scrollInfo.nPos += rcItem.left / nScrollPosWidth - 1; 3026 } 3027 3028 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 3029 } 3030 } 3031 } 3032 else if (rcItem.right > infoPtr->rcList.right) 3033 { 3034 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 3000 } 3001 } 3002 } else if (rcItem.right > infoPtr->rcList.right) 3003 { 3004 if (dwStyle & WS_HSCROLL) 3035 3005 { 3036 3006 /* scroll right */ … … 3039 3009 rcItem.right -= infoPtr->rcList.right; 3040 3010 nScrollPosWidth = infoPtr->nItemWidth; 3041 } 3042 else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 3011 } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 3043 3012 { 3044 3013 rcItem.right -= infoPtr->rcList.right; … … 3050 3019 if (nScrollPosWidth != 0) 3051 3020 { 3021 SCROLLINFO scrollInfo; 3022 3052 3023 if (rcItem.right % nScrollPosWidth == 0) 3024 infoPtr->lefttop.x += rcItem.right / nScrollPosWidth; 3025 else 3026 infoPtr->lefttop.x += rcItem.right / nScrollPosWidth + 1; 3027 3028 if (infoPtr->lefttop.x != oldlefttop.x) 3053 3029 { 3054 scrollInfo.nPos += rcItem.right / nScrollPosWidth; 3030 scrollInfo.nPos = infoPtr->lefttop.x; 3031 SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE); 3055 3032 } 3056 else3057 {3058 scrollInfo.nPos += rcItem.right / nScrollPosWidth + 1;3059 }3060 3061 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);3062 3033 } 3063 3034 } … … 3067 3038 { 3068 3039 /* scroll up */ 3069 if ( GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE)3040 if (dwStyle & WS_VSCROLL) 3070 3041 { 3071 3042 if (uView == LVS_REPORT) … … 3081 3052 3082 3053 if (rcItem.top % nScrollPosHeight == 0) 3083 { 3084 scrollInfo.nPos += rcItem.top / nScrollPosHeight; 3085 } 3054 infoPtr->lefttop.y += rcItem.top / nScrollPosHeight; 3086 3055 else 3087 { 3088 scrollInfo.nPos += rcItem.top / nScrollPosHeight - 1; 3089 } 3090 3091 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 3056 infoPtr->lefttop.y += rcItem.top / nScrollPosHeight - 1; 3057 3058 if (infoPtr->lefttop.y != oldlefttop.y) 3059 { 3060 scrollInfo.nPos = infoPtr->lefttop.y; 3061 SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE); 3062 } 3092 3063 } 3093 3064 } … … 3095 3066 { 3096 3067 /* scroll down */ 3097 if ( GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE)3068 if (dwStyle & WS_VSCROLL) 3098 3069 { 3099 3070 if (uView == LVS_REPORT) … … 3109 3080 3110 3081 if (rcItem.bottom % nScrollPosHeight == 0) 3111 { 3112 scrollInfo.nPos += rcItem.bottom / nScrollPosHeight; 3113 } 3082 infoPtr->lefttop.y += rcItem.bottom / nScrollPosHeight; 3114 3083 else 3115 { 3116 scrollInfo.nPos += rcItem.bottom / nScrollPosHeight + 1; 3117 } 3118 3119 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 3120 } 3121 } 3122 } 3084 infoPtr->lefttop.y += rcItem.bottom / nScrollPosHeight + 1; 3085 if (infoPtr->lefttop.y != oldlefttop.y) 3086 { 3087 scrollInfo.nPos = infoPtr->lefttop.y; 3088 SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE); 3089 } 3090 } 3091 } 3092 } 3093 3094 if ((oldlefttop.x != infoPtr->lefttop.x) || (oldlefttop.y != infoPtr->lefttop.y)) 3095 LISTVIEW_ScrollWindow(hwnd,(oldlefttop.x-infoPtr->lefttop.x)*LISTVIEW_SCROLL_DIV_SIZE,(oldlefttop.y-infoPtr->lefttop.y)*infoPtr->nItemHeight,uView); 3123 3096 3124 3097 return TRUE; … … 3277 3250 { 3278 3251 /* get position of the new item index */ 3279 if (L istView_GetItemPosition(hwnd, nItem, &ptItem) == FALSE)3252 if (LISTVIEW_GetItemPosition(hwnd, nItem, &ptItem) == FALSE) 3280 3253 return -1; 3281 3254 } … … 3291 3264 lvItem.iSubItem = 0; 3292 3265 if (unicode) 3293 L istView_GetItemW(hwnd, &lvItem);3266 LISTVIEW_GetItem(hwnd,&lvItem,TRUE,FALSE);//CB:todo 3294 3267 else 3295 L istView_GetItemA(hwnd,(LVITEMA*)&lvItem);3268 LISTVIEW_GetItem(hwnd,&lvItem,FALSE,FALSE);//CB:todo 3296 3269 if (rc != FALSE) 3297 3270 { … … 3679 3652 * [IO] LPLVITEMW : item info 3680 3653 * [I] internal : if true then we will use tricks that avoid copies 3681 * but are not compatible with the regular interface 3654 * but are not compatible with the regular interface 3655 * the unicode parameter is only used for NULL strings, 3656 * the caller is responsible for ASCII/UNICODE translations 3682 3657 * 3683 3658 * RETURN: … … 3685 3660 * FAILURE : FALSE 3686 3661 */ 3687 static LRESULT LISTVIEW_GetItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode)3662 static LRESULT LISTVIEW_GetItem(HWND hwnd,LPLVITEMW lpLVItem,BOOL unicode,BOOL internal) 3688 3663 { 3689 3664 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 3690 3665 BOOL bResult = FALSE; 3691 3666 NMLVDISPINFOW dispInfo; 3692 LISTVIEW_SUBITEM *lpSubItem; 3693 LISTVIEW_ITEM *lpItem; 3694 HDPA hdpaSubItems; 3695 3696 //TRACE("(hwnd=%x, lpLVItem=%p)\n", hwnd, lpLVItem); 3697 3698 if (lpLVItem != NULL) 3667 3668 if (lpLVItem) 3699 3669 { 3700 3670 if ((lpLVItem->iItem >= 0) && (lpLVItem->iItem < GETITEMCOUNT(infoPtr))) 3701 3671 { 3702 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOW)); 3703 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); 3704 if (hdpaSubItems != NULL) 3705 { 3706 lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0); 3707 if (lpItem != NULL) 3672 HDPA hdpaSubItems; 3673 3674 ZeroMemory(&dispInfo,sizeof(NMLVDISPINFOW)); 3675 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems,lpLVItem->iItem); 3676 if (hdpaSubItems) 3677 { 3678 LISTVIEW_ITEM *lpItem = (LISTVIEW_ITEM*)DPA_GetPtr(hdpaSubItems,0); 3679 3680 if (lpItem) 3708 3681 { 3709 3682 bResult = TRUE; … … 3713 3686 LPWSTR textW = NULL; 3714 3687 3715 if ((lpItem->iImage == I_IMAGECALLBACK) && 3716 (lpLVItem->mask & LVIF_IMAGE)) 3717 { 3688 if ((lpItem->iImage == I_IMAGECALLBACK) && (lpLVItem->mask & LVIF_IMAGE)) 3718 3689 dispInfo.item.mask |= LVIF_IMAGE; 3719 } 3720 3721 if ((lpItem->pszText == LPSTR_TEXTCALLBACKW) && 3722 (lpLVItem->mask & LVIF_TEXT)) 3690 3691 if ((lpItem->pszText == LPSTR_TEXTCALLBACKW) && (lpLVItem->mask & LVIF_TEXT)) 3723 3692 { 3724 3693 dispInfo.item.mask |= LVIF_TEXT; … … 3754 3723 { 3755 3724 lpLVItem->iImage = dispInfo.item.iImage; 3756 } 3757 else if (lpLVItem->mask & LVIF_IMAGE) 3758 { 3759 lpLVItem->iImage = lpItem->iImage; 3760 } 3725 if (dispInfo.item.mask & LVIF_DI_SETITEM) 3726 lpItem->iImage = dispInfo.item.iImage; 3727 } else if (lpLVItem->mask & LVIF_IMAGE) 3728 lpLVItem->iImage = lpItem->iImage; 3761 3729 3762 3730 if (dispInfo.item.mask & LVIF_TEXT) … … 3771 3739 INT len = dispInfo.item.pszText ? lstrlenA((LPSTR)dispInfo.item.pszText):0; 3772 3740 3773 COMCTL32_Free(lpItem->pszText);3741 if (lpItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpItem->pszText); 3774 3742 if (len > 0) 3775 3743 { … … 3783 3751 if (dispInfo.item.pszText == NULL) 3784 3752 { 3785 if (unicode) 3786 lpLVItem->pszText[0] = L'\0'; 3787 else 3788 ((LPSTR)lpLVItem->pszText)[0] = '\0'; 3753 if (!internal) 3754 { 3755 if (unicode) 3756 lpLVItem->pszText[0] = L'\0'; 3757 else 3758 ((LPSTR)lpLVItem->pszText)[0] = '\0'; 3759 } else 3760 { 3761 lpLVItem->pszText = NULL; 3762 ((LPLVINTERNALITEMW)lpLVItem)->unicode = unicode; 3763 } 3789 3764 } else 3790 3765 { 3791 if ( unicode)3766 if (internal) 3792 3767 { 3768 lpLVItem->pszText = dispInfo.item.pszText; 3793 3769 if (isUnicodeNotify(&infoPtr->header)) 3794 lstrcpynW(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3795 else 3796 lstrcpynAtoW(lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3797 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3770 { 3771 ((LPLVINTERNALITEMW)lpLVItem)->unicode = TRUE; 3772 if (textW == dispInfo.item.pszText) 3773 { 3774 ((LPLVINTERNALITEMW)lpLVItem)->mustFree = TRUE; 3775 textW = NULL; 3776 } else ((LPLVINTERNALITEMW)lpLVItem)->mustFree = FALSE; 3777 } else 3778 { 3779 ((LPLVINTERNALITEMW)lpLVItem)->unicode = FALSE; 3780 if (textA == (LPSTR)dispInfo.item.pszText) 3781 { 3782 ((LPLVINTERNALITEMW)lpLVItem)->mustFree = TRUE; 3783 textA = NULL; 3784 } else ((LPLVINTERNALITEMW)lpLVItem)->mustFree = FALSE; 3785 } 3798 3786 } else 3799 3787 { 3800 if (isUnicodeNotify(&infoPtr->header)) 3801 lstrcpynWtoA((LPSTR)lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3802 else 3803 lstrcpynA((LPSTR)lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3804 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3788 if (unicode) 3789 { 3790 if (isUnicodeNotify(&infoPtr->header)) 3791 lstrcpynW(lpLVItem->pszText,dispInfo.item.pszText,lpLVItem->cchTextMax); 3792 else 3793 lstrcpynAtoW(lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3794 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3795 } else 3796 { 3797 if (isUnicodeNotify(&infoPtr->header)) 3798 lstrcpynWtoA((LPSTR)lpLVItem->pszText,dispInfo.item.pszText,lpLVItem->cchTextMax); 3799 else 3800 lstrcpynA((LPSTR)lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3801 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3802 } 3805 3803 } 3806 3804 } 3807 } 3808 else if (lpLVItem->mask & LVIF_TEXT) 3805 } else if (lpLVItem->mask & LVIF_TEXT) 3809 3806 { 3810 3807 if (lpItem->pszText != NULL) 3811 3808 { 3812 if ( unicode)3809 if (internal) 3813 3810 { 3814 l strcpynW(lpLVItem->pszText,lpItem->pszText,lpLVItem->cchTextMax);3815 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0';3811 lpLVItem->pszText = lpItem->pszText; 3812 ((LPLVINTERNALITEMW)lpLVItem)->unicode = TRUE; 3816 3813 } else 3817 3814 { 3818 lstrcpynWtoA((LPSTR)lpLVItem->pszText,lpItem->pszText,lpLVItem->cchTextMax); 3819 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3815 if (unicode) 3816 { 3817 lstrcpynW(lpLVItem->pszText,lpItem->pszText,lpLVItem->cchTextMax); 3818 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3819 } else 3820 { 3821 lstrcpynWtoA((LPSTR)lpLVItem->pszText,lpItem->pszText,lpLVItem->cchTextMax); 3822 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3823 } 3820 3824 } 3821 } 3822 else 3825 } else 3823 3826 { 3824 if (unicode) 3825 ZeroMemory(lpLVItem->pszText,sizeof(WCHAR)*lpLVItem->cchTextMax); 3826 else 3827 ZeroMemory(lpLVItem->pszText,sizeof(CHAR)*lpLVItem->cchTextMax); 3827 if (internal) 3828 { 3829 lpLVItem->pszText = NULL; 3830 ((LPLVINTERNALITEMW)lpLVItem)->unicode = unicode; 3831 } else 3832 { 3833 if (unicode) 3834 lpLVItem->pszText[0] = 0; 3835 else 3836 ((CHAR*)lpLVItem->pszText)[0] = 0; 3837 } 3828 3838 } 3829 3839 } … … 3835 3845 lpLVItem->state |= (dispInfo.item.state & 3836 3846 dispInfo.item.stateMask); 3837 } 3838 else if (lpLVItem->mask & LVIF_STATE) 3839 { 3840 lpLVItem->state = lpItem->state & lpLVItem->stateMask; 3841 } 3847 } else if (lpLVItem->mask & LVIF_STATE) 3848 lpLVItem->state = lpItem->state & lpLVItem->stateMask; 3842 3849 3843 3850 if (lpLVItem->mask & LVIF_PARAM) 3844 {3845 3851 lpLVItem->lParam = lpItem->lParam; 3846 }3847 3852 3848 3853 if (lpLVItem->mask & LVIF_INDENT) 3849 {3850 3854 lpLVItem->iIndent = lpItem->iIndent; 3851 } 3855 3852 3856 if (textA) COMCTL32_Free(textA); 3853 3857 if (textW) COMCTL32_Free(textW); 3854 } 3855 else 3858 } else //SubItem 3856 3859 { 3857 3860 CHAR* textA = NULL; 3858 3861 WCHAR* textW = NULL; 3859 lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems,3860 lpLVItem->iSubItem); 3861 if (lpSubItem != NULL)3862 LISTVIEW_SUBITEM *lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems,lpLVItem->iSubItem); 3863 3864 if (lpSubItem) 3862 3865 { 3863 if ((lpSubItem->iImage == I_IMAGECALLBACK) && 3864 (lpLVItem->mask & LVIF_IMAGE)) 3865 { 3866 if ((lpSubItem->iImage == I_IMAGECALLBACK) && (lpLVItem->mask & LVIF_IMAGE)) 3866 3867 dispInfo.item.mask |= LVIF_IMAGE; 3867 } 3868 3869 if ((lpSubItem->pszText == LPSTR_TEXTCALLBACKW) && 3870 (lpLVItem->mask & LVIF_TEXT)) 3868 3869 if ((lpSubItem->pszText == LPSTR_TEXTCALLBACKW) && (lpLVItem->mask & LVIF_TEXT)) 3871 3870 { 3872 3871 dispInfo.item.mask |= LVIF_TEXT; … … 3884 3883 } 3885 3884 } 3886 } 3887 else 3885 } else //lpSubItem == NULL 3888 3886 { 3889 3887 if (lpLVItem->mask & LVIF_IMAGE) 3890 {3891 3888 dispInfo.item.mask |= LVIF_IMAGE; 3892 }3893 3889 3894 3890 if (lpLVItem->mask & LVIF_TEXT) … … 3915 3911 dispInfo.item.iSubItem = lpLVItem->iSubItem; 3916 3912 dispInfo.item.lParam = lpItem->lParam; 3917 sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? LVN_GETDISPINFOW:LVN_GETDISPINFO W,&dispInfo.hdr);3913 sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? LVN_GETDISPINFOW:LVN_GETDISPINFOA,&dispInfo.hdr); 3918 3914 } 3919 3915 … … 3921 3917 { 3922 3918 lpLVItem->iImage = dispInfo.item.iImage; 3923 } 3924 else if (lpLVItem->mask & LVIF_IMAGE) 3925 { 3926 lpLVItem->iImage = lpItem->iImage; 3927 } 3919 if (dispInfo.item.mask & LVIF_DI_SETITEM) 3920 lpSubItem->iImage = dispInfo.item.iImage; 3921 } else if (lpLVItem->mask & LVIF_IMAGE) 3922 lpLVItem->iImage = lpSubItem->iImage; 3928 3923 3929 3924 if (dispInfo.item.mask & LVIF_PARAM) 3930 { 3931 lpLVItem->lParam = dispInfo.item.lParam; 3932 } 3925 lpLVItem->lParam = dispInfo.item.lParam; 3933 3926 else if (lpLVItem->mask & LVIF_PARAM) 3934 { 3935 lpLVItem->lParam = lpItem->lParam; 3936 } 3927 lpLVItem->lParam = lpItem->lParam; 3937 3928 3938 3929 if (dispInfo.item.mask & LVIF_TEXT) 3939 3930 { 3940 if ( dispInfo.item.mask & LVIF_DI_SETITEM)3931 if ((dispInfo.item.mask & LVIF_DI_SETITEM) && lpSubItem) 3941 3932 { 3942 if ( lpSubItem)3933 if (isUnicodeNotify(&infoPtr->header)) 3943 3934 { 3935 Str_SetPtrW(&lpSubItem->pszText,dispInfo.item.pszText); 3936 } else 3937 { 3938 INT len = dispInfo.item.pszText ? lstrlenA((LPSTR)dispInfo.item.pszText):0; 3939 3940 if (lpSubItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(lpSubItem->pszText); 3941 if (len > 0) 3942 { 3943 len++; 3944 lpSubItem->pszText = (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR)); 3945 lstrcpyAtoW(lpSubItem->pszText,(LPSTR)dispInfo.item.pszText); 3946 } else lpSubItem->pszText = NULL; 3947 } 3948 } 3949 /* Make sure the source string is valid */ 3950 if (dispInfo.item.pszText == NULL) 3951 { 3952 if (internal) 3953 { 3954 lpLVItem->pszText = NULL; 3955 ((LPLVINTERNALITEMW)lpLVItem)->unicode = unicode; 3956 } else 3957 { 3958 if (unicode) 3959 lpLVItem->pszText[0] = L'\0'; 3960 else 3961 ((LPSTR)lpLVItem->pszText)[0] = '\0'; 3962 } 3963 } else 3964 { 3965 if (internal) 3966 { 3967 lpLVItem->pszText = dispInfo.item.pszText; 3944 3968 if (isUnicodeNotify(&infoPtr->header)) 3945 3969 { 3946 Str_SetPtrW(&lpSubItem->pszText,dispInfo.item.pszText); 3970 ((LPLVINTERNALITEMW)lpLVItem)->unicode = TRUE; 3971 if (textW == dispInfo.item.pszText) 3972 { 3973 ((LPLVINTERNALITEMW)lpLVItem)->mustFree = TRUE; 3974 textW = NULL; 3975 } else ((LPLVINTERNALITEMW)lpLVItem)->mustFree = FALSE; 3947 3976 } else 3948 3977 { 3949 INT len = dispInfo.item.pszText ? lstrlenA((LPSTR)dispInfo.item.pszText):0; 3950 3951 COMCTL32_Free(lpSubItem->pszText); 3952 if (len > 0) 3978 ((LPLVINTERNALITEMW)lpLVItem)->unicode = FALSE; 3979 if (textA == (LPSTR)dispInfo.item.pszText) 3953 3980 { 3954 len++; 3955 lpSubItem->pszText = (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR)); 3956 lstrcpyAtoW(lpSubItem->pszText,(LPSTR)dispInfo.item.pszText); 3957 } else lpSubItem->pszText = NULL; 3981 ((LPLVINTERNALITEMW)lpLVItem)->mustFree = TRUE; 3982 textA = NULL; 3983 } else ((LPLVINTERNALITEMW)lpLVItem)->mustFree = FALSE; 3984 } 3985 } else 3986 { 3987 if (unicode) 3988 { 3989 if (isUnicodeNotify(&infoPtr->header)) 3990 lstrcpynW(lpLVItem->pszText,dispInfo.item.pszText,lpLVItem->cchTextMax); 3991 else 3992 lstrcpynAtoW(lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3993 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3994 } else 3995 { 3996 if (isUnicodeNotify(&infoPtr->header)) 3997 lstrcpynWtoA((LPSTR)lpLVItem->pszText,dispInfo.item.pszText,lpLVItem->cchTextMax); 3998 else 3999 lstrcpynA((LPSTR)lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 4000 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 3958 4001 } 3959 4002 } 3960 4003 } 3961 /* Make sure the source string is valid */3962 3963 if ( dispInfo.item.pszText == NULL)4004 } else if (lpLVItem->mask & LVIF_TEXT) 4005 { 4006 if (lpSubItem->pszText) 3964 4007 { 3965 if (unicode) 3966 lpLVItem->pszText[0] = L'\0'; 3967 else 3968 ((LPSTR)lpLVItem->pszText)[0] = '\0'; 4008 if (internal) 4009 { 4010 lpLVItem->pszText = lpSubItem->pszText; 4011 ((LPLVINTERNALITEMW)lpLVItem)->unicode = TRUE; 4012 } else 4013 { 4014 if (unicode) 4015 { 4016 lstrcpynW(lpLVItem->pszText,lpSubItem->pszText,lpLVItem->cchTextMax); 4017 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 4018 } else 4019 { 4020 lstrcpynWtoA((LPSTR)lpLVItem->pszText,lpSubItem->pszText,lpLVItem->cchTextMax); 4021 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 4022 } 4023 } 3969 4024 } else 3970 4025 { 3971 if ( unicode)4026 if (internal) 3972 4027 { 3973 if (isUnicodeNotify(&infoPtr->header)) 3974 lstrcpynW(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3975 else 3976 lstrcpynAtoW(lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3977 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 4028 lpLVItem->pszText = NULL; 4029 ((LPLVINTERNALITEMW)lpLVItem)->unicode = unicode; 3978 4030 } else 3979 4031 { 3980 if ( isUnicodeNotify(&infoPtr->header))3981 l strcpynWtoA((LPSTR)lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax);4032 if (unicode) 4033 lpLVItem->pszText[0] = 0; 3982 4034 else 3983 lstrcpynA((LPSTR)lpLVItem->pszText,(LPSTR)dispInfo.item.pszText,lpLVItem->cchTextMax); 3984 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 4035 ((CHAR*)lpLVItem->pszText)[0] = 0; 3985 4036 } 3986 4037 } 3987 4038 } 3988 else if (lpLVItem->mask & LVIF_TEXT) 3989 { 3990 if (lpSubItem->pszText != NULL) 3991 { 3992 if (unicode) 3993 { 3994 lstrcpynW(lpLVItem->pszText,lpSubItem->pszText,lpLVItem->cchTextMax); 3995 lpLVItem->pszText[lpLVItem->cchTextMax-1] = L'\0'; 3996 } else 3997 { 3998 lstrcpynWtoA((LPSTR)lpLVItem->pszText,lpSubItem->pszText,lpLVItem->cchTextMax); 3999 ((LPSTR)lpLVItem->pszText)[lpLVItem->cchTextMax-1] = '\0'; 4000 } 4001 } 4002 else 4003 { 4004 if (unicode) 4005 ZeroMemory(lpLVItem->pszText,sizeof(WCHAR)*lpLVItem->cchTextMax); 4006 else 4007 ZeroMemory(lpLVItem->pszText,sizeof(CHAR)*lpLVItem->cchTextMax); 4008 } 4009 } 4039 if (textA) COMCTL32_Free(textA); 4040 if (textW) COMCTL32_Free(textW); 4010 4041 } 4011 4042 } … … 4071 4102 * FAILURE : FALSE 4072 4103 */ 4073 static BOOL LISTVIEW_GetItemPosition(HWND hwnd, INT nItem, 4074 LPPOINT lpptPosition) 4104 static BOOL LISTVIEW_GetItemPosition(HWND hwnd, INT nItem, LPPOINT lpptPosition) 4075 4105 { 4076 4106 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); … … 4091 4121 { 4092 4122 bResult = TRUE; 4093 nItem = nItem - L istView_GetTopIndex(hwnd);4123 nItem = nItem - LISTVIEW_GetTopIndex(hwnd); 4094 4124 nCountPerColumn = LISTVIEW_GetCountPerColumn(hwnd); 4095 4125 if (nItem < 0) … … 4117 4147 bResult = TRUE; 4118 4148 lpptPosition->x = REPORT_MARGINX; 4119 lpptPosition->y = ((nItem - L istView_GetTopIndex(hwnd)) *4149 lpptPosition->y = ((nItem - LISTVIEW_GetTopIndex(hwnd)) * 4120 4150 infoPtr->nItemHeight) + infoPtr->rcList.top; 4121 4151 } … … 4137 4167 4138 4168 return bResult; 4169 } 4170 4171 //same as ListView_GetItemRect, but direct call 4172 static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code) 4173 { 4174 if (lprc) lprc->left = code; 4175 return LISTVIEW_GetItemRect(hwnd,nItem,lprc); 4139 4176 } 4140 4177 … … 4164 4201 INT nLabelWidth; 4165 4202 TEXTMETRICA tm; 4166 4167 // TRACE("(hwnd=%x, nItem=%d, lprc=%p)\n", hwnd, nItem, lprc); 4168 4203 //CB: todo: LVS_REPORT view: clip text rect to header item width! 4204 // large icon view: text rect is wrong! 4169 4205 if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && (lprc != NULL)) 4170 4206 { 4171 if (L istView_GetItemPosition(hwnd, nItem, &ptItem) != FALSE)4207 if (LISTVIEW_GetItemPosition(hwnd, nItem, &ptItem) != FALSE) 4172 4208 { 4173 4209 switch(lprc->left) … … 4479 4515 INT LISTVIEW_GetLabelWidth(HWND hwnd, INT nItem) 4480 4516 { 4481 WCHAR szDispText[DISP_TEXT_SIZE];4482 4517 INT nLabelWidth = 0; 4483 LVITEMW lvItem; 4484 4485 // TRACE("(hwnd=%x, nItem=%d)\n", hwnd, nItem); 4518 LVINTERNALITEMW lvItem; 4486 4519 4487 4520 ZeroMemory(&lvItem, sizeof(LVITEMW)); 4488 lvItem. mask = LVIF_TEXT;4489 lvItem. iItem = nItem;4490 lvItem. cchTextMax = DISP_TEXT_SIZE;4491 lvItem. pszText = szDispText;4492 if (LISTVIEW_GetItem(hwnd,&lvItem,TRUE) != FALSE)4493 {4494 nLabelWidth = L istView_GetStringWidthW(hwnd,lvItem.pszText);4495 }4521 lvItem.header.mask = LVIF_TEXT; 4522 lvItem.header.iItem = nItem; 4523 lvItem.header.cchTextMax = DISP_TEXT_SIZE; 4524 lvItem.header.pszText = NULL; 4525 lvItem.mustFree = FALSE; 4526 if (LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE)) 4527 nLabelWidth = LISTVIEW_GetStringWidth(hwnd,lvItem.header.pszText,lvItem.unicode); 4528 if (lvItem.mustFree) COMCTL32_Free(lvItem.header.pszText); 4496 4529 4497 4530 return nLabelWidth; … … 4551 4584 lvItem.stateMask = uMask; 4552 4585 lvItem.mask = LVIF_STATE; 4553 if (LISTVIEW_GetItem(hwnd,&lvItem,TRUE ) != FALSE)4586 if (LISTVIEW_GetItem(hwnd,&lvItem,TRUE,FALSE) != FALSE) 4554 4587 { 4555 4588 uState = lvItem.state; … … 4584 4617 lpLVItem->mask = LVIF_TEXT; 4585 4618 lpLVItem->iItem = nItem; 4586 if (LISTVIEW_GetItem(hwnd,lpLVItem,unicode ) != FALSE)4619 if (LISTVIEW_GetItem(hwnd,lpLVItem,unicode,FALSE) != FALSE) //CB: todo 4587 4620 { 4588 4621 nLength = unicode ? lstrlenW(lpLVItem->pszText):lstrlenA((LPSTR)lpLVItem->pszText); … … 4639 4672 { 4640 4673 nItem--; 4641 if ((L istView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask)4674 if ((LISTVIEW_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) 4642 4675 return nItem; 4643 4676 } … … 4647 4680 lvFindInfo.flags = LVFI_NEARESTXY; 4648 4681 lvFindInfo.vkDirection = VK_UP; 4649 L istView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt);4650 while ((nItem = L istView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1)4651 { 4652 if ((L istView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask)4682 LISTVIEW_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); 4683 while ((nItem = LISTVIEW_FindItem(hwnd,nItem,&lvFindInfo,TRUE)) != -1) 4684 { 4685 if ((LISTVIEW_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) 4653 4686 return nItem; 4654 4687 } … … 4662 4695 { 4663 4696 nItem++; 4664 if ((L istView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask)4697 if ((LISTVIEW_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) 4665 4698 return nItem; 4666 4699 } … … 4670 4703 lvFindInfo.flags = LVFI_NEARESTXY; 4671 4704 lvFindInfo.vkDirection = VK_DOWN; 4672 L istView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt);4673 while ((nItem = L istView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1)4674 { 4675 if ((L istView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask)4705 LISTVIEW_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); 4706 while ((nItem = LISTVIEW_FindItem(hwnd,nItem,&lvFindInfo,TRUE)) != -1) 4707 { 4708 if ((LISTVIEW_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) 4676 4709 return nItem; 4677 4710 } … … 4686 4719 { 4687 4720 nItem -= nCountPerColumn; 4688 if ((L istView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask)4721 if ((LISTVIEW_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) 4689 4722 return nItem; 4690 4723 } … … 4694 4727 lvFindInfo.flags = LVFI_NEARESTXY; 4695 4728 lvFindInfo.vkDirection = VK_LEFT; 4696 L istView_GetItemPosition(hwnd, nItem, &lvFindInfo.pt);4697 while ((nItem = L istView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1)4698 { 4699 if ((L istView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask)4729 LISTVIEW_GetItemPosition(hwnd, nItem, &lvFindInfo.pt); 4730 while ((nItem = LISTVIEW_FindItem(hwnd,nItem,&lvFindInfo,TRUE)) != -1) 4731 { 4732 if ((LISTVIEW_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) 4700 4733 return nItem; 4701 4734 } … … 4710 4743 { 4711 4744 nItem += nCountPerColumn; 4712 if ((L istView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask)4745 if ((LISTVIEW_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) 4713 4746 return nItem; 4714 4747 } … … 4718 4751 lvFindInfo.flags = LVFI_NEARESTXY; 4719 4752 lvFindInfo.vkDirection = VK_RIGHT; 4720 L istView_GetItemPosition(hwnd, nItem,&lvFindInfo.pt);4721 while ((nItem = L istView_FindItemW(hwnd, nItem, &lvFindInfo)) != -1)4722 { 4723 if ((L istView_GetItemState(hwnd, nItem, uMask) & uMask) == uMask)4753 LISTVIEW_GetItemPosition(hwnd,nItem,&lvFindInfo.pt); 4754 while ((nItem = LISTVIEW_FindItem(hwnd,nItem,&lvFindInfo,TRUE)) != -1) 4755 { 4756 if ((LISTVIEW_GetItemState(hwnd, nItem, uMask) & uMask) == uMask) 4724 4757 return nItem; 4725 4758 } … … 4733 4766 for (i = nItem; i < GETITEMCOUNT(infoPtr); i++) 4734 4767 { 4735 if ((L istView_GetItemState(hwnd, i, uMask) & uMask) == uMask)4768 if ((LISTVIEW_GetItemState(hwnd, i, uMask) & uMask) == uMask) 4736 4769 return i; 4737 4770 } … … 4758 4791 static LRESULT LISTVIEW_GetOrigin(HWND hwnd, LPPOINT lpptOrigin) 4759 4792 { 4760 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 4761 UINT uView = lStyle & LVS_TYPEMASK; 4793 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 4794 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 4795 UINT uView = dwStyle & LVS_TYPEMASK; 4762 4796 BOOL bResult = FALSE; 4763 4797 4764 // TRACE("(hwnd=%x, lpptOrigin=%p)\n", hwnd, lpptOrigin);4765 4766 4798 if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 4767 4799 { 4768 SCROLLINFO scrollInfo;4769 4800 ZeroMemory(lpptOrigin, sizeof(POINT)); 4770 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 4771 scrollInfo.cbSize = sizeof(SCROLLINFO); 4772 4773 if (lStyle & WS_HSCROLL) 4774 { 4775 scrollInfo.fMask = SIF_POS; 4776 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 4777 { 4778 lpptOrigin->x = -scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE; 4779 } 4780 } 4781 4782 if (lStyle & WS_VSCROLL) 4783 { 4784 scrollInfo.fMask = SIF_POS; 4785 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE) 4786 { 4787 lpptOrigin->y = -scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE; 4788 } 4789 } 4801 4802 if (dwStyle & WS_HSCROLL) 4803 lpptOrigin->x = -infoPtr->lefttop.x*LISTVIEW_SCROLL_DIV_SIZE; 4804 4805 if (dwStyle & WS_VSCROLL) 4806 lpptOrigin->y = -infoPtr->lefttop.y*LISTVIEW_SCROLL_DIV_SIZE; 4790 4807 4791 4808 bResult = TRUE; … … 4813 4830 for (i = 0; i < GETITEMCOUNT(infoPtr); i++) 4814 4831 { 4815 if (L istView_GetItemState(hwnd, i, LVIS_SELECTED) & LVIS_SELECTED)4832 if (LISTVIEW_GetItemState(hwnd, i, LVIS_SELECTED) & LVIS_SELECTED) 4816 4833 { 4817 4834 nSelectedCount++; … … 5032 5049 static LRESULT LISTVIEW_InsertColumn(HWND hwnd,INT nColumn,LPLVCOLUMNW lpColumn,BOOL unicode) 5033 5050 { 5034 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 5051 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 5035 5052 HDITEMW hdi; 5036 5053 INT nNewColumn = -1; 5037 5054 5038 // TRACE("(hwnd=%x, nColumn=%d, lpColumn=%p)\n",hwnd, nColumn,5039 // lpColumn);5040 5041 5055 if (lpColumn != NULL) 5042 5056 { … … 5053 5067 { 5054 5068 hdi.fmt |= HDF_LEFT; 5055 } 5056 else 5069 } else 5057 5070 { 5058 5071 if (lpColumn->fmt & LVCFMT_LEFT) 5059 {5060 5072 hdi.fmt |= HDF_LEFT; 5061 }5062 5073 else if (lpColumn->fmt & LVCFMT_RIGHT) 5063 {5064 5074 hdi.fmt |= HDF_RIGHT; 5065 }5066 5075 else if (lpColumn->fmt & LVCFMT_CENTER) 5067 {5068 5076 hdi.fmt |= HDF_CENTER; 5069 }5070 5077 } 5071 5078 … … 5123 5130 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 5124 5131 5125 LISTVIEW_UpdateScroll(hwnd);5126 InvalidateRect(hwnd, NULL, TRUE);5132 infoPtr->refreshFlags |= RF_UPDATESCROLL; 5133 LISTVIEW_QueueRefresh(hwnd); 5127 5134 } 5128 5135 … … 5172 5179 static LRESULT LISTVIEW_InsertItem(HWND hwnd, LPLVITEMW lpLVItem,BOOL unicode) 5173 5180 { 5174 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 5175 LONG lStyle = GetWindowLongA(hwnd,GWL_STYLE);5176 UINT uView = lStyle & LVS_TYPEMASK;5177 LONG lCtrlId = GetWindowLongA(hwnd, 5181 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 5182 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 5183 UINT uView = dwStyle & LVS_TYPEMASK; 5184 LONG lCtrlId = GetWindowLongA(hwnd,GWL_ID); 5178 5185 NMLISTVIEW nmlv; 5179 5186 INT nItem = -1; … … 5182 5189 LISTVIEW_ITEM *lpItem = NULL; 5183 5190 5184 if (lpLVItem != NULL)5191 if (lpLVItem) 5185 5192 { 5186 5193 /* make sure it's not a subitem; cannot insert a subitem */ … … 5188 5195 { 5189 5196 lpItem = (LISTVIEW_ITEM *)COMCTL32_Alloc(sizeof(LISTVIEW_ITEM)); 5190 if (lpItem != NULL)5197 if (lpItem) 5191 5198 { 5192 5199 ZeroMemory(lpItem, sizeof(LISTVIEW_ITEM)); … … 5200 5207 if (nItem != -1) 5201 5208 { 5202 if ( (( lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING))5203 && !( lStyle & LVS_OWNERDRAWFIXED)5209 if ( ((dwStyle & LVS_SORTASCENDING) || (dwStyle & LVS_SORTDESCENDING)) 5210 && !(dwStyle & LVS_OWNERDRAWFIXED) 5204 5211 && (LPSTR_TEXTCALLBACKW != lpLVItem->pszText) ) 5205 5212 { … … 5251 5258 if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 5252 5259 { 5253 if ( lStyle & LVS_ALIGNLEFT)5260 if (dwStyle & LVS_ALIGNLEFT) 5254 5261 { 5255 5262 LISTVIEW_AlignLeft(hwnd); … … 5261 5268 } 5262 5269 5263 LISTVIEW_UpdateScroll(hwnd);5264 5270 /* refresh client area */ 5265 InvalidateRect(hwnd, NULL, TRUE); 5271 infoPtr->refreshFlags |= RF_UPDATESCROLL; 5272 LISTVIEW_QueueRefresh(hwnd); 5266 5273 } 5267 5274 } … … 5274 5281 /* free memory if unsuccessful */ 5275 5282 if ((nItem == -1) && (lpItem != NULL)) 5276 {5277 5283 COMCTL32_Free(lpItem); 5278 }5279 5284 5280 5285 return nItem; … … 5298 5303 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5299 5304 BOOL bResult = FALSE; 5300 RECT rc;5301 5305 5302 5306 if (nFirst <= nLast) … … 5307 5311 { 5308 5312 /* bResult = */ 5309 InvalidateRect(hwnd, &rc, TRUE);5313 LISTVIEW_Refresh(hwnd); 5310 5314 } 5311 5315 } … … 5333 5337 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5334 5338 5335 infoPtr->clrBk = clrBk; 5336 InvalidateRect(hwnd, NULL, TRUE); 5339 if (infoPtr->clrBk != clrBk) 5340 { 5341 infoPtr->clrBk = clrBk; 5342 LISTVIEW_Refresh(hwnd); 5343 } 5337 5344 5338 5345 return TRUE; … … 5544 5551 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 5545 5552 5546 InvalidateRect(hwnd, NULL, TRUE); // force redraw of the listview5553 LISTVIEW_QueueRefresh(hwnd); // force redraw of the listview 5547 5554 5548 5555 return lret; … … 5646 5653 } 5647 5654 5648 5649 5655 /*** 5650 5656 * DESCRIPTION: … … 5659 5665 * FAILURE : FALSE 5660 5666 */ 5661 static LRESULT LISTVIEW_SetItem Handler(HWND hwnd,LPLVITEMW lpLVItem,BOOL unicode)5667 static LRESULT LISTVIEW_SetItem(HWND hwnd,LPLVITEMW lpLVItem,BOOL unicode) 5662 5668 { 5663 5669 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5664 5670 BOOL bResult = FALSE; 5671 HDPA hdpaSubItems; 5672 NMLISTVIEW nmlv; 5665 5673 5666 5674 if (lpLVItem != NULL) … … 5670 5678 if (lpLVItem->iSubItem == 0) 5671 5679 { 5672 bResult = LISTVIEW_SetItem(hwnd,lpLVItem,unicode); 5673 } 5674 else 5675 { 5676 bResult = LISTVIEW_SetSubItem(hwnd,lpLVItem,unicode); 5677 } 5678 } 5679 } 5680 5680 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); 5681 if (hdpaSubItems) 5682 { 5683 LISTVIEW_ITEM *lpItem; 5684 5685 lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, lpLVItem->iSubItem); 5686 if (lpItem) 5687 { 5688 UINT uChanged; 5689 5690 ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); 5691 nmlv.lParam = lpItem->lParam; 5692 uChanged = LISTVIEW_GetItemChanges(lpItem,lpLVItem,unicode); 5693 if (uChanged != 0) 5694 { 5695 if (uChanged & LVIF_STATE) 5696 { 5697 nmlv.uNewState = lpLVItem->state & lpLVItem->stateMask; 5698 nmlv.uOldState = lpItem->state & lpLVItem->stateMask; 5699 } 5700 5701 nmlv.uChanged = uChanged; 5702 nmlv.iItem = lpLVItem->iItem; 5703 nmlv.lParam = lpItem->lParam; 5704 /* send LVN_ITEMCHANGING notification */ 5705 sendNotify(hwnd,LVN_ITEMCHANGING,&nmlv.hdr); 5706 5707 /* copy information */ 5708 bResult = LISTVIEW_InitItem(hwnd, lpItem, lpLVItem,unicode); 5709 5710 /* send LVN_ITEMCHANGED notification */ 5711 sendNotify(hwnd,LVN_ITEMCHANGED,&nmlv.hdr); 5712 5713 LISTVIEW_RefreshItem(hwnd,lpLVItem->iItem); 5714 } else 5715 bResult = TRUE; 5716 } 5717 } 5718 } else //sub-item 5719 { 5720 hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems,lpLVItem->iItem); 5721 if (hdpaSubItems) 5722 { 5723 /* set subitem only if column is present */ 5724 if (Header_GetItemCount(infoPtr->hwndHeader) > lpLVItem->iSubItem) 5725 { 5726 LISTVIEW_SUBITEM *lpSubItem; 5727 5728 lpSubItem = LISTVIEW_GetSubItem(hdpaSubItems,lpLVItem->iSubItem); 5729 if (lpSubItem) 5730 bResult = LISTVIEW_InitSubItem(hwnd,lpSubItem,lpLVItem,unicode); 5731 else 5732 bResult = LISTVIEW_AddSubItem(hwnd,lpLVItem,unicode); 5733 5734 LISTVIEW_RefreshSubItem(hwnd,lpLVItem->iItem,lpLVItem->iSubItem); 5735 } 5736 } 5737 } 5738 } 5739 } 5681 5740 5682 5741 return bResult; … … 5742 5801 * FAILURE : FALSE 5743 5802 */ 5744 static BOOL LISTVIEW_SetItemPosition(HWND hwnd, INT nItem, 5745 INT nPosX, INT nPosY) 5803 static BOOL LISTVIEW_SetItemPosition(HWND hwnd, INT nItem, INT nPosX, INT nPosY) 5746 5804 { 5747 5805 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); … … 5751 5809 BOOL bResult = FALSE; 5752 5810 5753 // TRACE("(hwnd=%x,nItem=%d,X=%d,Y=%d)\n", hwnd, nItem, nPosX, nPosY);5754 5755 5811 if ((nItem >= 0) || (nItem < GETITEMCOUNT(infoPtr))) 5756 5812 { … … 5776 5832 /* LISTVIEW_SetItemPosition32 */ 5777 5833 5834 //replaces ListView_SetItemState macro 5835 static LRESULT LISTVIEW_SetItemState(HWND hwnd,INT nItem,DWORD data,DWORD mask) 5836 { 5837 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 5838 LVITEMW lvItem; 5839 BOOL bResult; 5840 5841 ZeroMemory(&lvItem, sizeof(LVITEMW)); 5842 lvItem.mask = LVIF_STATE; 5843 lvItem.stateMask = mask; 5844 lvItem.state = data; 5845 5846 if (nItem == -1) 5847 { 5848 bResult = TRUE; 5849 5850 /* apply to all items */ 5851 for (INT i = 0; i< GETITEMCOUNT(infoPtr); i++) 5852 { 5853 lvItem.iItem = i; 5854 if (!LISTVIEW_SetItem(hwnd,&lvItem,TRUE)) 5855 bResult = FALSE; 5856 } 5857 } else 5858 { 5859 lvItem.iItem = nItem; 5860 bResult = LISTVIEW_SetItem(hwnd,&lvItem,TRUE); 5861 } 5862 5863 return bResult; 5864 } 5865 5778 5866 /*** 5779 5867 * DESCRIPTION: … … 5789 5877 * FAILURE : FALSE 5790 5878 */ 5791 static LRESULT LISTVIEW_SetItemState(HWND hwnd, INT nItem,LPLVITEMW lpLVItem)5792 { 5793 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO 5879 static LRESULT LISTVIEW_SetItemState(HWND hwnd,INT nItem,LPLVITEMW lpLVItem) 5880 { 5881 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 5794 5882 BOOL bResult = FALSE; 5795 5883 LVITEMW lvItem; 5796 5884 INT i; 5797 5885 5886 ZeroMemory(&lvItem, sizeof(LVITEMW)); 5887 lvItem.mask = LVIF_STATE; 5888 lvItem.state = lpLVItem->state; 5889 lvItem.stateMask = lpLVItem->stateMask; 5890 5798 5891 if (nItem == -1) 5799 5892 { 5800 5893 bResult = TRUE; 5801 ZeroMemory(&lvItem, sizeof(LVITEMW));5802 lvItem.mask = LVIF_STATE;5803 lvItem.state = lpLVItem->state;5804 lvItem.stateMask = lpLVItem->stateMask ;5805 5894 5806 5895 /* apply to all items */ … … 5808 5897 { 5809 5898 lvItem.iItem = i; 5810 if (ListView_SetItemW(hwnd,&lvItem) == FALSE) 5811 { 5899 if (!LISTVIEW_SetItem(hwnd,&lvItem,TRUE)) 5812 5900 bResult = FALSE; 5813 } 5814 } 5815 } 5816 else 5817 { 5818 ZeroMemory(&lvItem, sizeof(LVITEMW)); 5819 lvItem.mask = LVIF_STATE; 5820 lvItem.state = lpLVItem->state; 5821 lvItem.stateMask = lpLVItem->stateMask; 5901 } 5902 } else 5903 { 5822 5904 lvItem.iItem = nItem; 5823 bResult = L istView_SetItemW(hwnd, &lvItem);5905 bResult = LISTVIEW_SetItem(hwnd,&lvItem,TRUE); 5824 5906 } 5825 5907 … … 5853 5935 lvItem.iItem = nItem; 5854 5936 lvItem.iSubItem = lpLVItem->iSubItem; 5855 if (unicode) 5856 bResult = ListView_SetItemW(hwnd,&lvItem); 5857 else 5858 bResult = ListView_SetItemA(hwnd,&lvItem); 5937 bResult = LISTVIEW_SetItem(hwnd,&lvItem,unicode); 5859 5938 } 5860 5939 … … 5897 5976 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5898 5977 5899 infoPtr->clrTextBk = clrTextBk; 5900 InvalidateRect(hwnd, NULL, TRUE); 5978 if (infoPtr->clrTextBk != clrTextBk) 5979 { 5980 infoPtr->clrTextBk = clrTextBk; 5981 LISTVIEW_Refresh(hwnd); 5982 } 5901 5983 5902 5984 return TRUE; … … 5919 6001 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd); 5920 6002 5921 infoPtr->clrText = clrText; 5922 InvalidateRect(hwnd, NULL, TRUE); 6003 if (infoPtr->clrText != clrText) 6004 { 6005 infoPtr->clrText = clrText; 6006 LISTVIEW_Refresh(hwnd); 6007 } 5923 6008 5924 6009 return TRUE; … … 6057 6142 ((lStyle & LVS_TYPEMASK) == LVS_SMALLICON))) 6058 6143 { 6059 L istView_Arrange(hwnd, 0);6144 LISTVIEW_Arrange(hwnd, 0); 6060 6145 } 6061 6146 else 6062 6147 { 6063 6148 /* get item bounding rectangle */ 6064 ListView_GetItemRect(hwnd,nItem,&rc,LVIR_BOUNDS); 6065 InvalidateRect(hwnd, &rc, TRUE); 6149 6150 LISTVIEW_GetItemRect(hwnd,nItem,&rc,LVIR_BOUNDS); 6151 InvalidateRect(hwnd,&rc,TRUE); 6066 6152 } 6067 6153 } … … 6215 6301 * [I] HWND : window handle 6216 6302 * [I] INT : scroll code 6217 * [I] SHORT : current scroll position if scroll code is SB_TH IMBPOSITION6303 * [I] SHORT : current scroll position if scroll code is SB_THUMBPOSITION 6218 6304 * or SB_THUMBTRACK. 6219 6305 * [I] HWND : scrollbar control window handle … … 6222 6308 * Zero 6223 6309 */ 6224 static LRESULT LISTVIEW_VScroll(HWND hwnd, INT nScrollCode, SHORT nCurrentPos, 6225 HWND hScrollWnd) 6226 { 6227 SCROLLINFO scrollInfo; 6228 6229 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 6230 scrollInfo.cbSize = sizeof(SCROLLINFO); 6231 scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE; 6232 6233 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE) 6234 { 6235 INT nOldScrollPos = scrollInfo.nPos; 6236 switch (nScrollCode) 6237 { 6310 static LRESULT LISTVIEW_VScroll(HWND hwnd,INT nScrollCode,SHORT nCurrentPos,HWND hScrollWnd) 6311 { 6312 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 6313 INT maxY = infoPtr->maxScroll.y-infoPtr->scrollPage.y,oldY = infoPtr->lefttop.y; 6314 6315 switch (nScrollCode) 6316 { 6238 6317 case SB_LINEUP: 6239 if (scrollInfo.nPos > scrollInfo.nMin) 6240 { 6241 scrollInfo.nPos--; 6242 } 6243 break; 6318 if (infoPtr->lefttop.y > 0) 6319 infoPtr->lefttop.y--; 6320 break; 6244 6321 6245 6322 case SB_LINEDOWN: 6246 if (scrollInfo.nPos < scrollInfo.nMax) 6247 { 6248 scrollInfo.nPos++; 6249 } 6323 if (infoPtr->lefttop.y < maxY) 6324 infoPtr->lefttop.y++; 6250 6325 break; 6251 6326 6252 6327 case SB_PAGEUP: 6253 if (scrollInfo.nPos > scrollInfo.nMin) 6254 { 6255 6256 if (scrollInfo.nPos >= scrollInfo.nPage) 6257 { 6258 scrollInfo.nPos -= scrollInfo.nPage; 6259 } 6328 if (infoPtr->lefttop.y > 0) 6329 { 6330 if (infoPtr->lefttop.y >= infoPtr->scrollPage.y) 6331 infoPtr->lefttop.y -= infoPtr->scrollPage.y; 6260 6332 else 6261 { 6262 scrollInfo.nPos = scrollInfo.nMin; 6263 } 6333 infoPtr->lefttop.y = 0; 6264 6334 } 6265 6335 break; 6266 6336 6267 6337 case SB_PAGEDOWN: 6268 if (scrollInfo.nPos < scrollInfo.nMax) 6269 { 6270 if (scrollInfo.nPos <= scrollInfo.nMax - scrollInfo.nPage) 6271 { 6272 scrollInfo.nPos += scrollInfo.nPage; 6273 } 6338 if (infoPtr->lefttop.y < maxY) 6339 { 6340 if (infoPtr->lefttop.y <= maxY-infoPtr->scrollPage.y) 6341 infoPtr->lefttop.y += infoPtr->scrollPage.y; 6274 6342 else 6275 { 6276 scrollInfo.nPos = scrollInfo.nMax; 6277 } 6343 infoPtr->lefttop.y = maxY; 6278 6344 } 6279 6345 break; 6280 6346 6281 6347 case SB_THUMBTRACK: 6282 scrollInfo.nPos = nCurrentPos; 6283 if (scrollInfo.nPos > scrollInfo.nMax) 6284 scrollInfo.nPos=scrollInfo.nMax; 6285 6286 if (scrollInfo.nPos < scrollInfo.nMin) 6287 scrollInfo.nPos=scrollInfo.nMin; 6288 6348 infoPtr->lefttop.y = nCurrentPos; 6349 if (infoPtr->lefttop.y > maxY) 6350 infoPtr->lefttop.y = maxY; 6351 6352 if (infoPtr->lefttop.y < 0) 6353 infoPtr->lefttop.y = 0; 6289 6354 break; 6290 } 6291 6292 if (nOldScrollPos != scrollInfo.nPos) 6293 { 6294 scrollInfo.fMask = SIF_POS; 6295 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 6296 InvalidateRect(hwnd, NULL, TRUE); 6297 } 6298 } 6299 6300 return 0; 6355 } 6356 6357 if (oldY != infoPtr->lefttop.y) 6358 { 6359 SCROLLINFO scrollInfo; 6360 RECT rect; 6361 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 6362 UINT uView = dwStyle & LVS_TYPEMASK; 6363 INT yScroll = (oldY-infoPtr->lefttop.y)*infoPtr->nItemHeight; 6364 6365 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 6366 scrollInfo.cbSize = sizeof(SCROLLINFO); 6367 scrollInfo.nPos = infoPtr->lefttop.y; 6368 scrollInfo.fMask = SIF_POS; 6369 SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE); 6370 6371 LISTVIEW_ScrollWindow(hwnd,0,yScroll,uView); 6372 6373 return TRUE; 6374 } 6375 6376 return FALSE; 6301 6377 } 6302 6378 … … 6315 6391 * Zero 6316 6392 */ 6317 static LRESULT LISTVIEW_HScroll(HWND hwnd, INT nScrollCode, SHORT nCurrentPos, 6318 HWND hScrollWnd) 6393 static LRESULT LISTVIEW_HScroll(HWND hwnd,INT nScrollCode,SHORT nCurrentPos,HWND hScrollWnd) 6319 6394 { 6320 6395 SCROLLINFO scrollInfo; 6321 6396 //CB: todo 6322 6397 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 6323 6398 scrollInfo.cbSize = sizeof(SCROLLINFO); … … 6395 6470 LISTVIEW_UpdateHeaderSize(hwnd, scrollInfo.nPos); 6396 6471 } 6397 InvalidateRect(hwnd, NULL, TRUE);6472 LISTVIEW_Refresh(hwnd); 6398 6473 } 6399 6474 } … … 6404 6479 static LRESULT LISTVIEW_MouseWheel(HWND hwnd, INT wheelDelta) 6405 6480 { 6481 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd); 6406 6482 INT gcWheelDelta = 0; 6407 6483 UINT pulScrollLines = 3; 6408 SCROLLINFO scrollInfo; 6409 6410 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 6484 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 6485 UINT uView = dwStyle & LVS_TYPEMASK; 6411 6486 6412 6487 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); 6413 6488 gcWheelDelta -= wheelDelta; 6414 6489 6415 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO));6416 scrollInfo.cbSize = sizeof(SCROLLINFO);6417 scrollInfo.fMask = SIF_POS | SIF_RANGE;6418 6419 6490 switch(uView) 6420 6491 { 6421 case LVS_ICON:6422 case LVS_SMALLICON:6492 case LVS_ICON: 6493 case LVS_SMALLICON: 6423 6494 /* 6424 6495 * listview should be scrolled by a multiple of 37 dependently on its dimension or its visible item number 6425 6496 * should be fixed in the future. 6426 6497 */ 6427 if ( GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE)6428 LISTVIEW_VScroll(hwnd, SB_THUMBPOSITION, scrollInfo.nPos + (gcWheelDelta < 0) ? 37 : -37,0);6498 if (dwStyle & WS_VSCROLL) 6499 LISTVIEW_VScroll(hwnd,SB_THUMBPOSITION,infoPtr->lefttop.y+(gcWheelDelta < 0) ? 37:-37,0); 6429 6500 break; 6430 6501 6431 case LVS_REPORT:6502 case LVS_REPORT: 6432 6503 if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines) 6433 6504 { 6434 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE) 6435 { 6436 int cLineScroll = min(LISTVIEW_GetCountPerColumn(hwnd), pulScrollLines); 6437 cLineScroll *= (gcWheelDelta / WHEEL_DELTA); 6438 LISTVIEW_VScroll(hwnd, SB_THUMBPOSITION, scrollInfo.nPos + cLineScroll, 0); 6439 } 6505 if (dwStyle & WS_VSCROLL) 6506 { 6507 int cLineScroll = min(LISTVIEW_GetCountPerColumn(hwnd), pulScrollLines); 6508 6509 cLineScroll *= (gcWheelDelta / WHEEL_DELTA); 6510 LISTVIEW_VScroll(hwnd,SB_THUMBPOSITION,infoPtr->lefttop.y+cLineScroll,0); 6511 } 6440 6512 } 6441 6513 break; 6442 6514 6443 case LVS_LIST:6444 LISTVIEW_HScroll(hwnd, (gcWheelDelta < 0) ? SB_LINELEFT : SB_LINERIGHT, 0,0);6515 case LVS_LIST: 6516 LISTVIEW_HScroll(hwnd,(gcWheelDelta < 0) ? SB_LINELEFT:SB_LINERIGHT,0,0); 6445 6517 break; 6446 6518 } … … 6501 6573 6502 6574 case VK_LEFT: 6503 nItem = L istView_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_TOLEFT);6575 nItem = LISTVIEW_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_TOLEFT); 6504 6576 break; 6505 6577 6506 6578 case VK_UP: 6507 nItem = L istView_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_ABOVE);6579 nItem = LISTVIEW_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_ABOVE); 6508 6580 break; 6509 6581 6510 6582 case VK_RIGHT: 6511 nItem = L istView_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_TORIGHT);6583 nItem = LISTVIEW_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_TORIGHT); 6512 6584 break; 6513 6585 6514 6586 case VK_DOWN: 6515 nItem = L istView_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_BELOW);6587 nItem = LISTVIEW_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_BELOW); 6516 6588 break; 6517 6589 … … 6526 6598 6527 6599 if ((nItem != -1) && (nItem != infoPtr->nFocusedItem)) 6528 { 6529 bRedraw = LISTVIEW_KeySelection(hwnd, nItem); 6530 if (bRedraw != FALSE) 6531 { 6532 /* refresh client area */ 6533 InvalidateRect(hwnd, NULL, TRUE); 6534 UpdateWindow(hwnd); 6535 } 6536 } 6600 LISTVIEW_KeySelection(hwnd, nItem); 6537 6601 6538 6602 return 0; … … 6574 6638 LISTVIEW_INFO *infoPtr = NULL; 6575 6639 INT nItem = -1; 6576 BOOL bRedraw;6577 6640 INT nSize = 0; 6578 6641 INT idx = 0; … … 6625 6688 { /* get item */ 6626 6689 LISTVIEW_InitLvItemStruct( item, idx, TEXT ); 6627 L istView_GetItemA( hwnd, &item );6690 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo 6628 6691 6629 6692 /* compare items */ … … 6641 6704 { 6642 6705 LISTVIEW_InitLvItemStruct( item, idx, TEXT ); 6643 L istView_GetItemA( hwnd, &item );6706 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo 6644 6707 6645 6708 if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 ) … … 6658 6721 6659 6722 LISTVIEW_InitLvItemStruct( item, infoPtr->nFocusedItem + 1, TEXT ); 6660 L istView_GetItemA( hwnd, &item );6723 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo 6661 6724 6662 6725 if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 ) … … 6670 6733 { 6671 6734 LISTVIEW_InitLvItemStruct( item, idx, TEXT ); 6672 L istView_GetItemA( hwnd, &item );6735 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo 6673 6736 6674 6737 if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 ) … … 6684 6747 { 6685 6748 LISTVIEW_InitLvItemStruct( item,idx, TEXT ); 6686 L istView_GetItemA( hwnd, &item );6749 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo 6687 6750 6688 6751 if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 ) … … 6708 6771 { 6709 6772 LISTVIEW_InitLvItemStruct( item,idx, TEXT ); 6710 L istView_GetItemA( hwnd, &item );6773 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo 6711 6774 6712 6775 if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 ) … … 6724 6787 { 6725 6788 LISTVIEW_InitLvItemStruct( item,idx, TEXT ); 6726 L istView_GetItemA( hwnd, &item );6789 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo 6727 6790 6728 6791 if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 ) … … 6745 6808 { /* get item */ 6746 6809 LISTVIEW_InitLvItemStruct( item, idx, TEXT ); 6747 L istView_GetItemA( hwnd, &item );6810 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo 6748 6811 6749 6812 /* compare items */ … … 6761 6824 return 0; 6762 6825 6763 bRedraw = LISTVIEW_KeySelection(hwnd, nItem ); 6764 if (bRedraw != FALSE) 6765 { 6766 /* refresh client area */ 6767 InvalidateRect(hwnd, NULL, TRUE); 6768 UpdateWindow(hwnd); 6769 } 6826 LISTVIEW_KeySelection(hwnd, nItem ); 6770 6827 6771 6828 /* Store the WM_CHAR for next time */ … … 6799 6856 infoPtr->bFocus = FALSE; 6800 6857 6801 /* NEED drawing optimization ; redraw the selected items */ 6802 InvalidateRect(hwnd, NULL, TRUE); 6858 /* redraw the selected items */ 6859 if (infoPtr->nFocusedItem != -1) 6860 LISTVIEW_RefreshItem(hwnd,infoPtr->nFocusedItem); 6803 6861 6804 6862 return 0; … … 6863 6921 INT nItem; 6864 6922 6865 // TRACE("(hwnd=%x, key=%hu, X=%hu, Y=%hu)\n", hwnd, wKey, wPosX,6866 // wPosY);6867 6868 6923 /* send NM_RELEASEDCAPTURE notification */ 6869 6924 sendNotify(hwnd,NM_RELEASEDCAPTURE); … … 6884 6939 if (lStyle & LVS_SINGLESEL) 6885 6940 { 6886 if ((ListView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) 6887 && infoPtr->bDoEditLabel != TRUE) 6941 if ((LISTVIEW_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) && infoPtr->bDoEditLabel != TRUE) 6888 6942 { 6889 6943 infoPtr->bDoEditLabel = TRUE; … … 6917 6971 else 6918 6972 { 6919 if (ListView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED 6920 && infoPtr->bDoEditLabel != TRUE) 6973 if ((LISTVIEW_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED) && (infoPtr->bDoEditLabel != TRUE)) 6921 6974 { 6922 6975 infoPtr->bDoEditLabel = TRUE; … … 6934 6987 LISTVIEW_RemoveSelections(hwnd, 0, GETITEMCOUNT(infoPtr)); 6935 6988 } 6936 6937 //InvalidateRect(hwnd, NULL, TRUE);6938 6989 6939 6990 return 0; … … 7069 7120 { 7070 7121 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 7071 InvalidateRect(hwnd, NULL, TRUE);7122 LISTVIEW_Refresh(hwnd); 7072 7123 } 7073 7124 else if((lpnmh->code == HDN_ITEMCLICKA) || (lpnmh->code == HDN_ITEMCLICKW)) … … 7094 7145 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 7095 7146 LISTVIEW_UpdateScroll(hwnd); 7096 InvalidateRect(hwnd, NULL, TRUE);7147 LISTVIEW_Refresh(hwnd); 7097 7148 } 7098 7149 … … 7115 7166 static LRESULT LISTVIEW_Paint(HWND hwnd, HDC hdc) 7116 7167 { 7117 PAINTSTRUCT ps; 7118 7119 // TRACE("(hwnd=%x,hdc=%x)\n", hwnd, hdc); 7120 7121 if (hdc == 0) 7122 { 7123 hdc = BeginPaint(hwnd, &ps); 7124 LISTVIEW_Draw(hwnd, hdc); 7125 EndPaint(hwnd, &ps); 7126 } 7127 else 7128 { 7129 LISTVIEW_Draw(hwnd, hdc); 7130 } 7168 if (!hdc) 7169 { 7170 PAINTSTRUCT ps; 7171 7172 hdc = BeginPaint(hwnd,&ps); 7173 LISTVIEW_Draw(hwnd, hdc,&ps.rcPaint); 7174 EndPaint(hwnd,&ps); 7175 } else 7176 LISTVIEW_Draw(hwnd,hdc,NULL); 7131 7177 7132 7178 return 0; … … 7274 7320 infoPtr->bFocus = TRUE; 7275 7321 7276 InvalidateRect(hwnd, NULL, TRUE);7277 UpdateWindow(hwnd);7322 if (infoPtr->nFocusedItem != -1) 7323 LISTVIEW_RefreshItem(hwnd,infoPtr->nFocusedItem); 7278 7324 7279 7325 return 0; … … 7316 7362 7317 7363 /* invalidate listview control client area */ 7318 InvalidateRect(hwnd, NULL, TRUE); 7319 7320 if (fRedraw != FALSE) 7321 { 7364 LISTVIEW_Refresh(hwnd); 7365 7366 if (fRedraw) 7322 7367 UpdateWindow(hwnd); 7323 }7324 7368 7325 7369 return 0; … … 7340 7384 static LRESULT LISTVIEW_SetRedraw(HWND hwnd, BOOL bRedraw) 7341 7385 { 7342 LRESULT lResult; 7343 lResult = DefWindowProcA(hwnd, WM_SETREDRAW, bRedraw, 0); 7344 if(bRedraw) 7345 { 7346 RedrawWindow(hwnd, NULL, 0, 7347 RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN | RDW_ERASENOW); 7348 } 7349 return lResult; 7386 LRESULT lResult; 7387 //CB:todo 7388 lResult = DefWindowProcA(hwnd, WM_SETREDRAW, bRedraw, 0); 7389 //if (bRedraw) 7390 // RedrawWindow(hwnd,NULL,0,RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN | RDW_ERASENOW); 7391 7392 return lResult; 7350 7393 } 7351 7394 … … 7387 7430 7388 7431 /* invalidate client area + erase background */ 7389 InvalidateRect(hwnd, NULL, TRUE);7432 LISTVIEW_Refresh(hwnd);//CB:tocheck 7390 7433 7391 7434 return 0; … … 7557 7600 7558 7601 /* invalidate client area + erase background */ 7559 InvalidateRect(hwnd, NULL, TRUE);7602 LISTVIEW_Refresh(hwnd);//CB:todo 7560 7603 7561 7604 /* print the list of unsupported window styles */ … … 7575 7618 7576 7619 return 0; 7577 }7578 7579 /***7580 * DESCRIPTION:7581 * Window procedure of the listview control.7582 *7583 */7584 static LRESULT WINAPI LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,7585 LPARAM lParam)7586 {7587 switch (uMsg)7588 {7589 case LVM_APPROXIMATEVIEWRECT:7590 return LISTVIEW_ApproximateViewRect(hwnd, (INT)wParam,7591 LOWORD(lParam), HIWORD(lParam));7592 case LVM_ARRANGE:7593 return LISTVIEW_Arrange(hwnd, (INT)wParam);7594 7595 /* case LVM_CREATEDRAGIMAGE: */7596 7597 case LVM_DELETEALLITEMS:7598 return LISTVIEW_DeleteAllItems(hwnd);7599 7600 case LVM_DELETECOLUMN:7601 return LISTVIEW_DeleteColumn(hwnd, (INT)wParam);7602 7603 case LVM_DELETEITEM:7604 return LISTVIEW_DeleteItem(hwnd, (INT)wParam);7605 7606 case LVM_EDITLABELA:7607 return LISTVIEW_EditLabel(hwnd,(INT)wParam,FALSE);7608 7609 case LVM_EDITLABELW:7610 return LISTVIEW_EditLabel(hwnd,(INT)wParam,TRUE);7611 7612 case LVM_ENSUREVISIBLE:7613 return LISTVIEW_EnsureVisible(hwnd, (INT)wParam, (BOOL)lParam);7614 7615 case LVM_FINDITEMA:7616 return LISTVIEW_FindItem(hwnd,(INT)wParam,(LPLVFINDINFOW)lParam,FALSE);7617 7618 case LVM_FINDITEMW:7619 return LISTVIEW_FindItem(hwnd,(INT)wParam,(LPLVFINDINFOW)lParam,TRUE);7620 7621 case LVM_GETBKCOLOR:7622 return LISTVIEW_GetBkColor(hwnd);7623 7624 /* case LVM_GETBKIMAGE: */7625 7626 case LVM_GETCALLBACKMASK:7627 return LISTVIEW_GetCallbackMask(hwnd);7628 7629 case LVM_GETCOLUMNA:7630 return LISTVIEW_GetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE);7631 7632 case LVM_GETCOLUMNW:7633 return LISTVIEW_GetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE);7634 7635 7636 case LVM_GETCOLUMNORDERARRAY:7637 return LISTVIEW_GetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam);7638 7639 case LVM_GETCOLUMNWIDTH:7640 return LISTVIEW_GetColumnWidth(hwnd, (INT)wParam);7641 7642 case LVM_GETCOUNTPERPAGE:7643 return LISTVIEW_GetCountPerPage(hwnd);7644 7645 case LVM_GETEDITCONTROL:7646 return LISTVIEW_GetEditControl(hwnd);7647 7648 case LVM_GETEXTENDEDLISTVIEWSTYLE:7649 return LISTVIEW_GetExtendedListViewStyle(hwnd);7650 7651 case LVM_GETHEADER:7652 return LISTVIEW_GetHeader(hwnd);7653 7654 /* case LVM_GETHOTCURSOR: */7655 7656 case LVM_GETHOTITEM:7657 return LISTVIEW_GetHotItem(hwnd);7658 7659 /* case LVM_GETHOVERTIME: */7660 7661 case LVM_GETIMAGELIST:7662 return LISTVIEW_GetImageList(hwnd, (INT)wParam);7663 7664 /* case LVM_GETISEARCHSTRING: */7665 7666 case LVM_GETITEMA:7667 return LISTVIEW_GetItem(hwnd,(LPLVITEMW)lParam,FALSE);7668 7669 case LVM_GETITEMW:7670 return LISTVIEW_GetItem(hwnd,(LPLVITEMW)lParam,TRUE);7671 7672 7673 case LVM_GETITEMCOUNT:7674 return LISTVIEW_GetItemCount(hwnd);7675 7676 case LVM_GETITEMPOSITION:7677 return LISTVIEW_GetItemPosition(hwnd, (INT)wParam, (LPPOINT)lParam);7678 7679 case LVM_GETITEMRECT:7680 return LISTVIEW_GetItemRect(hwnd, (INT)wParam, (LPRECT)lParam);7681 7682 case LVM_GETITEMSPACING:7683 return LISTVIEW_GetItemSpacing(hwnd, (BOOL)wParam);7684 7685 case LVM_GETITEMSTATE:7686 return LISTVIEW_GetItemState(hwnd, (INT)wParam, (UINT)lParam);7687 7688 case LVM_GETITEMTEXTA:7689 LISTVIEW_GetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,FALSE);7690 break;7691 7692 case LVM_GETITEMTEXTW:7693 LISTVIEW_GetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,TRUE);7694 break;7695 7696 7697 case LVM_GETNEXTITEM:7698 return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam));7699 7700 /* case LVM_GETNUMBEROFWORKAREAS: */7701 7702 case LVM_GETORIGIN:7703 return LISTVIEW_GetOrigin(hwnd, (LPPOINT)lParam);7704 7705 case LVM_GETSELECTEDCOUNT:7706 return LISTVIEW_GetSelectedCount(hwnd);7707 7708 case LVM_GETSELECTIONMARK:7709 return LISTVIEW_GetSelectionMark(hwnd);7710 7711 case LVM_GETSTRINGWIDTHA:7712 return LISTVIEW_GetStringWidth(hwnd,(LPWSTR)lParam,FALSE);7713 7714 case LVM_GETSTRINGWIDTHW:7715 return LISTVIEW_GetStringWidth(hwnd,(LPWSTR)lParam,TRUE);7716 7717 /* case LVM_GETSUBITEMRECT: */7718 7719 case LVM_GETTEXTBKCOLOR:7720 return LISTVIEW_GetTextBkColor(hwnd);7721 7722 case LVM_GETTEXTCOLOR:7723 return LISTVIEW_GetTextColor(hwnd);7724 7725 /* case LVM_GETTOOLTIPS: */7726 7727 case LVM_GETTOPINDEX:7728 return LISTVIEW_GetTopIndex(hwnd);7729 7730 /* case LVM_GETUNICODEFORMAT: */7731 7732 case LVM_GETVIEWRECT:7733 return LISTVIEW_GetViewRect(hwnd, (LPRECT)lParam);7734 7735 /* case LVM_GETWORKAREAS: */7736 7737 case LVM_HITTEST:7738 return LISTVIEW_HitTest(hwnd, (LPLVHITTESTINFO)lParam);7739 7740 case LVM_INSERTCOLUMNA:7741 return LISTVIEW_InsertColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE);7742 7743 case LVM_INSERTCOLUMNW:7744 return LISTVIEW_InsertColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE);7745 7746 case LVM_INSERTITEMA:7747 return LISTVIEW_InsertItem(hwnd,(LPLVITEMW)lParam,FALSE);7748 7749 case LVM_INSERTITEMW:7750 return LISTVIEW_InsertItem(hwnd,(LPLVITEMW)lParam,TRUE);7751 7752 case LVM_REDRAWITEMS:7753 return LISTVIEW_RedrawItems(hwnd, (INT)wParam, (INT)lParam);7754 7755 /* case LVM_SCROLL: */7756 /* return LISTVIEW_Scroll(hwnd, (INT)wParam, (INT)lParam); */7757 7758 case LVM_SETBKCOLOR:7759 return LISTVIEW_SetBkColor(hwnd, (COLORREF)lParam);7760 7761 /* case LVM_SETBKIMAGE: */7762 7763 case LVM_SETCALLBACKMASK:7764 return LISTVIEW_SetCallbackMask(hwnd, (UINT)wParam);7765 7766 case LVM_SETCOLUMNA:7767 return LISTVIEW_SetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE);7768 7769 case LVM_SETCOLUMNW:7770 return LISTVIEW_SetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE);7771 7772 case LVM_SETCOLUMNORDERARRAY:7773 return LISTVIEW_SetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam);7774 7775 case LVM_SETCOLUMNWIDTH:7776 return LISTVIEW_SetColumnWidth(hwnd, (INT)wParam, (INT)lParam);7777 7778 case LVM_SETEXTENDEDLISTVIEWSTYLE:7779 return LISTVIEW_SetExtendedListViewStyle(hwnd, (DWORD)wParam, (DWORD)lParam);7780 7781 /* case LVM_SETHOTCURSOR: */7782 7783 case LVM_SETHOTITEM:7784 return LISTVIEW_SetHotItem(hwnd, (INT)wParam);7785 7786 /* case LVM_SETHOVERTIME: */7787 /* case LVM_SETICONSPACING: */7788 7789 case LVM_SETIMAGELIST:7790 return LISTVIEW_SetImageList(hwnd, (INT)wParam, (HIMAGELIST)lParam);7791 7792 case LVM_SETITEMA:7793 return LISTVIEW_SetItemHandler(hwnd,(LPLVITEMW)lParam,FALSE);7794 7795 case LVM_SETITEMW:7796 return LISTVIEW_SetItemHandler(hwnd,(LPLVITEMW)lParam,TRUE);7797 7798 case LVM_SETITEMCOUNT:7799 return LISTVIEW_SetItemCount(hwnd, (INT)wParam, (DWORD)lParam);7800 7801 case LVM_SETITEMPOSITION:7802 return LISTVIEW_SetItemPosition(hwnd, (INT)wParam, (INT)LOWORD(lParam),7803 (INT)HIWORD(lParam));7804 7805 /* case LVM_SETITEMPOSITION32: */7806 7807 case LVM_SETITEMSTATE:7808 return LISTVIEW_SetItemState(hwnd, (INT)wParam, (LPLVITEMW)lParam);7809 7810 case LVM_SETITEMTEXTA:7811 return LISTVIEW_SetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,FALSE);7812 7813 case LVM_SETITEMTEXTW:7814 return LISTVIEW_SetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,TRUE);7815 7816 case LVM_SETSELECTIONMARK:7817 return LISTVIEW_SetSelectionMark(hwnd, (INT)lParam);7818 7819 case LVM_SETTEXTBKCOLOR:7820 return LISTVIEW_SetTextBkColor(hwnd, (COLORREF)lParam);7821 7822 case LVM_SETTEXTCOLOR:7823 return LISTVIEW_SetTextColor(hwnd, (COLORREF)lParam);7824 7825 /* case LVM_SETTOOLTIPS: */7826 /* case LVM_SETUNICODEFORMAT: */7827 /* case LVM_SETWORKAREAS: */7828 7829 case LVM_SORTITEMS:7830 return LISTVIEW_SortItems(hwnd, wParam, lParam);7831 7832 /* case LVM_SUBITEMHITTEST: */7833 7834 case LVM_UPDATE:7835 return LISTVIEW_Update(hwnd, (INT)wParam);7836 7837 case WM_CHAR:7838 return LISTVIEW_ProcessLetterKeys( hwnd, wParam, lParam );7839 7840 case WM_COMMAND:7841 return LISTVIEW_Command(hwnd, wParam, lParam);7842 7843 case WM_CREATE:7844 return LISTVIEW_Create(hwnd, wParam, lParam);7845 7846 case WM_ERASEBKGND:7847 return LISTVIEW_EraseBackground(hwnd, wParam, lParam);7848 7849 case WM_GETDLGCODE:7850 return DLGC_WANTCHARS | DLGC_WANTARROWS;7851 7852 case WM_GETFONT:7853 return LISTVIEW_GetFont(hwnd);7854 7855 case WM_HSCROLL:7856 return LISTVIEW_HScroll(hwnd, (INT)LOWORD(wParam),7857 (INT)HIWORD(wParam), (HWND)lParam);7858 7859 case WM_KEYDOWN:7860 return LISTVIEW_KeyDown(hwnd, (INT)wParam, (LONG)lParam);7861 7862 case WM_KILLFOCUS:7863 return LISTVIEW_KillFocus(hwnd);7864 7865 case WM_LBUTTONDBLCLK:7866 return LISTVIEW_LButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam),7867 HIWORD(lParam));7868 7869 case WM_LBUTTONDOWN:7870 return LISTVIEW_LButtonDown(hwnd, (WORD)wParam, LOWORD(lParam),7871 HIWORD(lParam));7872 case WM_LBUTTONUP:7873 return LISTVIEW_LButtonUp(hwnd, (WORD)wParam, LOWORD(lParam),7874 HIWORD(lParam));7875 7876 /* case WM_MOUSEMOVE: */7877 /* return LISTVIEW_MouseMove (hwnd, wParam, lParam); */7878 7879 case WM_NCCREATE:7880 return LISTVIEW_NCCreate(hwnd, wParam, lParam);7881 7882 case WM_NCDESTROY:7883 return LISTVIEW_NCDestroy(hwnd);7884 7885 case WM_NOTIFY:7886 return LISTVIEW_Notify(hwnd, (INT)wParam, (LPNMHDR)lParam);7887 7888 case WM_PAINT:7889 return LISTVIEW_Paint(hwnd, (HDC)wParam);7890 7891 case WM_RBUTTONDBLCLK:7892 return LISTVIEW_RButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam),7893 HIWORD(lParam));7894 7895 case WM_RBUTTONDOWN:7896 return LISTVIEW_RButtonDown(hwnd, (WORD)wParam, LOWORD(lParam),7897 HIWORD(lParam));7898 7899 case WM_RBUTTONUP:7900 return LISTVIEW_RButtonUp(hwnd, (WORD)wParam, LOWORD(lParam),7901 HIWORD(lParam));7902 7903 case WM_SETFOCUS:7904 return LISTVIEW_SetFocus(hwnd, (HWND)wParam);7905 7906 case WM_SETFONT:7907 return LISTVIEW_SetFont(hwnd, (HFONT)wParam, (WORD)lParam);7908 7909 case WM_SETREDRAW:7910 return LISTVIEW_SetRedraw(hwnd, (BOOL)wParam);7911 7912 case WM_SIZE:7913 return LISTVIEW_Size(hwnd, (int)SLOWORD(lParam), (int)SHIWORD(lParam));7914 7915 case WM_STYLECHANGED:7916 return LISTVIEW_StyleChanged(hwnd, wParam, (LPSTYLESTRUCT)lParam);7917 7918 /* case WM_TIMER: */7919 7920 case WM_VSCROLL:7921 return LISTVIEW_VScroll(hwnd, (INT)LOWORD(wParam),7922 (INT)HIWORD(wParam), (HWND)lParam);7923 7924 case WM_MOUSEWHEEL:7925 if (wParam & (MK_SHIFT | MK_CONTROL))7926 return DefWindowProcA( hwnd, uMsg, wParam, lParam );7927 return LISTVIEW_MouseWheel(hwnd, (short int)HIWORD(wParam));7928 7929 /* case WM_WINDOWPOSCHANGED: */7930 /* case WM_WININICHANGE: */7931 7932 default:7933 //if (uMsg >= WM_USER)7934 //{7935 // ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam,7936 // lParam);7937 //}7938 7939 /* call default window procedure */7940 return defComCtl32ProcA(hwnd, uMsg, wParam, lParam);7941 }7942 7943 return 0;7944 }7945 7946 /***7947 * DESCRIPTION:7948 * Registers the window class.7949 *7950 * PARAMETER(S):7951 * None7952 *7953 * RETURN:7954 * None7955 */7956 VOID LISTVIEW_Register(VOID)7957 {7958 WNDCLASSA wndClass;7959 7960 ZeroMemory(&wndClass, sizeof(WNDCLASSA));7961 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;7962 wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc;7963 wndClass.cbClsExtra = 0;7964 wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *);7965 wndClass.hCursor = LoadCursorA(0, IDC_ARROWA);7966 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);7967 wndClass.lpszClassName = WC_LISTVIEWA;7968 RegisterClassA(&wndClass);7969 }7970 7971 /***7972 * DESCRIPTION:7973 * Unregisters the window class.7974 *7975 * PARAMETER(S):7976 * None7977 *7978 * RETURN:7979 * None7980 */7981 VOID LISTVIEW_Unregister(VOID)7982 {7983 UnregisterClassA(WC_LISTVIEWA, (HINSTANCE)NULL);7984 7620 } 7985 7621 … … 8196 7832 return hedit; 8197 7833 } 7834 7835 /*** 7836 * DESCRIPTION: 7837 * Window procedure of the listview control. 7838 * 7839 */ 7840 static LRESULT WINAPI LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, 7841 LPARAM lParam) 7842 { 7843 switch (uMsg) 7844 { 7845 case LVM_APPROXIMATEVIEWRECT: 7846 return LISTVIEW_ApproximateViewRect(hwnd, (INT)wParam, 7847 LOWORD(lParam), HIWORD(lParam)); 7848 case LVM_ARRANGE: 7849 return LISTVIEW_Arrange(hwnd, (INT)wParam); 7850 7851 /* case LVM_CREATEDRAGIMAGE: */ 7852 7853 case LVM_DELETEALLITEMS: 7854 return LISTVIEW_DeleteAllItems(hwnd); 7855 7856 case LVM_DELETECOLUMN: 7857 return LISTVIEW_DeleteColumn(hwnd, (INT)wParam); 7858 7859 case LVM_DELETEITEM: 7860 return LISTVIEW_DeleteItem(hwnd, (INT)wParam); 7861 7862 case LVM_EDITLABELA: 7863 return LISTVIEW_EditLabel(hwnd,(INT)wParam,FALSE); 7864 7865 case LVM_EDITLABELW: 7866 return LISTVIEW_EditLabel(hwnd,(INT)wParam,TRUE); 7867 7868 case LVM_ENSUREVISIBLE: 7869 return LISTVIEW_EnsureVisible(hwnd,(INT)wParam,(BOOL)lParam); 7870 7871 case LVM_FINDITEMA: 7872 return LISTVIEW_FindItem(hwnd,(INT)wParam,(LPLVFINDINFOW)lParam,FALSE); 7873 7874 case LVM_FINDITEMW: 7875 return LISTVIEW_FindItem(hwnd,(INT)wParam,(LPLVFINDINFOW)lParam,TRUE); 7876 7877 case LVM_GETBKCOLOR: 7878 return LISTVIEW_GetBkColor(hwnd); 7879 7880 /* case LVM_GETBKIMAGE: */ 7881 7882 case LVM_GETCALLBACKMASK: 7883 return LISTVIEW_GetCallbackMask(hwnd); 7884 7885 case LVM_GETCOLUMNA: 7886 return LISTVIEW_GetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE); 7887 7888 case LVM_GETCOLUMNW: 7889 return LISTVIEW_GetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE); 7890 7891 7892 case LVM_GETCOLUMNORDERARRAY: 7893 return LISTVIEW_GetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam); 7894 7895 case LVM_GETCOLUMNWIDTH: 7896 return LISTVIEW_GetColumnWidth(hwnd, (INT)wParam); 7897 7898 case LVM_GETCOUNTPERPAGE: 7899 return LISTVIEW_GetCountPerPage(hwnd); 7900 7901 case LVM_GETEDITCONTROL: 7902 return LISTVIEW_GetEditControl(hwnd); 7903 7904 case LVM_GETEXTENDEDLISTVIEWSTYLE: 7905 return LISTVIEW_GetExtendedListViewStyle(hwnd); 7906 7907 case LVM_GETHEADER: 7908 return LISTVIEW_GetHeader(hwnd); 7909 7910 /* case LVM_GETHOTCURSOR: */ 7911 7912 case LVM_GETHOTITEM: 7913 return LISTVIEW_GetHotItem(hwnd); 7914 7915 /* case LVM_GETHOVERTIME: */ 7916 7917 case LVM_GETIMAGELIST: 7918 return LISTVIEW_GetImageList(hwnd, (INT)wParam); 7919 7920 /* case LVM_GETISEARCHSTRING: */ 7921 7922 case LVM_GETITEMA: 7923 return LISTVIEW_GetItem(hwnd,(LPLVITEMW)lParam,FALSE,FALSE); 7924 7925 case LVM_GETITEMW: 7926 return LISTVIEW_GetItem(hwnd,(LPLVITEMW)lParam,TRUE,FALSE); 7927 7928 7929 case LVM_GETITEMCOUNT: 7930 return LISTVIEW_GetItemCount(hwnd); 7931 7932 case LVM_GETITEMPOSITION: 7933 return LISTVIEW_GetItemPosition(hwnd, (INT)wParam, (LPPOINT)lParam); 7934 7935 case LVM_GETITEMRECT: 7936 return LISTVIEW_GetItemRect(hwnd, (INT)wParam, (LPRECT)lParam); 7937 7938 case LVM_GETITEMSPACING: 7939 return LISTVIEW_GetItemSpacing(hwnd, (BOOL)wParam); 7940 7941 case LVM_GETITEMSTATE: 7942 return LISTVIEW_GetItemState(hwnd, (INT)wParam, (UINT)lParam); 7943 7944 case LVM_GETITEMTEXTA: 7945 LISTVIEW_GetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,FALSE); 7946 break; 7947 7948 case LVM_GETITEMTEXTW: 7949 LISTVIEW_GetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,TRUE); 7950 break; 7951 7952 7953 case LVM_GETNEXTITEM: 7954 return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam)); 7955 7956 /* case LVM_GETNUMBEROFWORKAREAS: */ 7957 7958 case LVM_GETORIGIN: 7959 return LISTVIEW_GetOrigin(hwnd, (LPPOINT)lParam); 7960 7961 case LVM_GETSELECTEDCOUNT: 7962 return LISTVIEW_GetSelectedCount(hwnd); 7963 7964 case LVM_GETSELECTIONMARK: 7965 return LISTVIEW_GetSelectionMark(hwnd); 7966 7967 case LVM_GETSTRINGWIDTHA: 7968 return LISTVIEW_GetStringWidth(hwnd,(LPWSTR)lParam,FALSE); 7969 7970 case LVM_GETSTRINGWIDTHW: 7971 return LISTVIEW_GetStringWidth(hwnd,(LPWSTR)lParam,TRUE); 7972 7973 /* case LVM_GETSUBITEMRECT: */ 7974 7975 case LVM_GETTEXTBKCOLOR: 7976 return LISTVIEW_GetTextBkColor(hwnd); 7977 7978 case LVM_GETTEXTCOLOR: 7979 return LISTVIEW_GetTextColor(hwnd); 7980 7981 /* case LVM_GETTOOLTIPS: */ 7982 7983 case LVM_GETTOPINDEX: 7984 return LISTVIEW_GetTopIndex(hwnd); 7985 7986 case LVM_GETVIEWRECT: 7987 return LISTVIEW_GetViewRect(hwnd, (LPRECT)lParam); 7988 7989 /* case LVM_GETWORKAREAS: */ 7990 7991 case LVM_HITTEST: 7992 return LISTVIEW_HitTest(hwnd, (LPLVHITTESTINFO)lParam); 7993 7994 case LVM_INSERTCOLUMNA: 7995 return LISTVIEW_InsertColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE); 7996 7997 case LVM_INSERTCOLUMNW: 7998 return LISTVIEW_InsertColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE); 7999 8000 case LVM_INSERTITEMA: 8001 return LISTVIEW_InsertItem(hwnd,(LPLVITEMW)lParam,FALSE); 8002 8003 case LVM_INSERTITEMW: 8004 return LISTVIEW_InsertItem(hwnd,(LPLVITEMW)lParam,TRUE); 8005 8006 case LVM_REDRAWITEMS: 8007 return LISTVIEW_RedrawItems(hwnd, (INT)wParam, (INT)lParam); 8008 8009 /* case LVM_SCROLL: */ 8010 /* return LISTVIEW_Scroll(hwnd, (INT)wParam, (INT)lParam); */ 8011 8012 case LVM_SETBKCOLOR: 8013 return LISTVIEW_SetBkColor(hwnd, (COLORREF)lParam); 8014 8015 /* case LVM_SETBKIMAGE: */ 8016 8017 case LVM_SETCALLBACKMASK: 8018 return LISTVIEW_SetCallbackMask(hwnd, (UINT)wParam); 8019 8020 case LVM_SETCOLUMNA: 8021 return LISTVIEW_SetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,FALSE); 8022 8023 case LVM_SETCOLUMNW: 8024 return LISTVIEW_SetColumn(hwnd,(INT)wParam,(LPLVCOLUMNW)lParam,TRUE); 8025 8026 case LVM_SETCOLUMNORDERARRAY: 8027 return LISTVIEW_SetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam); 8028 8029 case LVM_SETCOLUMNWIDTH: 8030 return LISTVIEW_SetColumnWidth(hwnd, (INT)wParam, (INT)lParam); 8031 8032 case LVM_SETEXTENDEDLISTVIEWSTYLE: 8033 return LISTVIEW_SetExtendedListViewStyle(hwnd, (DWORD)wParam, (DWORD)lParam); 8034 8035 /* case LVM_SETHOTCURSOR: */ 8036 8037 case LVM_SETHOTITEM: 8038 return LISTVIEW_SetHotItem(hwnd, (INT)wParam); 8039 8040 /* case LVM_SETHOVERTIME: */ 8041 /* case LVM_SETICONSPACING: */ 8042 8043 case LVM_SETIMAGELIST: 8044 return LISTVIEW_SetImageList(hwnd, (INT)wParam, (HIMAGELIST)lParam); 8045 8046 case LVM_SETITEMA: 8047 return LISTVIEW_SetItem(hwnd,(LPLVITEMW)lParam,FALSE); 8048 8049 case LVM_SETITEMW: 8050 return LISTVIEW_SetItem(hwnd,(LPLVITEMW)lParam,TRUE); 8051 8052 case LVM_SETITEMCOUNT: 8053 return LISTVIEW_SetItemCount(hwnd, (INT)wParam, (DWORD)lParam); 8054 8055 case LVM_SETITEMPOSITION: 8056 return LISTVIEW_SetItemPosition(hwnd, (INT)wParam, (INT)LOWORD(lParam), 8057 (INT)HIWORD(lParam)); 8058 8059 /* case LVM_SETITEMPOSITION32: */ 8060 8061 case LVM_SETITEMSTATE: 8062 return LISTVIEW_SetItemState(hwnd, (INT)wParam, (LPLVITEMW)lParam); 8063 8064 case LVM_SETITEMTEXTA: 8065 return LISTVIEW_SetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,FALSE); 8066 8067 case LVM_SETITEMTEXTW: 8068 return LISTVIEW_SetItemText(hwnd,(INT)wParam,(LPLVITEMW)lParam,TRUE); 8069 8070 case LVM_SETSELECTIONMARK: 8071 return LISTVIEW_SetSelectionMark(hwnd, (INT)lParam); 8072 8073 case LVM_SETTEXTBKCOLOR: 8074 return LISTVIEW_SetTextBkColor(hwnd, (COLORREF)lParam); 8075 8076 case LVM_SETTEXTCOLOR: 8077 return LISTVIEW_SetTextColor(hwnd, (COLORREF)lParam); 8078 8079 /* case LVM_SETTOOLTIPS: */ 8080 /* case LVM_SETWORKAREAS: */ 8081 8082 case LVM_SORTITEMS: 8083 return LISTVIEW_SortItems(hwnd, wParam, lParam); 8084 8085 /* case LVM_SUBITEMHITTEST: */ 8086 8087 case LVM_UPDATE: 8088 return LISTVIEW_Update(hwnd, (INT)wParam); 8089 8090 case WM_CHAR: 8091 return LISTVIEW_ProcessLetterKeys( hwnd, wParam, lParam ); 8092 8093 case WM_COMMAND: 8094 return LISTVIEW_Command(hwnd, wParam, lParam); 8095 8096 case WM_CREATE: 8097 return LISTVIEW_Create(hwnd, wParam, lParam); 8098 8099 case WM_ERASEBKGND: 8100 return LISTVIEW_EraseBackground(hwnd, wParam, lParam); 8101 8102 case WM_GETDLGCODE: 8103 return DLGC_WANTCHARS | DLGC_WANTARROWS; 8104 8105 case WM_GETFONT: 8106 return LISTVIEW_GetFont(hwnd); 8107 8108 case WM_HSCROLL: 8109 return LISTVIEW_HScroll(hwnd, (INT)LOWORD(wParam), 8110 (INT)HIWORD(wParam), (HWND)lParam); 8111 8112 case WM_KEYDOWN: 8113 return LISTVIEW_KeyDown(hwnd, (INT)wParam, (LONG)lParam); 8114 8115 case WM_KILLFOCUS: 8116 return LISTVIEW_KillFocus(hwnd); 8117 8118 case WM_LBUTTONDBLCLK: 8119 return LISTVIEW_LButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam), 8120 HIWORD(lParam)); 8121 8122 case WM_LBUTTONDOWN: 8123 return LISTVIEW_LButtonDown(hwnd, (WORD)wParam, LOWORD(lParam), 8124 HIWORD(lParam)); 8125 case WM_LBUTTONUP: 8126 return LISTVIEW_LButtonUp(hwnd, (WORD)wParam, LOWORD(lParam), 8127 HIWORD(lParam)); 8128 8129 /* case WM_MOUSEMOVE: */ 8130 /* return LISTVIEW_MouseMove (hwnd, wParam, lParam); */ 8131 8132 case WM_NCCREATE: 8133 return LISTVIEW_NCCreate(hwnd, wParam, lParam); 8134 8135 case WM_NCDESTROY: 8136 return LISTVIEW_NCDestroy(hwnd); 8137 8138 case WM_NOTIFY: 8139 return LISTVIEW_Notify(hwnd, (INT)wParam, (LPNMHDR)lParam); 8140 8141 case WM_PAINT: 8142 return LISTVIEW_Paint(hwnd, (HDC)wParam); 8143 8144 case WM_RBUTTONDBLCLK: 8145 return LISTVIEW_RButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam), 8146 HIWORD(lParam)); 8147 8148 case WM_RBUTTONDOWN: 8149 return LISTVIEW_RButtonDown(hwnd, (WORD)wParam, LOWORD(lParam), 8150 HIWORD(lParam)); 8151 8152 case WM_RBUTTONUP: 8153 return LISTVIEW_RButtonUp(hwnd, (WORD)wParam, LOWORD(lParam), 8154 HIWORD(lParam)); 8155 8156 case WM_SETFOCUS: 8157 return LISTVIEW_SetFocus(hwnd, (HWND)wParam); 8158 8159 case WM_SETFONT: 8160 return LISTVIEW_SetFont(hwnd, (HFONT)wParam, (WORD)lParam); 8161 8162 case WM_SETREDRAW: 8163 return LISTVIEW_SetRedraw(hwnd, (BOOL)wParam); 8164 8165 case WM_SIZE: 8166 return LISTVIEW_Size(hwnd, (int)SLOWORD(lParam), (int)SHIWORD(lParam)); 8167 8168 case WM_STYLECHANGED: 8169 return LISTVIEW_StyleChanged(hwnd, wParam, (LPSTYLESTRUCT)lParam); 8170 8171 case WM_TIMER: 8172 return LISTVIEW_Timer(hwnd,wParam,lParam); 8173 8174 case WM_VSCROLL: 8175 return LISTVIEW_VScroll(hwnd,(INT)LOWORD(wParam),(INT)HIWORD(wParam),(HWND)lParam); 8176 8177 case WM_MOUSEWHEEL: 8178 if (wParam & (MK_SHIFT | MK_CONTROL)) 8179 return DefWindowProcA( hwnd, uMsg, wParam, lParam ); 8180 return LISTVIEW_MouseWheel(hwnd, (short int)HIWORD(wParam)); 8181 8182 /* case WM_WINDOWPOSCHANGED: */ 8183 /* case WM_WININICHANGE: */ 8184 8185 default: 8186 //if (uMsg >= WM_USER) 8187 //{ 8188 // ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, 8189 // lParam); 8190 //} 8191 8192 /* call default window procedure */ 8193 return defComCtl32ProcA(hwnd, uMsg, wParam, lParam); 8194 } 8195 8196 return 0; 8197 } 8198 8199 /*** 8200 * DESCRIPTION: 8201 * Registers the window class. 8202 * 8203 * PARAMETER(S): 8204 * None 8205 * 8206 * RETURN: 8207 * None 8208 */ 8209 VOID LISTVIEW_Register(VOID) 8210 { 8211 WNDCLASSA wndClass; 8212 8213 ZeroMemory(&wndClass, sizeof(WNDCLASSA)); 8214 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; 8215 wndClass.lpfnWndProc = (WNDPROC)LISTVIEW_WindowProc; 8216 wndClass.cbClsExtra = 0; 8217 wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *); 8218 wndClass.hCursor = LoadCursorA(0, IDC_ARROWA); 8219 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 8220 wndClass.lpszClassName = WC_LISTVIEWA; 8221 RegisterClassA(&wndClass); 8222 } 8223 8224 /*** 8225 * DESCRIPTION: 8226 * Unregisters the window class. 8227 * 8228 * PARAMETER(S): 8229 * None 8230 * 8231 * RETURN: 8232 * None 8233 */ 8234 VOID LISTVIEW_Unregister(VOID) 8235 { 8236 UnregisterClassA(WC_LISTVIEWA, (HINSTANCE)NULL); 8237 } -
trunk/src/comctl32/nativefont.cpp
r3145 r3182 1 /* $Id: nativefont.cpp,v 1. 2 2000-03-17 17:13:23 cbratschi Exp $ */1 /* $Id: nativefont.cpp,v 1.3 2000-03-21 17:30:43 cbratschi Exp $ */ 2 2 /* 3 3 * Native Font control … … 5 5 * Copyright 1998, 1999 Eric Kohl 6 6 * Copyright 1999 Achim Hasenmueller 7 * Copyright 2000 Christoph Bratschi 7 8 * 8 9 * NOTES … … 53 54 } 54 55 56 static VOID NATIVEFONT_Draw(HWND hwnd,HDC hdc,RECT *updateRect) 57 { 58 drawStubControl(hwnd,hdc); 59 } 55 60 61 static LRESULT NATIVEFONT_Paint(HWND hwnd,WPARAM wParam,LPARAM lParam) 62 { 63 HDC hdc = (HDC)wParam; 56 64 57 static LRESULT WINAPI 58 NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 65 if (!hdc) 66 { 67 PAINTSTRUCT ps; 68 69 hdc = BeginPaint(hwnd,&ps); 70 NATIVEFONT_Draw(hwnd, hdc,&ps.rcPaint); 71 EndPaint(hwnd,&ps); 72 } else 73 NATIVEFONT_Draw(hwnd,hdc,NULL); 74 75 return 0; 76 } 77 78 static LRESULT WINAPI NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 59 79 { 60 switch (uMsg) 61 { 80 switch (uMsg) 81 { 82 case WM_CREATE: 83 return NATIVEFONT_Create(hwnd,wParam,lParam); 62 84 63 case WM_CREATE:64 return NATIVEFONT_Create (hwnd, wParam,lParam);85 case WM_DESTROY: 86 return NATIVEFONT_Destroy(hwnd,wParam,lParam); 65 87 66 case WM_DESTROY:67 return NATIVEFONT_Destroy (hwnd, wParam,lParam);88 case WM_PAINT: 89 return NATIVEFONT_Paint(hwnd,wParam,lParam); 68 90 69 default: 70 // ERR (nativefont, "unknown msg %04x wp=%08x lp=%08lx\n", 71 // uMsg, wParam, lParam); 72 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 73 } 74 return 0; 91 default: 92 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 93 } 94 return 0; 75 95 } 76 96 -
trunk/src/comctl32/pager.cpp
r3145 r3182 1 /* $Id: pager.cpp,v 1. 2 2000-03-17 17:13:23cbratschi Exp $ */1 /* $Id: pager.cpp,v 1.3 2000-03-21 17:30:44 cbratschi Exp $ */ 2 2 /* 3 3 * Pager control … … 201 201 /* allocate memory for info structure */ 202 202 infoPtr = (PAGER_INFO*)initControl(hwnd,sizeof(PAGER_INFO)); 203 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);204 203 205 204 /* set default settings */ … … 277 276 } 278 277 279 278 static VOID PAGER_Draw(HWND hwnd,HDC hdc,RECT *updateRect) 279 { 280 drawStubControl(hwnd,hdc); 281 } 282 283 static LRESULT PAGER_Paint(HWND hwnd,WPARAM wParam,LPARAM lParam) 284 { 285 HDC hdc = (HDC)wParam; 286 287 if (!hdc) 288 { 289 PAINTSTRUCT ps; 290 291 hdc = BeginPaint(hwnd,&ps); 292 PAGER_Draw(hwnd, hdc,&ps.rcPaint); 293 EndPaint(hwnd,&ps); 294 } else 295 PAGER_Draw(hwnd,hdc,NULL); 296 297 return 0; 298 } 280 299 281 300 static LRESULT WINAPI … … 338 357 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 339 358 340 /* case WM_PAINT: */ 341 /* return PAGER_Paint (hwnd, wParam); */ 359 case WM_PAINT: 360 return PAGER_Paint(hwnd,wParam,lParam); 342 361 343 362 case WM_SIZE: … … 345 364 346 365 default: 347 //if (uMsg >= WM_USER)348 //ERR (pager, "unknown msg %04x wp=%08x lp=%08lx\n",349 //uMsg, wParam, lParam);350 366 //if (uMsg >= WM_USER) 367 // ERR (pager, "unknown msg %04x wp=%08x lp=%08lx\n", 368 // uMsg, wParam, lParam); 369 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 351 370 } 352 371 return 0; -
trunk/src/comctl32/rsrc.orc
r3154 r3182 1 /* $Id: rsrc.orc,v 1.3 2000-03-21 17:30:44 cbratschi Exp $ */ 1 2 #include "winuser.h" 2 3 #include "comctl32.h" … … 950 951 VALUE "FileVersion", "4.72.3110.1\0" 951 952 VALUE "InternalName", "COMCTL32\0" 952 VALUE "LegalCopyright", "Copyright (C) 1999 \0"953 VALUE "LegalCopyright", "Copyright (C) 1999-2000\0" 953 954 VALUE "LegalTrademarks", "\0" 954 955 VALUE "OriginalFilename", "COMCTL32.DLL\0" -
trunk/src/comctl32/toolbar.cpp
r3154 r3182 1 /* $Id: toolbar.cpp,v 1. 3 2000-03-18 16:17:31cbratschi Exp $ */1 /* $Id: toolbar.cpp,v 1.4 2000-03-21 17:30:44 cbratschi Exp $ */ 2 2 /* 3 3 * Toolbar control … … 759 759 760 760 tbNotify.iItem = pos; 761 tbNotify.tbButton = (TBBUTTON*)btnPtr; 761 tbNotify.tbButton.iBitmap = btnPtr->iBitmap; 762 tbNotify.tbButton.idCommand = btnPtr->idCommand; 763 tbNotify.tbButton.fsState = btnPtr->fsState; 764 tbNotify.tbButton.fsStyle = btnPtr->fsStyle; 765 tbNotify.tbButton.dwData = btnPtr->dwData; 766 tbNotify.tbButton.iString = btnPtr->iString; 767 762 768 tbNotify.cchText = MAXTOOLNAME; 763 769 if (unicode) … … 843 849 844 850 tbNotify.iItem = i; 845 tbNotify.tbButton = (TBBUTTON*)btnPtr; 851 tbNotify.tbButton.iBitmap = btnPtr->iBitmap; 852 tbNotify.tbButton.idCommand = btnPtr->idCommand; 853 tbNotify.tbButton.fsState = btnPtr->fsState; 854 tbNotify.tbButton.fsStyle = btnPtr->fsStyle; 855 tbNotify.tbButton.dwData = btnPtr->dwData; 856 tbNotify.tbButton.iString = btnPtr->iString; 846 857 tbNotify.cchText = 0; 847 858 tbNotify.pszText = NULL; -
trunk/src/comctl32/tooltips.cpp
r3154 r3182 1 /* $Id: tooltips.cpp,v 1. 4 2000-03-18 16:17:32cbratschi Exp $ */1 /* $Id: tooltips.cpp,v 1.5 2000-03-21 17:30:45 cbratschi Exp $ */ 2 2 /* 3 3 * Tool tip control … … 79 79 } 80 80 81 82 static VOID 83 TOOLTIPS_GetTipText(HWND hwnd,TOOLTIPS_INFO *infoPtr,INT nTool) 81 static VOID TOOLTIPS_GetCallbackText(HWND hwnd,TOOLTIPS_INFO *infoPtr,TTTOOL_INFO *toolPtr) 82 { 83 if (isUnicodeNotify(&infoPtr->header)) 84 { 85 NMTTDISPINFOW ttnmdi; 86 87 /* fill NMHDR struct */ 88 ZeroMemory (&ttnmdi,sizeof(NMTTDISPINFOW)); 89 ttnmdi.hdr.hwndFrom = hwnd; 90 ttnmdi.hdr.idFrom = toolPtr->uId; 91 ttnmdi.hdr.code = TTN_GETDISPINFOW; 92 ttnmdi.lpszText = (WCHAR*)&ttnmdi.szText; 93 ttnmdi.uFlags = toolPtr->uFlags; 94 ttnmdi.lParam = toolPtr->lParam; 95 SendMessageA(toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&ttnmdi); 96 97 if ((ttnmdi.hinst) && (HIWORD((UINT)ttnmdi.lpszText) == 0)) 98 { 99 LoadStringW(ttnmdi.hinst,(UINT)ttnmdi.lpszText,infoPtr->szTipText,INFOTIPSIZE); 100 if (ttnmdi.uFlags & TTF_DI_SETITEM) 101 { 102 toolPtr->hinst = ttnmdi.hinst; 103 toolPtr->lpszText = (LPWSTR)ttnmdi.lpszText; 104 } 105 } else 106 { 107 if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) 108 { 109 if (!HIWORD(ttnmdi.lpszText) && (ttnmdi.lpszText != NULL)) 110 { 111 //error 112 infoPtr->szTipText[0] = '\0'; 113 return; 114 } 115 lstrcpynW(infoPtr->szTipText,ttnmdi.lpszText,INFOTIPSIZE); 116 if (ttnmdi.uFlags & TTF_DI_SETITEM) 117 { 118 INT len = lstrlenW(ttnmdi.lpszText); 119 toolPtr->hinst = 0; 120 toolPtr->lpszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 121 lstrcpyW(toolPtr->lpszText,ttnmdi.lpszText); 122 } 123 } else 124 { 125 //ERR (tooltips, "recursive text callback!\n"); 126 infoPtr->szTipText[0] = '\0'; 127 } 128 } 129 } else 130 { 131 NMTTDISPINFOA ttnmdi; 132 133 /* fill NMHDR struct */ 134 ZeroMemory (&ttnmdi,sizeof(NMTTDISPINFOA)); 135 ttnmdi.hdr.hwndFrom = hwnd; 136 ttnmdi.hdr.idFrom = toolPtr->uId; 137 ttnmdi.hdr.code = TTN_GETDISPINFOA; 138 ttnmdi.lpszText = (CHAR*)&ttnmdi.szText; 139 ttnmdi.uFlags = toolPtr->uFlags; 140 ttnmdi.lParam = toolPtr->lParam; 141 SendMessageA(toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&ttnmdi); 142 143 if ((ttnmdi.hinst) && (HIWORD((UINT)ttnmdi.lpszText) == 0)) 144 { 145 LoadStringW(ttnmdi.hinst,(UINT)ttnmdi.lpszText,infoPtr->szTipText,INFOTIPSIZE); 146 if (ttnmdi.uFlags & TTF_DI_SETITEM) 147 { 148 toolPtr->hinst = ttnmdi.hinst; 149 toolPtr->lpszText = (LPWSTR)ttnmdi.lpszText; 150 } 151 } else 152 { 153 if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) 154 { 155 if (!HIWORD(ttnmdi.lpszText) && (ttnmdi.lpszText != NULL)) 156 { 157 //error 158 infoPtr->szTipText[0] = '\0'; 159 return; 160 } 161 lstrcpynAtoW(infoPtr->szTipText,ttnmdi.lpszText,INFOTIPSIZE); 162 if (ttnmdi.uFlags & TTF_DI_SETITEM) 163 { 164 INT len = lstrlenA(ttnmdi.lpszText); 165 toolPtr->hinst = 0; 166 toolPtr->lpszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 167 lstrcpyAtoW(toolPtr->lpszText,ttnmdi.lpszText); 168 } 169 } else 170 { 171 //ERR (tooltips, "recursive text callback!\n"); 172 infoPtr->szTipText[0] = '\0'; 173 } 174 } 175 } 176 } 177 178 static VOID TOOLTIPS_GetTipText(HWND hwnd,TOOLTIPS_INFO *infoPtr,INT nTool) 84 179 { 85 180 TTTOOL_INFO *toolPtr = &infoPtr->tools[nTool]; … … 93 188 { 94 189 if (toolPtr->lpszText == LPSTR_TEXTCALLBACKW) 95 { 96 NMTTDISPINFOA ttnmdi; 97 98 /* fill NMHDR struct */ 99 ZeroMemory (&ttnmdi,sizeof(NMTTDISPINFOA)); 100 ttnmdi.hdr.hwndFrom = hwnd; 101 ttnmdi.hdr.idFrom = toolPtr->uId; 102 ttnmdi.hdr.code = TTN_GETDISPINFOA; 103 ttnmdi.lpszText = (LPSTR)&ttnmdi.szText; 104 ttnmdi.uFlags = toolPtr->uFlags; 105 ttnmdi.lParam = toolPtr->lParam; 106 SendMessageA (toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&ttnmdi); 107 108 if ((ttnmdi.hinst) && (HIWORD((UINT)ttnmdi.szText) == 0)) 109 { 110 LoadStringW (ttnmdi.hinst,(UINT)ttnmdi.szText,infoPtr->szTipText,INFOTIPSIZE); 111 if (ttnmdi.uFlags & TTF_DI_SETITEM) 112 { 113 toolPtr->hinst = ttnmdi.hinst; 114 toolPtr->lpszText = (LPWSTR)ttnmdi.szText; 115 } 116 } else if (ttnmdi.szText[0]) 117 { 118 lstrcpynAtoW(infoPtr->szTipText,ttnmdi.szText,INFOTIPSIZE); 119 if (ttnmdi.uFlags & TTF_DI_SETITEM) 120 { 121 INT len = lstrlenA(ttnmdi.szText); 122 toolPtr->hinst = 0; 123 toolPtr->lpszText = (WCHAR*)COMCTL32_Alloc((len+1)* sizeof(WCHAR)); 124 lstrcpyAtoW(toolPtr->lpszText,ttnmdi.szText); 125 } 126 } else if (ttnmdi.lpszText == 0) 127 { 128 /* no text available */ 129 infoPtr->szTipText[0] = '\0'; 130 } else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) 131 { 132 lstrcpynAtoW(infoPtr->szTipText,ttnmdi.lpszText,INFOTIPSIZE); 133 if (ttnmdi.uFlags & TTF_DI_SETITEM) 134 { 135 INT len = lstrlenA(ttnmdi.lpszText); 136 toolPtr->hinst = 0; 137 toolPtr->lpszText = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 138 lstrcpyAtoW(toolPtr->lpszText,ttnmdi.lpszText); 139 } 140 } else 141 { 142 //ERR (tooltips, "recursive text callback!\n"); 143 infoPtr->szTipText[0] = '\0'; 144 } 145 } else 190 TOOLTIPS_GetCallbackText(hwnd,infoPtr,toolPtr); 191 else 146 192 { 147 193 /* the item is a usual (unicode) text */ 148 194 lstrcpynW(infoPtr->szTipText,toolPtr->lpszText,INFOTIPSIZE); 149 195 } 150 } 151 else 196 } else 152 197 { 153 198 /* no text available */ 154 199 infoPtr->szTipText[0] = '\0'; 155 200 } 156 157 // TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));158 201 } 159 202 … … 626 669 } 627 670 628 // TRACE (tooltips, "tool %d\n", nTool);629 630 671 return nTool; 631 672 } … … 638 679 639 680 infoPtr->bActive = (BOOL)wParam; 640 641 // if (infoPtr->bActive)642 // TRACE (tooltips, "activate!\n");643 681 644 682 if (!(infoPtr->bActive) && (infoPtr->nCurrentTool != -1)) … … 1228 1266 if (nTool == -1) return 0; 1229 1267 1230 TOOLTIPS_GetTipText(hwnd,infoPtr,nTool); //CB: get text1268 TOOLTIPS_GetTipText(hwnd,infoPtr,nTool); 1231 1269 1232 1270 lstrcpyWtoA(lpToolInfo->lpszText,infoPtr->szTipText); … … 1251 1289 if (nTool == -1) return 0; 1252 1290 1253 TOOLTIPS_GetTipText(hwnd,infoPtr,nTool); //CB: get text1291 TOOLTIPS_GetTipText(hwnd,infoPtr,nTool); 1254 1292 1255 1293 lstrcpyW(lpToolInfo->lpszText,infoPtr->szTipText); -
trunk/src/comctl32/treeview.cpp
r3154 r3182 1 /* $Id: treeview.cpp,v 1. 3 2000-03-18 16:17:34cbratschi Exp $ */1 /* $Id: treeview.cpp,v 1.4 2000-03-21 17:30:46 cbratschi Exp $ */ 2 2 /* Treeview control 3 3 * … … 66 66 static BOOL TREEVIEW_SendTreeviewNotify (HWND hwnd, UINT code, UINT action, HTREEITEM oldItem, HTREEITEM newItem); 67 67 static BOOL TREEVIEW_SendTreeviewDnDNotify (HWND hwnd, UINT code, HTREEITEM dragItem, POINT pt); 68 static BOOL TREEVIEW_SendDispInfoNotify (HWND hwnd, TREEVIEW_ITEM *wineItem, UINT code, UINT what); 68 static INT TREEVIEW_CallbackChildren(HWND hwnd,TREEVIEW_ITEM *wineItem); 69 static INT TREEVIEW_CallbackImage(HWND hwnd,TREEVIEW_ITEM *wineItem); 70 static INT TREEVIEW_CallbackSelectedImage(HWND hwnd,TREEVIEW_ITEM *wineItem); 71 static WCHAR* TREEVIEW_CallbackText(HWND hwnd,TREEVIEW_ITEM *wineItem,BOOL *mustFree); 69 72 static BOOL TREEVIEW_SendCustomDrawNotify (HWND hwnd, DWORD dwDrawStage, HDC hdc, RECT rc); 70 73 static BOOL TREEVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc, TREEVIEW_ITEM *tvItem, UINT uItemDrawState); … … 73 76 static LRESULT TREEVIEW_DoSelectItem(HWND hwnd,INT action,HTREEITEM newSelect,INT cause); 74 77 static void TREEVIEW_Refresh(HWND hwnd); 78 static void TREEVIEW_RefreshItem(HWND hwnd,TREEVIEW_ITEM *item,BOOL wholeLine); 75 79 static void TREEVIEW_Draw(HWND hwnd,HDC hdc,RECT *updateRect); 76 80 static BOOL TREEVIEW_UnqueueRefresh(HWND hwnd,BOOL calc,BOOL refresh); … … 127 131 { 128 132 if (wineItem->cChildren == I_CHILDRENCALLBACK) 129 { 130 TREEVIEW_ITEM tempItem; 131 132 tempItem.hItem = wineItem->hItem; 133 tempItem.state = wineItem->state; 134 tempItem.lParam = wineItem->lParam; 135 136 TREEVIEW_SendDispInfoNotify(hwnd, &tempItem, TVN_GETDISPINFO, TVIF_CHILDREN); 137 cChildren = tempItem.cChildren; 138 } 133 cChildren = TREEVIEW_CallbackChildren(hwnd,wineItem); 139 134 else 140 135 cChildren = wineItem->cChildren; 141 136 } 142 137 else if ( wineItem->firstChild ) … … 328 323 COMCTL32_Free (killItem->pszText); 329 324 killItem->pszText = NULL; 330 TREEVIEW_SendTreeviewNotify (hwnd, TVN_DELETEITEM, 0, (HTREEITEM)kill, 0);325 TREEVIEW_SendTreeviewNotify (hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_DELETEITEMW:TVN_DELETEITEMA, 0, (HTREEITEM)kill, 0); 331 326 if (killItem->firstChild) 332 327 TREEVIEW_RemoveAllChildren (hwnd, killItem); … … 356 351 wineItem->pszText = NULL; 357 352 358 TREEVIEW_SendTreeviewNotify (hwnd, TVN_DELETEITEM, 0, (HTREEITEM)iItem, 0);353 TREEVIEW_SendTreeviewNotify (hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_DELETEITEMW:TVN_DELETEITEMA, 0, (HTREEITEM)iItem, 0); 359 354 360 355 if (wineItem->firstChild) … … 403 398 killItem->pszText = NULL; 404 399 405 TREEVIEW_SendTreeviewNotify 406 (hwnd, TVN_DELETEITEM, 0, killItem->hItem, 0); 400 TREEVIEW_SendTreeviewNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_DELETEITEMW:TVN_DELETEITEMA, 0, killItem->hItem, 0); 407 401 } 408 402 … … 474 468 if (!(GetWindowLongA(hwnd, GWL_STYLE) & TVS_NONEVENHEIGHT)) 475 469 if (infoPtr->uItemHeight & 0x1) infoPtr->uItemHeight++; 470 471 if (prevHeight != infoPtr->uItemHeight) 472 { 473 infoPtr->uInternalStatus |= TV_CALCALL; 474 TREEVIEW_QueueRefresh(hwnd); 475 } 476 476 477 477 return prevHeight; … … 808 808 /* The item is curently selected */ 809 809 if (item->iSelectedImage == I_IMAGECALLBACK) 810 TREEVIEW_SendDispInfoNotify(hwnd, item, TVN_GETDISPINFO, TVIF_SELECTEDIMAGE);811 812 imageIndex = item->iSelectedImage;810 imageIndex = TREEVIEW_CallbackSelectedImage(hwnd,item); 811 else 812 imageIndex = item->iSelectedImage; 813 813 } else 814 814 { 815 815 /* The item is not selected */ 816 816 if (item->iImage == I_IMAGECALLBACK) 817 TREEVIEW_SendDispInfoNotify(hwnd, item, TVN_GETDISPINFO, TVIF_IMAGE);818 819 imageIndex = item->iImage;817 imageIndex = TREEVIEW_CallbackImage(hwnd,item); 818 else 819 imageIndex = item->iImage; 820 820 } 821 821 … … 844 844 HBRUSH hbrBk = 0; 845 845 BOOL inFocus = GetFocus() == hwnd; 846 WCHAR* text; 847 BOOL mustFree = FALSE; 846 848 847 849 oldBkMode = SetBkMode(hdc, TRANSPARENT); … … 879 881 880 882 if (item->pszText == LPSTR_TEXTCALLBACKW) 881 TREEVIEW_SendDispInfoNotify (hwnd, item, TVN_GETDISPINFO, TVIF_TEXT); 883 text = TREEVIEW_CallbackText(hwnd,item,&mustFree); 884 else 885 text = item->pszText; 882 886 883 887 if (hbrBk) … … 890 894 891 895 /* Draw it */ 892 DrawTextW ( hdc, 893 item->pszText, 894 lstrlenW(item->pszText), 895 &item->text, 896 uTextJustify | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); 896 DrawTextW(hdc,text,lstrlenW(text),&item->text,uTextJustify | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); 897 if (mustFree) COMCTL32_Free(text); 897 898 898 899 item->text.left -= 2; … … 1028 1029 TVITEMEXW *tvItem; 1029 1030 INT iItem,len; 1031 BOOL mustRefresh = FALSE; 1032 BOOL mustRepaint = FALSE; 1030 1033 1031 1034 if (infoPtr->hwndEdit) SetFocus(hwnd); … … 1034 1037 iItem = (INT)tvItem->hItem; 1035 1038 1036 wineItem = TREEVIEW_ValidItem (infoPtr,(HTREEITEM)iItem);1039 wineItem = TREEVIEW_ValidItem(infoPtr,(HTREEITEM)iItem); 1037 1040 if (!wineItem) return FALSE; 1038 1041 1039 if (tvItem->mask & TVIF_CHILDREN) 1042 if ((tvItem->mask & TVIF_CHILDREN) && (wineItem->cChildren != tvItem->cChildren)) 1043 { 1040 1044 wineItem->cChildren = tvItem->cChildren; 1041 1042 if (tvItem->mask & TVIF_IMAGE) 1045 mustRefresh = TRUE; 1046 } 1047 1048 if ((tvItem->mask & TVIF_IMAGE) && (wineItem->iImage != tvItem->iImage)) 1049 { 1043 1050 wineItem->iImage = tvItem->iImage; 1044 1045 if (tvItem->mask & TVIF_INTEGRAL) 1051 mustRepaint = TRUE; 1052 } 1053 1054 if ((tvItem->mask & TVIF_INTEGRAL) && (wineItem->iIntegral != tvItem->iIntegral)) 1055 { 1046 1056 wineItem->iIntegral = tvItem->iIntegral; 1057 mustRefresh = TRUE; 1058 } 1047 1059 1048 1060 if (tvItem->mask & TVIF_PARAM) 1049 1061 wineItem->lParam = tvItem->lParam; 1050 1062 1051 if (tvItem->mask & TVIF_SELECTEDIMAGE) 1063 if ((tvItem->mask & TVIF_SELECTEDIMAGE) && (wineItem->iSelectedImage != tvItem->iSelectedImage)) 1064 { 1052 1065 wineItem->iSelectedImage = tvItem->iSelectedImage; 1066 mustRepaint = TRUE; 1067 } 1053 1068 1054 1069 if (tvItem->mask & TVIF_STATE) 1055 1070 { 1071 DWORD oldState = wineItem->state,oldMask = wineItem->stateMask; 1072 1056 1073 wineItem->state &= ~tvItem->stateMask; 1057 1074 wineItem->state |= (tvItem->state & tvItem->stateMask); 1058 1075 wineItem->stateMask |= tvItem->stateMask; 1076 mustRepaint = (oldState != wineItem->state) || (oldMask != wineItem->stateMask); 1059 1077 } 1060 1078 … … 1066 1084 { 1067 1085 len = lstrlenW(tvItem->pszText)+1; 1086 1068 1087 if (len > wineItem->cchTextMax) 1069 1088 { 1070 wineItem->pszText= (WCHAR*)COMCTL32_ReAlloc(wineItem->pszText,len*sizeof(WCHAR)); 1089 if (wineItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(wineItem->pszText); 1090 wineItem->pszText= (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR)); 1071 1091 wineItem->cchTextMax = len; 1072 1092 } 1073 lstrcpy nW(wineItem->pszText,tvItem->pszText,len);1093 lstrcpyW(wineItem->pszText,tvItem->pszText); 1074 1094 } else 1075 1095 { 1076 1096 if (wineItem->cchTextMax) 1077 1097 { 1078 COMCTL32_Free (wineItem->pszText);1098 if (wineItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free (wineItem->pszText); 1079 1099 wineItem->cchTextMax = 0; 1080 1100 } … … 1083 1103 } else 1084 1104 { 1085 LPTVITEMEXA tvItem; 1086 1087 tvItem = (LPTVITEMEXA)lParam; 1088 1089 if (tvItem->pszText != LPSTR_TEXTCALLBACKA) 1090 { 1091 len = lstrlenA (tvItem->pszText) + 1; 1105 if ((LPSTR)tvItem->pszText != LPSTR_TEXTCALLBACKA) 1106 { 1107 len = lstrlenA((LPSTR)tvItem->pszText)+1; 1092 1108 if (len > wineItem->cchTextMax) 1093 1109 { 1094 wineItem->pszText = (WCHAR*)COMCTL32_ReAlloc(wineItem->pszText,len*sizeof(WCHAR)); 1110 if (wineItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(wineItem->pszText); 1111 wineItem->pszText = (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR)); 1095 1112 wineItem->cchTextMax = len; 1096 1113 } 1097 lstrcpy nAtoW(wineItem->pszText,tvItem->pszText,len);1114 lstrcpyAtoW(wineItem->pszText,(LPSTR)tvItem->pszText); 1098 1115 } else 1099 1116 { 1100 1117 if (wineItem->cchTextMax) 1101 1118 { 1102 COMCTL32_Free(wineItem->pszText);1119 if (wineItem->pszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(wineItem->pszText); 1103 1120 wineItem->cchTextMax = 0; 1104 1121 } … … 1106 1123 } 1107 1124 } 1108 } 1109 1110 wineItem->mask |= tvItem->mask; 1111 wineItem->calculated = FALSE; 1112 TREEVIEW_QueueRefresh(hwnd); 1125 mustRepaint = TRUE; 1126 } 1127 1128 if (wineItem->mask != (wineItem->mask | tvItem->mask)) 1129 { 1130 wineItem->mask |= tvItem->mask; 1131 mustRepaint = TRUE; 1132 } 1133 1134 if (mustRepaint || mustRefresh) 1135 { 1136 wineItem->calculated = FALSE; 1137 if (mustRefresh) 1138 TREEVIEW_QueueRefresh(hwnd); 1139 else 1140 TREEVIEW_RefreshItem(hwnd,wineItem,FALSE); 1141 } 1113 1142 1114 1143 return TRUE; … … 1153 1182 1154 1183 //redraw text and image 1155 if ((( item->mask &(TVIF_IMAGE | TVIF_SELECTEDIMAGE)) || (dwStyle & TVS_CHECKBOXES)) && (item->iSelectedImage != item->iImage))1184 if ((((item->mask & (TVIF_IMAGE | TVIF_SELECTEDIMAGE)) == (TVIF_IMAGE | TVIF_SELECTEDIMAGE)) || (dwStyle & TVS_CHECKBOXES)) && (item->iSelectedImage != item->iImage)) 1156 1185 { 1157 1186 rect.left += TREEVIEW_LEFT_MARGIN; … … 1265 1294 UINT uTextJustify = DT_LEFT; 1266 1295 HFONT hOldFont; 1296 WCHAR* text; 1297 BOOL mustFree = FALSE; 1267 1298 1268 1299 r.left += 3; … … 1275 1306 1276 1307 if (item->pszText == LPSTR_TEXTCALLBACKW) 1277 TREEVIEW_SendDispInfoNotify (hwnd, item, TVN_GETDISPINFO, TVIF_TEXT); 1308 text = TREEVIEW_CallbackText(hwnd,item,&mustFree); 1309 else 1310 text = item->pszText; 1278 1311 1279 1312 if (!hdc) … … 1289 1322 1290 1323 /* Obtain the text coordinate */ 1291 DrawTextW ( 1292 hdc, 1293 item->pszText, 1294 lstrlenW(item->pszText), 1295 &item->text, 1296 uTextJustify | DT_VCENTER | DT_SINGLELINE | DT_CALCRECT | DT_NOPREFIX); 1324 DrawTextW (hdc,text,lstrlenW(text),&item->text,uTextJustify | DT_VCENTER | DT_SINGLELINE | DT_CALCRECT | DT_NOPREFIX); 1325 if (mustFree) COMCTL32_Free(text); 1297 1326 1298 1327 SelectObject(hdc,hOldFont); … … 1583 1612 TREEVIEW_DrawItem(hwnd,hdc,item,dwStyle,infoPtr); 1584 1613 visFound = TRUE; 1585 } 1614 } else if (updateRect && (item->rect.top >= updateRect->bottom)) break; 1586 1615 } else if (visFound) break; 1587 1616 if (!visFound && (dwStyle & TVS_HASLINES) && (dwStyle & TVS_LINESATROOT)) … … 1691 1720 infoPtr->Timer &= ~TV_REFRESH_TIMER_SET; 1692 1721 if (calc) TREEVIEW_CalcItems(hwnd,0,infoPtr); 1693 if (refresh) TREEVIEW_Refresh(hwnd); 1722 if (refresh) 1723 { 1724 TREEVIEW_Refresh(hwnd); 1725 UpdateWindow(hwnd); 1726 } 1694 1727 1695 1728 return TRUE; … … 1720 1753 1721 1754 if (tvItem->mask & TVIF_IMAGE) 1722 tvItem->iImage = wineItem->iImage; 1755 { 1756 if (wineItem->iImage == I_IMAGECALLBACK) 1757 tvItem->iImage = TREEVIEW_CallbackImage(hwnd,wineItem); 1758 else 1759 tvItem->iImage = wineItem->iImage; 1760 } 1723 1761 1724 1762 if (tvItem->mask & TVIF_INTEGRAL) … … 1730 1768 1731 1769 if (tvItem->mask & TVIF_SELECTEDIMAGE) 1732 tvItem->iSelectedImage = wineItem->iSelectedImage; 1770 { 1771 if (wineItem->iSelectedImage == I_IMAGECALLBACK) 1772 tvItem->iSelectedImage = TREEVIEW_CallbackSelectedImage(hwnd,wineItem); 1773 else 1774 tvItem->iSelectedImage = wineItem->iSelectedImage; 1775 } 1733 1776 1734 1777 if (tvItem->mask & TVIF_STATE) … … 1737 1780 if (tvItem->mask & TVIF_TEXT) 1738 1781 { 1782 WCHAR* text; 1783 BOOL mustFree = FALSE; 1784 1739 1785 if (wineItem->pszText == LPSTR_TEXTCALLBACKW) 1740 TREEVIEW_SendDispInfoNotify(hwnd,wineItem,TVN_GETDISPINFO,TVIF_TEXT); 1786 text = TREEVIEW_CallbackText(hwnd,wineItem,&mustFree); 1787 else 1788 text = wineItem->pszText; 1789 1741 1790 if (unicode) 1742 { 1743 if (wineItem->pszText == LPSTR_TEXTCALLBACKW) 1744 tvItem->pszText = LPSTR_TEXTCALLBACKW; 1745 else if (wineItem->pszText) 1746 lstrcpynW(tvItem->pszText,wineItem->pszText,tvItem->cchTextMax); 1747 } else 1748 { 1749 LPTVITEMEXA tvItem = (LPTVITEMEXA)lParam; 1750 1751 if (wineItem->pszText == LPSTR_TEXTCALLBACKW) 1752 tvItem->pszText = LPSTR_TEXTCALLBACKA; 1753 else if (wineItem->pszText) 1754 lstrcpynWtoA(tvItem->pszText, wineItem->pszText,tvItem->cchTextMax); 1755 } 1791 lstrcpynW(tvItem->pszText,text,tvItem->cchTextMax); 1792 else 1793 lstrcpynWtoA((LPSTR)tvItem->pszText,text,tvItem->cchTextMax); 1794 if (mustFree) COMCTL32_Free(text); 1756 1795 } 1757 1796 … … 1974 2013 WCHAR *txt1,*txt2; 1975 2014 TREEVIEW_ITEM *item; 1976 1977 item = (TREEVIEW_ITEM *) first; 2015 INT res; 2016 BOOL mustFree1 = FALSE,mustFree2 = FALSE; 2017 2018 item = (TREEVIEW_ITEM*)first; 1978 2019 if (item->pszText == LPSTR_TEXTCALLBACKW) 1979 TREEVIEW_SendDispInfoNotify (hwnd, item, TVN_GETDISPINFO, TVIF_TEXT);1980 1981 txt1 = item->pszText;1982 1983 item = (TREEVIEW_ITEM *)second;2020 txt1 = TREEVIEW_CallbackText(hwnd,item,&mustFree1); 2021 else 2022 txt1 = item->pszText; 2023 2024 item = (TREEVIEW_ITEM*)second; 1984 2025 if (item->pszText == LPSTR_TEXTCALLBACKW) 1985 TREEVIEW_SendDispInfoNotify (hwnd, item, TVN_GETDISPINFO, TVIF_TEXT); 1986 1987 txt2 = item->pszText; 1988 1989 return lstrcmpiW(txt1,txt2); //CB: or lstrcmpW? 2026 txt2 = TREEVIEW_CallbackText(hwnd,item,&mustFree2); 2027 else 2028 txt2 = item->pszText; 2029 2030 res = lstrcmpiW(txt1,txt2); //CB: or lstrcmpW? 2031 if (mustFree1) COMCTL32_Free(txt1); 2032 if (mustFree2) COMCTL32_Free(txt2); 2033 2034 return res; 1990 2035 } 1991 2036 … … 2149 2194 static LRESULT 2150 2195 TREEVIEW_InsertItem(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode) 2151 2152 2196 { 2153 2197 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); … … 2218 2262 */ 2219 2263 tvItem = &ptdi->itemex; 2220 wineItem =&infoPtr->items[iItem];2264 wineItem = &infoPtr->items[iItem]; 2221 2265 2222 2266 if ((ptdi->hParent==TVI_ROOT) || (ptdi->hParent==0)) { … … 2252 2296 if (tvItem->pszText != LPSTR_TEXTCALLBACKW) 2253 2297 { 2254 //TRACE (treeview,"(%p,%s)\n", &tvItem->pszText, tvItem->pszText);2255 2298 len = lstrlenW(tvItem->pszText)+1; 2256 2299 wineItem->pszText = (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR)); … … 2259 2302 } else 2260 2303 { 2261 //TRACE (treeview,"LPSTR_TEXTCALLBACK\n");2262 2304 wineItem->pszText = LPSTR_TEXTCALLBACKW; 2263 2305 wineItem->cchTextMax = 0; … … 2265 2307 } else 2266 2308 { 2267 TVITEMEXA *tvItemA = (LPTVITEMEXA)tvItem; 2268 2269 if (tvItemA->pszText != LPSTR_TEXTCALLBACKA) 2270 { 2271 //TRACE (treeview,"(%p,%s)\n", &tvItem->pszText, tvItem->pszText); 2272 len = lstrlenA(tvItemA->pszText)+1; 2273 wineItem->pszText= (WCHAR*)COMCTL32_Alloc (len*sizeof(WCHAR)); 2274 lstrcpyAtoW (wineItem->pszText, tvItemA->pszText); 2309 if ((LPSTR)tvItem->pszText != LPSTR_TEXTCALLBACKA) 2310 { 2311 len = lstrlenA((LPSTR)tvItem->pszText)+1; 2312 wineItem->pszText = (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR)); 2313 lstrcpyAtoW (wineItem->pszText,(LPSTR)tvItem->pszText); 2275 2314 wineItem->cchTextMax = len; 2276 2315 } else 2277 2316 { 2278 //TRACE (treeview,"LPSTR_TEXTCALLBACK\n");2279 2317 wineItem->pszText = LPSTR_TEXTCALLBACKW; 2280 2318 wineItem->cchTextMax = 0; … … 2309 2347 { 2310 2348 TREEVIEW_ITEM *aChild; 2311 2312 2349 TREEVIEW_ITEM *previousChild = NULL; 2313 2350 BOOL bItemInserted = FALSE; 2351 WCHAR* text; 2352 BOOL mustFree = FALSE; 2314 2353 2315 2354 if (parentItem) … … 2319 2358 2320 2359 /* lookup the text if using LPSTR_TEXTCALLBACKs */ 2321 if (wineItem->pszText==LPSTR_TEXTCALLBACKW) { 2322 TREEVIEW_SendDispInfoNotify (hwnd, wineItem, TVN_GETDISPINFO, TVIF_TEXT); 2323 } 2360 if (wineItem->pszText == LPSTR_TEXTCALLBACKW) 2361 text = TREEVIEW_CallbackText(hwnd,wineItem,&mustFree); 2362 else 2363 text = wineItem->pszText; 2324 2364 2325 2365 /* Iterate the parent children to see where we fit in */ … … 2327 2367 { 2328 2368 INT comp; 2369 WCHAR* text2; 2370 BOOL mustFree2 = FALSE; 2329 2371 2330 2372 /* lookup the text if using LPSTR_TEXTCALLBACKs */ 2331 if (aChild->pszText==LPSTR_TEXTCALLBACKW) { 2332 TREEVIEW_SendDispInfoNotify (hwnd, aChild, TVN_GETDISPINFO, TVIF_TEXT); 2333 } 2334 2335 comp = lstrcmpW(wineItem->pszText, aChild->pszText); 2373 if (aChild->pszText == LPSTR_TEXTCALLBACKW) 2374 text2 = TREEVIEW_CallbackText(hwnd,aChild,&mustFree2); 2375 else 2376 text2 = aChild->pszText; 2377 2378 comp = lstrcmpW(text,text2); 2379 if (mustFree2) COMCTL32_Free(text2); 2336 2380 if ( comp < 0 ) /* we are smaller than the current one */ 2337 2381 { … … 2361 2405 } 2362 2406 } 2407 if (mustFree) COMCTL32_Free(text); 2363 2408 2364 2409 /* … … 2481 2526 if (newIndent != infoPtr->uIndent) 2482 2527 { 2483 infoPtr->uIndent =newIndent;2528 infoPtr->uIndent = newIndent; 2484 2529 infoPtr->uInternalStatus |= TV_CALCALL; 2485 2530 TREEVIEW_QueueRefresh(hwnd); … … 2780 2825 TREEVIEW_Paint (HWND hwnd, WPARAM wParam, LPARAM lParam) 2781 2826 { 2782 HDC hdc; 2827 HDC hdc = (HDC)wParam; 2828 2829 if (!hdc) 2830 { 2783 2831 PAINTSTRUCT ps; 2784 2832 2785 hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; 2786 TREEVIEW_Draw(hwnd,hdc,&ps.rcPaint); 2787 if(!wParam) 2788 EndPaint (hwnd, &ps); 2789 2790 return 0; 2833 hdc = BeginPaint(hwnd,&ps); 2834 TREEVIEW_Draw(hwnd, hdc,&ps.rcPaint); 2835 EndPaint(hwnd,&ps); 2836 } else 2837 TREEVIEW_Draw(hwnd,hdc,NULL); 2838 2839 return 0; 2791 2840 } 2792 2841 … … 2853 2902 2854 2903 static BOOL 2855 TREEVIEW_SendTreeviewNotify (HWND hwnd, UINT code, UINT action, 2856 HTREEITEM oldItem, HTREEITEM newItem) 2904 TREEVIEW_SendTreeviewNotify (HWND hwnd,UINT code,UINT action,HTREEITEM oldItem,HTREEITEM newItem) 2857 2905 { 2858 2906 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); … … 2875 2923 if (!isUnicodeNotify(&infoPtr->header)) 2876 2924 { 2877 if (!wineItem->pszText ) nmhdr.itemOld.pszText = NULL; else2925 if (!wineItem->pszText || (wineItem->pszText == LPSTR_TEXTCALLBACKW)) nmhdr.itemOld.pszText = NULL; else 2878 2926 { 2879 2927 INT len = lstrlenW(wineItem->pszText)+1; … … 2901 2949 if (!isUnicodeNotify(&infoPtr->header)) 2902 2950 { 2903 if (!wineItem->pszText ) nmhdr.itemNew.pszText = NULL; else2951 if (!wineItem->pszText || (wineItem->pszText == LPSTR_TEXTCALLBACKW)) nmhdr.itemNew.pszText = NULL; else 2904 2952 { 2905 2953 INT len = lstrlenW(wineItem->pszText)+1; … … 2950 2998 } 2951 2999 2952 static BOOL 2953 TREEVIEW_SendDispInfoNotify (HWND hwnd, TREEVIEW_ITEM *wineItem, UINT code, UINT what) 3000 static INT TREEVIEW_CallbackImage(HWND hwnd,TREEVIEW_ITEM *wineItem) 3001 { 3002 NMTVDISPINFOW tvdi; 3003 BOOL retval; 3004 3005 tvdi.item.mask = TVIF_IMAGE; 3006 tvdi.item.hItem = wineItem->hItem; 3007 tvdi.item.state = wineItem->state; 3008 tvdi.item.lParam = wineItem->lParam; 3009 tvdi.item.iImage = 0; 3010 3011 retval = (BOOL)sendNotify(hwnd,isUnicodeNotify(hwnd) ? TVN_GETDISPINFOW:TVN_GETDISPINFOA,&tvdi.hdr); 3012 3013 if (tvdi.item.mask & TVIF_DI_SETITEM) 3014 wineItem->iImage = tvdi.item.iImage; 3015 3016 return tvdi.item.iImage; 3017 } 3018 3019 static INT TREEVIEW_CallbackSelectedImage(HWND hwnd,TREEVIEW_ITEM *wineItem) 3020 { 3021 NMTVDISPINFOW tvdi; 3022 BOOL retval; 3023 3024 tvdi.item.mask = TVIF_SELECTEDIMAGE; 3025 tvdi.item.hItem = wineItem->hItem; 3026 tvdi.item.state = wineItem->state; 3027 tvdi.item.lParam = wineItem->lParam; 3028 tvdi.item.iSelectedImage = 0; 3029 3030 retval = (BOOL)sendNotify(hwnd,isUnicodeNotify(hwnd) ? TVN_GETDISPINFOW:TVN_GETDISPINFOA,&tvdi.hdr); 3031 3032 if (tvdi.item.mask & TVIF_DI_SETITEM) 3033 wineItem->iSelectedImage = tvdi.item.iSelectedImage; 3034 3035 return tvdi.item.iSelectedImage; 3036 } 3037 3038 static WCHAR* TREEVIEW_CallbackText(HWND hwnd,TREEVIEW_ITEM *wineItem,BOOL *mustFree) 2954 3039 { 2955 3040 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); … … 2958 3043 WCHAR *buf; 2959 3044 2960 tvdi.item.mask = what;3045 tvdi.item.mask = TVIF_TEXT; 2961 3046 tvdi.item.hItem = wineItem->hItem; 2962 3047 tvdi.item.state = wineItem->state; 2963 3048 tvdi.item.lParam = wineItem->lParam; 2964 tvdi.item.pszText = (WCHAR*)COMCTL32_Alloc(128*(isUnicodeNotify(&infoPtr->header) ? sizeof(WCHAR):sizeof( char)));2965 tvdi.item.cchTextMax = 128;3049 tvdi.item.pszText = (WCHAR*)COMCTL32_Alloc(128*(isUnicodeNotify(&infoPtr->header) ? sizeof(WCHAR):sizeof(CHAR))); 3050 tvdi.item.cchTextMax = 128; 2966 3051 buf = tvdi.item.pszText; 2967 3052 2968 retval = (BOOL)sendNotify(hwnd,code,&tvdi.hdr); 2969 2970 /* Ignore posible changes */ 2971 if (code == TVN_BEGINLABELEDIT) 2972 return retval; 2973 2974 if (what & TVIF_TEXT) 2975 { 2976 if (isUnicodeNotify(&infoPtr->header)) 3053 retval = (BOOL)sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_GETDISPINFOW:TVN_GETDISPINFOA,&tvdi.hdr); 3054 3055 if (tvdi.item.pszText == LPSTR_TEXTCALLBACKW) 3056 { 3057 *mustFree = FALSE; 3058 return NULL; 3059 } 3060 3061 if (isUnicodeNotify(&infoPtr->header)) 3062 { 3063 if (tvdi.item.mask & TVIF_DI_SETITEM) 2977 3064 { 2978 3065 wineItem->pszText = tvdi.item.pszText; … … 2982 3069 } else 2983 3070 { 2984 // TRACE (treeview,"user-supplied buffer\n");3071 //user-supplied buffer 2985 3072 COMCTL32_Free(buf); 2986 3073 wineItem->cchTextMax = 0; 2987 3074 } 3075 *mustFree = FALSE; 3076 return wineItem->pszText; 2988 3077 } else 2989 3078 { 3079 if (buf != tvdi.item.pszText) 3080 { 3081 COMCTL32_Free(buf); 3082 *mustFree = FALSE; 3083 } else *mustFree = TRUE; 3084 return tvdi.item.pszText; 3085 } 3086 } else 3087 { 3088 if (tvdi.item.mask & TVIF_DI_SETITEM) 3089 { 2990 3090 if (buf == tvdi.item.pszText) 2991 3091 { 2992 COMCTL32_Free(wineItem->pszText);2993 3092 wineItem->cchTextMax = 128; 2994 3093 wineItem->pszText = (WCHAR*)COMCTL32_Alloc(128*sizeof(WCHAR)); … … 2997 3096 } else 2998 3097 { 2999 // TRACE (treeview,"user-supplied buffer\n");3098 //user-supplied buffer 3000 3099 COMCTL32_Free(buf); 3001 3100 wineItem->cchTextMax = 0; 3002 3101 } 3102 *mustFree = FALSE; 3103 return wineItem->pszText; 3104 } else 3105 { 3106 INT len = lstrlenA((LPSTR)tvdi.item.pszText); 3107 WCHAR* textW = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 3108 3109 lstrcpyAtoW(textW,(LPSTR)tvdi.item.pszText); 3110 COMCTL32_Free(buf); 3111 *mustFree = TRUE; 3112 return textW; 3003 3113 } 3004 3114 } 3005 3006 if (what & TVIF_SELECTEDIMAGE) 3007 wineItem->iSelectedImage = tvdi.item.iSelectedImage; 3008 if (what & TVIF_IMAGE) 3009 wineItem->iImage = tvdi.item.iImage; 3010 if (what & TVIF_CHILDREN) 3011 wineItem->cChildren = tvdi.item.cChildren; 3012 3013 return retval; 3115 } 3116 3117 static INT TREEVIEW_CallbackChildren(HWND hwnd,TREEVIEW_ITEM *wineItem) 3118 { 3119 NMTVDISPINFOW tvdi; 3120 BOOL retval; 3121 3122 tvdi.item.mask = TVIF_CHILDREN; 3123 tvdi.item.hItem = wineItem->hItem; 3124 tvdi.item.state = wineItem->state; 3125 tvdi.item.lParam = wineItem->lParam; 3126 tvdi.item.cChildren = 0; 3127 3128 retval = (BOOL)sendNotify(hwnd,isUnicodeNotify(hwnd) ? TVN_GETDISPINFOW:TVN_GETDISPINFOA,&tvdi.hdr); 3129 3130 if (tvdi.item.mask & TVIF_DI_SETITEM) 3131 wineItem->cChildren = tvdi.item.cChildren; 3132 3133 return tvdi.item.cChildren; 3014 3134 } 3015 3135 … … 3162 3282 3163 3283 /* this item has never been expanded */ 3164 if (TREEVIEW_SendTreeviewNotify(hwnd, TVN_ITEMEXPANDING,TVE_EXPAND,0,(HTREEITEM)expand))3284 if (TREEVIEW_SendTreeviewNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_ITEMEXPANDINGW:TVN_ITEMEXPANDINGA,TVE_EXPAND,0,(HTREEITEM)expand)) 3165 3285 return FALSE; 3166 3286 … … 3186 3306 //TRACE(treeview, " TVN_ITEMEXPANDING sent...\n"); 3187 3307 3188 TREEVIEW_SendTreeviewNotify ( 3189 hwnd, 3190 TVN_ITEMEXPANDED, 3191 TVE_EXPAND, 3192 0, 3193 (HTREEITEM)expand); 3308 TREEVIEW_SendTreeviewNotify (hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_ITEMEXPANDEDW:TVN_ITEMEXPANDEDA,TVE_EXPAND,0,(HTREEITEM)expand); 3194 3309 3195 3310 //TRACE(treeview, " TVN_ITEMEXPANDED sent...\n"); … … 3321 3436 HFONT hOldFont = 0; 3322 3437 TEXTMETRICA textMetric; 3438 WCHAR* textW; 3439 CHAR* textA = NULL; 3440 BOOL mustFree = FALSE; 3441 NMTVDISPINFOW tvdi; 3323 3442 3324 3443 if (!editItem) … … 3333 3452 3334 3453 if (editItem->pszText == LPSTR_TEXTCALLBACKW) 3335 TREEVIEW_SendDispInfoNotify (hwnd, editItem, TVN_GETDISPINFO, TVIF_TEXT); 3454 textW = TREEVIEW_CallbackText(hwnd,editItem,&mustFree); 3455 else 3456 textW = editItem->pszText; 3336 3457 3337 3458 hdc = GetDC(hwnd); … … 3343 3464 3344 3465 /*Get String Lenght in pixels */ 3345 GetTextExtentPoint32W(hdc, editItem->pszText, lstrlenW(editItem->pszText),&sz);3466 GetTextExtentPoint32W(hdc,textW,lstrlenW(textW),&sz); 3346 3467 3347 3468 /*Add Extra spacing for the next character */ … … 3372 3493 (DWORD) TREEVIEW_Edit_SubclassProc); 3373 3494 3374 if (TREEVIEW_SendDispInfoNotify (hwnd, editItem, TVN_BEGINLABELEDIT, 3375 editItem->mask & (TVIF_HANDLE|TVIF_TEXT|TVIF_STATE|TVIF_PARAM))) 3495 tvdi.item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE | TVIF_PARAM; 3496 tvdi.item.hItem = editItem->hItem; 3497 tvdi.item.state = editItem->state; 3498 tvdi.item.lParam = editItem->lParam; 3499 if (isUnicodeNotify(&infoPtr->header)) 3500 { 3501 tvdi.item.pszText = textW; 3502 } else 3503 { 3504 textA = HEAP_strdupWtoA(GetProcessHeap(),0,textW); 3505 tvdi.item.pszText = (LPWSTR)textA; 3506 } 3507 3508 if (sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_BEGINLABELEDITW:TVN_BEGINLABELEDITA,&tvdi.hdr)) 3376 3509 { 3377 3510 DestroyWindow(infoPtr->hwndEdit); 3378 3511 infoPtr->hwndEdit = 0; 3512 if (mustFree) COMCTL32_Free(textW); 3513 if (textA) COMCTL32_Free(textA); 3379 3514 3380 3515 return (HWND)0; 3381 3516 } 3517 if (textA) HeapFree(GetProcessHeap(),0,textA); 3382 3518 3383 3519 infoPtr->editItem = hItem; 3384 SetWindowTextW(infoPtr->hwndEdit, editItem->pszText);3520 SetWindowTextW(infoPtr->hwndEdit,textW); 3385 3521 SetFocus(infoPtr->hwndEdit); 3386 3522 SendMessageA(infoPtr->hwndEdit, EM_SETSEL, 0, -1); 3387 3523 ShowWindow(infoPtr->hwndEdit, SW_SHOW); 3524 if (mustFree) COMCTL32_Free(textW); 3388 3525 3389 3526 return infoPtr->hwndEdit; … … 3392 3529 3393 3530 LRESULT WINAPI 3394 TREEVIEW_EndEditLabelNow (HWND hwnd,BOOL bCancel)3531 TREEVIEW_EndEditLabelNow(HWND hwnd,BOOL bCancel) 3395 3532 { 3396 3533 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); … … 3416 3553 iLength = GetWindowTextW(infoPtr->hwndEdit,textW,1023); 3417 3554 3418 //if (iLength >= 1023)3419 //{3420 // ERR("Insuficient space to retrieve new item label.");3421 //}3422 3423 3555 if (isUnicodeNotify(&infoPtr->header)) tvdi.item.pszText = textW; else 3424 3556 { 3425 3557 INT len = iLength+1; 3426 3558 3427 textA = (CHAR*)COMCTL32_Alloc(len );3559 textA = (CHAR*)COMCTL32_Alloc(len*sizeof(CHAR)); 3428 3560 lstrcpynWtoA(textA,textW,len); 3429 3561 tvdi.item.pszText = (WCHAR*)textA; 3430 3562 } 3431 3563 tvdi.item.cchTextMax = iLength + 1; 3432 } 3433 else 3434 { 3435 tvdi.item.pszText = NULL; 3436 tvdi.item.cchTextMax = 0; 3437 } 3438 3439 bCommit = (BOOL)sendNotify(hwnd,TVN_ENDLABELEDIT,&tvdi.hdr); 3564 } else 3565 { 3566 tvdi.item.pszText = NULL; 3567 tvdi.item.cchTextMax = 0; 3568 } 3569 3570 bCommit = (BOOL)sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_ENDLABELEDITW:TVN_ENDLABELEDITA,&tvdi.hdr); 3440 3571 3441 3572 if (!bCancel && bCommit) /* Apply the changes */ 3442 3573 { 3574 WCHAR* text; 3575 BOOL mustFree = FALSE; 3576 3443 3577 if (!isUnicodeNotify(&infoPtr->header)) 3444 3578 lstrcpynAtoW(textW,textA,iLength+1); 3445 if (lstrcmpW(textW,editedItem->pszText) != 0) 3446 { 3447 if(NULL == COMCTL32_ReAlloc(editedItem->pszText,(iLength+1)*sizeof(WCHAR))) 3448 { 3449 //ERR("OutOfMemory, cannot allocate space for label"); 3450 DestroyWindow(infoPtr->hwndEdit); 3451 infoPtr->hwndEdit = 0; 3452 if (textA) COMCTL32_Free(textA); 3453 if (textW) COMCTL32_Free(textW); 3454 3455 return FALSE; 3456 } 3457 else 3458 { 3459 editedItem->cchTextMax = iLength + 1; 3460 lstrcpyW( editedItem->pszText,textW); 3579 3580 if (editedItem->pszText == LPSTR_TEXTCALLBACKW) 3581 text = TREEVIEW_CallbackText(hwnd,editedItem,&mustFree); 3582 else 3583 text = editedItem->pszText; 3584 3585 if (lstrcmpW(textW,text) != 0) 3586 { 3587 if (editedItem->pszText == LPSTR_TEXTCALLBACKW) 3588 { 3589 NMTVDISPINFOW tvdi; 3590 BOOL retval; 3591 3592 tvdi.item.mask = TVIF_TEXT; 3593 tvdi.item.hItem = editedItem->hItem; 3594 tvdi.item.state = editedItem->state; 3595 tvdi.item.lParam = editedItem->lParam; 3596 if (isUnicodeNotify(&infoPtr->header)) 3597 { 3598 tvdi.item.pszText = textW; 3599 tvdi.item.cchTextMax = lstrlenW(textW); 3600 } else 3601 { 3602 tvdi.item.pszText = (LPWSTR)textA; 3603 tvdi.item.cchTextMax = lstrlenA(textA); 3604 } 3605 3606 retval = (BOOL)sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_SETDISPINFOW:TVN_SETDISPINFOA,&tvdi.hdr); 3607 } else 3608 { 3609 if(NULL == COMCTL32_ReAlloc(text,(iLength+1)*sizeof(WCHAR))) 3610 { 3611 //ERR("OutOfMemory, cannot allocate space for label"); 3612 DestroyWindow(infoPtr->hwndEdit); 3613 infoPtr->hwndEdit = 0; 3614 if (textA) COMCTL32_Free(textA); 3615 if (textW) COMCTL32_Free(textW); 3616 if (mustFree) COMCTL32_Free(text); 3617 3618 return FALSE; 3619 } else 3620 { 3621 editedItem->cchTextMax = iLength + 1; 3622 lstrcpyW(editedItem->pszText,textW); 3623 } 3461 3624 } 3462 3625 } 3626 if (mustFree) COMCTL32_Free(text); 3463 3627 } 3464 3628 … … 3580 3744 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 3581 3745 LPWSTR text; 3746 BOOL mustFree = FALSE; 3582 3747 TTTOOLINFOW ti; 3583 3748 POINT pt; … … 3586 3751 { 3587 3752 NMTVGETINFOTIPW tvgit; 3588 3589 tvgit.pszText = (WCHAR*)COMCTL32_Alloc(isUnicodeNotify(&infoPtr->header) ? INFOTIPSIZE*sizeof(WCHAR):INFOTIPSIZE*sizeof(CHAR)); 3753 WCHAR* buf = (WCHAR*)COMCTL32_Alloc(isUnicodeNotify(&infoPtr->header) ? INFOTIPSIZE*sizeof(WCHAR):INFOTIPSIZE*sizeof(CHAR)); 3754 3755 tvgit.pszText = buf; 3590 3756 tvgit.cchTextMax = INFOTIPSIZE; 3591 3757 tvgit.hItem = item->hItem; … … 3595 3761 if (isUnicodeNotify(&infoPtr->header)) 3596 3762 { 3763 if (buf != tvgit.pszText) COMCTL32_Free(buf); else mustFree = TRUE; 3597 3764 text = tvgit.pszText; 3598 3765 } else … … 3600 3767 text = (WCHAR*)COMCTL32_Alloc(tvgit.cchTextMax*sizeof(WCHAR)); 3601 3768 lstrcpyAtoW(text,(LPSTR)tvgit.pszText); 3769 COMCTL32_Free(buf); 3602 3770 } 3603 3771 } else 3604 3772 { 3605 3773 if (item->pszText == LPSTR_TEXTCALLBACKW) 3606 TREEVIEW_SendDispInfoNotify(hwnd,item,TVN_GETDISPINFO,TVIF_TEXT);3607 3608 text = item->pszText;3774 text = TREEVIEW_CallbackText(hwnd,item,&mustFree); 3775 else 3776 text = item->pszText; 3609 3777 } 3610 3778 #if 0 //CB: not yet … … 3622 3790 SendMessageA(infoPtr->hwndToolTip,TTM_TRACKACTIVATE,(WPARAM)TRUE,(LPARAM)&ti); 3623 3791 #endif 3624 if ( text != item->pszText) COMCTL32_Free(text);3792 if (mustFree) COMCTL32_Free(text); 3625 3793 } 3626 3794 … … 3673 3841 if (TREEVIEW_TrackMouse(hwnd, ht.pt)) 3674 3842 { 3675 TREEVIEW_SendTreeviewDnDNotify (hwnd, TVN_BEGINDRAG, ht.hItem, ht.pt);3843 TREEVIEW_SendTreeviewDnDNotify (hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_BEGINDRAGW:TVN_BEGINDRAGA, ht.hItem, ht.pt); 3676 3844 infoPtr->dropItem = ht.hItem; 3677 3845 return 0; … … 3745 3913 if (ht.hItem) 3746 3914 { 3747 TREEVIEW_SendTreeviewDnDNotify (hwnd, TVN_BEGINRDRAG, ht.hItem, ht.pt);3915 TREEVIEW_SendTreeviewDnDNotify (hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_BEGINRDRAGW:TVN_BEGINDRAGA, ht.hItem, ht.pt); 3748 3916 infoPtr->dropItem = ht.hItem; 3749 3917 } … … 3784 3952 TREEVIEW_CreateDragImage (HWND hwnd, WPARAM wParam, LPARAM lParam) 3785 3953 { 3786 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);3787 TREEVIEW_ITEM *dragItem;3788 INT cx,cy;3789 HDC hdc,htopdc;3790 HWND hwtop;3791 HBITMAP hbmp,hOldbmp;3792 SIZE size;3793 RECT rc;3794 HFONT hOldFont;3795 WCHAR*itemtxt;3796 3797 // TRACE (treeview,"\n"); 3798 if (!(infoPtr->himlNormal)) return 0;3799 dragItem=TREEVIEW_ValidItem (infoPtr, (HTREEITEM) lParam);3800 3801 if (!dragItem) return 0;3802 3803 if (dragItem->pszText==LPSTR_TEXTCALLBACKW) {3804 TREEVIEW_SendDispInfoNotify (hwnd, dragItem, TVN_GETDISPINFO, TVIF_TEXT);3805 }3806 itemtxt=dragItem->pszText;3807 3808 hwtop=GetDesktopWindow();3809 htopdc= GetDC(hwtop);3810 hdc=CreateCompatibleDC(htopdc);3811 3812 hOldFont=SelectObject (hdc, infoPtr->hFont);3813 GetTextExtentPoint32W (hdc, itemtxt, lstrlenW (itemtxt), &size);3814 3815 hbmp=CreateCompatibleBitmap (htopdc, size.cx, size.cy);3816 hOldbmp=SelectObject (hdc, hbmp);3817 3818 ImageList_GetIconSize (infoPtr->himlNormal, &cx, &cy);3819 size.cx+=cx;3820 if (cy>size.cy) size.cy=cy;3821 3822 infoPtr->dragList=ImageList_Create (size.cx, size.cy, ILC_COLOR, 10, 10);3823 ImageList_Draw (infoPtr->himlNormal, dragItem->iImage, hdc, 0, 0, ILD_NORMAL);3954 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 3955 TREEVIEW_ITEM *dragItem; 3956 INT cx,cy; 3957 HDC hdc,htopdc; 3958 HWND hwtop; 3959 HBITMAP hbmp,hOldbmp; 3960 SIZE size; 3961 RECT rc; 3962 HFONT hOldFont; 3963 WCHAR *itemtxt; 3964 BOOL mustFree = FALSE; 3965 3966 if (!(infoPtr->himlNormal)) return 0; 3967 dragItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM) lParam); 3968 3969 if (!dragItem) return 0; 3970 3971 if (dragItem->pszText == LPSTR_TEXTCALLBACKW) 3972 itemtxt = TREEVIEW_CallbackText(hwnd,dragItem,&mustFree); 3973 else 3974 itemtxt = dragItem->pszText; 3975 3976 hwtop = GetDesktopWindow(); 3977 htopdc = GetDC(hwtop); 3978 hdc = CreateCompatibleDC(htopdc); 3979 3980 hOldFont = SelectObject (hdc, infoPtr->hFont); 3981 GetTextExtentPoint32W (hdc, itemtxt, lstrlenW (itemtxt), &size); 3982 3983 hbmp = CreateCompatibleBitmap (htopdc, size.cx, size.cy); 3984 hOldbmp = SelectObject (hdc, hbmp); 3985 3986 ImageList_GetIconSize (infoPtr->himlNormal, &cx, &cy); 3987 size.cx += cx; 3988 if (cy > size.cy) size.cy = cy; 3989 3990 infoPtr->dragList = ImageList_Create (size.cx, size.cy, ILC_COLOR, 10, 10); 3991 ImageList_Draw (infoPtr->himlNormal, dragItem->iImage, hdc, 0, 0, ILD_NORMAL); 3824 3992 3825 3993 /* … … 3828 3996 */ 3829 3997 3830 /* draw item text */ 3831 3832 SetRect (&rc, cx, 0, size.cx,size.cy); 3833 DrawTextW (hdc, itemtxt, lstrlenW (itemtxt), &rc, DT_LEFT); 3834 SelectObject (hdc, hOldFont); 3835 SelectObject (hdc, hOldbmp); 3836 3837 ImageList_Add (infoPtr->dragList, hbmp, 0); 3838 3839 DeleteDC (hdc); 3840 DeleteObject (hbmp); 3841 ReleaseDC (hwtop, htopdc); 3842 3843 return (LRESULT)infoPtr->dragList; 3998 /* draw item text */ 3999 4000 SetRect (&rc, cx, 0, size.cx,size.cy); 4001 DrawTextW (hdc, itemtxt, lstrlenW (itemtxt), &rc, DT_LEFT); 4002 SelectObject (hdc, hOldFont); 4003 SelectObject (hdc, hOldbmp); 4004 4005 ImageList_Add (infoPtr->dragList, hbmp, 0); 4006 4007 DeleteDC (hdc); 4008 DeleteObject (hbmp); 4009 ReleaseDC (hwtop, htopdc); 4010 if (mustFree) COMCTL32_Free(itemtxt); 4011 4012 return (LRESULT)infoPtr->dragList; 3844 4013 } 3845 4014 … … 3878 4047 return FALSE; 3879 4048 3880 prevItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)prevSelect);4049 prevItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)prevSelect); 3881 4050 3882 4051 if (newSelect) 3883 if (TREEVIEW_SendTreeviewNotify(hwnd, TVN_SELCHANGING,cause,(HTREEITEM)prevSelect,(HTREEITEM)newSelect))4052 if (TREEVIEW_SendTreeviewNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_SELCHANGINGW:TVN_SELCHANGINGA,cause,(HTREEITEM)prevSelect,(HTREEITEM)newSelect)) 3884 4053 return FALSE; /* FIXME: OK? */ 3885 4054 … … 3906 4075 TREEVIEW_RefreshItem(hwnd,wineItem,FALSE); 3907 4076 3908 TREEVIEW_SendTreeviewNotify(hwnd, TVN_SELCHANGED,cause,(HTREEITEM)prevSelect,(HTREEITEM)newSelect);4077 TREEVIEW_SendTreeviewNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_SELCHANGEDW:TVN_SELCHANGEDA,cause,(HTREEITEM)prevSelect,(HTREEITEM)newSelect); 3909 4078 3910 4079 break; 3911 4080 3912 4081 case TVGN_DROPHILITE: 3913 prevItem = TREEVIEW_ValidItem (infoPtr, infoPtr->dropItem);4082 prevItem = TREEVIEW_ValidItem (infoPtr, infoPtr->dropItem); 3914 4083 3915 4084 if (prevItem) … … 4007 4176 4008 4177 static LRESULT 4009 TREEVIEW_VScroll (HWND hwnd, WPARAM wParam,LPARAM lParam)4178 TREEVIEW_VScroll(HWND hwnd,WPARAM wParam,LPARAM lParam) 4010 4179 { 4011 4180 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); … … 4420 4589 static BOOL TREEVIEW_Compare(HWND hwnd,TREEVIEW_ITEM *item,LPWSTR text,INT textlen) 4421 4590 { 4591 WCHAR* itemtext; 4592 BOOL mustFree = FALSE,res; 4593 4422 4594 if (item->pszText == LPSTR_TEXTCALLBACKW) 4423 TREEVIEW_SendDispInfoNotify(hwnd,item,TVN_GETDISPINFO,TVIF_TEXT); 4424 if (item->pszText == LPSTR_TEXTCALLBACKW) return FALSE; 4595 itemtext = TREEVIEW_CallbackText(hwnd,item,&mustFree); 4596 else 4597 itemtext = item->pszText; 4425 4598 4426 4599 //simulate lstrcmpniW 4427 return CompareStringW(LOCALE_SYSTEM_DEFAULT,NORM_IGNORECASE,item->pszText,MIN(lstrlenW(item->pszText),textlen),text,textlen) == 2; 4600 res = (CompareStringW(LOCALE_SYSTEM_DEFAULT,NORM_IGNORECASE,itemtext,MIN(lstrlenW(itemtext),textlen),text,textlen) == 2); 4601 if (mustFree) COMCTL32_Free(itemtext); 4602 4603 return res; 4428 4604 } 4429 4605 … … 4573 4749 4574 4750 case TVM_DELETEITEM: 4575 4751 return TREEVIEW_DeleteItem (hwnd, wParam, lParam); 4576 4752 4577 4753 case TVM_EXPAND: 4578 4754 return TREEVIEW_Expand (hwnd, wParam, lParam); 4579 4755 4580 4756 case TVM_GETITEMRECT: 4581 4757 return TREEVIEW_GetItemRect (hwnd, wParam, lParam); 4582 4758 4583 4759 case TVM_GETCOUNT: 4584 4760 return TREEVIEW_GetCount (hwnd, wParam, lParam); 4585 4761 4586 4762 case TVM_GETINDENT: 4587 4763 return TREEVIEW_GetIndent (hwnd); 4588 4764 4589 4765 case TVM_SETINDENT: 4590 4766 return TREEVIEW_SetIndent (hwnd, wParam); 4591 4767 4592 4768 case TVM_GETIMAGELIST: 4593 4769 return TREEVIEW_GetImageList (hwnd, wParam, lParam); 4594 4770 4595 4771 case TVM_SETIMAGELIST: 4596 4772 return TREEVIEW_SetImageList (hwnd, wParam, lParam); 4597 4773 4598 4774 case TVM_GETNEXTITEM: 4599 4775 return TREEVIEW_GetNextItem (hwnd, wParam, lParam); 4600 4776 4601 4777 case TVM_SELECTITEM: 4602 4778 return TREEVIEW_SelectItem (hwnd, wParam, lParam); 4603 4779 4604 4780 case TVM_GETITEMA: 4605 4781 return TREEVIEW_GetItem(hwnd,wParam,lParam,FALSE); 4606 4782 4607 4783 case TVM_GETITEMW: 4608 4784 return TREEVIEW_GetItem(hwnd,wParam,lParam,TRUE); 4609 4785 4610 4786 case TVM_SETITEMA: 4611 4787 return TREEVIEW_SetItem(hwnd,wParam,lParam,FALSE); 4612 4788 4613 4789 case TVM_SETITEMW: 4614 4790 return TREEVIEW_SetItem(hwnd,wParam,lParam,TRUE); 4615 4791 4616 4792 case TVM_EDITLABELA: 4617 4793 return TREEVIEW_EditLabel(hwnd,(HTREEITEM)lParam,FALSE); 4618 4794 4619 4795 case TVM_EDITLABELW: 4620 4796 return TREEVIEW_EditLabel(hwnd,(HTREEITEM)lParam,TRUE); 4621 4797 4622 4798 case TVM_GETEDITCONTROL: 4623 4799 return TREEVIEW_GetEditControl (hwnd); 4624 4800 4625 4801 case TVM_GETVISIBLECOUNT: 4626 4802 return TREEVIEW_GetVisibleCount (hwnd, wParam, lParam); 4627 4803 4628 4804 case TVM_HITTEST: 4629 4805 return TREEVIEW_HitTest(hwnd,(LPTVHITTESTINFO)lParam); 4630 4806 4631 4807 case TVM_CREATEDRAGIMAGE: 4632 4808 return TREEVIEW_CreateDragImage (hwnd, wParam, lParam); 4633 4809 4634 4810 case TVM_SORTCHILDREN: 4635 4811 return TREEVIEW_SortChildren(hwnd, wParam, lParam); 4636 4812 4637 4813 case TVM_ENSUREVISIBLE: 4638 4814 return TREEVIEW_EnsureVisible(hwnd,(HTREEITEM)lParam); 4639 4815 4640 4816 case TVM_SORTCHILDRENCB: 4641 4817 return TREEVIEW_SortChildrenCB(hwnd, wParam, lParam); 4642 4818 4643 4819 case TVM_ENDEDITLABELNOW: 4644 4820 return TREEVIEW_EndEditLabelNow (hwnd,(BOOL)wParam); 4645 4821 4646 4822 case TVM_GETISEARCHSTRINGA: 4647 4823 return TREEVIEW_GetISearchString(hwnd,(LPWSTR)lParam,FALSE); 4648 4824 4649 4825 case TVM_GETISEARCHSTRINGW: 4650 4826 return TREEVIEW_GetISearchString(hwnd,(LPWSTR)lParam,TRUE); 4651 4827 4652 4828 case TVM_GETTOOLTIPS: 4653 4829 return TREEVIEW_GetToolTips (hwnd); 4654 4830 4655 4831 case TVM_SETTOOLTIPS: 4656 4832 return TREEVIEW_SetToolTips (hwnd, wParam); 4657 4833 4658 4834 case TVM_SETINSERTMARK: 4659 4835 return TREEVIEW_SetInsertMark (hwnd,wParam, lParam); 4660 4836 4661 4837 case TVM_SETITEMHEIGHT: 4662 4838 return TREEVIEW_SetItemHeight (hwnd, wParam); 4663 4839 4664 4840 case TVM_GETITEMHEIGHT: 4665 4841 return TREEVIEW_GetItemHeight (hwnd); 4666 4842 4667 4843 case TVM_SETBKCOLOR: 4668 4844 return TREEVIEW_SetBkColor (hwnd, wParam, lParam); 4669 4845 4670 4846 case TVM_SETTEXTCOLOR: 4671 4847 return TREEVIEW_SetTextColor (hwnd, wParam, lParam); 4672 4848 4673 4849 case TVM_GETBKCOLOR: 4674 4850 return TREEVIEW_GetBkColor (hwnd); 4675 4851 4676 4852 case TVM_GETTEXTCOLOR: 4677 4853 return TREEVIEW_GetTextColor (hwnd); 4678 4854 4679 4855 case TVM_SETSCROLLTIME: 4680 4856 return TREEVIEW_SetScrollTime (hwnd, (UINT)wParam); 4681 4857 4682 4858 case TVM_GETSCROLLTIME: 4683 4859 return TREEVIEW_GetScrollTime (hwnd); 4684 4860 4685 4861 case TVM_GETITEMSTATE: 4686 4862 return TREEVIEW_GetItemState (hwnd,wParam, lParam); 4687 4863 4688 4864 case TVM_GETLINECOLOR: 4689 4865 return TREEVIEW_GetLineColor (hwnd,wParam, lParam); 4690 4866 4691 4867 case TVM_SETLINECOLOR: 4692 4868 return TREEVIEW_SetLineColor (hwnd,wParam, lParam); 4693 4869 4694 4870 case TVM_SETINSERTMARKCOLOR: 4695 4871 return TREEVIEW_SetInsertMarkColor (hwnd,wParam, lParam); 4696 4872 4697 4873 case TVM_GETINSERTMARKCOLOR: 4698 4874 return TREEVIEW_GetInsertMarkColor (hwnd,wParam, lParam); 4699 4875 4700 4876 case WM_COMMAND: 4701 4877 return TREEVIEW_Command (hwnd, wParam, lParam); 4702 4878 4703 4879 case WM_DESTROY: 4704 4880 return TREEVIEW_Destroy (hwnd); 4705 4881 4706 4882 case WM_ENABLE: 4707 4883 return TREEVIEW_Enable(hwnd,wParam,lParam); 4708 4884 4709 4885 case WM_ERASEBKGND: 4710 4886 return TREEVIEW_EraseBackground (hwnd, wParam, lParam); 4711 4887 4712 4888 case WM_GETDLGCODE: 4713 4889 return TREEVIEW_GetDlgCode(hwnd,wParam,lParam); 4714 4890 4715 4891 case WM_PAINT: 4716 4892 return TREEVIEW_Paint (hwnd, wParam, lParam); 4717 4893 4718 4894 case WM_GETFONT: 4719 4895 return TREEVIEW_GetFont (hwnd, wParam, lParam); 4720 4896 4721 4897 case WM_SETFONT: 4722 4898 return TREEVIEW_SetFont (hwnd, wParam, lParam); 4723 4899 4724 4900 case WM_KEYDOWN: 4725 4901 return TREEVIEW_KeyDown (hwnd, wParam, lParam); 4726 4902 4727 4903 case WM_CHAR: 4728 4904 return TREEVIEW_Char(hwnd,wParam,lParam); 4729 4905 4730 4906 case WM_SETFOCUS: 4731 4907 return TREEVIEW_SetFocus (hwnd, wParam, lParam); 4732 4908 4733 4909 case WM_KILLFOCUS: 4734 4910 return TREEVIEW_KillFocus (hwnd, wParam, lParam); 4735 4911 4736 4912 case WM_MOUSEMOVE: 4737 4913 return TREEVIEW_MouseMove(hwnd,wParam,lParam); 4738 4914 4739 4915 case WM_LBUTTONDOWN: 4740 4916 return TREEVIEW_LButtonDown (hwnd, wParam, lParam); 4741 4917 4742 4918 case WM_LBUTTONDBLCLK: 4743 4919 return TREEVIEW_LButtonDoubleClick (hwnd, wParam, lParam); 4744 4920 4745 4921 case WM_RBUTTONDOWN: 4746 4922 return TREEVIEW_RButtonDown (hwnd, wParam, lParam); 4747 4923 4748 4924 case WM_RBUTTONDBLCLK: 4749 4925 return TREEVIEW_RButtonDoubleClick(hwnd,wParam,lParam); 4750 4926 4751 4927 case WM_STYLECHANGED: 4752 4928 return TREEVIEW_StyleChanged (hwnd, wParam, lParam); 4753 4929 4754 4930 case WM_SYSCOLORCHANGE: 4755 4931 return TREEVIEW_SysColorChange(hwnd,wParam,lParam); 4756 4932 4757 4933 case WM_SETCURSOR: 4758 4934 return TREEVIEW_SetCursor(hwnd,wParam,lParam); 4759 4935 4760 4936 case WM_SETREDRAW: 4761 4937 return TREEVIEW_SetRedraw(hwnd,wParam,lParam); 4762 4938 4763 4939 case WM_TIMER: 4764 4940 return TREEVIEW_HandleTimer (hwnd, wParam, lParam); 4765 4941 4766 4942 case WM_SIZE: 4767 4943 return TREEVIEW_Size (hwnd, wParam,lParam); 4768 4944 4769 4945 case WM_HSCROLL: 4770 4946 return TREEVIEW_HScroll (hwnd, wParam, lParam); 4771 4947 4772 4948 case WM_VSCROLL: 4773 4949 return TREEVIEW_VScroll (hwnd, wParam, lParam); 4774 4950 4775 4951 case WM_MOUSEWHEEL: 4776 4952 return TREEVIEW_MouseWheel (hwnd, wParam, lParam); 4777 4953 4778 4954 case WM_DRAWITEM: 4779 4780 4955 //printf ("drawItem\n"); 4956 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 4781 4957 4782 4958 default: 4783 //if (uMsg >= WM_USER) 4784 // FIXME (treeview, "Unknown msg %04x wp=%08x lp=%08lx\n", 4785 // uMsg, wParam, lParam); 4786 return defComCtl32ProcA(hwnd,uMsg,wParam,lParam); 4959 return defComCtl32ProcA(hwnd,uMsg,wParam,lParam); 4787 4960 } 4788 4961 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.