- (final?) update of TreeView_* macro's.

- implementation of TVM_SETINSERTMARK & TVM_SETINSERTMARKCOLOR
- fixed some typo's
- custom draw enhancements
- implementation of state images
- implementation of TVS_CHECKBOXES
This commit is contained in:
Alex Priem 1999-11-28 19:50:01 +00:00 committed by Alexandre Julliard
parent 426e812ba0
commit e6e71ad4e6
5 changed files with 383 additions and 205 deletions

View File

@ -56,3 +56,8 @@ extern HMODULE COMCTL32_hModule;
#define IDM_OCT 310 #define IDM_OCT 310
#define IDM_NOV 311 #define IDM_NOV 311
#define IDM_DEC 312 #define IDM_DEC 312
/* Treeview Checboxes */
#define IDT_CHECK 401

View File

@ -67,6 +67,35 @@ IDD_MCMONTHMENU MENU LOADONCALL DISCARDABLE
END END
} }
IDT_CHECK BITMAP LOADONCALL DISCARDABLE
{
'42 4D 8E 01 00 00 00 00 00 00 5E 00 00 00 28 00'
'00 00 1F 00 00 00 10 00 00 00 01 00 04 00 02 00'
'00 00 30 01 00 00 01 00 00 00 01 00 00 00 0A 00'
'00 00 0A 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 80 00 00 00 C0 C0 C0 00 80 80 80 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF FF FF 00 1F 99'
'00 00 01 99 0D 11 02 99 0E 11 01 99 00 00 01 99'
'0D 11 02 99 0E 11 01 99 00 00 01 99 02 11 09 99'
'02 11 02 99 02 11 0A 99 02 11 01 99 00 00 01 99'
'02 11 09 99 02 11 02 99 02 11 0A 99 02 11 01 99'
'00 00 01 99 02 11 09 99 02 11 02 99 02 11 03 99'
'02 00 05 99 02 11 01 99 00 00 01 99 02 11 09 99'
'02 11 02 99 02 11 03 99 03 00 04 99 02 11 01 99'
'00 00 01 99 02 11 09 99 02 11 02 99 02 11 02 99'
'04 00 04 99 02 11 01 99 00 00 01 99 02 11 09 99'
'02 11 02 99 02 11 01 99 02 00 02 99 02 00 03 99'
'02 11 01 99 00 00 01 99 02 11 09 99 02 11 02 99'
'02 11 02 00 04 99 02 00 02 99 02 11 01 99 00 00'
'01 99 02 11 09 99 02 11 02 99 02 11 01 00 06 99'
'02 00 01 99 02 11 01 99 00 00 01 99 02 11 09 99'
'02 11 02 99 02 11 07 99 02 00 01 99 01 00 01 11'
'01 99 00 00 01 99 02 11 09 99 02 11 02 99 02 11'
'08 99 01 00 01 99 01 00 01 11 01 99 00 00 01 99'
'0D 11 02 99 0A 11 02 00 02 11 01 99 00 00 01 99'
'0D 11 02 99 0E 11 01 99 00 00 1F 99 00 01'
}
IDB_STD_SMALL BITMAP LOADONCALL DISCARDABLE IDB_STD_SMALL BITMAP LOADONCALL DISCARDABLE
{ {

View File

@ -44,6 +44,7 @@
#include "wingdi.h" #include "wingdi.h"
#include "commctrl.h" #include "commctrl.h"
#include "treeview.h" #include "treeview.h"
#include "comctl32.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(treeview) DEFAULT_DEBUG_CHANNEL(treeview)
@ -407,7 +408,7 @@ TREEVIEW_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
HIMAGELIST himlTemp; HIMAGELIST himlTemp;
TRACE("\n"); TRACE("%x,%lx\n", wParam, lParam);
switch ((INT)wParam) { switch ((INT)wParam) {
case TVSIL_NORMAL: case TVSIL_NORMAL:
himlTemp = infoPtr->himlNormal; himlTemp = infoPtr->himlNormal;
@ -430,11 +431,9 @@ TREEVIEW_SetItemHeight (HWND hwnd, WPARAM wParam)
{ {
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
INT cx,cy,prevHeight=infoPtr->uItemHeight; INT cx,cy,prevHeight=infoPtr->uItemHeight;
HDC hdc;
TRACE("\n"); TRACE("\n");
if (wParam==-1) { if (wParam==-1) {
hdc=GetDC (hwnd);
infoPtr->uItemHeight=-1; infoPtr->uItemHeight=-1;
return prevHeight; return prevHeight;
} }
@ -478,6 +477,41 @@ TREEVIEW_SetLineColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
return (LRESULT) prevColor; return (LRESULT) prevColor;
} }
static LRESULT
TREEVIEW_GetInsertMarkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
TRACE("\n");
return (LRESULT) infoPtr->clrInsertMark;
}
static LRESULT
TREEVIEW_SetInsertMarkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
COLORREF prevColor=infoPtr->clrInsertMark;
TRACE("%d %ld\n",wParam,lParam);
infoPtr->clrInsertMark=(COLORREF) lParam;
return (LRESULT) prevColor;
}
static LRESULT
TREEVIEW_SetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
FIXME("%d %ld\n",wParam,lParam);
if (!TREEVIEW_ValidItem (infoPtr, (HTREEITEM)lParam)) return 0;
FIXME("%d %ld\n",wParam,lParam);
infoPtr->insertBeforeorAfter=(BOOL) wParam;
infoPtr->insertMarkItem=(HTREEITEM) lParam;
TREEVIEW_Refresh (hwnd);
return 1;
}
static LRESULT static LRESULT
TREEVIEW_SetTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam) TREEVIEW_SetTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
@ -530,7 +564,7 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
{ {
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
INT center,xpos,cx,cy, cditem, drawmode; INT center,xpos,cx,cy, cditem;
HFONT hOldFont; HFONT hOldFont;
UINT uTextJustify = DT_LEFT; UINT uTextJustify = DT_LEFT;
RECT r; RECT r;
@ -544,14 +578,9 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
cditem=0; cditem=0;
TRACE ("cdmode:%x\n",infoPtr->cdmode); TRACE ("cdmode:%x\n",infoPtr->cdmode);
if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW) { if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW) {
drawmode=CDDS_ITEMPREPAINT; cditem=TREEVIEW_SendCustomDrawItemNotify
(hwnd, hdc, wineItem, CDDS_ITEMPREPAINT);
if (infoPtr->cdmode & CDRF_NOTIFYSUBITEMDRAW) TRACE("prepaint:cditem-app returns 0x%x\n",cditem);
drawmode|=CDDS_SUBITEM;
cditem=TREEVIEW_SendCustomDrawItemNotify (hwnd, hdc, wineItem, drawmode);
TRACE("cditem:%d\n",cditem);
if (cditem & CDRF_SKIPDEFAULT) if (cditem & CDRF_SKIPDEFAULT)
return; return;
@ -582,7 +611,7 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
TREEVIEW_ITEM *upNode = NULL; TREEVIEW_ITEM *upNode = NULL;
BOOL hasParentOrSibling = TRUE; BOOL hasParentOrSibling = TRUE;
RECT upRect = {0,0,0,0}; RECT upRect = {0,0,0,0};
HPEN hOldPen, hnewPen; HPEN hOldPen, hNewPen;
POINT points[3]; POINT points[3];
/* /*
* determine the target location of the line at root, either be linked * determine the target location of the line at root, either be linked
@ -620,15 +649,15 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
/* /*
* Get a dotted pen * Get a dotted pen
*/ */
hnewPen = CreatePen(PS_DOT, 0, infoPtr->clrLine); hNewPen = CreatePen(PS_DOT, 0, infoPtr->clrLine);
hOldPen = SelectObject( hdc, hnewPen ); hOldPen = SelectObject( hdc, hNewPen );
if (hasParentOrSibling) if (hasParentOrSibling)
Polyline (hdc,points,3); Polyline (hdc,points,3);
else else
Polyline (hdc,points,2); Polyline (hdc,points,2);
DeleteObject(hnewPen); DeleteObject(hNewPen);
SelectObject(hdc, hOldPen); SelectObject(hdc, hOldPen);
} }
} }
@ -668,63 +697,76 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
} }
/* /*
* Display the image assiciated with this item * Display the image associated with this item
*/ */
xpos += 13; /* update position */ xpos += 13; /* update position */
if (wineItem->mask & (TVIF_IMAGE|TVIF_SELECTEDIMAGE)) { if (wineItem->mask & (TVIF_IMAGE|TVIF_SELECTEDIMAGE)) {
INT imageIndex; INT imageIndex;
HIMAGELIST *himlp = NULL; HIMAGELIST *himlp = NULL;
if (infoPtr->himlNormal) /* State images are displayed to the left of the Normal image
* image number is in state; zero should be `display no image'.
* FIXME: that last sentence looks like it needs some checking.
*/
if (infoPtr->himlState)
himlp=&infoPtr->himlState;
imageIndex=wineItem->state>>12;
imageIndex++; /* yeah, right */
TRACE ("imindex:%d\n",imageIndex);
if ((himlp) && (imageIndex))
{
imageIndex--; /* see FIXME */
ImageList_Draw ( *himlp, imageIndex, hdc, xpos-2, r.top+1, ILD_NORMAL);
ImageList_GetIconSize (*himlp, &cx, &cy);
wineItem->statebitmap.left=xpos-2;
wineItem->statebitmap.right=xpos-2+cx;
wineItem->statebitmap.top=r.top+1;
wineItem->statebitmap.bottom=r.top+1+cy;
xpos+=cx;
}
/* Now, draw the normal image; can be either selected or
* non-selected image.
*/
himlp=NULL;
if (infoPtr->himlNormal)
himlp=&infoPtr->himlNormal; /* get the image list */ himlp=&infoPtr->himlNormal; /* get the image list */
imageIndex = wineItem->iImage;
if ( (wineItem->state & TVIS_SELECTED) && if ( (wineItem->state & TVIS_SELECTED) &&
(wineItem->iSelectedImage)) { (wineItem->iSelectedImage)) {
/* State images are displayed to the left of the Normal image*/
if (infoPtr->himlState)
himlp=&infoPtr->himlState;
/* The item is curently selected */ /* The item is curently selected */
if (wineItem->iSelectedImage == I_IMAGECALLBACK) if (wineItem->iSelectedImage == I_IMAGECALLBACK)
TREEVIEW_SendDispInfoNotify ( TREEVIEW_SendDispInfoNotify
hwnd, (hwnd, wineItem, TVN_GETDISPINFO, TVIF_SELECTEDIMAGE);
wineItem,
TVN_GETDISPINFO,
TVIF_SELECTEDIMAGE);
imageIndex = wineItem->iSelectedImage;
imageIndex = wineItem->iSelectedImage;
} else { } else {
/* This item is not selected */ /* The item is not selected */
if (wineItem->iImage == I_IMAGECALLBACK) if (wineItem->iImage == I_IMAGECALLBACK)
TREEVIEW_SendDispInfoNotify ( TREEVIEW_SendDispInfoNotify
hwnd, (hwnd, wineItem, TVN_GETDISPINFO, TVIF_IMAGE);
wineItem,
TVN_GETDISPINFO,
TVIF_IMAGE);
imageIndex = wineItem->iImage; imageIndex = wineItem->iImage;
} }
if (himlp) if (himlp)
{ {
/* We found an image to display? Draw it. */ ImageList_Draw ( *himlp, imageIndex, hdc, xpos-2, r.top+1, ILD_NORMAL);
ImageList_Draw (
*himlp,
wineItem->iImage,
hdc,
xpos-2,
r.top+1,
ILD_NORMAL);
ImageList_GetIconSize (*himlp, &cx, &cy); ImageList_GetIconSize (*himlp, &cx, &cy);
wineItem->bitmap.left=xpos-2;
wineItem->bitmap.right=xpos-2+cx;
wineItem->bitmap.top=r.top+1;
wineItem->bitmap.bottom=r.top+1+cy;
xpos+=cx; xpos+=cx;
} }
} }
/* /*
* Display the text assiciated with this item * Display the text associated with this item
*/ */
r.left=xpos; r.left=xpos;
if ((wineItem->mask & TVIF_TEXT) && (wineItem->pszText)) if ((wineItem->mask & TVIF_TEXT) && (wineItem->pszText))
@ -741,25 +783,39 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
wineItem->text.top = r.top; wineItem->text.top = r.top;
wineItem->text.bottom= r.bottom; wineItem->text.bottom= r.bottom;
if (wineItem->state & (TVIS_SELECTED | TVIS_DROPHILITED) ) {
oldBkMode = SetBkMode (hdc, OPAQUE);
oldBkColor = SetBkColor (hdc, GetSysColor( COLOR_HIGHLIGHT));
oldTextColor = SetTextColor(hdc, GetSysColor( COLOR_HIGHLIGHTTEXT));
}
else
{
oldBkMode = SetBkMode(hdc, TRANSPARENT);
oldTextColor = SetTextColor(hdc, GetSysColor( COLOR_WINDOWTEXT));
}
if (wineItem->pszText== LPSTR_TEXTCALLBACKA) { if (wineItem->pszText== LPSTR_TEXTCALLBACKA) {
TRACE("LPSTR_TEXTCALLBACK\n"); TRACE("LPSTR_TEXTCALLBACK\n");
TREEVIEW_SendDispInfoNotify (hwnd, wineItem, TVN_GETDISPINFO, TVIF_TEXT); TREEVIEW_SendDispInfoNotify (hwnd, wineItem, TVN_GETDISPINFO, TVIF_TEXT);
} }
/* Yep, there are some things that need to be straightened out here.
Removing the comments around the setTextColor does not give the right
results. Dito FillRect.
*/
/* GetTextExtentPoint32A (hdc, wineItem->pszText,
strlen (wineItem->pszText), &size); */
/* FillRect ( hdc, &wineItem->text, GetSysColorBrush (infoPtr->clrBk));
*/
if (!(cditem & CDRF_NOTIFYPOSTPAINT) &&
(wineItem->state & (TVIS_SELECTED | TVIS_DROPHILITED)) ) {
oldBkMode = SetBkMode (hdc, OPAQUE);
oldBkColor = SetBkColor (hdc, GetSysColor( COLOR_HIGHLIGHT));
oldTextColor = SetTextColor(hdc, GetSysColor( COLOR_HIGHLIGHTTEXT));
} else {
oldBkMode = SetBkMode (hdc, TRANSPARENT);
oldBkColor = SetBkColor (hdc, infoPtr->clrBk);
/* oldTextColor = SetTextColor(hdc, infoPtr->clrText); */
}
/* Draw it */ /* Draw it */
DrawTextA ( DrawTextA ( hdc,
hdc,
wineItem->pszText, wineItem->pszText,
lstrlenA(wineItem->pszText), lstrlenA(wineItem->pszText),
&wineItem->text, &wineItem->text,
@ -784,8 +840,8 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
/* Draw the box arround the selected item */ /* Draw the box arround the selected item */
if (wineItem->state & TVIS_SELECTED ) if (wineItem->state & TVIS_SELECTED )
{ {
HPEN hnewPen = CreatePen(PS_DOT, 0, GetSysColor(COLOR_WINDOWTEXT) ); HPEN hNewPen = CreatePen(PS_DOT, 0, GetSysColor(COLOR_WINDOWTEXT) );
HPEN hOldPen = SelectObject( hdc, hnewPen ); HPEN hOldPen = SelectObject( hdc, hNewPen );
POINT points[4]; POINT points[4];
points[0].x = wineItem->text.left-1; points[0].x = wineItem->text.left-1;
@ -799,13 +855,47 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
Polyline (hdc,points,4); Polyline (hdc,points,4);
DeleteObject(hnewPen); DeleteObject(hNewPen);
SelectObject(hdc, hOldPen); SelectObject(hdc, hOldPen);
} }
} }
if (cditem & CDRF_NOTIFYPOSTPAINT) /* Draw insertion mark if necessary */
TREEVIEW_SendCustomDrawItemNotify (hwnd, hdc, wineItem, CDDS_ITEMPOSTPAINT);
if (infoPtr->insertMarkItem)
TRACE ("item:%d,mark:%d\n", (int)wineItem->hItem,
(int) infoPtr->insertMarkItem);
if (wineItem->hItem==infoPtr->insertMarkItem) {
HPEN hNewPen, hOldPen;
int offset;
hNewPen = CreatePen(PS_SOLID, 2, infoPtr->clrInsertMark);
hOldPen = SelectObject( hdc, hNewPen );
if (infoPtr->insertBeforeorAfter)
offset=wineItem->text.top+1;
else
offset=wineItem->text.bottom-1;
MoveToEx (hdc, wineItem->text.left, offset-3, NULL);
LineTo (hdc, wineItem->text.left, offset+3);
MoveToEx (hdc, wineItem->text.left, offset, NULL);
LineTo (hdc, r.right-2, offset);
MoveToEx (hdc, r.right-2, offset+3, NULL);
LineTo (hdc, r.right-2, offset-3);
DeleteObject(hNewPen);
SelectObject(hdc, hOldPen);
}
if (cditem & CDRF_NOTIFYPOSTPAINT) {
cditem=TREEVIEW_SendCustomDrawItemNotify
(hwnd, hdc, wineItem, CDDS_ITEMPOSTPAINT);
TRACE("postpaint:cditem-app returns 0x%x\n",cditem);
}
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
} }
@ -829,7 +919,7 @@ TREEVIEW_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
TREEVIEW_Refresh (hwnd); /* we want a rect for the current view */ TREEVIEW_Refresh (hwnd); /* we want a rect for the current view */
/* /*
* retrive the item ptr * retrieve the item ptr
*/ */
iItem = (HTREEITEM *) lParam; iItem = (HTREEITEM *) lParam;
wineItem = TREEVIEW_ValidItem (infoPtr, *iItem); wineItem = TREEVIEW_ValidItem (infoPtr, *iItem);
@ -906,7 +996,11 @@ TREEVIEW_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
if (tvItem->mask & TVIF_STATE) { if (tvItem->mask & TVIF_STATE) {
wineItem->state=tvItem->state & tvItem->stateMask; TRACE ("prevstate,state,mask:%x,%x,%x\n",wineItem->state,tvItem->state,
tvItem->stateMask);
wineItem->state&= ~tvItem->stateMask;
wineItem->state|= (tvItem->state & tvItem->stateMask);
wineItem->stateMask|= tvItem->stateMask;
} }
if (tvItem->mask & TVIF_TEXT) { if (tvItem->mask & TVIF_TEXT) {
@ -936,6 +1030,7 @@ TREEVIEW_GetItemState (HWND hwnd, WPARAM wParam, LPARAM lParam)
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
TREEVIEW_ITEM *wineItem; TREEVIEW_ITEM *wineItem;
TRACE("\n");
wineItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)wParam); wineItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)wParam);
if (!wineItem) return 0; if (!wineItem) return 0;
@ -1200,11 +1295,7 @@ TREEVIEW_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
TRACE("item %d<%p>, txt %p, img %p, action %x\n", TRACE("item %d<%p>, txt %p, img %p, action %x\n",
iItem, iItem, tvItem, tvItem->pszText, &tvItem->iImage, tvItem->mask);
tvItem,
tvItem->pszText,
& tvItem->iImage,
tvItem->mask);
return TRUE; return TRUE;
} }
@ -1872,9 +1963,8 @@ TREEVIEW_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
wineItem->iSelectedImage=tvItem->iSelectedImage; wineItem->iSelectedImage=tvItem->iSelectedImage;
if (tvItem->mask & TVIF_STATE) { if (tvItem->mask & TVIF_STATE) {
TRACE("Changing item state from %d to %d\n", TRACE("item state: %x ->%x\n", wineItem->state, tvItem->state);
wineItem->state, TRACE("statemask: %x ->%x\n", wineItem->stateMask, tvItem->stateMask);
tvItem->state);
wineItem->state=tvItem->state; wineItem->state=tvItem->state;
wineItem->stateMask=tvItem->stateMask; wineItem->stateMask=tvItem->stateMask;
} }
@ -2149,11 +2239,12 @@ static LRESULT
TREEVIEW_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) TREEVIEW_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TREEVIEW_INFO *infoPtr; TREEVIEW_INFO *infoPtr;
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
LOGFONTA logFont; LOGFONTA logFont;
TEXTMETRICA tm; TEXTMETRICA tm;
HDC hdc; HDC hdc;
TRACE("wnd %x\n",hwnd); TRACE("wnd %x, style %lx\n",hwnd,dwStyle);
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (TREEVIEW_INFO *) COMCTL32_Alloc (sizeof(TREEVIEW_INFO)); infoPtr = (TREEVIEW_INFO *) COMCTL32_Alloc (sizeof(TREEVIEW_INFO));
@ -2175,8 +2266,9 @@ TREEVIEW_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->uInternalStatus=0; infoPtr->uInternalStatus=0;
infoPtr->uNumItems=0; infoPtr->uNumItems=0;
infoPtr->clrBk = GetSysColor (COLOR_WINDOW); infoPtr->clrBk = GetSysColor (COLOR_WINDOW);
infoPtr->clrText = GetSysColor (COLOR_BTNTEXT); infoPtr->clrText = GetSysColor (COLOR_WINDOWTEXT);
infoPtr->clrLine = GetSysColor (COLOR_WINDOWTEXT); infoPtr->clrLine = GetSysColor (COLOR_WINDOWTEXT);
infoPtr->clrInsertMark = GetSysColor (COLOR_BTNTEXT);
infoPtr->cy = 0; infoPtr->cy = 0;
infoPtr->cx = 0; infoPtr->cx = 0;
infoPtr->uIndent = 15; infoPtr->uIndent = 15;
@ -2193,16 +2285,13 @@ TREEVIEW_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->selectedItem=0; infoPtr->selectedItem=0;
infoPtr->clrText=-1; /* use system color */ infoPtr->clrText=-1; /* use system color */
infoPtr->dropItem=0; infoPtr->dropItem=0;
infoPtr->insertMarkItem=0;
infoPtr->insertBeforeorAfter=0;
infoPtr->pCallBackSort=NULL; infoPtr->pCallBackSort=NULL;
infoPtr->uScrollTime = 300; /* milliseconds */ infoPtr->uScrollTime = 300; /* milliseconds */
/*
infoPtr->hwndNotify = GetParent32 (hwnd);
infoPtr->bTransparent = ( GetWindowLongA( hwnd, GWL_STYLE) & TBSTYLE_FLAT);
*/
infoPtr->hwndToolTip=0; infoPtr->hwndToolTip=0;
if (!( GetWindowLongA( hwnd, GWL_STYLE) & TVS_NOTOOLTIPS)) { /* Create tooltip control */ if (!(dwStyle & TVS_NOTOOLTIPS)) { /* Create tooltip control */
TTTOOLINFOA ti; TTTOOLINFOA ti;
infoPtr->hwndToolTip = infoPtr->hwndToolTip =
@ -2251,6 +2340,19 @@ TREEVIEW_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
GWL_WNDPROC, GWL_WNDPROC,
(LONG) TREEVIEW_Edit_SubclassProc); (LONG) TREEVIEW_Edit_SubclassProc);
if (dwStyle & TVS_CHECKBOXES) {
HBITMAP hbmLoad;
int nIndex;
infoPtr->himlState =
ImageList_Create (16, 16,ILC_COLOR|ILC_MASK, 15, 1);
hbmLoad = LoadBitmapA (COMCTL32_hModule, MAKEINTRESOURCEA(IDT_CHECK));
TRACE ("%x\n",hbmLoad);
nIndex = ImageList_AddMasked (infoPtr->himlState, hbmLoad, CLR_DEFAULT);
TRACE ("%d\n",nIndex);
DeleteObject (hbmLoad);
}
ReleaseDC (hwnd, hdc); ReleaseDC (hwnd, hdc);
return 0; return 0;
} }
@ -2527,6 +2629,7 @@ TREEVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc,
LPNMCUSTOMDRAW nmcd; LPNMCUSTOMDRAW nmcd;
DWORD dwDrawStage,dwItemSpec; DWORD dwDrawStage,dwItemSpec;
UINT uItemState; UINT uItemState;
INT retval;
dwDrawStage=CDDS_ITEM | uItemDrawState; dwDrawStage=CDDS_ITEM | uItemDrawState;
dwItemSpec=(DWORD)wineItem->hItem; dwItemSpec=(DWORD)wineItem->hItem;
@ -2548,16 +2651,20 @@ TREEVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc,
nmcd->dwItemSpec = dwItemSpec; nmcd->dwItemSpec = dwItemSpec;
nmcd->uItemState = uItemState; nmcd->uItemState = uItemState;
nmcd->lItemlParam= wineItem->lParam; nmcd->lItemlParam= wineItem->lParam;
nmcdhdr.clrText = infoPtr->clrText; nmcdhdr.clrText = infoPtr->clrText;
nmcdhdr.clrTextBk= infoPtr->clrBk; nmcdhdr.clrTextBk= infoPtr->clrBk;
nmcdhdr.iLevel = wineItem->iLevel; nmcdhdr.iLevel = wineItem->iLevel;
TRACE("drawstage:%lx hdc:%x item:%lx, itemstate:%x\n", TRACE("drawstage:%lx hdc:%x item:%lx, itemstate:%x, lItemlParam:%lx\n",
dwDrawStage, hdc, dwItemSpec, uItemState); nmcd->dwDrawStage, nmcd->hdc, nmcd->dwItemSpec,
nmcd->uItemState, nmcd->lItemlParam);
return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY, retval=SendMessageA (GetParent (hwnd), WM_NOTIFY,
(WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmcdhdr); (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmcdhdr);
infoPtr->clrText=nmcdhdr.clrText;
infoPtr->clrBk =nmcdhdr.clrTextBk;
return (BOOL) retval;
} }
@ -2757,31 +2864,35 @@ TREEVIEW_HitTest (HWND hwnd, LPARAM lParam)
return 0; return 0;
} }
/* FIXME: implement other flags
* Assign the appropriate flags depending on the click location
* Intitialize flags before to "|=" it...
*/
lpht->flags=0; lpht->flags=0;
if (x < wineItem->expandBox.left) if (x < wineItem->expandBox.left) {
{
lpht->flags |= TVHT_ONITEMINDENT; lpht->flags |= TVHT_ONITEMINDENT;
goto done;
} }
else if ( ( x >= wineItem->expandBox.left) && if ( PtInRect ( &wineItem->expandBox, lpht->pt)) {
( x <= wineItem->expandBox.right))
{
lpht->flags |= TVHT_ONITEMBUTTON; lpht->flags |= TVHT_ONITEMBUTTON;
goto done;
} }
else if (x < wineItem->rect.right) if ( PtInRect ( &wineItem->bitmap, lpht->pt)) {
{ lpht->flags |= TVHT_ONITEMICON;
goto done;
}
if ( PtInRect ( &wineItem->statebitmap, lpht->pt)) {
lpht->flags |= TVHT_ONITEMSTATEICON;
goto done;
}
if ( PtInRect ( &wineItem->text, lpht->pt)) {
lpht->flags |= TVHT_ONITEMLABEL; lpht->flags |= TVHT_ONITEMLABEL;
goto done;
} }
else
{ lpht->flags|=TVHT_ONITEMRIGHT;
lpht->flags|=TVHT_ONITEMRIGHT;
}
done:
lpht->hItem=wineItem->hItem; lpht->hItem=wineItem->hItem;
TRACE ("(%ld,%ld):result %x\n",lpht->pt.x,lpht->pt.y,lpht->flags);
return (LRESULT) wineItem->hItem; return (LRESULT) wineItem->hItem;
} }
@ -2906,7 +3017,7 @@ TREEVIEW_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
INT iItem; INT iItem;
TREEVIEW_ITEM *editItem; TREEVIEW_ITEM *wineItem;
TVHITTESTINFO ht; TVHITTESTINFO ht;
ht.pt.x = (INT)LOWORD(lParam); ht.pt.x = (INT)LOWORD(lParam);
@ -2920,10 +3031,11 @@ TREEVIEW_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* Get the item */ /* Get the item */
iItem = TREEVIEW_HitTest (hwnd, (LPARAM) &ht); iItem = TREEVIEW_HitTest (hwnd, (LPARAM) &ht);
TRACE ("%d\n",iItem);
if (!iItem) if (!iItem)
return 0; return 0;
editItem = TREEVIEW_ValidItem(infoPtr, (HTREEITEM)iItem); wineItem = TREEVIEW_ValidItem(infoPtr, (HTREEITEM)iItem);
infoPtr->uInternalStatus &= ~(TV_LDRAG | TV_LDRAGGING); infoPtr->uInternalStatus &= ~(TV_LDRAG | TV_LDRAGGING);
@ -2932,33 +3044,33 @@ TREEVIEW_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
* and the click occured on the item label... * and the click occured on the item label...
*/ */
if ( ( GetWindowLongA( hwnd, GWL_STYLE) & TVS_EDITLABELS ) && if ( ( GetWindowLongA( hwnd, GWL_STYLE) & TVS_EDITLABELS ) &&
( editItem->state & TVIS_SELECTED ) && ( wineItem->state & TVIS_SELECTED ) &&
( ht.flags & TVHT_ONITEMLABEL )) ( ht.flags & TVHT_ONITEMLABEL ))
{ {
if ( infoPtr->editItem == 0 ) /* If we are not curently editing */ if ( infoPtr->editItem == 0 ) /* If we are not curently editing */
{ {
if ( TREEVIEW_SendDispInfoNotify( /* Return true to cancel edition */ if ( TREEVIEW_SendDispInfoNotify( /* Return true to cancel edition */
hwnd, hwnd,
editItem, wineItem,
TVN_BEGINLABELEDIT, TVN_BEGINLABELEDIT,
0)) 0))
{ {
return 0; return 0;
} }
TRACE("Edit started for %s.\n", editItem->pszText); TRACE("Edit started for %s.\n", wineItem->pszText);
infoPtr->editItem = editItem->hItem; infoPtr->editItem = wineItem->hItem;
SetWindowPos ( SetWindowPos (
infoPtr->hwndEdit, infoPtr->hwndEdit,
HWND_TOP, HWND_TOP,
editItem->text.left - 2, wineItem->text.left - 2,
editItem->text.top - 1, wineItem->text.top - 1,
editItem->text.right - editItem->text.left + 20 , wineItem->text.right - wineItem->text.left + 20 ,
editItem->text.bottom - editItem->text.top + 3, wineItem->text.bottom - wineItem->text.top + 3,
SWP_DRAWFRAME ); SWP_DRAWFRAME );
SetWindowTextA( infoPtr->hwndEdit, editItem->pszText ); SetWindowTextA( infoPtr->hwndEdit, wineItem->pszText );
SendMessageA ( infoPtr->hwndEdit, EM_SETSEL, 0, -1 ); SendMessageA ( infoPtr->hwndEdit, EM_SETSEL, 0, -1 );
SetFocus ( infoPtr->hwndEdit); SetFocus ( infoPtr->hwndEdit);
ShowWindow ( infoPtr->hwndEdit, SW_SHOW); ShowWindow ( infoPtr->hwndEdit, SW_SHOW);
@ -2970,13 +3082,23 @@ TREEVIEW_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
else if ( ht.flags & (TVHT_ONITEMLABEL | TVHT_ONITEMICON)) else if ( ht.flags & (TVHT_ONITEMLABEL | TVHT_ONITEMICON))
{ {
TREEVIEW_DoSelectItem ( TREEVIEW_DoSelectItem ( hwnd, TVGN_CARET, (HTREEITEM)iItem, TVC_BYMOUSE);
hwnd,
TVGN_CARET,
(HTREEITEM)iItem,
TVC_BYMOUSE);
} }
if (ht.flags & TVHT_ONITEMSTATEICON) {
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
if (dwStyle & TVS_CHECKBOXES) { /* TVS_CHECKBOXES requires _us_ */
int state; /* to toggle the current state */
state=1-(wineItem->state>>12);
TRACE ("state:%x\n", state);
wineItem->state&= ~TVIS_STATEIMAGEMASK;
wineItem->state|=state<<12;
TRACE ("state:%x\n", wineItem->state);
TREEVIEW_QueueRefresh (hwnd);
}
}
return 0; return 0;
} }
@ -3113,82 +3235,82 @@ TREEVIEW_DoSelectItem (HWND hwnd, INT action, HTREEITEM newSelect, INT cause)
wineItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)newSelect); wineItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)newSelect);
TRACE("Entering item %d, flag %x, cause %x, state %d\n", TRACE("Entering item %d, flag %x, cause %x, state %d\n",
(INT)newSelect, (INT)newSelect,
action, action,
cause, cause,
wineItem->state); wineItem->state);
if ( (wineItem) && (wineItem->parent)) if ( (wineItem) && (wineItem->parent))
{ {
/* /*
* If the item has a collapse parent expand the parent so he * If the item has a collapse parent expand the parent so he
* can expose the item * can expose the item
*/ */
TREEVIEW_ITEM *parentItem = TREEVIEW_ValidItem (infoPtr, wineItem->parent); TREEVIEW_ITEM *parentItem = TREEVIEW_ValidItem (infoPtr, wineItem->parent);
if ( !(parentItem->state & TVIS_EXPANDED)) if ( !(parentItem->state & TVIS_EXPANDED))
TREEVIEW_Expand (hwnd, TVE_EXPAND, (LPARAM) wineItem->parent); TREEVIEW_Expand (hwnd, TVE_EXPAND, (LPARAM) wineItem->parent);
} }
switch (action) switch (action)
{ {
case TVGN_CARET: case TVGN_CARET:
prevSelect=(INT)infoPtr->selectedItem; prevSelect=(INT)infoPtr->selectedItem;
if ((HTREEITEM)prevSelect==newSelect) if ((HTREEITEM)prevSelect==newSelect)
return FALSE; return FALSE;
prevItem= TREEVIEW_ValidItem (infoPtr, (HTREEITEM)prevSelect); prevItem= TREEVIEW_ValidItem (infoPtr, (HTREEITEM)prevSelect);
if (newSelect) if (newSelect)
if (TREEVIEW_SendTreeviewNotify( if (TREEVIEW_SendTreeviewNotify(
hwnd, hwnd,
TVN_SELCHANGING, TVN_SELCHANGING,
cause, cause,
(HTREEITEM)prevSelect, (HTREEITEM)prevSelect,
(HTREEITEM)newSelect)) (HTREEITEM)newSelect))
return FALSE; /* FIXME: OK? */ return FALSE; /* FIXME: OK? */
if (prevItem) if (prevItem)
prevItem->state &= ~TVIS_SELECTED; prevItem->state &= ~TVIS_SELECTED;
if (wineItem) if (wineItem)
wineItem->state |= TVIS_SELECTED; wineItem->state |= TVIS_SELECTED;
infoPtr->selectedItem=(HTREEITEM)newSelect; infoPtr->selectedItem=(HTREEITEM)newSelect;
TREEVIEW_SendTreeviewNotify( TREEVIEW_SendTreeviewNotify(
hwnd, hwnd,
TVN_SELCHANGED, TVN_SELCHANGED,
cause, cause,
(HTREEITEM)prevSelect, (HTREEITEM)prevSelect,
(HTREEITEM)newSelect); (HTREEITEM)newSelect);
break; break;
case TVGN_DROPHILITE: case TVGN_DROPHILITE:
prevItem= TREEVIEW_ValidItem (infoPtr, infoPtr->dropItem); prevItem= TREEVIEW_ValidItem (infoPtr, infoPtr->dropItem);
if (prevItem) if (prevItem)
prevItem->state &= ~TVIS_DROPHILITED; prevItem->state &= ~TVIS_DROPHILITED;
infoPtr->dropItem=(HTREEITEM)newSelect; infoPtr->dropItem=(HTREEITEM)newSelect;
if (wineItem) if (wineItem)
wineItem->state |=TVIS_DROPHILITED; wineItem->state |=TVIS_DROPHILITED;
break; break;
case TVGN_FIRSTVISIBLE: case TVGN_FIRSTVISIBLE:
FIXME("FIRSTVISIBLE not implemented\n"); FIXME("FIRSTVISIBLE not implemented\n");
break; break;
} }
TREEVIEW_QueueRefresh (hwnd); TREEVIEW_QueueRefresh (hwnd);
TRACE("Leaving state %d\n", wineItem->state); TRACE("Leaving state %d\n", wineItem->state);
return TRUE; return TRUE;
} }
/* FIXME: handle NM_KILLFocus enzo */ /* FIXME: handle NM_KILLFocus etc */
static LRESULT static LRESULT
TREEVIEW_SelectItem (HWND hwnd, WPARAM wParam, LPARAM lParam) TREEVIEW_SelectItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
@ -3366,11 +3488,10 @@ TREEVIEW_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (!newItem) if (!newItem)
newItem=& infoPtr->items[(INT)infoPtr->TopRootItem]; newItem=& infoPtr->items[(INT)infoPtr->TopRootItem];
hNewSelection = newItem->hItem; hNewSelection = newItem->hItem;
if (! newItem->visible)
scrollNeeds = SB_LINEUP;
if (! newItem->visible)
scrollNeeds = SB_LINEUP;
break; break;
case VK_DOWN: case VK_DOWN:
@ -3644,8 +3765,7 @@ TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TREEVIEW_SetToolTips (hwnd, wParam); return TREEVIEW_SetToolTips (hwnd, wParam);
case TVM_SETINSERTMARK: case TVM_SETINSERTMARK:
FIXME("Unimplemented msg TVM_SETINSERTMARK\n"); return TREEVIEW_SetInsertMark (hwnd,wParam, lParam);
return 0;
case TVM_SETITEMHEIGHT: case TVM_SETITEMHEIGHT:
return TREEVIEW_SetItemHeight (hwnd, wParam); return TREEVIEW_SetItemHeight (hwnd, wParam);
@ -3681,8 +3801,10 @@ TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TREEVIEW_SetLineColor (hwnd,wParam, lParam); return TREEVIEW_SetLineColor (hwnd,wParam, lParam);
case TVM_SETINSERTMARKCOLOR: case TVM_SETINSERTMARKCOLOR:
FIXME("Unimplemented msg TVM_SETINSERTMARKCOLOR\n"); return TREEVIEW_SetInsertMarkColor (hwnd,wParam, lParam);
return 0;
case TVM_GETINSERTMARKCOLOR:
return TREEVIEW_GetInsertMarkColor (hwnd,wParam, lParam);
case TVM_SETUNICODEFORMAT: case TVM_SETUNICODEFORMAT:
FIXME("Unimplemented msg TVM_SETUNICODEFORMAT\n"); FIXME("Unimplemented msg TVM_SETUNICODEFORMAT\n");

