- Implementation of simple comctl32 v5.0 changes.
- TVM_SORTCHILDRENCB also accepts TVI_ROOT as a valid hParent.
This commit is contained in:
parent
e6bffc0965
commit
e74f219da6
|
@ -458,6 +458,26 @@ TREEVIEW_GetItemHeight (HWND hwnd)
|
||||||
return infoPtr->uItemHeight;
|
return infoPtr->uItemHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT
|
||||||
|
TREEVIEW_GetLineColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
||||||
|
|
||||||
|
TRACE("\n");
|
||||||
|
return (LRESULT) infoPtr->clrLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LRESULT
|
||||||
|
TREEVIEW_SetLineColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
||||||
|
COLORREF prevColor=infoPtr->clrLine;
|
||||||
|
|
||||||
|
TRACE("\n");
|
||||||
|
infoPtr->clrLine=(COLORREF) lParam;
|
||||||
|
return (LRESULT) prevColor;
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TREEVIEW_SetTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TREEVIEW_SetTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -522,11 +542,12 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
|
||||||
hOldFont = SelectObject (hdc, infoPtr->hFont);
|
hOldFont = SelectObject (hdc, infoPtr->hFont);
|
||||||
|
|
||||||
cditem=0;
|
cditem=0;
|
||||||
|
TRACE ("cdmode:%x\n",infoPtr->cdmode);
|
||||||
if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW) {
|
if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW) {
|
||||||
drawmode=CDDS_ITEMPREPAINT;
|
drawmode=CDDS_ITEMPREPAINT;
|
||||||
|
|
||||||
if (infoPtr->cdmode & CDRF_NOTIFYSUBITEMDRAW)
|
if (infoPtr->cdmode & CDRF_NOTIFYSUBITEMDRAW)
|
||||||
drawmode|=CDDS_SUBITEM;
|
drawmode|=CDDS_SUBITEM;
|
||||||
|
|
||||||
cditem=TREEVIEW_SendCustomDrawItemNotify (hwnd, hdc, wineItem, drawmode);
|
cditem=TREEVIEW_SendCustomDrawItemNotify (hwnd, hdc, wineItem, drawmode);
|
||||||
|
|
||||||
|
@ -597,9 +618,9 @@ TREEVIEW_DrawItem (HWND hwnd, HDC hdc, TREEVIEW_ITEM *wineItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a doted pen
|
* Get a dotted pen
|
||||||
*/
|
*/
|
||||||
hnewPen = CreatePen(PS_DOT, 0, GetSysColor(COLOR_WINDOWTEXT) );
|
hnewPen = CreatePen(PS_DOT, 0, infoPtr->clrLine);
|
||||||
hOldPen = SelectObject( hdc, hnewPen );
|
hOldPen = SelectObject( hdc, hnewPen );
|
||||||
|
|
||||||
if (hasParentOrSibling)
|
if (hasParentOrSibling)
|
||||||
|
@ -874,7 +895,6 @@ TREEVIEW_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (tvItem->mask & TVIF_INTEGRAL) {
|
if (tvItem->mask & TVIF_INTEGRAL) {
|
||||||
wineItem->iIntegral=tvItem->iIntegral;
|
wineItem->iIntegral=tvItem->iIntegral;
|
||||||
FIXME(" TVIF_INTEGRAL not supported yet\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tvItem->mask & TVIF_PARAM) {
|
if (tvItem->mask & TVIF_PARAM) {
|
||||||
|
@ -907,6 +927,19 @@ TREEVIEW_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT
|
||||||
|
TREEVIEW_GetItemState (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
|
{
|
||||||
|
TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
|
||||||
|
TREEVIEW_ITEM *wineItem;
|
||||||
|
|
||||||
|
wineItem = TREEVIEW_ValidItem (infoPtr, (HTREEITEM)wParam);
|
||||||
|
if (!wineItem) return 0;
|
||||||
|
|
||||||
|
return (wineItem->state & lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1141,7 +1174,6 @@ TREEVIEW_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (tvItem->mask & TVIF_INTEGRAL) {
|
if (tvItem->mask & TVIF_INTEGRAL) {
|
||||||
tvItem->iIntegral=wineItem->iIntegral;
|
tvItem->iIntegral=wineItem->iIntegral;
|
||||||
FIXME(" TVIF_INTEGRAL not supported yet\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* undocumented: windows ignores TVIF_PARAM and
|
/* undocumented: windows ignores TVIF_PARAM and
|
||||||
|
@ -1427,10 +1459,14 @@ LRESULT WINAPI TREEVIEW_Sort (
|
||||||
/* Obtain the TVSORTBC struct */
|
/* Obtain the TVSORTBC struct */
|
||||||
infoPtr->pCallBackSort = pSort;
|
infoPtr->pCallBackSort = pSort;
|
||||||
|
|
||||||
|
/* undocumented feature: TVI_ROOT means `sort the whole tree' */
|
||||||
|
|
||||||
|
if (parent==TVI_ROOT) parent=infoPtr->TopRootItem;
|
||||||
|
|
||||||
/* Check for a valid handle to the parent item */
|
/* Check for a valid handle to the parent item */
|
||||||
if (!TREEVIEW_ValidItem(infoPtr, parent))
|
if (!TREEVIEW_ValidItem(infoPtr, parent))
|
||||||
{
|
{
|
||||||
ERR ("invalid item hParent=%d\n", (INT)parent);
|
ERR ("invalid item hParent=%x\n", (INT)parent);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2053,9 +2089,9 @@ TREEVIEW_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
TRACE("wnd %x\n",hwnd);
|
TRACE("wnd %x\n",hwnd);
|
||||||
/* 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));
|
||||||
|
|
||||||
SetWindowLongA( hwnd, 0, (DWORD)infoPtr);
|
SetWindowLongA( hwnd, 0, (DWORD)infoPtr);
|
||||||
|
|
||||||
if (infoPtr == NULL) {
|
if (infoPtr == NULL) {
|
||||||
ERR("could not allocate info memory!\n");
|
ERR("could not allocate info memory!\n");
|
||||||
|
@ -2072,8 +2108,9 @@ TREEVIEW_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
/* set default settings */
|
/* set default settings */
|
||||||
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_BTNTEXT);
|
||||||
|
infoPtr->clrLine = GetSysColor (COLOR_WINDOWTEXT);
|
||||||
infoPtr->cy = 0;
|
infoPtr->cy = 0;
|
||||||
infoPtr->cx = 0;
|
infoPtr->cx = 0;
|
||||||
infoPtr->uIndent = 15;
|
infoPtr->uIndent = 15;
|
||||||
|
@ -2234,7 +2271,7 @@ TREEVIEW_SendSimpleNotify (HWND hwnd, UINT code)
|
||||||
|
|
||||||
TRACE("%x\n",code);
|
TRACE("%x\n",code);
|
||||||
nmhdr.hwndFrom = hwnd;
|
nmhdr.hwndFrom = hwnd;
|
||||||
nmhdr.idFrom = GetWindowLongA( hwnd, GWL_ID);
|
nmhdr.idFrom = GetWindowLongA( hwnd, GWL_ID);
|
||||||
nmhdr.code = code;
|
nmhdr.code = code;
|
||||||
|
|
||||||
return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
|
return (BOOL) SendMessageA (GetParent (hwnd), WM_NOTIFY,
|
||||||
|
@ -3544,6 +3581,15 @@ TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case TVM_GETSCROLLTIME:
|
case TVM_GETSCROLLTIME:
|
||||||
FIXME("Unimplemented msg TVM_GETSCROLLTIME\n");
|
FIXME("Unimplemented msg TVM_GETSCROLLTIME\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case TVM_GETITEMSTATE:
|
||||||
|
return TREEVIEW_GetItemState (hwnd,wParam, lParam);
|
||||||
|
|
||||||
|
case TVM_GETLINECOLOR:
|
||||||
|
return TREEVIEW_GetLineColor (hwnd,wParam, lParam);
|
||||||
|
|
||||||
|
case TVM_SETLINECOLOR:
|
||||||
|
return TREEVIEW_SetLineColor (hwnd,wParam, lParam);
|
||||||
|
|
||||||
case TVM_SETINSERTMARKCOLOR:
|
case TVM_SETINSERTMARKCOLOR:
|
||||||
FIXME("Unimplemented msg TVM_SETINSERTMARKCOLOR\n");
|
FIXME("Unimplemented msg TVM_SETINSERTMARKCOLOR\n");
|
||||||
|
@ -3586,14 +3632,12 @@ TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
return TREEVIEW_KeyDown (hwnd, wParam, lParam);
|
return TREEVIEW_KeyDown (hwnd, wParam, lParam);
|
||||||
|
|
||||||
|
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
return TREEVIEW_SetFocus (hwnd, wParam, lParam);
|
return TREEVIEW_SetFocus (hwnd, wParam, lParam);
|
||||||
|
|
||||||
case WM_KILLFOCUS:
|
case WM_KILLFOCUS:
|
||||||
return TREEVIEW_KillFocus (hwnd, wParam, lParam);
|
return TREEVIEW_KillFocus (hwnd, wParam, lParam);
|
||||||
|
|
||||||
|
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
return TREEVIEW_LButtonDown (hwnd, wParam, lParam);
|
return TREEVIEW_LButtonDown (hwnd, wParam, lParam);
|
||||||
|
|
||||||
|
@ -3612,11 +3656,10 @@ TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
return TREEVIEW_MouseMove (hwnd, wParam, lParam);
|
return TREEVIEW_MouseMove (hwnd, wParam, lParam);
|
||||||
|
|
||||||
|
|
||||||
/* case WM_SYSCOLORCHANGE: */
|
|
||||||
case WM_STYLECHANGED:
|
case WM_STYLECHANGED:
|
||||||
return TREEVIEW_StyleChanged (hwnd, wParam, lParam);
|
return TREEVIEW_StyleChanged (hwnd, wParam, lParam);
|
||||||
|
|
||||||
|
/* case WM_SYSCOLORCHANGE: */
|
||||||
/* case WM_SETREDRAW: */
|
/* case WM_SETREDRAW: */
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
|
|
|
@ -1669,9 +1669,34 @@ typedef struct
|
||||||
#define TVM_UNKNOWN36 (TV_FIRST+36)
|
#define TVM_UNKNOWN36 (TV_FIRST+36)
|
||||||
#define TVM_SETINSERTMARKCOLOR (TV_FIRST+37)
|
#define TVM_SETINSERTMARKCOLOR (TV_FIRST+37)
|
||||||
#define TVM_GETINSERTMARKCOLOR (TV_FIRST+38)
|
#define TVM_GETINSERTMARKCOLOR (TV_FIRST+38)
|
||||||
|
#define TVM_GETITEMSTATE (TV_FIRST+39)
|
||||||
|
#define TVM_SETLINECOLOR (TV_FIRST+40)
|
||||||
|
#define TVM_GETLINECOLOR (TV_FIRST+41)
|
||||||
#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)
|
||||||
#define TVN_LAST (0U-499U)
|
#define TVN_LAST (0U-499U)
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ typedef struct tagTREEVIEW_INFO
|
||||||
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;
|
||||||
HFONT hFont;
|
HFONT hFont;
|
||||||
HFONT hBoldFont;
|
HFONT hBoldFont;
|
||||||
HWND hwndToolTip;
|
HWND hwndToolTip;
|
||||||
|
|
Loading…
Reference in New Issue