Fixed some graphical problems of the treeview and added support LMB

click on +/- sign to open and close.
Fixed a bug in imagelist where the last image could not be displayed.
This commit is contained in:
Sylvain St.Germain 1999-03-16 10:38:44 +00:00 committed by Alexandre Julliard
parent 6d45e7a9ef
commit 02300aeaa5
3 changed files with 392 additions and 249 deletions

View File

@ -894,7 +894,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
return FALSE; return FALSE;
if (pimldp->himl == NULL) if (pimldp->himl == NULL)
return FALSE; return FALSE;
if ((pimldp->i < 0) || (pimldp->i >= pimldp->himl->cCurImage)) if ((pimldp->i < 0) || (pimldp->i > pimldp->himl->cCurImage))
return FALSE; return FALSE;
himlLocal = pimldp->himl; himlLocal = pimldp->himl;

View File

@ -2,6 +2,7 @@
* *
* Copyright 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * Copyright 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* Copyright 1998,1999 Alex Priem <alexp@sci.kun.nl> * Copyright 1998,1999 Alex Priem <alexp@sci.kun.nl>
* Copyright 1999 Sylvain St-Germain
* *
* *
* TODO: * TODO:
@ -404,12 +405,6 @@ TREEVIEW_GetTextColor (HWND hwnd)
} }
/* FIXME: draw background (infoPtr->clrBk) */
/* cdmode: custom draw mode as received from app. in first NMCUSTOMDRAW /* cdmode: custom draw mode as received from app. in first NMCUSTOMDRAW
notification */ notification */
@ -418,16 +413,13 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
{ {
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
INT oldBkMode,center,xpos,cx,cy, cditem, drawmode;
TREEVIEW_ITEM *parentItem;
COLORREF oldBkColor = 0;
HFONT hOldFont;
UINT uTextJustify = DT_LEFT;
HPEN hOldPen, hnewPen;
RECT r,upper;
HIMAGELIST *himlp; INT center,xpos,cx,cy, cditem, drawmode;
HFONT hOldFont;
UINT uTextJustify = DT_LEFT;
RECT r;
if (wineItem->state & TVIS_BOLD) if (wineItem->state & TVIS_BOLD)
hOldFont = SelectObject (hdc, infoPtr->hBoldFont); hOldFont = SelectObject (hdc, infoPtr->hBoldFont);
else else
@ -436,138 +428,260 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
cditem=0; cditem=0;
if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW) { if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW) {
drawmode=CDDS_ITEMPREPAINT; drawmode=CDDS_ITEMPREPAINT;
if (infoPtr->cdmode & CDRF_NOTIFYSUBITEMDRAW) drawmode|=CDDS_SUBITEM;
if (infoPtr->cdmode & CDRF_NOTIFYSUBITEMDRAW)
drawmode|=CDDS_SUBITEM;
cditem=TREEVIEW_SendCustomDrawItemNotify (hwnd, hdc, wineItem, drawmode); cditem=TREEVIEW_SendCustomDrawItemNotify (hwnd, hdc, wineItem, drawmode);
TRACE (treeview,"cditem:%d\n",cditem); TRACE (treeview,"cditem:%d\n",cditem);
if (cditem & CDRF_SKIPDEFAULT) if (cditem & CDRF_SKIPDEFAULT)
return; return;
} }
/*
* Set drawing starting points
*/
r = wineItem->rect; /* this item rectangle */
center = (r.top+r.bottom)/2; /* this item vertical center */
xpos = r.left + 8; /* horizontal starting point */
/*
* Display the tree hierarchy
*/
if ( GetWindowLongA( hwnd, GWL_STYLE) & TVS_HASLINES)
{
/*
* Write links to parent node
* we draw the L starting from the child to the parent
*
* points[0] is attached to the current item
* points[1] is the L corner
* points[2] is attached to the parent or the up sibling
*/
if ( GetWindowLongA( hwnd, GWL_STYLE) & TVS_LINESATROOT)
{
TREEVIEW_ITEM *upNode = NULL;
TREEVIEW_ITEM *downNode = NULL;
BOOL hasParentOrSibling = TRUE;
RECT upRect = {0,0,0,0};
HPEN hOldPen, hnewPen;
POINT points[3], downLink[2];
/*
* determine the target location of the line at root, either be linked
* to the up sibling or to the parent node.
*/
if (wineItem->upsibling)
upNode = TREEVIEW_ValidItem (infoPtr, wineItem->upsibling);
else if (wineItem->parent)
upNode = TREEVIEW_ValidItem (infoPtr, wineItem->parent);
else
hasParentOrSibling = FALSE;
if (upNode)
upRect = upNode->rect;
if ( wineItem->iLevel == 0 )
{
points[2].x = points[1].x = upRect.left+8;
points[0].x = points[2].x + 10;
points[2].y = upRect.bottom-3;
points[1].y = points[0].y = center;
}
else
{
points[2].x = points[1].x = 8 + (20*wineItem->iLevel);
points[2].y = ((upNode->cChildren == 0) ?
upRect.top :
upRect.bottom-3);
points[1].y = points[0].y = center;
points[0].x = points[1].x + 10;
}
/*
* Check wheather this item has an invisible sibling. If so, draw a
* link to the bottom of the treeview otherwise there will not be any...
*/
if (wineItem->sibling)
{
downNode = TREEVIEW_ValidItem (infoPtr, wineItem->sibling);
if (downNode->visible == FALSE)
{
downLink[0].x = downLink[1].x = points[2].x;
downLink[0].y = points[2].y;
downLink[1].y = infoPtr->uTotalHeight - points[2].y;
}
}
hnewPen = CreatePen(PS_DOT, 0, GetSysColor(COLOR_WINDOWTEXT) ); /*
hOldPen = SelectObject( hdc, hnewPen ); * Get a doted pen
*/
r=wineItem->rect; hnewPen = CreatePen(PS_DOT, 0, GetSysColor(COLOR_WINDOWTEXT) );
if (wineItem->parent) { hOldPen = SelectObject( hdc, hnewPen );
parentItem=TREEVIEW_ValidItem (infoPtr, wineItem->parent);
upper=parentItem->rect; if (hasParentOrSibling)
Polyline (hdc,points,3);
else
Polyline (hdc,points,2);
/* FIXME: This simple stuff it does not work...
if ( downNode && ( downNode->visible == FALSE ))
Polyline (hdc,downLink,2);
*/
DeleteObject(hnewPen);
SelectObject(hdc, hOldPen);
}
} }
else {
upper.top=0; /*
upper.left=8; * Display the (+/-) signs
*/
wineItem->expandBox.left = 0; /* Initialize the expandBox */
wineItem->expandBox.top = 0;
wineItem->expandBox.right = 0;
wineItem->expandBox.bottom = 0;
if (( GetWindowLongA( hwnd, GWL_STYLE) & TVS_HASBUTTONS) &&
( GetWindowLongA( hwnd, GWL_STYLE) & TVS_HASLINES))
{
if (wineItem->cChildren)
{
if (wineItem->parent)
xpos+=5; /* update position only for nodes that have a parent */
Rectangle (hdc, xpos-4, center-4, xpos+5, center+5);
MoveToEx (hdc, xpos-2, center, NULL);
LineTo (hdc, xpos+3, center);
if (!(wineItem->state & TVIS_EXPANDED)) {
MoveToEx (hdc, xpos, center-2, NULL);
LineTo (hdc, xpos, center+3);
}
/* Setup expand box coordinate to facilitate the LMBClick handling */
wineItem->expandBox.left = xpos-4;
wineItem->expandBox.top = center-4;
wineItem->expandBox.right = xpos+5;
wineItem->expandBox.bottom = center+5;
}
else
{
xpos+=(5*wineItem->iLevel);
}
} }
center=(r.top+r.bottom)/2;
xpos=r.left+8;
if ( GetWindowLongA( hwnd, GWL_STYLE) & TVS_HASLINES) {
POINT points[3];
if (( GetWindowLongA( hwnd, GWL_STYLE) & TVS_LINESATROOT) && (wineItem->iLevel==0)) {
points[0].y=points[1].y=center;
points[2].y=upper.top;
points[1].x=points[2].x=upper.left;
points[0].x=upper.left+12;
points[2].y+=5;
Polyline (hdc,points,3);
}
else {
points[0].y=points[1].y=center;
points[2].y=upper.top;
points[1].x=points[2].x=upper.left+13;
points[0].x=upper.left+25;
points[2].y+=5;
Polyline (hdc,points,3);
}
}
DeleteObject(hnewPen);
SelectObject(hdc, hOldPen);
if (( GetWindowLongA( hwnd, GWL_STYLE) & TVS_HASBUTTONS) && ( GetWindowLongA( hwnd, GWL_STYLE) & TVS_HASLINES) &&
(wineItem->cChildren)) {
Rectangle (hdc, xpos-4, center-4, xpos+5, center+5);
MoveToEx (hdc, xpos-2, center, NULL);
LineTo (hdc, xpos+3, center);
if (!(wineItem->state & TVIS_EXPANDED)) {
MoveToEx (hdc, xpos, center-2, NULL);
LineTo (hdc, xpos, center+3);
}
}
xpos+=13;
/*
* Display the image assiciated with this item
*/
if (wineItem->mask & (TVIF_IMAGE|TVIF_SELECTEDIMAGE)) { if (wineItem->mask & (TVIF_IMAGE|TVIF_SELECTEDIMAGE)) {
INT imageIndex;
HIMAGELIST *himlp = NULL;
xpos += 13; /* update position */
himlp=NULL; if (infoPtr->himlNormal)
if (infoPtr->himlNormal) himlp=&infoPtr->himlNormal; himlp=&infoPtr->himlNormal; /* get the image list */
if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage)) { if ( (wineItem->state & TVIS_SELECTED) &&
if (infoPtr->himlState) himlp=&infoPtr->himlState; (wineItem->iSelectedImage)) {
if (wineItem->iSelectedImage==I_IMAGECALLBACK)
TREEVIEW_SendDispInfoNotify (hwnd, wineItem, /* State images are displayed to the left of the Normal image*/
TVN_GETDISPINFO, TVIF_SELECTEDIMAGE); if (infoPtr->himlState)
} else { /* NOT selected */ himlp=&infoPtr->himlState;
if (wineItem->iImage==I_IMAGECALLBACK)
TREEVIEW_SendDispInfoNotify (hwnd, wineItem, /* The item is curently selected */
TVN_GETDISPINFO, TVIF_IMAGE); if (wineItem->iSelectedImage == I_IMAGECALLBACK)
TREEVIEW_SendDispInfoNotify (
hwnd,
wineItem,
TVN_GETDISPINFO,
TVIF_SELECTEDIMAGE);
imageIndex = wineItem->iSelectedImage;
} else {
/* This item is not selected */
if (wineItem->iImage == I_IMAGECALLBACK)
TREEVIEW_SendDispInfoNotify (
hwnd,
wineItem,
TVN_GETDISPINFO,
TVIF_IMAGE);
imageIndex = wineItem->iImage;
} }
if (himlp)
{
/* We found an image to display? Draw it. */
ImageList_Draw (
*himlp,
wineItem->iImage,
hdc,
xpos-2,
r.top+1,
ILD_NORMAL);
if (himlp) { ImageList_GetIconSize (*himlp, &cx, &cy);
ImageList_Draw (*himlp, wineItem->iImage, hdc, xpos-2, r.top+1, ILD_NORMAL); xpos+=cx;
ImageList_GetIconSize (*himlp, &cx, &cy); }
xpos+=cx; }
}
}
r.left=xpos; r.left=xpos;
if ((wineItem->mask & TVIF_TEXT) && (wineItem->pszText)) { if ((wineItem->mask & TVIF_TEXT) && (wineItem->pszText))
{
COLORREF oldBkColor = 0;
COLORREF oldTextColor = 0;
INT oldBkMode;
if (wineItem->state & (TVIS_SELECTED | TVIS_DROPHILITED) ) { if (wineItem->state & (TVIS_SELECTED | TVIS_DROPHILITED) ) {
oldBkMode = SetBkMode(hdc, OPAQUE); oldBkMode = SetBkMode (hdc, OPAQUE);
oldBkColor= SetBkColor (hdc, GetSysColor( COLOR_HIGHLIGHT)); oldBkColor = SetBkColor (hdc, GetSysColor( COLOR_HIGHLIGHT));
SetTextColor (hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); oldTextColor = SetTextColor(hdc, GetSysColor( COLOR_HIGHLIGHTTEXT));
} else { }
oldBkMode = SetBkMode(hdc, TRANSPARENT); else
} {
r.left += 3; oldBkMode = SetBkMode(hdc, TRANSPARENT);
r.right -= 3; oldTextColor = SetTextColor(hdc, GetSysColor( COLOR_WINDOWTEXT));
wineItem->text.left=r.left; }
wineItem->text.right=r.right;
if (infoPtr->clrText==-1)
SetTextColor (hdc, COLOR_BTNTEXT);
else
SetTextColor (hdc, infoPtr->clrText); /* FIXME: setback retval */
if (wineItem->pszText== LPSTR_TEXTCALLBACKA) { r.left += 3;
TRACE (treeview,"LPSTR_TEXTCALLBACK\n"); r.right -= 3;
TREEVIEW_SendDispInfoNotify (hwnd, wineItem, wineItem->text.left=r.left;
TVN_GETDISPINFO, TVIF_TEXT); wineItem->text.right=r.right;
}
DrawTextA (hdc, wineItem->pszText, lstrlenA(wineItem->pszText), &r, if (wineItem->pszText== LPSTR_TEXTCALLBACKA) {
uTextJustify|DT_VCENTER|DT_SINGLELINE); TRACE (treeview,"LPSTR_TEXTCALLBACK\n");
TREEVIEW_SendDispInfoNotify (hwnd, wineItem, TVN_GETDISPINFO, TVIF_TEXT);
}
if (oldBkMode != TRANSPARENT) DrawTextA (
SetBkMode(hdc, oldBkMode); hdc,
if (wineItem->state & (TVIS_SELECTED | TVIS_DROPHILITED)) wineItem->pszText,
SetBkColor (hdc, oldBkColor); lstrlenA(wineItem->pszText),
} &r,
uTextJustify|DT_VCENTER|DT_SINGLELINE);
/*
* FIXME if not always done, the bmp following the selection are not
* visible ????
*/
SetTextColor( hdc, oldTextColor);
if (oldBkMode != TRANSPARENT)
SetBkMode(hdc, oldBkMode);
if (wineItem->state & (TVIS_SELECTED | TVIS_DROPHILITED))
SetBkColor (hdc, oldBkColor);
}
if (cditem & CDRF_NOTIFYPOSTPAINT) if (cditem & CDRF_NOTIFYPOSTPAINT)
TREEVIEW_SendCustomDrawItemNotify (hwnd, hdc, wineItem, TREEVIEW_SendCustomDrawItemNotify (hwnd, hdc, wineItem, CDDS_ITEMPOSTPAINT);
CDDS_ITEMPOSTPAINT);
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
} }
static LRESULT static LRESULT
TREEVIEW_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam) TREEVIEW_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
@ -1822,69 +1936,85 @@ TREEVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc,
static LRESULT static LRESULT
TREEVIEW_Expand (HWND hwnd, WPARAM wParam, LPARAM lParam) TREEVIEW_Expand (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
TREEVIEW_ITEM *wineItem, *parentItem; TREEVIEW_ITEM *wineItem;
UINT flag; UINT flag;
INT expand; INT expand;
flag= (UINT) wParam; flag = (UINT) wParam;
expand= (INT) lParam; expand = (INT) lParam;
TRACE (treeview,"flags:%x item:%x\n", expand, wParam); TRACE (treeview,"flags:%x item:%x\n", expand, wParam);
wineItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)expand); wineItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)expand);
if (!wineItem) return 0;
if (!wineItem->cChildren) return 0;
if (wineItem->cChildren==I_CHILDRENCALLBACK) { if (!wineItem)
FIXME (treeview,"we don't handle I_CHILDRENCALLBACK yet\n"); return 0;
return 0; if (!wineItem->cChildren)
} return 0;
if (flag & TVE_TOGGLE) { /* FIXME: check exact behaviour here */ if (wineItem->cChildren==I_CHILDRENCALLBACK) {
flag &= ~TVE_TOGGLE; /* ie: bitwise ops or 'case' ops */ FIXME (treeview,"we don't handle I_CHILDRENCALLBACK yet\n");
if (wineItem->state & TVIS_EXPANDED) return 0;
flag |= TVE_COLLAPSE; }
else
flag |= TVE_EXPAND;
}
switch (flag) { if (flag & TVE_TOGGLE) { /* FIXME: check exact behaviour here */
flag &= ~TVE_TOGGLE; /* ie: bitwise ops or 'case' ops */
if (wineItem->state & TVIS_EXPANDED)
flag |= TVE_COLLAPSE;
else
flag |= TVE_EXPAND;
}
switch (flag)
{
case TVE_COLLAPSERESET: case TVE_COLLAPSERESET:
if (!wineItem->state & TVIS_EXPANDED) return 0; if (!wineItem->state & TVIS_EXPANDED)
wineItem->state &= ~(TVIS_EXPANDEDONCE | TVIS_EXPANDED); return 0;
TREEVIEW_RemoveAllChildren (hwnd, wineItem);
break; wineItem->state &= ~(TVIS_EXPANDEDONCE | TVIS_EXPANDED);
TREEVIEW_RemoveAllChildren (hwnd, wineItem);
break;
case TVE_COLLAPSE: case TVE_COLLAPSE:
if (!wineItem->state & TVIS_EXPANDED) return 0; if (!wineItem->state & TVIS_EXPANDED)
wineItem->state &= ~TVIS_EXPANDED; return 0;
break;
wineItem->state &= ~TVIS_EXPANDED;
break;
case TVE_EXPAND: case TVE_EXPAND:
if (wineItem->state & TVIS_EXPANDED) return 0; if (wineItem->state & TVIS_EXPANDED)
if (wineItem->parent) { return 0;
parentItem=TREEVIEW_ValidItem(infoPtr,wineItem->parent);
TREEVIEW_Expand (hwnd, wParam, (LPARAM) wineItem->parent);
}
if (!(wineItem->state & TVIS_EXPANDEDONCE)) {
if (TREEVIEW_SendTreeviewNotify (hwnd, TVN_ITEMEXPANDING,
0, 0, (HTREEITEM)expand))
return FALSE; /* FIXME: OK? */
wineItem->state |= TVIS_EXPANDED | TVIS_EXPANDEDONCE;
TREEVIEW_SendTreeviewNotify (hwnd, TVN_ITEMEXPANDED,
0, 0, (HTREEITEM)expand);
}
wineItem->state |= TVIS_EXPANDED;
break;
case TVE_EXPANDPARTIAL:
FIXME (treeview, "TVE_EXPANDPARTIAL not implemented\n");
wineItem->state ^=TVIS_EXPANDED;
wineItem->state |=TVIS_EXPANDEDONCE;
break;
}
TREEVIEW_QueueRefresh (hwnd);
return TRUE; if (!(wineItem->state & TVIS_EXPANDEDONCE))
{
if (TREEVIEW_SendTreeviewNotify (
hwnd,
TVN_ITEMEXPANDING,
0,
0,
(HTREEITEM)expand))
return FALSE; /* FIXME: OK? */
wineItem->state |= TVIS_EXPANDED | TVIS_EXPANDEDONCE;
TREEVIEW_SendTreeviewNotify (
hwnd,
TVN_ITEMEXPANDED,
0,
0,
(HTREEITEM)expand);
}
wineItem->state |= TVIS_EXPANDED;
break;
case TVE_EXPANDPARTIAL:
FIXME (treeview, "TVE_EXPANDPARTIAL not implemented\n");
wineItem->state ^=TVIS_EXPANDED;
wineItem->state |=TVIS_EXPANDEDONCE;
break;
}
TREEVIEW_QueueRefresh (hwnd);
return TRUE;
} }
@ -1932,28 +2062,45 @@ TREEVIEW_HitTest (HWND hwnd, LPARAM lParam)
if (x > rect.right) status|=TVHT_TORIGHT; if (x > rect.right) status|=TVHT_TORIGHT;
if (y < rect.top ) status|=TVHT_ABOVE; if (y < rect.top ) status|=TVHT_ABOVE;
if (y > rect.bottom) status|=TVHT_BELOW; if (y > rect.bottom) status|=TVHT_BELOW;
if (status) { if (status) {
lpht->flags=status; lpht->flags=status;
return 0; return 0;
} }
wineItem=TREEVIEW_HitTestPoint (hwnd, lpht->pt); wineItem=TREEVIEW_HitTestPoint (hwnd, lpht->pt);
if (!wineItem) { if (!wineItem) {
lpht->flags=TVHT_NOWHERE; lpht->flags=TVHT_NOWHERE;
return 0; return 0;
} }
if (x>wineItem->rect.right) { /* FIXME: implement other flags
lpht->flags|=TVHT_ONITEMRIGHT; * Assign the appropriate flags depending on the click location
return (LRESULT) wineItem->hItem; * Intitialize flags before to "|=" it...
} */
lpht->flags=0;
if (x < wineItem->expandBox.left)
{
lpht->flags |= TVHT_ONITEMINDENT;
}
else if ( ( x >= wineItem->expandBox.left) &&
( x <= wineItem->expandBox.right))
{
lpht->flags |= TVHT_ONITEMBUTTON;
}
else if (x < wineItem->rect.right)
{
lpht->flags |= TVHT_ONITEMLABEL;
}
else
{
lpht->flags|=TVHT_ONITEMRIGHT;
}
if (x<wineItem->rect.left+10) lpht->flags|=TVHT_ONITEMBUTTON; lpht->hItem=wineItem->hItem;
lpht->flags=TVHT_ONITEMLABEL; /* FIXME: implement other flags */ return (LRESULT) wineItem->hItem;
lpht->hItem=wineItem->hItem;
return (LRESULT) wineItem->hItem;
} }