View File

@ -387,6 +387,7 @@ typedef struct _IMAGELIST *HIMAGELIST;
#define ILD_BLEND ILD_BLEND50 #define ILD_BLEND ILD_BLEND50
#define INDEXTOOVERLAYMASK(i) ((i)<<8) #define INDEXTOOVERLAYMASK(i) ((i)<<8)
#define INDEXTOSTATEIMAGEMASK(i) ((i)<<12)
#define ILCF_MOVE (0x00000000) #define ILCF_MOVE (0x00000000)
#define ILCF_SWAP (0x00000001) #define ILCF_SWAP (0x00000001)
@ -1705,26 +1706,6 @@ typedef struct
#define TVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT #define TVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT
#define TVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT #define TVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT
#define TreeView_GetItemState(hwndTV, hti, mask) \
(UINT)SendMessageA((hwndTV), TVM_GETITEMSTATE, (WPARAM)(hti), (LPARAM)(mask))
#define TreeView_GetCheckState(hwndTV, hti) \
((((UINT)(SendMessageA((hwndTV), TVM_GETITEMSTATE, (WPARAM)(hti), \
TVIS_STATEIMAGEMASK))) >> 12) -1)
#define TreeView_SetLineColor(hwnd, clr) \
(COLORREF)SendMessageA((hwnd), TVM_SETLINECOLOR, 0, (LPARAM)(clr))
#define TreeView_GetLineColor(hwnd) \
(COLORREF)SendMessageA((hwnd), TVM_GETLINECOLOR, 0, 0)
#define TreeView_SetItemState(hwndTV, hti, data, _mask) \
{ TVITEM _TVi; \
_TVi.mask = TVIF_STATE; \
_TVi.hItem = hti; \
_TVi.stateMask = _mask; \
_TVi.state = data; \
SendMessageA((hwndTV), TVM_SETITEM, 0, (LPARAM)(TV_ITEM *)&_TVi); \
}
#define TVN_FIRST (0U-400U) #define TVN_FIRST (0U-400U)
@ -1815,6 +1796,7 @@ typedef struct
#define TVS_FULLROWSELECT 0x1000 #define TVS_FULLROWSELECT 0x1000
#define TVS_NOSCROLL 0x2000 #define TVS_NOSCROLL 0x2000
#define TVS_NONEVENHEIGHT 0x4000 #define TVS_NONEVENHEIGHT 0x4000
#define TVS_NOHSCROLL 0x8000
#define TVS_SHAREDIMAGELISTS 0x0000 #define TVS_SHAREDIMAGELISTS 0x0000
#define TVS_PRIVATEIMAGELISTS 0x0400 #define TVS_PRIVATEIMAGELISTS 0x0400
@ -2061,7 +2043,7 @@ typedef struct tagNMTVGETINFOTIPW
(LPARAM)(HTREEITEM) (hitem)) (LPARAM)(HTREEITEM) (hitem))
#define TreeView_GetChild(hwnd, hitem) \ #define TreeView_GetChild(hwnd, hitem) \
TreeView_GetNextItem(hwnd, hitem , TVGN_CHILD) TreeView_GetNextItem(hwnd, hitem , TVGN_CHILD)
#define TreeView_GetNextSibling(hwnd, hitem) \ #define TreeView_GetNextSibling(hwnd, hitem) \
TreeView_GetNextItem(hwnd, hitem , TVGN_NEXT) TreeView_GetNextItem(hwnd, hitem , TVGN_NEXT)
#define TreeView_GetPrevSibling(hwnd, hitem) \ #define TreeView_GetPrevSibling(hwnd, hitem) \
@ -2094,22 +2076,24 @@ typedef struct tagNMTVGETINFOTIPW
#define TreeView_SelectItem(hwnd, hitem) \ #define TreeView_SelectItem(hwnd, hitem) \
TreeView_Select(hwnd, hitem, TVGN_CARET) TreeView_Select(hwnd, hitem, TVGN_CARET)
#define TreeView_SelectDropTarget(hwnd, hitem) \ #define TreeView_SelectDropTarget(hwnd, hitem) \
TreeView_Select(hwnd, hitem, TVGN_DROPHILITE) TreeView_Select(hwnd, hitem, TVGN_DROPHILITE)
/* FIXME #define TreeView_SelectSetFirstVisible(hwnd, hitem) \
#define TreeView_SelectSetFirstVisible(hwnd, hitem) \ TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE)
TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE)
*/
#define TreeView_GetItemA(hwnd, pitem) \ #define TreeView_GetItemA(hwnd, pitem) \
(BOOL)SendMessageA((hwnd), TVM_GETITEMA, 0, (LPARAM) (TVITEMA *)(pitem)) (BOOL)SendMessageA((hwnd), TVM_GETITEMA, 0, (LPARAM) (TVITEMA *)(pitem))
#define TreeView_GetItemW(hwnd, pitem) \
(BOOL)SendMessageW((hwnd), TVM_GETITEMA, 0, (LPARAM) (TVITEMA *)(pitem))
#define TreeView_SetItemA(hwnd, pitem) \ #define TreeView_SetItemA(hwnd, pitem) \
(BOOL)SendMessageA((hwnd), TVM_SETITEMA, 0, (LPARAM)(const TVITEMA *)(pitem)) (BOOL)SendMessageA((hwnd), TVM_SETITEMA, 0, (LPARAM)(const TVITEMA *)(pitem))
#define TreeView_SetItemW(hwnd, pitem) \
(BOOL)SendMessageW((hwnd), TVM_SETITEMA, 0, (LPARAM)(const TVITEMA *)(pitem))
#define TreeView_EditLabel(hwnd, hitem) \ #define TreeView_EditLabel(hwnd, hitem) \
(HWND)SendMessageA((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem)) (HWND)SendMessageA((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem))
#define TreeView_GetEditControl(hwnd) \ #define TreeView_GetEditControl(hwnd) \
(HWND)SendMessageA((hwnd), TVM_GETEDITCONTROL, 0, 0) (HWND)SendMessageA((hwnd), TVM_GETEDITCONTROL, 0, 0)
@ -2138,12 +2122,19 @@ typedef struct tagNMTVGETINFOTIPW
#define TreeView_EndEditLabelNow(hwnd, fCancel) \ #define TreeView_EndEditLabelNow(hwnd, fCancel) \
(BOOL)SendMessageA((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0) (BOOL)SendMessageA((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0)
#define TreeView_GetISearchString(hwndTV, lpsz) \ #define TreeView_GetISearchString(hwnd, lpsz) \
(BOOL)SendMessageA((hwndTV), TVM_GETISEARCHSTRING, 0, \ (BOOL)SendMessageA((hwnd), TVM_GETISEARCHSTRING, 0, \
(LPARAM)(LPTSTR)lpsz) (LPARAM)(LPTSTR)lpsz)
#define TreeView_SetToolTips(hwnd, hwndTT) \
(BOOL)SendMessageA((hwnd), TVM_SETTOOLTIPS, (WPARAM)(hwndTT), 0)
#define TreeView_GetToolTips(hwnd) \
(BOOL)SendMessageA((hwnd), TVM_GETTOOLTIPS, 0, 0)
#define TreeView_SetItemHeight(hwnd, iHeight) \ #define TreeView_SetItemHeight(hwnd, iHeight) \
(INT)SendMessageA((hwnd), TVM_SETITEMHEIGHT, (WPARAM)iHeight, 0) (INT)SendMessageA((hwnd), TVM_SETITEMHEIGHT, (WPARAM)iHeight, 0)
#define TreeView_GetItemHeight(hwnd) \ #define TreeView_GetItemHeight(hwnd) \
(INT)SendMessageA((hwnd), TVM_GETITEMHEIGHT, 0, 0) (INT)SendMessageA((hwnd), TVM_GETITEMHEIGHT, 0, 0)
@ -2165,11 +2156,37 @@ typedef struct tagNMTVGETINFOTIPW
#define TreeView_GetScrollTime(hwnd) \ #define TreeView_GetScrollTime(hwnd) \
(UINT)SendMessageA((hwnd), TVM_GETSCROLLTIME, 0, 0) (UINT)SendMessageA((hwnd), TVM_GETSCROLLTIME, 0, 0)
#define TreeView_SetInsertMark(hwnd, hItem, fAfter) \
(BOOL)SendMessageA((hwnd), TVM_SETINSERTMARK, (WPARAM)(fAfter), \
(LPARAM) (hItem))
#define TreeView_SetInsertMarkColor(hwnd, clr) \ #define TreeView_SetInsertMarkColor(hwnd, clr) \
(COLORREF)SendMessageA((hwnd), TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr) (COLORREF)SendMessageA((hwnd), TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr)
#define TreeView_GetInsertMarkColor(hwnd) \ #define TreeView_GetInsertMarkColor(hwnd) \
(COLORREF)SendMessageA((hwnd), TVM_GETINSERTMARKCOLOR, 0, 0) (COLORREF)SendMessageA((hwnd), TVM_GETINSERTMARKCOLOR, 0, 0)
#define TreeView_GetItemState(hwndTV, hti, mask) \
(UINT)SendMessageA((hwndTV), TVM_GETITEMSTATE, (WPARAM)(hti), (LPARAM)(mask))
#define TreeView_GetCheckState(hwndTV, hti) \
((((UINT)(SendMessageA((hwndTV), TVM_GETITEMSTATE, (WPARAM)(hti), \
TVIS_STATEIMAGEMASK))) >> 12) -1)
#define TreeView_SetLineColor(hwnd, clr) \
(COLORREF)SendMessageA((hwnd), TVM_SETLINECOLOR, 0, (LPARAM)(clr))
#define TreeView_GetLineColor(hwnd) \
(COLORREF)SendMessageA((hwnd), TVM_GETLINECOLOR, 0, 0)
#define TreeView_SetItemState(hwndTV, hti, data, _mask) \
{ TVITEM _TVi; \
_TVi.mask = TVIF_STATE; \
_TVi.hItem = hti; \
_TVi.stateMask = _mask; \
_TVi.state = data; \
SendMessageA((hwndTV), TVM_SETITEM, 0, (LPARAM)(TV_ITEM *)&_TVi); \
}

View File

@ -40,6 +40,8 @@ typedef struct {
RECT rect; RECT rect;
RECT text; RECT text;
RECT expandBox; /* expand box (+/-) coordinate */ RECT expandBox; /* expand box (+/-) coordinate */
RECT bitmap;
RECT statebitmap;
} TREEVIEW_ITEM; } TREEVIEW_ITEM;
@ -67,11 +69,14 @@ typedef struct tagTREEVIEW_INFO
HTREEITEM editItem; /* handle to item currently editted, 0 if none */ HTREEITEM editItem; /* handle to item currently editted, 0 if none */
HTREEITEM firstVisible; /* handle to first visible item */ HTREEITEM firstVisible; /* handle to first visible item */
HTREEITEM dropItem; /* handle to item selected by drag cursor */ HTREEITEM dropItem; /* handle to item selected by drag cursor */
HTREEITEM insertMarkItem; /* item after which insertion mark is placed */
BOOL insertBeforeorAfter; /* flag used by TVM_SETINSERTMARK */
HIMAGELIST dragList; /* Bitmap of dragged item */ HIMAGELIST dragList; /* Bitmap of dragged item */
INT cx,cy; /* current x/y place in list */ INT cx,cy; /* current x/y place in list */
COLORREF clrBk; COLORREF clrBk;
COLORREF clrText; COLORREF clrText;
COLORREF clrLine; COLORREF clrLine;
COLORREF clrInsertMark;
HFONT hFont; HFONT hFont;
HFONT hBoldFont; HFONT hBoldFont;
HWND hwndToolTip; HWND hwndToolTip;