View File

@ -17,72 +17,68 @@
/* internal structures */ /* internal structures */
typedef struct { typedef struct {
UINT mask; UINT mask;
HTREEITEM hItem; HTREEITEM hItem;
UINT state; UINT state;
UINT stateMask; UINT stateMask;
LPSTR pszText; LPSTR pszText;
int cchTextMax; int cchTextMax;
int iImage; int iImage;
int iSelectedImage; int iSelectedImage;
int cChildren; int cChildren;
LPARAM lParam; LPARAM lParam;
int iIntegral; int iIntegral;
int iLevel; /* indentation level:0=root level */ int iLevel; /* indentation level:0=root level */
COLORREF clrText; COLORREF clrText;
HTREEITEM parent; /* handle to parent or 0 if at root*/
HTREEITEM parent; /* handle to parent or 0 if at root*/ HTREEITEM firstChild; /* handle to first child or 0 if no child*/
HTREEITEM firstChild; /* handle to first child or 0 if no child*/ HTREEITEM sibling; /* handle to next item in list, 0 if last */
HTREEITEM sibling; /* handle to next item in list, 0 if last */ HTREEITEM upsibling; /* handle to previous item in list, 0 if first */
HTREEITEM upsibling; /* handle to previous item in list, 0 if first */ int visible;
int visible; RECT rect;
RECT rect; RECT text;
RECT text; RECT expandBox; /* expand box (+/-) coordinate */
} TREEVIEW_ITEM; } TREEVIEW_ITEM;
typedef struct tagTREEVIEW_INFO typedef struct tagTREEVIEW_INFO
{ {
UINT uInternalStatus; UINT uInternalStatus;
UINT bAutoSize; /* merge with uInternalStatus */ UINT bAutoSize; /* merge with uInternalStatus */
INT Timer; INT Timer;
UINT uNumItems; /* number of valid TREEVIEW_ITEMs */ UINT uNumItems; /* number of valid TREEVIEW_ITEMs */
UINT uNumPtrsAlloced; UINT uNumPtrsAlloced;
HTREEITEM uMaxHandle; /* needed for delete_item */ HTREEITEM uMaxHandle; /* needed for delete_item */
HTREEITEM TopRootItem; /* handle to first item in treeview */ HTREEITEM TopRootItem; /* handle to first item in treeview */
INT cdmode; /* last custom draw setting */ INT cdmode; /* last custom draw setting */
UINT uItemHeight; /* item height, -1 for default item height */
UINT uItemHeight; /* item height, -1 for default item height */ UINT uRealItemHeight;/* current item height in pixels */
UINT uRealItemHeight; /* current item height in pixels */ UINT uVisibleHeight; /* visible height of treeview in pixels */
UINT uVisibleHeight; /* visible height of treeview in pixels */ UINT uTotalHeight; /* total height of treeview in pixels */
UINT uTotalHeight; /* total height of treeview in pixels */ UINT uVisibleWidth;
UINT uVisibleWidth; UINT uTotalWidth;
UINT uTotalWidth; UINT uIndent; /* indentation in pixels */
UINT uIndent; /* indentation in pixels */ HTREEITEM selectedItem; /* handle to selected item or 0 if none */
HTREEITEM selectedItem; /* handle to selected item or 0 if none */ HTREEITEM focusItem; /* handle to item that has focus, 0 if none */
HTREEITEM focusItem; /* handle to item that has focus, 0 if none */ HTREEITEM hotItem; /* handle currently under cursor, 0 if none */
HTREEITEM hotItem; /* handle currently under cursor, 0 if none */ 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 */ 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; HFONT hFont;
HFONT hFont; HFONT hBoldFont;
HFONT hBoldFont; HWND hwndToolTip;
HWND hwndToolTip; HWND hwndEdit;
HWND hwndEdit; WNDPROC wpEditOrig; /* needed for subclassing edit control */
WNDPROC wpEditOrig; /* needed for subclassing edit control */ HIMAGELIST himlNormal;
HIMAGELIST himlState;
HIMAGELIST himlNormal; TREEVIEW_ITEM *items; /* itemlist */
HIMAGELIST himlState; INT *freeList; /* bitmap indicating which elements are valid */
TREEVIEW_ITEM *items; /* itemlist */ /* 1=valid, 0=free; */
INT *freeList; /* bitmap indicating which elements are valid */ /* size of list= uNumPtrsAlloced/32 */
/* 1=valid, 0=free; */
/* size of list= uNumPtrsAlloced/32 */
} TREEVIEW_INFO; } TREEVIEW_INFO;