ReactOS  0.4.11-dev-765-g5e024bf
treeview.c File Reference
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/heap.h"
Include dependency graph for treeview.c:

Go to the source code of this file.

Classes

struct  tagTREEVIEW_INFO
 
struct  _TREEITEM
 

Macros

#define NONAMELESSUNION
 
#define KEY_DELAY   450
 
#define TV_HSCROLL   0x01 /* treeview too large to fit in window */
 
#define TV_VSCROLL   0x02 /* (horizontal/vertical) */
 
#define TV_LDRAG   0x04 /* Lbutton pushed to start drag */
 
#define TV_LDRAGGING   0x08 /* Lbutton pushed, mouse moved. */
 
#define TV_RDRAG   0x10 /* ditto Rbutton */
 
#define TV_RDRAGGING   0x20
 
#define TV_EDIT_TIMER   2
 
#define TV_EDIT_TIMER_SET   2
 
#define TEXT_CALLBACK_SIZE   260
 
#define TREEVIEW_LEFT_MARGIN   8
 
#define MINIMUM_INDENT   19
 
#define CALLBACK_MASK_ALL   (TVIF_TEXT|TVIF_CHILDREN|TVIF_IMAGE|TVIF_SELECTEDIMAGE)
 
#define STATEIMAGEINDEX(x)   (((x) >> 12) & 0x0f)
 
#define OVERLAYIMAGEINDEX(x)   (((x) >> 8) & 0x0f)
 
#define ISVISIBLE(x)   ((x)->visibleOrder >= 0)
 
#define GETLINECOLOR(x)   ((x) == CLR_DEFAULT ? comctl32_color.clrGrayText : (x))
 
#define GETBKCOLOR(x)   ((x) == CLR_NONE ? comctl32_color.clrWindow : (x))
 
#define GETTXTCOLOR(x)   ((x) == CLR_NONE ? comctl32_color.clrWindowText : (x))
 
#define GETINSCOLOR(x)   ((x) == CLR_DEFAULT ? comctl32_color.clrBtnText : (x))
 
#define TVHEIGHT_MIN   16
 
#define TVHEIGHT_FONT_ADJUST   3 /* 2 for focus border + 1 for margin some apps assume */
 
#define SCROLL_ENTRY(dir, code)   { ((dir) << 7) | (code) }
 

Typedefs

typedef struct tagTREEVIEW_INFO TREEVIEW_INFO
 
typedef struct _TREEITEM TREEVIEW_ITEM
 
typedef VOID(* TREEVIEW_ItemEnumFunc )(TREEVIEW_INFO *, TREEVIEW_ITEM *, LPVOID)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (treeview)
 
static VOID TREEVIEW_Invalidate (const TREEVIEW_INFO *, const TREEVIEW_ITEM *)
 
static LRESULT TREEVIEW_DoSelectItem (TREEVIEW_INFO *, INT, HTREEITEM, INT)
 
static VOID TREEVIEW_SetFirstVisible (TREEVIEW_INFO *, TREEVIEW_ITEM *, BOOL)
 
static LRESULT TREEVIEW_EnsureVisible (TREEVIEW_INFO *, HTREEITEM, BOOL)
 
static LRESULT TREEVIEW_EndEditLabelNow (TREEVIEW_INFO *infoPtr, BOOL bCancel)
 
static VOID TREEVIEW_UpdateScrollBars (TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_HScroll (TREEVIEW_INFO *, WPARAM)
 
static void TREEVIEW_VerifyTree (TREEVIEW_INFO *infoPtr)
 
static TREEVIEW_INFOTREEVIEW_GetInfoPtr (HWND hwnd)
 
static int TREEVIEW_GetItemIndex (const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
 
static BOOL item_changed (const TREEVIEW_ITEM *tiOld, const TREEVIEW_ITEM *tiNew, const TVITEMEXW *tvChange)
 
static BOOL TREEVIEW_ValidItem (const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
 
static HFONT TREEVIEW_CreateBoldFont (HFONT hOrigFont)
 
static HFONT TREEVIEW_CreateUnderlineFont (HFONT hOrigFont)
 
static HFONT TREEVIEW_CreateBoldUnderlineFont (HFONT hfont)
 
static HFONT TREEVIEW_FontForItem (const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 
static const charTREEVIEW_ItemName (const TREEVIEW_ITEM *item)
 
static BOOL TREEVIEW_IsChildOf (const TREEVIEW_ITEM *parent, const TREEVIEW_ITEM *child)
 
static BOOL TREEVIEW_IsFullRowSelect (const TREEVIEW_INFO *infoPtr)
 
static BOOL TREEVIEW_IsItemHit (const TREEVIEW_INFO *infoPtr, const TVHITTESTINFO *ht)
 
static TREEVIEW_ITEMTREEVIEW_GetLastListItem (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static TREEVIEW_ITEMTREEVIEW_GetPrevListItem (const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *tvItem)
 
static TREEVIEW_ITEMTREEVIEW_GetNextListItem (const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *tvItem)
 
static TREEVIEW_ITEMTREEVIEW_GetListItem (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, LONG count)
 
static INT get_notifycode (const TREEVIEW_INFO *infoPtr, INT code)
 
static BOOL TREEVIEW_SendRealNotify (const TREEVIEW_INFO *infoPtr, UINT code, NMHDR *hdr)
 
static BOOL TREEVIEW_SendSimpleNotify (const TREEVIEW_INFO *infoPtr, UINT code)
 
static VOID TREEVIEW_TVItemFromItem (const TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem, TREEVIEW_ITEM *item)
 
static BOOL TREEVIEW_SendTreeviewNotify (const TREEVIEW_INFO *infoPtr, UINT code, UINT action, UINT mask, HTREEITEM oldItem, HTREEITEM newItem)
 
static BOOL TREEVIEW_SendTreeviewDnDNotify (const TREEVIEW_INFO *infoPtr, UINT code, HTREEITEM dragItem, POINT pt)
 
static BOOL TREEVIEW_SendCustomDrawNotify (const TREEVIEW_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, RECT rc)
 
static BOOL TREEVIEW_SendCustomDrawItemNotify (const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item, UINT uItemDrawState, NMTVCUSTOMDRAW *nmcdhdr)
 
static BOOL TREEVIEW_BeginLabelEditNotify (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editItem)
 
static void TREEVIEW_UpdateDispInfo (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT mask)
 
static BOOL TREEVIEW_HasChildren (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static INT TREEVIEW_NotifyFormat (TREEVIEW_INFO *infoPtr, HWND hwndFrom, UINT nCommand)
 
static VOID TREEVIEW_ComputeItemInternalMetrics (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static VOID TREEVIEW_ComputeTextWidth (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, HDC hDC)
 
static VOID TREEVIEW_ComputeItemRect (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static void TREEVIEW_RecalculateVisibleOrder (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *start)
 
static VOID TREEVIEW_UpdateSubTree (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *root)
 
static TREEVIEW_ITEMTREEVIEW_AllocateItem (const TREEVIEW_INFO *infoPtr)
 
static void TREEVIEW_FreeItem (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static void TREEVIEW_InsertBefore (TREEVIEW_ITEM *newItem, TREEVIEW_ITEM *sibling, TREEVIEW_ITEM *parent)
 
static void TREEVIEW_InsertAfter (TREEVIEW_ITEM *newItem, TREEVIEW_ITEM *sibling, TREEVIEW_ITEM *parent)
 
static BOOL TREEVIEW_DoSetItemT (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, const TVITEMEXW *tvItem, BOOL isW)
 
static LRESULT TREEVIEW_InsertItemT (TREEVIEW_INFO *infoPtr, const TVINSERTSTRUCTW *ptdi, BOOL isW)
 
static void TREEVIEW_RemoveItem (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static void TREEVIEW_RemoveAllChildren (TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *parentItem)
 
static void TREEVIEW_UnlinkItem (const TREEVIEW_ITEM *item)
 
static void TREEVIEW_RemoveTree (TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_DeleteItem (TREEVIEW_INFO *infoPtr, HTREEITEM item)
 
static LRESULT TREEVIEW_SetRedraw (TREEVIEW_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TREEVIEW_GetIndent (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_SetIndent (TREEVIEW_INFO *infoPtr, UINT newIndent)
 
static LRESULT TREEVIEW_GetToolTips (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_SetToolTips (TREEVIEW_INFO *infoPtr, HWND hwndTT)
 
static LRESULT TREEVIEW_SetUnicodeFormat (TREEVIEW_INFO *infoPtr, BOOL fUnicode)
 
static LRESULT TREEVIEW_GetUnicodeFormat (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_GetScrollTime (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_SetScrollTime (TREEVIEW_INFO *infoPtr, UINT uScrollTime)
 
static LRESULT TREEVIEW_GetImageList (const TREEVIEW_INFO *infoPtr, WPARAM wParam)
 
static UINT TREEVIEW_NaturalHeight (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_SetImageList (TREEVIEW_INFO *infoPtr, UINT type, HIMAGELIST himlNew)
 
static LRESULT TREEVIEW_SetItemHeight (TREEVIEW_INFO *infoPtr, INT newHeight)
 
static LRESULT TREEVIEW_GetItemHeight (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_GetFont (const TREEVIEW_INFO *infoPtr)
 
static INT CALLBACK TREEVIEW_ResetTextWidth (LPVOID pItem, LPVOID unused)
 
static LRESULT TREEVIEW_SetFont (TREEVIEW_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
 
static LRESULT TREEVIEW_GetLineColor (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_SetLineColor (TREEVIEW_INFO *infoPtr, COLORREF color)
 
static LRESULT TREEVIEW_GetTextColor (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_SetTextColor (TREEVIEW_INFO *infoPtr, COLORREF color)
 
static LRESULT TREEVIEW_GetBkColor (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_SetBkColor (TREEVIEW_INFO *infoPtr, COLORREF newColor)
 
static LRESULT TREEVIEW_GetInsertMarkColor (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_SetInsertMarkColor (TREEVIEW_INFO *infoPtr, COLORREF color)
 
static LRESULT TREEVIEW_SetInsertMark (TREEVIEW_INFO *infoPtr, BOOL wParam, HTREEITEM item)
 
static LRESULT TREEVIEW_GetItemRect (const TREEVIEW_INFO *infoPtr, BOOL fTextRect, LPRECT lpRect)
 
static LRESULT TREEVIEW_GetVisibleCount (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_GetItemT (const TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
 
static LRESULT TREEVIEW_SetItemT (TREEVIEW_INFO *infoPtr, const TVITEMEXW *tvItem, BOOL isW)
 
static LRESULT TREEVIEW_GetItemState (const TREEVIEW_INFO *infoPtr, HTREEITEM item, UINT mask)
 
static LRESULT TREEVIEW_GetNextItem (const TREEVIEW_INFO *infoPtr, UINT which, HTREEITEM item)
 
static LRESULT TREEVIEW_GetCount (const TREEVIEW_INFO *infoPtr)
 
static VOID TREEVIEW_ToggleItemState (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static void TREEVIEW_DrawItemLines (const TREEVIEW_INFO *infoPtr, HDC hdc, const TREEVIEW_ITEM *item)
 
static void TREEVIEW_DrawItem (const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
 
static void TREEVIEW_FillBkgnd (const TREEVIEW_INFO *infoPtr, HDC hdc, const RECT *rc)
 
static LRESULT TREEVIEW_EraseBackground (const TREEVIEW_INFO *infoPtr, HDC hdc)
 
static void TREEVIEW_Refresh (TREEVIEW_INFO *infoPtr, HDC hdc, const RECT *rc)
 
static void TREEVIEW_InvalidateItem (const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 
static void TREEVIEW_InitCheckboxes (TREEVIEW_INFO *infoPtr)
 
static void TREEVIEW_ResetImageStateIndex (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static LRESULT TREEVIEW_Paint (TREEVIEW_INFO *infoPtr, HDC hdc_ref)
 
static LRESULT TREEVIEW_PrintClient (TREEVIEW_INFO *infoPtr, HDC hdc, DWORD options)
 
static INT WINAPI TREEVIEW_CallBackCompare (const TREEVIEW_ITEM *first, const TREEVIEW_ITEM *second, const TVSORTCB *pCallBackSort)
 
static INT WINAPI TREEVIEW_SortOnName (TREEVIEW_ITEM *first, TREEVIEW_ITEM *second, const TREEVIEW_INFO *infoPtr)
 
static INT TREEVIEW_CountChildren (const TREEVIEW_ITEM *item)
 
static HDPA TREEVIEW_BuildChildDPA (const TREEVIEW_ITEM *item)
 
static LRESULT TREEVIEW_Sort (TREEVIEW_INFO *infoPtr, HTREEITEM parent, LPTVSORTCB pSort)
 
static LRESULT TREEVIEW_SortChildrenCB (TREEVIEW_INFO *infoPtr, LPTVSORTCB pSort)
 
static LRESULT TREEVIEW_SortChildren (TREEVIEW_INFO *infoPtr, LPARAM lParam)
 
static BOOL TREEVIEW_SendExpanding (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT action)
 
static VOID TREEVIEW_SendExpanded (const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT action)
 
static BOOL TREEVIEW_Collapse (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, BOOL bRemoveChildren, BOOL bUser)
 
static BOOL TREEVIEW_Expand (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, BOOL partial, BOOL user)
 
static void TREEVIEW_SingleExpand (TREEVIEW_INFO *infoPtr, HTREEITEM selection, HTREEITEM item)
 
static BOOL TREEVIEW_Toggle (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, BOOL user)
 
static VOID TREEVIEW_ExpandAll (TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
 
static LRESULT TREEVIEW_ExpandMsg (TREEVIEW_INFO *infoPtr, UINT flag, HTREEITEM item)
 
static TREEVIEW_ITEMTREEVIEW_HitTestPoint (const TREEVIEW_INFO *infoPtr, POINT pt)
 
static TREEVIEW_ITEMTREEVIEW_HitTest (const TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
 
static LRESULT TREEVIEW_GetEditControl (const TREEVIEW_INFO *infoPtr)
 
static LRESULT CALLBACK TREEVIEW_Edit_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT TREEVIEW_Command (TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static HWND TREEVIEW_EditLabel (TREEVIEW_INFO *infoPtr, HTREEITEM hItem)
 
static LRESULT TREEVIEW_HandleTimer (TREEVIEW_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TREEVIEW_TrackMouse (const TREEVIEW_INFO *infoPtr, POINT pt)
 
static LRESULT TREEVIEW_LButtonDoubleClick (TREEVIEW_INFO *infoPtr, LPARAM lParam)
 
static LRESULT TREEVIEW_LButtonDown (TREEVIEW_INFO *infoPtr, LPARAM lParam)
 
static LRESULT TREEVIEW_RButtonDown (TREEVIEW_INFO *infoPtr, LPARAM lParam)
 
static LRESULT TREEVIEW_CreateDragImage (TREEVIEW_INFO *infoPtr, LPARAM lParam)
 
static LRESULT TREEVIEW_SelectItem (TREEVIEW_INFO *infoPtr, INT wParam, HTREEITEM item)
 
static INT TREEVIEW_ProcessLetterKeys (TREEVIEW_INFO *infoPtr, WPARAM charCode, LPARAM keyData)
 
static LRESULT TREEVIEW_VScroll (TREEVIEW_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TREEVIEW_MouseWheel (TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TREEVIEW_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 
static LRESULT TREEVIEW_Destroy (TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_ScrollKeyDown (TREEVIEW_INFO *infoPtr, WPARAM key)
 
static LRESULT TREEVIEW_KeyDown (TREEVIEW_INFO *infoPtr, WPARAM wParam)
 
static LRESULT TREEVIEW_MouseLeave (TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_MouseMove (TREEVIEW_INFO *infoPtr, LPARAM lParam)
 
static BOOL TREEVIEW_NCPaint (const TREEVIEW_INFO *infoPtr, HRGN region, LPARAM lParam)
 
static LRESULT TREEVIEW_Notify (const TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TREEVIEW_Size (TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TREEVIEW_StyleChanged (TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TREEVIEW_SetCursor (const TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TREEVIEW_SetFocus (TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_KillFocus (const TREEVIEW_INFO *infoPtr)
 
static LRESULT TREEVIEW_ThemeChanged (const TREEVIEW_INFO *infoPtr)
 
static LRESULT WINAPI TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID TREEVIEW_Register (void)
 
VOID TREEVIEW_Unregister (void)
 
static void TREEVIEW_VerifyChildren (TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 
static void TREEVIEW_VerifyItemCommon (TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 
static void TREEVIEW_VerifyItem (TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 
static void TREEVIEW_VerifyRoot (TREEVIEW_INFO *infoPtr)
 

Variables

static const WCHAR themeClass [] = { 'T','r','e','e','v','i','e','w',0 }
 

Macro Definition Documentation

Definition at line 196 of file treeview.c.

Referenced by TREEVIEW_DrawItem().

#define GETBKCOLOR (   x)    ((x) == CLR_NONE ? comctl32_color.clrWindow : (x))

Definition at line 203 of file treeview.c.

Referenced by TREEVIEW_DrawItem(), TREEVIEW_DrawItemLines(), and TREEVIEW_FillBkgnd().

#define GETINSCOLOR (   x)    ((x) == CLR_DEFAULT ? comctl32_color.clrBtnText : (x))

Definition at line 205 of file treeview.c.

Referenced by TREEVIEW_DrawItem().

#define GETLINECOLOR (   x)    ((x) == CLR_DEFAULT ? comctl32_color.clrGrayText : (x))

Definition at line 202 of file treeview.c.

Referenced by TREEVIEW_DrawItemLines().

#define GETTXTCOLOR (   x)    ((x) == CLR_NONE ? comctl32_color.clrWindowText : (x))

Definition at line 204 of file treeview.c.

Referenced by TREEVIEW_DrawItem(), and TREEVIEW_DrawItemLines().

#define KEY_DELAY   450

Definition at line 174 of file treeview.c.

Referenced by TREEVIEW_ProcessLetterKeys().

#define MINIMUM_INDENT   19

Definition at line 194 of file treeview.c.

Referenced by TREEVIEW_Create(), TREEVIEW_SetImageList(), and TREEVIEW_SetIndent().

#define NONAMELESSUNION

Definition at line 53 of file treeview.c.

#define OVERLAYIMAGEINDEX (   x)    (((x) >> 8) & 0x0f)

Definition at line 199 of file treeview.c.

#define SCROLL_ENTRY (   dir,
  code 
)    { ((dir) << 7) | (code) }

Referenced by TREEVIEW_ScrollKeyDown().

#define STATEIMAGEINDEX (   x)    (((x) >> 12) & 0x0f)
#define TEXT_CALLBACK_SIZE   260

Definition at line 190 of file treeview.c.

Referenced by TREEVIEW_DoSetItemT(), and TREEVIEW_UpdateDispInfo().

#define TREEVIEW_LEFT_MARGIN   8

Definition at line 192 of file treeview.c.

#define TV_EDIT_TIMER   2
#define TV_EDIT_TIMER_SET   2
#define TV_HSCROLL   0x01 /* treeview too large to fit in window */

Definition at line 178 of file treeview.c.

Referenced by TREEVIEW_HScroll(), and TREEVIEW_UpdateScrollBars().

#define TV_LDRAG   0x04 /* Lbutton pushed to start drag */

Definition at line 180 of file treeview.c.

#define TV_LDRAGGING   0x08 /* Lbutton pushed, mouse moved. */

Definition at line 181 of file treeview.c.

#define TV_RDRAG   0x10 /* ditto Rbutton */

Definition at line 182 of file treeview.c.

#define TV_RDRAGGING   0x20

Definition at line 183 of file treeview.c.

#define TV_VSCROLL   0x02 /* (horizontal/vertical) */

Definition at line 179 of file treeview.c.

Referenced by TREEVIEW_UpdateScrollBars(), and TREEVIEW_VScroll().

#define TVHEIGHT_FONT_ADJUST   3 /* 2 for focus border + 1 for margin some apps assume */

Definition at line 1730 of file treeview.c.

Referenced by TREEVIEW_NaturalHeight().

#define TVHEIGHT_MIN   16

Definition at line 1729 of file treeview.c.

Referenced by TREEVIEW_NaturalHeight().

Typedef Documentation

typedef VOID(* TREEVIEW_ItemEnumFunc)(TREEVIEW_INFO *, TREEVIEW_ITEM *, LPVOID)

Definition at line 210 of file treeview.c.

Function Documentation

static INT get_notifycode ( const TREEVIEW_INFO infoPtr,
INT  code 
)
static

Definition at line 499 of file treeview.c.

Referenced by TREEVIEW_SendRealNotify().

500 {
501  if (!infoPtr->bNtfUnicode) {
502  switch (code) {
503  case TVN_SELCHANGINGW: return TVN_SELCHANGINGA;
504  case TVN_SELCHANGEDW: return TVN_SELCHANGEDA;
505  case TVN_GETDISPINFOW: return TVN_GETDISPINFOA;
506  case TVN_SETDISPINFOW: return TVN_SETDISPINFOA;
509  case TVN_BEGINDRAGW: return TVN_BEGINDRAGA;
510  case TVN_BEGINRDRAGW: return TVN_BEGINRDRAGA;
511  case TVN_DELETEITEMW: return TVN_DELETEITEMA;
514  case TVN_GETINFOTIPW: return TVN_GETINFOTIPA;
515  }
516  }
517  return code;
518 }
#define TVN_SELCHANGINGW
Definition: commctrl.h:3613
#define TVN_GETDISPINFOA
Definition: commctrl.h:3621
#define TVN_ITEMEXPANDEDW
Definition: commctrl.h:3669
#define TVN_BEGINDRAGA
Definition: commctrl.h:3670
#define TVN_BEGINRDRAGW
Definition: commctrl.h:3673
#define TVN_DELETEITEMA
Definition: commctrl.h:3674
#define TVN_ITEMEXPANDEDA
Definition: commctrl.h:3668
#define TVN_SELCHANGEDA
Definition: commctrl.h:3614
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3679
#define TVN_GETINFOTIPA
Definition: commctrl.h:3681
#define TVN_ITEMEXPANDINGW
Definition: commctrl.h:3667
#define TVN_SELCHANGEDW
Definition: commctrl.h:3615
#define TVN_DELETEITEMW
Definition: commctrl.h:3675
#define TVN_SETDISPINFOW
Definition: commctrl.h:3624
#define TVN_ENDLABELEDITA
Definition: commctrl.h:3678
#define TVN_SELCHANGINGA
Definition: commctrl.h:3612
int code
Definition: i386-dis.c:3591
#define TVN_BEGINDRAGW
Definition: commctrl.h:3671
#define TVN_BEGINLABELEDITW
Definition: commctrl.h:3677
#define TVN_GETDISPINFOW
Definition: commctrl.h:3622
#define TVN_GETINFOTIPW
Definition: commctrl.h:3682
#define TVN_SETDISPINFOA
Definition: commctrl.h:3623
#define TVN_BEGINLABELEDITA
Definition: commctrl.h:3676
#define TVN_BEGINRDRAGA
Definition: commctrl.h:3672
#define TVN_ITEMEXPANDINGA
Definition: commctrl.h:3666
static BOOL item_changed ( const TREEVIEW_ITEM tiOld,
const TREEVIEW_ITEM tiNew,
const TVITEMEXW tvChange 
)
inlinestatic

Definition at line 241 of file treeview.c.

Referenced by TREEVIEW_SetItemT().

243 {
244  /* Number of children has changed */
245  if ((tvChange->mask & TVIF_CHILDREN) && (tiOld->cChildren != tiNew->cChildren))
246  return TRUE;
247 
248  /* Image has changed and it's not a callback */
249  if ((tvChange->mask & TVIF_IMAGE) && (tiOld->iImage != tiNew->iImage) &&
250  tiNew->iImage != I_IMAGECALLBACK)
251  return TRUE;
252 
253  /* Selected image has changed and it's not a callback */
254  if ((tvChange->mask & TVIF_SELECTEDIMAGE) && (tiOld->iSelectedImage != tiNew->iSelectedImage) &&
256  return TRUE;
257 
258  if ((tvChange->mask & TVIF_EXPANDEDIMAGE) && (tiOld->iExpandedImage != tiNew->iExpandedImage) &&
260  return TRUE;
261 
262  /* Text has changed and it's not a callback */
263  if ((tvChange->mask & TVIF_TEXT) && (tiOld->pszText != tiNew->pszText) &&
264  tiNew->pszText != LPSTR_TEXTCALLBACKW)
265  return TRUE;
266 
267  /* Indent has changed */
268  if ((tvChange->mask & TVIF_INTEGRAL) && (tiOld->iIntegral != tiNew->iIntegral))
269  return TRUE;
270 
271  /* Item state has changed */
272  if ((tvChange->mask & TVIF_STATE) && ((tiOld->state ^ tiNew->state) & tvChange->stateMask ))
273  return TRUE;
274 
275  return FALSE;
276 }
#define TRUE
Definition: types.h:120
#define TVIF_EXPANDEDIMAGE
Definition: commctrl.h:3246
UINT stateMask
Definition: commctrl.h:3316
int cChildren
Definition: treeview.c:154
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3238
#define TVIF_CHILDREN
Definition: commctrl.h:3239
#define FALSE
Definition: types.h:117
#define TVIF_INTEGRAL
Definition: commctrl.h:3241
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2350
UINT state
Definition: treeview.c:147
int iIntegral
Definition: treeview.c:156
int iSelectedImage
Definition: treeview.c:152
LPWSTR pszText
Definition: treeview.c:149
#define I_IMAGECALLBACK
Definition: commctrl.h:2355
#define TVIF_TEXT
Definition: commctrl.h:3233
#define TVIF_IMAGE
Definition: commctrl.h:3234
int iExpandedImage
Definition: treeview.c:153
#define TVIF_STATE
Definition: commctrl.h:3236
int iImage
Definition: treeview.c:151
static TREEVIEW_ITEM* TREEVIEW_AllocateItem ( const TREEVIEW_INFO infoPtr)
static

Definition at line 1003 of file treeview.c.

Referenced by TREEVIEW_Create(), and TREEVIEW_InsertItemT().

1004 {
1005  TREEVIEW_ITEM *newItem = heap_alloc_zero(sizeof(*newItem));
1006 
1007  if (!newItem)
1008  return NULL;
1009 
1010  /* I_IMAGENONE would make more sense but this is neither what is
1011  * documented (MSDN doesn't specify) nor what Windows actually does
1012  * (it sets it to zero)... and I can so imagine an application using
1013  * inc/dec to toggle the images. */
1014  newItem->iImage = 0;
1015  newItem->iSelectedImage = 0;
1016  newItem->iExpandedImage = (WORD)I_IMAGENONE;
1017  newItem->infoPtr = infoPtr;
1018 
1019  if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
1020  {
1021  heap_free(newItem);
1022  return NULL;
1023  }
1024 
1025  return newItem;
1026 }
#define I_IMAGENONE
Definition: commctrl.h:2356
unsigned short WORD
Definition: ntddk_ex.h:93
#define INT_MAX
Definition: limits.h:40
const TREEVIEW_INFO * infoPtr
Definition: treeview.c:170
smooth NULL
Definition: ftsmooth.c:416
int iSelectedImage
Definition: treeview.c:152
INT WINAPI DPA_InsertPtr(HDPA hdpa, INT i, LPVOID p)
Definition: dpa.c:591
int iExpandedImage
Definition: treeview.c:153
int iImage
Definition: treeview.c:151
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static BOOL TREEVIEW_BeginLabelEditNotify ( const TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM editItem 
)
static

Definition at line 686 of file treeview.c.

Referenced by TREEVIEW_EditLabel().

687 {
688  NMTVDISPINFOW tvdi;
689  BOOL ret;
690 
692  &tvdi.item, editItem);
693 
694  ret = TREEVIEW_SendRealNotify(infoPtr, TVN_BEGINLABELEDITW, &tvdi.hdr);
695 
696  if (!infoPtr->bNtfUnicode)
697  heap_free(tvdi.item.pszText);
698 
699  return ret;
700 }
static VOID TREEVIEW_TVItemFromItem(const TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem, TREEVIEW_ITEM *item)
Definition: treeview.c:540
static BOOL TREEVIEW_SendRealNotify(const TREEVIEW_INFO *infoPtr, UINT code, NMHDR *hdr)
Definition: treeview.c:521
LPWSTR pszText
Definition: commctrl.h:3287
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
#define TVN_BEGINLABELEDITW
Definition: commctrl.h:3677
#define TVIF_HANDLE
Definition: commctrl.h:3237
#define TVIF_TEXT
Definition: commctrl.h:3233
TVITEMW item
Definition: commctrl.h:3639
#define TVIF_STATE
Definition: commctrl.h:3236
#define TVIF_PARAM
Definition: commctrl.h:3235
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static HDPA TREEVIEW_BuildChildDPA ( const TREEVIEW_ITEM item)
static

Definition at line 3134 of file treeview.c.

Referenced by TREEVIEW_Sort().

3135 {
3136  HTREEITEM child;
3137 
3138  HDPA list = DPA_Create(8);
3139  if (list == 0) return NULL;
3140 
3141  for (child = item->firstChild; child != NULL; child = child->nextSibling)
3142  {
3143  if (DPA_InsertPtr(list, INT_MAX, child) == -1)
3144  {
3145  DPA_Destroy(list);
3146  return NULL;
3147  }
3148  }
3149 
3150  return list;
3151 }
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
HTREEITEM nextSibling
Definition: treeview.c:143
#define INT_MAX
Definition: limits.h:40
BOOL WINAPI DPA_Destroy(HDPA hdpa)
Definition: dpa.c:396
static HWND child
Definition: cursoricon.c:298
HTREEITEM firstChild
Definition: treeview.c:144
smooth NULL
Definition: ftsmooth.c:416
INT WINAPI DPA_InsertPtr(HDPA hdpa, INT i, LPVOID p)
Definition: dpa.c:591
Definition: _list.h:228
#define list
Definition: rosglue.h:35
Definition: dpa.c:48
static INT WINAPI TREEVIEW_CallBackCompare ( const TREEVIEW_ITEM first,
const TREEVIEW_ITEM second,
const TVSORTCB pCallBackSort 
)
static

Definition at line 3089 of file treeview.c.

Referenced by TREEVIEW_Sort().

3091 {
3092  /* Forward the call to the client-defined callback */
3093  return pCallBackSort->lpfnCompare(first->lParam,
3094  second->lParam,
3095  pCallBackSort->lParam);
3096 }
LPARAM lParam
Definition: treeview.c:155
PFNTVCOMPARE lpfnCompare
Definition: commctrl.h:3582
LPARAM lParam
Definition: commctrl.h:3583
static BOOL TREEVIEW_Collapse ( TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM item,
BOOL  bRemoveChildren,
BOOL  bUser 
)
static

Definition at line 3328 of file treeview.c.

Referenced by TREEVIEW_ExpandMsg(), TREEVIEW_KeyDown(), TREEVIEW_SingleExpand(), and TREEVIEW_Toggle().

3330 {
3331  UINT action = TVE_COLLAPSE | (bRemoveChildren ? TVE_COLLAPSERESET : 0);
3332  BOOL bSetSelection, bSetFirstVisible;
3333  RECT scrollRect;
3334  LONG scrollDist = 0;
3335  TREEVIEW_ITEM *nextItem = NULL, *tmpItem;
3336  BOOL wasExpanded;
3337 
3338  TRACE("TVE_COLLAPSE %p %s\n", item, TREEVIEW_ItemName(item));
3339 
3340  if (!TREEVIEW_HasChildren(infoPtr, item))
3341  return FALSE;
3342 
3343  if (bUser)
3344  TREEVIEW_SendExpanding(infoPtr, item, action);
3345 
3346  if (item->firstChild == NULL)
3347  return FALSE;
3348 
3349  wasExpanded = (item->state & TVIS_EXPANDED) != 0;
3350  item->state &= ~TVIS_EXPANDED;
3351 
3352  if (wasExpanded && bUser)
3353  TREEVIEW_SendExpanded(infoPtr, item, action);
3354 
3355  bSetSelection = (infoPtr->selectedItem != NULL
3356  && TREEVIEW_IsChildOf(item, infoPtr->selectedItem));
3357 
3358  bSetFirstVisible = (infoPtr->firstVisible != NULL
3359  && TREEVIEW_IsChildOf(item, infoPtr->firstVisible));
3360 
3361  tmpItem = item;
3362  while (tmpItem)
3363  {
3364  if (tmpItem->nextSibling)
3365  {
3366  nextItem = tmpItem->nextSibling;
3367  break;
3368  }
3369  tmpItem = tmpItem->parent;
3370  }
3371 
3372  if (nextItem)
3373  scrollDist = nextItem->rect.top;
3374 
3375  if (bRemoveChildren)
3376  {
3377  INT old_cChildren = item->cChildren;
3378  TRACE("TVE_COLLAPSERESET\n");
3379  item->state &= ~TVIS_EXPANDEDONCE;
3380  TREEVIEW_RemoveAllChildren(infoPtr, item);
3381  item->cChildren = old_cChildren;
3382  }
3383  if (!wasExpanded)
3384  return FALSE;
3385 
3386  if (item->firstChild)
3387  {
3388  TREEVIEW_ITEM *i, *sibling;
3389 
3390  sibling = TREEVIEW_GetNextListItem(infoPtr, item);
3391 
3392  for (i = item->firstChild; i != sibling;
3393  i = TREEVIEW_GetNextListItem(infoPtr, i))
3394  {
3395  i->visibleOrder = -1;
3396  }
3397  }
3398 
3399  TREEVIEW_RecalculateVisibleOrder(infoPtr, item);
3400 
3401  if (nextItem)
3402  scrollDist = -(scrollDist - nextItem->rect.top);
3403 
3404  if (bSetSelection)
3405  {
3406  /* Don't call DoSelectItem, it sends notifications. */
3407  if (TREEVIEW_ValidItem(infoPtr, infoPtr->selectedItem))
3408  infoPtr->selectedItem->state &= ~TVIS_SELECTED;
3409  item->state |= TVIS_SELECTED;
3410  infoPtr->selectedItem = item;
3411  }
3412 
3413  TREEVIEW_UpdateScrollBars(infoPtr);
3414 
3415  scrollRect.left = 0;
3416  scrollRect.right = infoPtr->clientWidth;
3417  scrollRect.bottom = infoPtr->clientHeight;
3418 
3419  if (nextItem)
3420  {
3421  scrollRect.top = nextItem->rect.top;
3422 
3423  ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, &scrollRect,
3425  TREEVIEW_Invalidate(infoPtr, item);
3426  } else {
3427  scrollRect.top = item->rect.top;
3428  InvalidateRect(infoPtr->hwnd, &scrollRect, TRUE);
3429  }
3430 
3431  TREEVIEW_SetFirstVisible(infoPtr,
3432  bSetFirstVisible ? item : infoPtr->firstVisible,
3433  TRUE);
3434 
3435  return wasExpanded;
3436 }
#define TRUE
Definition: types.h:120
static VOID TREEVIEW_Invalidate(const TREEVIEW_INFO *, const TREEVIEW_ITEM *)
Definition: treeview.c:2955
HTREEITEM nextSibling
Definition: treeview.c:143
static void TREEVIEW_RemoveAllChildren(TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *parentItem)
Definition: treeview.c:1440
HTREEITEM firstVisible
Definition: treeview.c:100
RECT rect
Definition: treeview.c:160
#define TVIS_SELECTED
Definition: commctrl.h:3247
LONG visibleOrder
Definition: treeview.c:166
LONG top
Definition: windef.h:297
static const char * TREEVIEW_ItemName(const TREEVIEW_ITEM *item)
Definition: treeview.c:336
int cChildren
Definition: treeview.c:154
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3252
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
int32_t INT
Definition: typedefs.h:56
static BOOL TREEVIEW_IsChildOf(const TREEVIEW_ITEM *parent, const TREEVIEW_ITEM *child)
Definition: treeview.c:346
static VOID TREEVIEW_SendExpanded(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT action)
Definition: treeview.c:3315
HTREEITEM firstChild
Definition: treeview.c:144
GLenum GLclampf GLint i
Definition: glfuncs.h:14
static VOID TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr)
Definition: treeview.c:2743
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define SW_ERASE
Definition: winuser.h:2534
smooth NULL
Definition: ftsmooth.c:416
#define TVE_COLLAPSE
Definition: commctrl.h:3389
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
static TREEVIEW_ITEM * TREEVIEW_GetNextListItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *tvItem)
Definition: treeview.c:427
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
UINT state
Definition: treeview.c:147
LONG clientHeight
Definition: treeview.c:89
HTREEITEM selectedItem
Definition: treeview.c:95
#define SW_INVALIDATE
Definition: winuser.h:2533
#define TVIS_EXPANDED
Definition: commctrl.h:3251
const WCHAR * action
Definition: action.c:7779
static ATOM item
Definition: dde.c:856
unsigned int UINT
Definition: ndis.h:50
static BOOL TREEVIEW_SendExpanding(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT action)
Definition: treeview.c:3305
HTREEITEM parent
Definition: treeview.c:142
static BOOL TREEVIEW_HasChildren(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
Definition: treeview.c:834
LONG clientWidth
Definition: treeview.c:88
LONG bottom
Definition: windef.h:299
static VOID TREEVIEW_SetFirstVisible(TREEVIEW_INFO *, TREEVIEW_ITEM *, BOOL)
Definition: treeview.c:4823
static void TREEVIEW_RecalculateVisibleOrder(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *start)
Definition: treeview.c:929
static BOOL TREEVIEW_ValidItem(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:282
#define TVE_COLLAPSERESET
Definition: commctrl.h:3393
static LRESULT TREEVIEW_Command ( TREEVIEW_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 3816 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

3817 {
3818  TRACE("code=0x%x, id=0x%x, handle=0x%lx\n", HIWORD(wParam), LOWORD(wParam), lParam);
3819 
3820  switch (HIWORD(wParam))
3821  {
3822  case EN_UPDATE:
3823  {
3824  /*
3825  * Adjust the edit window size
3826  */
3827  WCHAR buffer[1024];
3828  TREEVIEW_ITEM *editItem = infoPtr->editItem;
3829  HDC hdc = GetDC(infoPtr->hwndEdit);
3830  SIZE sz;
3831  HFONT hFont, hOldFont = 0;
3832 
3833  TRACE("edit=%p\n", infoPtr->hwndEdit);
3834 
3835  if (!IsWindow(infoPtr->hwndEdit) || !hdc) return FALSE;
3836 
3837  infoPtr->bLabelChanged = TRUE;
3838 
3839  GetWindowTextW(infoPtr->hwndEdit, buffer, ARRAY_SIZE(buffer));
3840 
3841  /* Select font to get the right dimension of the string */
3842  hFont = (HFONT)SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0);
3843 
3844  if (hFont != 0)
3845  {
3846  hOldFont = SelectObject(hdc, hFont);
3847  }
3848 
3849  if (GetTextExtentPoint32W(hdc, buffer, strlenW(buffer), &sz))
3850  {
3851  TEXTMETRICW textMetric;
3852 
3853  /* Add Extra spacing for the next character */
3854  GetTextMetricsW(hdc, &textMetric);
3855  sz.cx += (textMetric.tmMaxCharWidth * 2);
3856 
3857  sz.cx = max(sz.cx, textMetric.tmMaxCharWidth * 3);
3858  sz.cx = min(sz.cx,
3859  infoPtr->clientWidth - editItem->textOffset + 2);
3860 
3861  SetWindowPos(infoPtr->hwndEdit,
3862  HWND_TOP,
3863  0,
3864  0,
3865  sz.cx,
3866  editItem->rect.bottom - editItem->rect.top + 3,
3868  }
3869 
3870  if (hFont != 0)
3871  {
3872  SelectObject(hdc, hOldFont);
3873  }
3874 
3875  ReleaseDC(infoPtr->hwnd, hdc);
3876  break;
3877  }
3878  case EN_KILLFOCUS:
3879  /* apparently we should respect passed handle value */
3880  if (infoPtr->hwndEdit != (HWND)lParam) return FALSE;
3881 
3882  TREEVIEW_EndEditLabelNow(infoPtr, FALSE);
3883  break;
3884 
3885  default:
3886  return SendMessageW(infoPtr->hwndNotify, WM_COMMAND, wParam, lParam);
3887  }
3888 
3889  return 0;
3890 }
LONG tmMaxCharWidth
Definition: wingdi.h:2366
#define HDC
Definition: msvc.h:22
#define SWP_DRAWFRAME
Definition: winuser.h:1224
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static LRESULT TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
Definition: treeview.c:3995
HTREEITEM editItem
Definition: treeview.c:98
BOOL WINAPI IsWindow(_In_opt_ HWND)
HDC WINAPI GetDC(_In_opt_ HWND)
RECT rect
Definition: treeview.c:160
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG top
Definition: windef.h:297
HANDLE HWND
Definition: compat.h:13
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define HWND_TOP
Definition: winuser.h:1193
GLuint buffer
Definition: glext.h:5915
HFONT hFont
Definition: main.c:53
#define EN_KILLFOCUS
Definition: winuser.h:1986
#define FALSE
Definition: types.h:117
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
#define WM_GETFONT
Definition: winuser.h:1633
LONG cx
Definition: windef.h:324
#define TRACE(s)
Definition: solgame.cpp:4
LONG textOffset
Definition: treeview.c:164
UINT WPARAM wParam
Definition: precomp.h:45
#define WM_COMMAND
Definition: winuser.h:1716
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT WPARAM LPARAM lParam
Definition: precomp.h:45
#define min(a, b)
Definition: monoChain.cc:55
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL bLabelChanged
Definition: treeview.c:123
#define HIWORD(l)
Definition: typedefs.h:246
LONG clientWidth
Definition: treeview.c:88
LONG bottom
Definition: windef.h:299
#define EN_UPDATE
Definition: winuser.h:1989
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define LOWORD(l)
Definition: pedump.c:82
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
static VOID TREEVIEW_ComputeItemInternalMetrics ( const TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM item 
)
static

Definition at line 866 of file treeview.c.

Referenced by TREEVIEW_InsertItemT(), TREEVIEW_RecalculateVisibleOrder(), TREEVIEW_SetItemT(), and TREEVIEW_UpdateSubTree().

867 {
868  /* has TVS_LINESATROOT and (TVS_HASLINES|TVS_HASBUTTONS) */
870  > TVS_LINESATROOT);
871 
872  item->linesOffset = infoPtr->uIndent * (lar ? item->iLevel : item->iLevel - 1)
873  - infoPtr->scrollX;
874  item->stateOffset = item->linesOffset + infoPtr->uIndent;
875  item->imageOffset = item->stateOffset
876  + (STATEIMAGEINDEX(item->state) ? infoPtr->stateImageWidth : 0);
877  item->textOffset = item->imageOffset + infoPtr->normalImageWidth;
878 }
LONG linesOffset
Definition: treeview.c:161
#define TVS_LINESATROOT
Definition: commctrl.h:3216
#define STATEIMAGEINDEX(x)
Definition: treeview.c:198
int iLevel
Definition: treeview.c:157
#define TVS_HASBUTTONS
Definition: commctrl.h:3214
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG textOffset
Definition: treeview.c:164
int normalImageWidth
Definition: treeview.c:128
UINT state
Definition: treeview.c:147
#define TVS_HASLINES
Definition: commctrl.h:3215
LONG stateOffset
Definition: treeview.c:162
LONG imageOffset
Definition: treeview.c:163
static VOID TREEVIEW_ComputeItemRect ( const TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM item 
)
static

Definition at line 915 of file treeview.c.

Referenced by TREEVIEW_RecalculateVisibleOrder().

916 {
917  item->rect.top = infoPtr->uItemHeight *
918  (item->visibleOrder - infoPtr->firstVisible->visibleOrder);
919 
920  item->rect.bottom = item->rect.top
921  + infoPtr->uItemHeight * item->iIntegral - 1;
922 
923  item->rect.left = 0;
924  item->rect.right = infoPtr->clientWidth;
925 }
HTREEITEM firstVisible
Definition: treeview.c:100
RECT rect
Definition: treeview.c:160
LONG visibleOrder
Definition: treeview.c:166
LONG top
Definition: windef.h:297
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
int iIntegral
Definition: treeview.c:156
UINT uItemHeight
Definition: treeview.c:85
LONG clientWidth
Definition: treeview.c:88
LONG bottom
Definition: windef.h:299
static VOID TREEVIEW_ComputeTextWidth ( const TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM item,
HDC  hDC 
)
static

Definition at line 881 of file treeview.c.

Referenced by TREEVIEW_DrawItem(), TREEVIEW_EndEditLabelNow(), TREEVIEW_GetItemRect(), TREEVIEW_HitTest(), TREEVIEW_InsertItemT(), TREEVIEW_SetItemT(), and TREEVIEW_UpdateSubTree().

882 {
883  HDC hdc;
884  HFONT hOldFont=0;
885  SIZE sz;
886 
887  /* DRAW's OM docker creates items like this */
888  if (item->pszText == NULL)
889  {
890  item->textWidth = 0;
891  return;
892  }
893 
894  if (hDC != 0)
895  {
896  hdc = hDC;
897  }
898  else
899  {
900  hdc = GetDC(infoPtr->hwnd);
901  hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, item));
902  }
903 
904  GetTextExtentPoint32W(hdc, item->pszText, strlenW(item->pszText), &sz);
905  item->textWidth = sz.cx;
906 
907  if (hDC == 0)
908  {
909  SelectObject(hdc, hOldFont);
910  ReleaseDC(0, hdc);
911  }
912 }
#define HDC
Definition: msvc.h:22
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HDC WINAPI GetDC(_In_opt_ HWND)
static HFONT TREEVIEW_FontForItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
Definition: treeview.c:325
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:324
HDC hDC
Definition: wglext.h:521
LONG textWidth
Definition: treeview.c:165
LPWSTR pszText
Definition: treeview.c:149
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
static INT TREEVIEW_CountChildren ( const TREEVIEW_ITEM item)
static

Definition at line 3120 of file treeview.c.

Referenced by TREEVIEW_Sort().

3121 {
3122  INT cChildren = 0;
3123  HTREEITEM hti;
3124 
3125  for (hti = item->firstChild; hti != NULL; hti = hti->nextSibling)
3126  cChildren++;
3127 
3128  return cChildren;
3129 }
HTREEITEM nextSibling
Definition: treeview.c:143
int32_t INT
Definition: typedefs.h:56
HTREEITEM firstChild
Definition: treeview.c:144
smooth NULL
Definition: ftsmooth.c:416
static LRESULT TREEVIEW_Create ( HWND  hwnd,
const CREATESTRUCTW lpcs 
)
static

Definition at line 5079 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

5080 {
5081  RECT rcClient;
5082  TREEVIEW_INFO *infoPtr;
5083  LOGFONTW lf;
5084 
5085  TRACE("wnd %p, style 0x%x\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE));
5086 
5087  infoPtr = heap_alloc_zero(sizeof(TREEVIEW_INFO));
5088 
5089  if (infoPtr == NULL)
5090  {
5091  ERR("could not allocate info memory!\n");
5092  return 0;
5093  }
5094 
5095  SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
5096 
5097  infoPtr->hwnd = hwnd;
5098  infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
5099  infoPtr->Timer = 0;
5100  infoPtr->uNumItems = 0;
5101  infoPtr->cdmode = 0;
5102  infoPtr->uScrollTime = 300; /* milliseconds */
5103  infoPtr->bRedraw = TRUE;
5104 
5105  GetClientRect(hwnd, &rcClient);
5106 
5107  /* No scroll bars yet. */
5108  infoPtr->clientWidth = rcClient.right;
5109  infoPtr->clientHeight = rcClient.bottom;
5110  infoPtr->uInternalStatus = 0;
5111 
5112  infoPtr->treeWidth = 0;
5113  infoPtr->treeHeight = 0;
5114 
5115  infoPtr->uIndent = MINIMUM_INDENT;
5116  infoPtr->selectedItem = NULL;
5117  infoPtr->focusedItem = NULL;
5118  infoPtr->hotItem = NULL;
5119  infoPtr->editItem = NULL;
5120  infoPtr->firstVisible = NULL;
5121  infoPtr->maxVisibleOrder = 0;
5122  infoPtr->dropItem = NULL;
5123  infoPtr->insertMarkItem = NULL;
5124  infoPtr->insertBeforeorAfter = 0;
5125  /* dragList */
5126 
5127  infoPtr->scrollX = 0;
5128  infoPtr->wheelRemainder = 0;
5129 
5130  infoPtr->clrBk = CLR_NONE; /* use system color */
5131  infoPtr->clrText = CLR_NONE; /* use system color */
5132  infoPtr->clrLine = CLR_DEFAULT;
5133  infoPtr->clrInsertMark = CLR_DEFAULT;
5134 
5135  /* hwndToolTip */
5136 
5137  infoPtr->hwndEdit = NULL;
5138  infoPtr->wpEditOrig = NULL;
5139  infoPtr->bIgnoreEditKillFocus = FALSE;
5140  infoPtr->bLabelChanged = FALSE;
5141 
5142  infoPtr->himlNormal = NULL;
5143  infoPtr->himlState = NULL;
5144  infoPtr->normalImageWidth = 0;
5145  infoPtr->normalImageHeight = 0;
5146  infoPtr->stateImageWidth = 0;
5147  infoPtr->stateImageHeight = 0;
5148 
5149  infoPtr->items = DPA_Create(16);
5150 
5151  SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
5152  infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW(&lf);
5153  infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont);
5154  infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont);
5156  infoPtr->hcurHand = LoadCursorW(NULL, (LPWSTR)IDC_HAND);
5157 
5158  infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr);
5159 
5160  infoPtr->root = TREEVIEW_AllocateItem(infoPtr);
5161  infoPtr->root->state = TVIS_EXPANDED;
5162  infoPtr->root->iLevel = -1;
5163  infoPtr->root->visibleOrder = -1;
5164 
5165  infoPtr->hwndNotify = lpcs->hwndParent;
5166  infoPtr->hwndToolTip = 0;
5167 
5168  /* Determine what type of notify should be issued (sets infoPtr->bNtfUnicode) */
5169  TREEVIEW_NotifyFormat(infoPtr, infoPtr->hwndNotify, NF_REQUERY);
5170 
5171  if (!(infoPtr->dwStyle & TVS_NOTOOLTIPS))
5174  hwnd, 0, 0, 0);
5175 
5176  /* Make sure actual scrollbar state is consistent with uInternalStatus */
5179 
5181 
5182  return 0;
5183 }
static HFONT TREEVIEW_CreateUnderlineFont(HFONT hOrigFont)
Definition: treeview.c:304
COLORREF clrText
Definition: treeview.c:109
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
COLORREF clrInsertMark
Definition: treeview.c:111
int stateImageHeight
Definition: treeview.c:130
HFONT hDefaultFont
Definition: treeview.c:113
HTREEITEM editItem
Definition: treeview.c:98
#define MINIMUM_INDENT
Definition: treeview.c:194
int normalImageHeight
Definition: treeview.c:127
#define SB_VERT
Definition: winuser.h:553
HTREEITEM firstVisible
Definition: treeview.c:100
static HFONT TREEVIEW_CreateBoldUnderlineFont(HFONT hfont)
Definition: treeview.c:314
LONG maxVisibleOrder
Definition: treeview.c:101
HTREEITEM insertMarkItem
Definition: treeview.c:103
#define SB_HORZ
Definition: winuser.h:552
LONG visibleOrder
Definition: treeview.c:166
WNDPROC wpEditOrig
Definition: treeview.c:121
static const WCHAR themeClass[]
Definition: treeview.c:207
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)
COLORREF clrBk
Definition: treeview.c:108
HTREEITEM dropItem
Definition: treeview.c:102
LONG right
Definition: windef.h:298
static TREEVIEW_ITEM * TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
Definition: treeview.c:1003
HCURSOR hcurHand
Definition: treeview.c:117
HIMAGELIST himlNormal
Definition: treeview.c:126
HTREEITEM hotItem
Definition: treeview.c:96
#define FALSE
Definition: types.h:117
int iLevel
Definition: treeview.c:157
#define CW_USEDEFAULT
Definition: winuser.h:225
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
HFONT hUnderlineFont
Definition: treeview.c:115
HTREEITEM root
Definition: treeview.c:77
#define CLR_NONE
Definition: commctrl.h:304
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define IDC_HAND
Definition: winuser.h:693
#define TRACE(s)
Definition: solgame.cpp:4
int normalImageWidth
Definition: treeview.c:128
#define NF_REQUERY
Definition: winuser.h:2415
BOOL bIgnoreEditKillFocus
Definition: treeview.c:122
UINT state
Definition: treeview.c:147
LONG clientHeight
Definition: treeview.c:89
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1677
#define TVS_NOTOOLTIPS
Definition: commctrl.h:3221
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HTREEITEM selectedItem
Definition: treeview.c:95
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define TVIS_EXPANDED
Definition: commctrl.h:3251
BOOL insertBeforeorAfter
Definition: treeview.c:104
#define ERR(fmt,...)
Definition: debug.h:109
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HFONT hBoldUnderlineFont
Definition: treeview.c:116
HIMAGELIST himlState
Definition: treeview.c:129
#define WS_POPUP
Definition: pedump.c:616
UINT uItemHeight
Definition: treeview.c:85
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
#define CLR_DEFAULT
Definition: commctrl.h:305
BOOL bLabelChanged
Definition: treeview.c:123
static UINT TREEVIEW_NaturalHeight(const TREEVIEW_INFO *infoPtr)
Definition: treeview.c:1734
LONG clientWidth
Definition: treeview.c:88
LONG bottom
Definition: windef.h:299
#define SetWindowLongPtrW
Definition: winuser.h:5215
UINT uScrollTime
Definition: treeview.c:82
WCHAR * LPWSTR
Definition: xmlstorage.h:184
COLORREF clrLine
Definition: treeview.c:110
HTREEITEM focusedItem
Definition: treeview.c:97
static HFONT TREEVIEW_CreateBoldFont(HFONT hOrigFont)
Definition: treeview.c:294
static INT TREEVIEW_NotifyFormat(TREEVIEW_INFO *infoPtr, HWND hwndFrom, UINT nCommand)
Definition: treeview.c:842
UINT uInternalStatus
Definition: treeview.c:78
static HFONT TREEVIEW_CreateBoldFont ( HFONT  hOrigFont)
static

Definition at line 294 of file treeview.c.

Referenced by TREEVIEW_Create(), and TREEVIEW_SetFont().

295 {
296  LOGFONTW font;
297 
298  GetObjectW(hOrigFont, sizeof(font), &font);
299  font.lfWeight = FW_BOLD;
300  return CreateFontIndirectW(&font);
301 }
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define FW_BOLD
Definition: wingdi.h:376
LONG lfWeight
Definition: dimm.idl:63
static HFONT TREEVIEW_CreateBoldUnderlineFont ( HFONT  hfont)
static

Definition at line 314 of file treeview.c.

Referenced by TREEVIEW_Create(), and TREEVIEW_SetFont().

315 {
316  LOGFONTW font;
317 
318  GetObjectW(hfont, sizeof(font), &font);
319  font.lfWeight = FW_BOLD;
320  font.lfUnderline = TRUE;
321  return CreateFontIndirectW(&font);
322 }
#define TRUE
Definition: types.h:120
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
static HFONT hfont
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define FW_BOLD
Definition: wingdi.h:376
LONG lfWeight
Definition: dimm.idl:63
BYTE lfUnderline
Definition: dimm.idl:65
static LRESULT TREEVIEW_CreateDragImage ( TREEVIEW_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 4393 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

4394 {
4395  TREEVIEW_ITEM *dragItem = (HTREEITEM)lParam;
4396  INT cx, cy;
4397  HDC hdc, htopdc;
4398  HWND hwtop;
4399  HBITMAP hbmp, hOldbmp;
4400  SIZE size;
4401  RECT rc;
4402  HFONT hOldFont;
4403 
4404  TRACE("\n");
4405 
4406  if (!(infoPtr->himlNormal))
4407  return 0;
4408 
4409  if (!dragItem || !TREEVIEW_ValidItem(infoPtr, dragItem))
4410  return 0;
4411 
4412  TREEVIEW_UpdateDispInfo(infoPtr, dragItem, TVIF_TEXT);
4413 
4414  hwtop = GetDesktopWindow();
4415  htopdc = GetDC(hwtop);
4416  hdc = CreateCompatibleDC(htopdc);
4417 
4418  hOldFont = SelectObject(hdc, infoPtr->hFont);
4419 
4420  if (dragItem->pszText)
4421  GetTextExtentPoint32W(hdc, dragItem->pszText, strlenW(dragItem->pszText),
4422  &size);
4423  else
4424  GetTextExtentPoint32A(hdc, "", 0, &size);
4425 
4426  TRACE("%d %d %s\n", size.cx, size.cy, debugstr_w(dragItem->pszText));
4427  hbmp = CreateCompatibleBitmap(htopdc, size.cx, size.cy);
4428  hOldbmp = SelectObject(hdc, hbmp);
4429 
4430  ImageList_GetIconSize(infoPtr->himlNormal, &cx, &cy);
4431  size.cx += cx;
4432  if (cy > size.cy)
4433  size.cy = cy;
4434 
4435  infoPtr->dragList = ImageList_Create(size.cx, size.cy, ILC_COLOR, 10, 10);
4436  ImageList_Draw(infoPtr->himlNormal, dragItem->iImage, hdc, 0, 0,
4437  ILD_NORMAL);
4438 
4439 /*
4440  ImageList_GetImageInfo (infoPtr->himlNormal, dragItem->hItem, &iminfo);
4441  ImageList_AddMasked (infoPtr->dragList, iminfo.hbmImage, CLR_DEFAULT);
4442 */
4443 
4444 /* draw item text */
4445 
4446  SetRect(&rc, cx, 0, size.cx, size.cy);
4447 
4448  if (dragItem->pszText)
4449  DrawTextW(hdc, dragItem->pszText, strlenW(dragItem->pszText), &rc,
4450  DT_LEFT);
4451 
4452  SelectObject(hdc, hOldFont);
4453  SelectObject(hdc, hOldbmp);
4454 
4455  ImageList_Add(infoPtr->dragList, hbmp, 0);
4456 
4457  DeleteDC(hdc);
4458  DeleteObject(hbmp);
4459  ReleaseDC(hwtop, htopdc);
4460 
4461  return (LRESULT)infoPtr->dragList;
4462 }
#define HDC
Definition: msvc.h:22
#define HBITMAP
Definition: msvc.h:28
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:413
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3231
HANDLE HWND
Definition: compat.h:13
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1193
int32_t INT
Definition: typedefs.h:56
HIMAGELIST himlNormal
Definition: treeview.c:126
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
#define DT_LEFT
Definition: winuser.h:534
#define debugstr_w
Definition: kernel32.h:32
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ILC_COLOR
Definition: commctrl.h:337
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
HDC hdc
Definition: msvc.h:53
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
LONG cx
Definition: windef.h:324
HIMAGELIST dragList
Definition: treeview.c:105
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LPWSTR pszText
Definition: treeview.c:149
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI DeleteDC(_In_ HDC)
#define TVIF_TEXT
Definition: commctrl.h:3233
UINT WPARAM LPARAM lParam
Definition: precomp.h:45
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
_Out_opt_ int * cx
Definition: commctrl.h:570
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:1941
#define ILD_NORMAL
Definition: commctrl.h:402
LONG_PTR LRESULT
Definition: windef.h:209
HBITMAP hbmp
Definition: msvc.h:60
LONG cy
Definition: windef.h:325
static void TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT mask)
Definition: treeview.c:703
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
static BOOL TREEVIEW_ValidItem(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:282
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
int iImage
Definition: treeview.c:151
static HFONT TREEVIEW_CreateUnderlineFont ( HFONT  hOrigFont)
static

Definition at line 304 of file treeview.c.

Referenced by TREEVIEW_Create(), and TREEVIEW_SetFont().

305 {
306  LOGFONTW font;
307 
308  GetObjectW(hOrigFont, sizeof(font), &font);
309  font.lfUnderline = TRUE;
310  return CreateFontIndirectW(&font);
311 }
#define TRUE
Definition: types.h:120
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BYTE lfUnderline
Definition: dimm.idl:65
static LRESULT TREEVIEW_DeleteItem ( TREEVIEW_INFO infoPtr,
HTREEITEM  item 
)
static

Definition at line 1517 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

1518 {
1519  TREEVIEW_ITEM *newSelection = NULL;
1520  TREEVIEW_ITEM *newFirstVisible = NULL;
1521  TREEVIEW_ITEM *parent, *prev = NULL;
1522  BOOL visible = FALSE;
1523 
1524  if (item == TVI_ROOT || !item)
1525  {
1526  TRACE("TVI_ROOT\n");
1527  parent = infoPtr->root;
1528  newSelection = NULL;
1529  visible = TRUE;
1530  TREEVIEW_RemoveTree(infoPtr);
1531  }
1532  else
1533  {
1534  if (!TREEVIEW_ValidItem(infoPtr, item))
1535  return FALSE;
1536 
1537  TRACE("%p (%s)\n", item, TREEVIEW_ItemName(item));
1538  parent = item->parent;
1539 
1540  if (ISVISIBLE(item))
1541  {
1542  prev = TREEVIEW_GetPrevListItem(infoPtr, item);
1543  visible = TRUE;
1544  }
1545 
1546  if (infoPtr->selectedItem != NULL
1547  && (item == infoPtr->selectedItem
1548  || TREEVIEW_IsChildOf(item, infoPtr->selectedItem)))
1549  {
1550  if (item->nextSibling)
1551  newSelection = item->nextSibling;
1552  else if (item->parent != infoPtr->root)
1553  newSelection = item->parent;
1554  else
1555  newSelection = item->prevSibling;
1556  TRACE("newSelection = %p\n", newSelection);
1557  }
1558 
1559  if (infoPtr->firstVisible == item)
1560  {
1561  visible = TRUE;
1562  if (item->nextSibling)
1563  newFirstVisible = item->nextSibling;
1564  else if (item->prevSibling)
1565  newFirstVisible = item->prevSibling;
1566  else if (item->parent != infoPtr->root)
1567  newFirstVisible = item->parent;
1568  TREEVIEW_SetFirstVisible(infoPtr, NULL, TRUE);
1569  }
1570  else
1571  newFirstVisible = infoPtr->firstVisible;
1572 
1573  TREEVIEW_RemoveItem(infoPtr, item);
1574  }
1575 
1576  /* Don't change if somebody else already has (infoPtr->selectedItem is cleared by FreeItem). */
1577  if (!infoPtr->selectedItem && newSelection)
1578  {
1579  if (TREEVIEW_ValidItem(infoPtr, newSelection))
1580  TREEVIEW_DoSelectItem(infoPtr, TVGN_CARET, newSelection, TVC_UNKNOWN);
1581  }
1582 
1583  /* Validate insertMark dropItem.
1584  * hotItem ??? - used for comparison only.
1585  */
1586  if (!TREEVIEW_ValidItem(infoPtr, infoPtr->insertMarkItem))
1587  infoPtr->insertMarkItem = 0;
1588 
1589  if (!TREEVIEW_ValidItem(infoPtr, infoPtr->dropItem))
1590  infoPtr->dropItem = 0;
1591 
1592  if (!TREEVIEW_ValidItem(infoPtr, newFirstVisible))
1593  newFirstVisible = infoPtr->root->firstChild;
1594 
1595  TREEVIEW_VerifyTree(infoPtr);
1596 
1597  if (visible)
1598  TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE);
1599 
1600  if (!infoPtr->bRedraw) return TRUE;
1601 
1602  if (visible)
1603  {
1604  TREEVIEW_RecalculateVisibleOrder(infoPtr, prev);
1605  TREEVIEW_UpdateScrollBars(infoPtr);
1606  TREEVIEW_Invalidate(infoPtr, NULL);
1607  }
1608  else if (ISVISIBLE(parent) && !TREEVIEW_HasChildren(infoPtr, parent))
1609  {
1610  /* parent lost '+/-' - update it */
1611  TREEVIEW_Invalidate(infoPtr, parent);
1612  }
1613 
1614  return TRUE;
1615 }
HTREEITEM prevSibling
Definition: treeview.c:159
#define TRUE
Definition: types.h:120
static VOID TREEVIEW_Invalidate(const TREEVIEW_INFO *, const TREEVIEW_ITEM *)
Definition: treeview.c:2955
HTREEITEM nextSibling
Definition: treeview.c:143
#define TVGN_CARET
Definition: commctrl.h:3428
HTREEITEM firstVisible
Definition: treeview.c:100
static void TREEVIEW_VerifyTree(TREEVIEW_INFO *infoPtr)
Definition: treeview.c:6037
HTREEITEM insertMarkItem
Definition: treeview.c:103
static void TREEVIEW_RemoveItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
Definition: treeview.c:1486
static const char * TREEVIEW_ItemName(const TREEVIEW_ITEM *item)
Definition: treeview.c:336
HTREEITEM dropItem
Definition: treeview.c:102
static BOOL TREEVIEW_IsChildOf(const TREEVIEW_ITEM *parent, const TREEVIEW_ITEM *child)
Definition: treeview.c:346
static LRESULT TREEVIEW_DoSelectItem(TREEVIEW_INFO *, INT, HTREEITEM, INT)
Definition: treeview.c:4467
#define TVC_UNKNOWN
Definition: commctrl.h:3617
HTREEITEM firstChild
Definition: treeview.c:144
static VOID TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr)
Definition: treeview.c:2743
#define FALSE
Definition: types.h:117
static TREEVIEW_ITEM * TREEVIEW_GetPrevListItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *tvItem)
Definition: treeview.c:402
smooth NULL
Definition: ftsmooth.c:416
static void TREEVIEW_RemoveTree(TREEVIEW_INFO *infoPtr)
Definition: treeview.c:1509
HTREEITEM root
Definition: treeview.c:77
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
r parent
Definition: btrfs.c:2644
#define TVI_ROOT
Definition: commctrl.h:3335
HTREEITEM selectedItem
Definition: treeview.c:95
#define ISVISIBLE(x)
Definition: treeview.c:200
HTREEITEM parent
Definition: treeview.c:142
static BOOL TREEVIEW_HasChildren(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
Definition: treeview.c:834
static VOID TREEVIEW_SetFirstVisible(TREEVIEW_INFO *, TREEVIEW_ITEM *, BOOL)
Definition: treeview.c:4823
static void TREEVIEW_RecalculateVisibleOrder(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *start)
Definition: treeview.c:929
static BOOL TREEVIEW_ValidItem(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:282
static LRESULT TREEVIEW_Destroy ( TREEVIEW_INFO infoPtr)
static

Definition at line 5187 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

5188 {
5189  TRACE("\n");
5190 
5191  /* free item data */
5192  TREEVIEW_RemoveTree(infoPtr);
5193  /* root isn't freed with other items */
5194  TREEVIEW_FreeItem(infoPtr, infoPtr->root);
5195  DPA_Destroy(infoPtr->items);
5196 
5197  /* Restore original wndproc */
5198  if (infoPtr->hwndEdit)
5200  (DWORD_PTR)infoPtr->wpEditOrig);
5201 
5202  CloseThemeData (GetWindowTheme (infoPtr->hwnd));
5203 
5204  /* Deassociate treeview from the window before doing anything drastic. */
5205  SetWindowLongPtrW(infoPtr->hwnd, 0, 0);
5206 
5207  DeleteObject(infoPtr->hDefaultFont);
5208  DeleteObject(infoPtr->hBoldFont);
5209  DeleteObject(infoPtr->hUnderlineFont);
5210  DeleteObject(infoPtr->hBoldUnderlineFont);
5211  DestroyWindow(infoPtr->hwndToolTip);
5212  heap_free(infoPtr);
5213 
5214  return 0;
5215 }
HFONT hDefaultFont
Definition: treeview.c:113
BOOL WINAPI DPA_Destroy(HDPA hdpa)
Definition: dpa.c:396
WNDPROC wpEditOrig
Definition: treeview.c:121
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI DestroyWindow(_In_ HWND)
HFONT hUnderlineFont
Definition: treeview.c:115
static void TREEVIEW_RemoveTree(TREEVIEW_INFO *infoPtr)
Definition: treeview.c:1509
HTREEITEM root
Definition: treeview.c:77
#define TRACE(s)
Definition: solgame.cpp:4
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define GWLP_WNDPROC
Definition: treelist.c:66
static void TREEVIEW_FreeItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
Definition: treeview.c:1031
HFONT hBoldUnderlineFont
Definition: treeview.c:116
#define SetWindowLongPtrW
Definition: winuser.h:5215
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static LRESULT TREEVIEW_DoSelectItem ( TREEVIEW_INFO infoPtr,
INT  action,
HTREEITEM  newSelect,
INT  cause 
)
static

Definition at line 4467 of file treeview.c.

Referenced by TREEVIEW_DeleteItem(), TREEVIEW_KeyDown(), TREEVIEW_LButtonDown(), TREEVIEW_ProcessLetterKeys(), TREEVIEW_SelectItem(), and TREEVIEW_SetFocus().

4469 {
4470  TREEVIEW_ITEM *prevSelect;
4471 
4472  assert(newSelect == NULL || TREEVIEW_ValidItem(infoPtr, newSelect));
4473 
4474  TRACE("Entering item %p (%s), flag 0x%x, cause 0x%x, state 0x%x\n",
4475  newSelect, TREEVIEW_ItemName(newSelect), action, cause,
4476  newSelect ? newSelect->state : 0);
4477 
4478  /* reset and redraw focusedItem if focusedItem was set so we don't */
4479  /* have to worry about the previously focused item when we set a new one */
4480  TREEVIEW_InvalidateItem(infoPtr, infoPtr->focusedItem);
4481  infoPtr->focusedItem = NULL;
4482 
4483  switch (action)
4484  {
4486  FIXME("TVSI_NOSINGLEEXPAND specified.\n");
4487  /* Fall through */
4488  case TVGN_CARET:
4489  prevSelect = infoPtr->selectedItem;
4490 
4491  if (prevSelect == newSelect) {
4492  TREEVIEW_EnsureVisible(infoPtr, infoPtr->selectedItem, FALSE);
4493  break;
4494  }
4495 
4496  if (TREEVIEW_SendTreeviewNotify(infoPtr,
4498  cause,
4500  prevSelect,
4501  newSelect))
4502  return FALSE;
4503 
4504  if (prevSelect)
4505  prevSelect->state &= ~TVIS_SELECTED;
4506  if (newSelect)
4507  newSelect->state |= TVIS_SELECTED;
4508 
4509  infoPtr->selectedItem = newSelect;
4510 
4511  TREEVIEW_EnsureVisible(infoPtr, infoPtr->selectedItem, FALSE);
4512 
4513  TREEVIEW_InvalidateItem(infoPtr, prevSelect);
4514  TREEVIEW_InvalidateItem(infoPtr, newSelect);
4515 
4518  cause,
4520  prevSelect,
4521  newSelect);
4522  break;
4523 
4524  case TVGN_DROPHILITE:
4525  prevSelect = infoPtr->dropItem;
4526 
4527  if (prevSelect)
4528  prevSelect->state &= ~TVIS_DROPHILITED;
4529 
4530  infoPtr->dropItem = newSelect;
4531 
4532  if (newSelect)
4533  newSelect->state |= TVIS_DROPHILITED;
4534 
4535  TREEVIEW_Invalidate(infoPtr, prevSelect);
4536  TREEVIEW_Invalidate(infoPtr, newSelect);
4537  break;
4538 
4539  case TVGN_FIRSTVISIBLE:
4540  if (newSelect != NULL)
4541  {
4542  TREEVIEW_EnsureVisible(infoPtr, newSelect, FALSE);
4543  TREEVIEW_SetFirstVisible(infoPtr, newSelect, TRUE);
4544  TREEVIEW_Invalidate(infoPtr, NULL);
4545  }
4546  break;
4547  }
4548 
4549  TRACE("Leaving state 0x%x\n", newSelect ? newSelect->state : 0);
4550  return TRUE;
4551 }
static BOOL TREEVIEW_SendTreeviewNotify(const TREEVIEW_INFO *infoPtr, UINT code, UINT action, UINT mask, HTREEITEM oldItem, HTREEITEM newItem)
Definition: treeview.c:573
#define TVN_SELCHANGINGW
Definition: commctrl.h:3613
#define TRUE
Definition: types.h:120
static VOID TREEVIEW_Invalidate(const TREEVIEW_INFO *, const TREEVIEW_ITEM *)
Definition: treeview.c:2955
#define TVGN_CARET
Definition: commctrl.h:3428
#define TVGN_DROPHILITE
Definition: commctrl.h:3427
#define TVIS_SELECTED
Definition: commctrl.h:3247
#define assert(x)
Definition: debug.h:53
static const char * TREEVIEW_ItemName(const TREEVIEW_ITEM *item)
Definition: treeview.c:336
HTREEITEM dropItem
Definition: treeview.c:102
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TVSI_NOSINGLEEXPAND
Definition: commctrl.h:3431
#define TVN_SELCHANGEDW
Definition: commctrl.h:3615
#define TVIS_DROPHILITED
Definition: commctrl.h:3249
static void TREEVIEW_InvalidateItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
Definition: treeview.c:2949
#define TRACE(s)
Definition: solgame.cpp:4
UINT state
Definition: treeview.c:147
HTREEITEM selectedItem
Definition: treeview.c:95
#define TVIF_HANDLE
Definition: commctrl.h:3237
static LRESULT TREEVIEW_EnsureVisible(TREEVIEW_INFO *, HTREEITEM, BOOL)
Definition: treeview.c:4726
const WCHAR * action
Definition: action.c:7779
#define TVIF_TEXT
Definition: commctrl.h:3233
#define TVIF_STATE
Definition: commctrl.h:3236
#define TVIF_PARAM
Definition: commctrl.h:3235
static VOID TREEVIEW_SetFirstVisible(TREEVIEW_INFO *, TREEVIEW_ITEM *, BOOL)
Definition: treeview.c:4823
static BOOL TREEVIEW_ValidItem(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:282
HTREEITEM focusedItem
Definition: treeview.c:97
#define TVGN_FIRSTVISIBLE
Definition: commctrl.h:3424
static BOOL TREEVIEW_DoSetItemT ( const TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM item,
const TVITEMEXW tvItem,
BOOL  isW 
)
static

Definition at line 1117 of file treeview.c.

Referenced by TREEVIEW_InsertItemT(), and TREEVIEW_SetItemT().

1119 {
1120  UINT callbackClear = 0;
1121  UINT callbackSet = 0;
1122 
1123  TRACE("item %p\n", item);
1124  /* Do this first in case it fails. */
1125  if (tvItem->mask & TVIF_TEXT)
1126  {
1127  item->textWidth = 0; /* force width recalculation */
1128  if (tvItem->pszText != LPSTR_TEXTCALLBACKW && tvItem->pszText != NULL) /* covers != TEXTCALLBACKA too, and undocumented: pszText of NULL also means TEXTCALLBACK */
1129  {
1130  int len;
1131  LPWSTR newText;
1132  if (isW)
1133  len = lstrlenW(tvItem->pszText) + 1;
1134  else
1135  len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)tvItem->pszText, -1, NULL, 0);
1136 
1137  newText = heap_realloc(item->pszText, len * sizeof(WCHAR));
1138 
1139  if (newText == NULL) return FALSE;
1140 
1141  callbackClear |= TVIF_TEXT;
1142 
1143  item->pszText = newText;
1144  item->cchTextMax = len;
1145  if (isW)
1146  lstrcpynW(item->pszText, tvItem->pszText, len);
1147  else
1148  MultiByteToWideChar(CP_ACP, 0, (LPSTR)tvItem->pszText, -1,
1149  item->pszText, len);
1150 
1151  TRACE("setting text %s, item %p\n", debugstr_w(item->pszText), item);
1152  }
1153  else
1154  {
1155  callbackSet |= TVIF_TEXT;
1156  item->pszText = heap_realloc(item->pszText, TEXT_CALLBACK_SIZE * sizeof(WCHAR));
1158  TRACE("setting callback, item %p\n", item);
1159  }
1160  }
1161 
1162  if (tvItem->mask & TVIF_CHILDREN)
1163  {
1164  item->cChildren = tvItem->cChildren;
1165 
1166  if (item->cChildren == I_CHILDRENCALLBACK)
1167  callbackSet |= TVIF_CHILDREN;
1168  else
1169  callbackClear |= TVIF_CHILDREN;
1170  }
1171 
1172  if (tvItem->mask & TVIF_IMAGE)
1173  {
1174  item->iImage = tvItem->iImage;
1175 
1176  if (item->iImage == I_IMAGECALLBACK)
1177  callbackSet |= TVIF_IMAGE;
1178  else
1179  callbackClear |= TVIF_IMAGE;
1180  }
1181 
1182  if (tvItem->mask & TVIF_SELECTEDIMAGE)
1183  {
1184  item->iSelectedImage = tvItem->iSelectedImage;
1185 
1186  if (item->iSelectedImage == I_IMAGECALLBACK)
1187  callbackSet |= TVIF_SELECTEDIMAGE;
1188  else
1189  callbackClear |= TVIF_SELECTEDIMAGE;
1190  }
1191 
1192  if (tvItem->mask & TVIF_EXPANDEDIMAGE)
1193  {
1194  item->iExpandedImage = tvItem->iExpandedImage;
1195 
1196  if (item->iExpandedImage == I_IMAGECALLBACK)
1197  callbackSet |= TVIF_EXPANDEDIMAGE;
1198  else
1199  callbackClear |= TVIF_EXPANDEDIMAGE;
1200  }
1201 
1202  if (tvItem->mask & TVIF_PARAM)
1203  item->lParam = tvItem->lParam;
1204 
1205  /* If the application sets TVIF_INTEGRAL without
1206  * supplying a TVITEMEX structure, it's toast. */
1207  if (tvItem->mask & TVIF_INTEGRAL)
1208  item->iIntegral = tvItem->iIntegral;
1209 
1210  if (tvItem->mask & TVIF_STATE)
1211  {
1212  TRACE("prevstate 0x%x, state 0x%x, mask 0x%x\n", item->state, tvItem->state,
1213  tvItem->stateMask);
1214  item->state &= ~tvItem->stateMask;
1215  item->state |= (tvItem->state & tvItem->stateMask);
1216  }
1217 
1218  if (tvItem->mask & TVIF_STATEEX)
1219  {
1220  FIXME("New extended state: 0x%x\n", tvItem->uStateEx);
1221  }
1222 
1223  item->callbackMask |= callbackSet;
1224  item->callbackMask &= ~callbackClear;
1225 
1226  return TRUE;
1227 }
#define TRUE
Definition: types.h:120
LPARAM lParam
Definition: commctrl.h:3322
#define TVIF_EXPANDEDIMAGE
Definition: commctrl.h:3246
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
LPWSTR pszText
Definition: commctrl.h:3317
UINT stateMask
Definition: commctrl.h:3316
int cChildren
Definition: treeview.c:154
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3238
char * LPSTR
Definition: xmlstorage.h:182
#define lstrlenW
Definition: compat.h:407
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
#define lstrcpynW
Definition: compat.h:397
#define TVIF_CHILDREN
Definition: commctrl.h:3239
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
int iExpandedImage
Definition: commctrl.h:3326
UINT uStateEx
Definition: commctrl.h:3324
LPARAM lParam
Definition: treeview.c:155
#define TRACE(s)
Definition: solgame.cpp:4
#define TVIF_INTEGRAL
Definition: commctrl.h:3241
LONG textWidth
Definition: treeview.c:165
int iSelectedImage
Definition: commctrl.h:3320
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2350
UINT state
Definition: treeview.c:147
#define I_CHILDRENCALLBACK
Definition: commctrl.h:3260
static const WCHAR isW[]
Definition: tokenize.c:59
int iIntegral
Definition: treeview.c:156
int iSelectedImage
Definition: treeview.c:152
LPWSTR pszText
Definition: treeview.c:149
GLenum GLsizei len
Definition: glext.h:6722
UINT callbackMask
Definition: treeview.c:146
#define I_IMAGECALLBACK
Definition: commctrl.h:2355
#define TEXT_CALLBACK_SIZE
Definition: treeview.c:190
#define TVIF_TEXT
Definition: commctrl.h:3233
#define TVIF_IMAGE
Definition: commctrl.h:3234
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
int iExpandedImage
Definition: treeview.c:153
#define TVIF_STATE
Definition: commctrl.h:3236
#define TVIF_PARAM
Definition: commctrl.h:3235
int cchTextMax
Definition: treeview.c:150
WCHAR * LPWSTR
Definition: xmlstorage.h:184
int iImage
Definition: treeview.c:151
static void TREEVIEW_DrawItem ( const TREEVIEW_INFO infoPtr,
HDC  hdc,
TREEVIEW_ITEM item 
)
static

Definition at line 2512 of file treeview.c.

Referenced by TREEVIEW_Refresh().

2513 {
2514  INT cditem;
2515  HFONT hOldFont;
2516  COLORREF oldTextColor, oldTextBkColor;
2517  int centery;
2518  BOOL inFocus = (GetFocus() == infoPtr->hwnd);
2519  NMTVCUSTOMDRAW nmcdhdr;
2520 
2522 
2523  /* - If item is drop target or it is selected and window is in focus -
2524  * use blue background (COLOR_HIGHLIGHT).
2525  * - If item is selected, window is not in focus, but it has style
2526  * TVS_SHOWSELALWAYS - use grey background (COLOR_BTNFACE)
2527  * - Otherwise - use background color
2528  */
2529  if ((item->state & TVIS_DROPHILITED) || ((item == infoPtr->focusedItem) && !(item->state & TVIS_SELECTED)) ||
2530  ((item->state & TVIS_SELECTED) && (!infoPtr->focusedItem || item == infoPtr->focusedItem) &&
2531  (inFocus || (infoPtr->dwStyle & TVS_SHOWSELALWAYS))))
2532  {
2533  if ((item->state & TVIS_DROPHILITED) || inFocus)
2534  {
2537  }
2538  else
2539  {
2541  nmcdhdr.clrText = GETTXTCOLOR(infoPtr->clrText);
2542  }
2543  }
2544  else
2545  {
2546  nmcdhdr.clrTextBk = GETBKCOLOR(infoPtr->clrBk);
2547  if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (item == infoPtr->hotItem))
2549  else
2550  nmcdhdr.clrText = GETTXTCOLOR(infoPtr->clrText);
2551  }
2552 
2553  hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, item));
2554  oldTextColor = SetTextColor(hdc, nmcdhdr.clrText);
2555  oldTextBkColor = SetBkColor(hdc, nmcdhdr.clrTextBk);
2556 
2557  /* The custom draw handler can query the text rectangle,
2558  * so get ready. */
2559  /* should already be known, set to 0 when changed */
2560  if (!item->textWidth)
2561  TREEVIEW_ComputeTextWidth(infoPtr, item, hdc);
2562 
2563  cditem = 0;
2564 
2565  if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW)
2566  {
2568  (infoPtr, hdc, item, CDDS_ITEMPREPAINT, &nmcdhdr);
2569  TRACE("prepaint:cditem-app returns 0x%x\n", cditem);
2570 
2571  if (cditem & CDRF_SKIPDEFAULT)
2572  {
2573  SelectObject(hdc, hOldFont);
2574  return;
2575  }
2576  }
2577 
2578  if (cditem & CDRF_NEWFONT)
2579  TREEVIEW_ComputeTextWidth(infoPtr, item, hdc);
2580 
2581  if (TREEVIEW_IsFullRowSelect(infoPtr))
2582  {
2583  HBRUSH brush = CreateSolidBrush(nmcdhdr.clrTextBk);
2584  FillRect(hdc, &item->rect, brush);
2585  DeleteObject(brush);
2586  }
2587 
2588  TREEVIEW_DrawItemLines(infoPtr, hdc, item);
2589 
2590  /* reset colors. Custom draw handler can change them */
2591  SetTextColor(hdc, nmcdhdr.clrText);
2592  SetBkColor(hdc, nmcdhdr.clrTextBk);
2593 
2594  centery = (item->rect.top + item->rect.bottom) / 2;
2595 
2596  /*
2597  * Display the images associated with this item
2598  */
2599  {
2600  INT imageIndex;
2601 
2602  /* State images are displayed to the left of the Normal image
2603  * image number is in state; zero should be `display no image'.
2604  */
2605  imageIndex = STATEIMAGEINDEX(item->state);
2606 
2607  if (infoPtr->himlState && imageIndex)
2608  {
2609  ImageList_Draw(infoPtr->himlState, imageIndex, hdc,
2610  item->stateOffset,
2611  centery - infoPtr->stateImageHeight / 2,
2612  ILD_NORMAL);
2613  }
2614 
2615  /* Now, draw the normal image; can be either selected,
2616  * non-selected or expanded image.
2617  */
2618 
2619  if ((item->state & TVIS_SELECTED) && (item->iSelectedImage >= 0))
2620  {
2621  /* The item is currently selected */
2622  imageIndex = item->iSelectedImage;
2623  }
2624  else if ((item->state & TVIS_EXPANDED) && (item->iExpandedImage != (WORD)I_IMAGENONE))
2625  {
2626  /* The item is currently not selected but expanded */
2627  imageIndex = item->iExpandedImage;
2628  }
2629  else
2630  {
2631  /* The item is not selected and not expanded */
2632  imageIndex = item->iImage;
2633  }
2634 
2635  if (infoPtr->himlNormal)
2636  {
2638 
2639  style |= item->state & TVIS_OVERLAYMASK;
2640 
2641  ImageList_DrawEx(infoPtr->himlNormal, imageIndex, hdc,
2642  item->imageOffset, centery - infoPtr->normalImageHeight / 2,
2643  0, 0, infoPtr->clrBk, item->state & TVIS_CUT ? GETBKCOLOR(infoPtr->clrBk) : CLR_DEFAULT,
2644  style);
2645  }
2646  }
2647 
2648 
2649  /*
2650  * Display the text associated with this item
2651  */
2652 
2653  /* Don't paint item's text if it's being edited */
2654  if (!infoPtr->hwndEdit || (infoPtr->selectedItem != item))
2655  {
2656  if (item->pszText)
2657  {
2658  RECT rcText;
2659  UINT align;
2660  SIZE sz;
2661 
2662  rcText.top = item->rect.top;
2663  rcText.bottom = item->rect.bottom;
2664  rcText.left = item->textOffset;
2665  rcText.right = rcText.left + item->textWidth + 4;
2666 
2667  TRACE("drawing text %s at (%s)\n",
2668  debugstr_w(item->pszText), wine_dbgstr_rect(&rcText));
2669 
2670  /* Draw it */
2671  GetTextExtentPoint32W(hdc, item->pszText, strlenW(item->pszText), &sz);
2672 
2673  align = SetTextAlign(hdc, TA_LEFT | TA_TOP);
2674  ExtTextOutW(hdc, rcText.left + 2, (rcText.top + rcText.bottom - sz.cy) / 2,
2676  &rcText,
2677  item->pszText,
2678  lstrlenW(item->pszText),
2679  NULL);
2680  SetTextAlign(hdc, align);
2681 
2682  /* Draw focus box around the selected item */
2683  if ((item == infoPtr->selectedItem) && inFocus)
2684  {
2685  DrawFocusRect(hdc,&rcText);
2686  }
2687  }
2688  }
2689 
2690  /* Draw insertion mark if necessary */
2691 
2692  if (infoPtr->insertMarkItem)
2693  TRACE("item:%d,mark:%p\n",
2694  TREEVIEW_GetItemIndex(infoPtr, item),
2695  infoPtr->insertMarkItem);
2696 
2697  if (item == infoPtr->insertMarkItem)
2698  {
2699  HPEN hNewPen, hOldPen;
2700  int offset;
2701  int left, right;
2702 
2703  hNewPen = CreatePen(PS_SOLID, 2, GETINSCOLOR(infoPtr->clrInsertMark));
2704  hOldPen = SelectObject(hdc, hNewPen);
2705 
2706  if (infoPtr->insertBeforeorAfter)
2707  offset = item->rect.bottom - 1;
2708  else
2709  offset = item->rect.top + 1;
2710 
2711  left = item->textOffset - 2;
2712  right = item->textOffset + item->textWidth + 2;
2713 
2714  MoveToEx(hdc, left, offset - 3, NULL);
2715  LineTo(hdc, left, offset + 4);
2716 
2717  MoveToEx(hdc, left, offset, NULL);
2718  LineTo(hdc, right + 1, offset);
2719 
2720  MoveToEx(hdc, right, offset + 3, NULL);
2721  LineTo(hdc, right, offset - 4);
2722 
2723  SelectObject(hdc, hOldPen);
2724  DeleteObject(hNewPen);
2725  }
2726 
2727  /* Restore the hdc state */
2728  SetTextColor(hdc, oldTextColor);
2729  SetBkColor(hdc, oldTextBkColor);
2730  SelectObject(hdc, hOldFont);
2731 
2732  if (cditem & CDRF_NOTIFYPOSTPAINT)
2733  {
2735  (infoPtr, hdc, item, CDDS_ITEMPOSTPAINT, &nmcdhdr);
2736  TRACE("postpaint:cditem-app returns 0x%x\n", cditem);
2737  }
2738 }
COLORREF clrText
Definition: treeview.c:109
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
static VOID TREEVIEW_ComputeTextWidth(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, HDC hDC)
Definition: treeview.c:881
UINT style
Definition: startmenu.cpp:1386
#define I_IMAGENONE
Definition: commctrl.h:2356
unsigned short WORD
Definition: ntddk_ex.h:93
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
COLORREF clrInsertMark
Definition: treeview.c:111
int stateImageHeight
Definition: treeview.c:130
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static BOOL TREEVIEW_IsFullRowSelect(const TREEVIEW_INFO *infoPtr)
Definition: treeview.c:358
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:259
int normalImageHeight
Definition: treeview.c:127
RECT rect
Definition: treeview.c:160
#define TVIS_SELECTED
Definition: commctrl.h:3247
HTREEITEM insertMarkItem
Definition: treeview.c:103
#define STATEIMAGEINDEX(x)
Definition: treeview.c:198
static HFONT TREEVIEW_FontForItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
Definition: treeview.c:325
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
GLintptr offset
Definition: glext.h:5920
LONG top
Definition: windef.h:297
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:270
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define TA_LEFT
Definition: wingdi.h:930
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1193
COLORREF clrBk
Definition: treeview.c:108
LONG left
Definition: windef.h:296
#define GETINSCOLOR(x)
Definition: treeview.c:205
UINT WINAPI SetTextAlign(_In_ HDC, _In_ UINT)
Definition: text.c:749
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:255
LONG right
Definition: windef.h:298
#define lstrlenW
Definition: compat.h:407
int32_t INT
Definition: typedefs.h:56
#define GETBKCOLOR(x)
Definition: treeview.c:203
static BOOL TREEVIEW_SendCustomDrawItemNotify(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item, UINT uItemDrawState, NMTVCUSTOMDRAW *nmcdhdr)
Definition: treeview.c:650
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HIMAGELIST himlNormal
Definition: treeview.c:126
#define PS_SOLID
Definition: wingdi.h:584
#define TA_TOP
Definition: wingdi.h:928
HTREEITEM hotItem
Definition: treeview.c:96
#define ETO_OPAQUE
Definition: wingdi.h:645
#define debugstr_w
Definition: kernel32.h:32
HDC hdc
Definition: msvc.h:53
#define TVIS_OVERLAYMASK
Definition: commctrl.h:3254
smooth NULL
Definition: ftsmooth.c:416
COLORREF clrHighlightText
Definition: comctl32.h:161
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:260
#define ETO_CLIPPED
Definition: wingdi.h:646
#define TVIS_DROPHILITED
Definition: commctrl.h:3249
#define CALLBACK_MASK_ALL
Definition: treeview.c:196
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG textOffset
Definition: treeview.c:164
LONG textWidth
Definition: treeview.c:165
const char * wine_dbgstr_rect(const RECT *rect)
UINT state
Definition: treeview.c:147
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
int iSelectedImage
Definition: treeview.c:152
BSTR align
LPWSTR pszText
Definition: treeview.c:149
HTREEITEM selectedItem
Definition: treeview.c:95
static int TREEVIEW_GetItemIndex(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:235
static void TREEVIEW_DrawItemLines(const TREEVIEW_INFO *infoPtr, HDC hdc, const TREEVIEW_ITEM *item)
Definition: treeview.c:2366
#define TVIS_EXPANDED
Definition: commctrl.h:3251
BOOL insertBeforeorAfter
Definition: treeview.c:104
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:784
COLORREF clrBtnFace
Definition: comctl32.h:159
#define TVS_TRACKSELECT
Definition: commctrl.h:3223
#define ILD_SELECTED
Definition: commctrl.h:415
COLORREF clrText
Definition: commctrl.h:3717
HIMAGELIST himlState
Definition: treeview.c:129
unsigned int UINT
Definition: ndis.h:50
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
COLORREF clrHighlight
Definition: comctl32.h:160
#define CLR_DEFAULT
Definition: commctrl.h:305
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3219
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HWND WINAPI GetFocus(void)
Definition: window.c:1860
int iExpandedImage
Definition: treeview.c:153
#define CDRF_NEWFONT
Definition: commctrl.h:254
#define TVIS_CUT
Definition: commctrl.h:3248
LONG bottom
Definition: windef.h:299
LONG stateOffset
Definition: treeview.c:162
#define ILD_NORMAL
Definition: commctrl.h:402
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:271
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
DWORD COLORREF
Definition: windef.h:290
LONG cy
Definition: windef.h:325
static void TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT mask)
Definition: treeview.c:703
#define GETTXTCOLOR(x)
Definition: treeview.c:204
LONG imageOffset
Definition: treeview.c:163
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
COLORREF clrTextBk
Definition: commctrl.h:3718
HTREEITEM focusedItem
Definition: treeview.c:97
int iImage
Definition: treeview.c:151
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1229
static void TREEVIEW_DrawItemLines ( const TREEVIEW_INFO infoPtr,
HDC  hdc,
const TREEVIEW_ITEM item 
)
static

Definition at line 2366 of file treeview.c.

Referenced by TREEVIEW_DrawItem().

2367 {
2368  LONG centerx, centery;
2369  BOOL lar = ((infoPtr->dwStyle
2371  > TVS_LINESATROOT);
2372  HBRUSH hbr, hbrOld;
2373  COLORREF clrBk = GETBKCOLOR(infoPtr->clrBk);
2374 
2375  if (!lar && item->iLevel == 0)
2376  return;
2377 
2378  hbr = CreateSolidBrush(clrBk);
2379  hbrOld = SelectObject(hdc, hbr);
2380 
2381  centerx = (item->linesOffset + item->stateOffset) / 2;
2382  centery = (item->rect.top + item->rect.bottom) / 2;
2383 
2384  if (infoPtr->dwStyle & TVS_HASLINES)
2385  {
2386  HPEN hOldPen, hNewPen;
2387  HTREEITEM parent;
2388  LOGBRUSH lb;
2389 
2390  /* Get a dotted grey pen */
2391  lb.lbStyle = BS_SOLID;
2392  lb.lbColor = GETLINECOLOR(infoPtr->clrLine);
2393  hNewPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &lb, 0, NULL);
2394  hOldPen = SelectObject(hdc, hNewPen);
2395 
2396  /* Make sure the center is on a dot (using +2 instead
2397  * of +1 gives us pixel-by-pixel compat with native) */
2398  centery = (centery + 2) & ~1;
2399 
2400  MoveToEx(hdc, item->stateOffset, centery, NULL);
2401  LineTo(hdc, centerx - 1, centery);
2402 
2403  if (item->prevSibling || item->parent != infoPtr->root)
2404  {
2405  MoveToEx(hdc, centerx, item->rect.top, NULL);
2406  LineTo(hdc, centerx, centery);
2407  }
2408 
2409  if (item->nextSibling)
2410  {
2411  MoveToEx(hdc, centerx, centery, NULL);
2412  LineTo(hdc, centerx, item->rect.bottom + 1);
2413  }
2414 
2415  /* Draw the line from our parent to its next sibling. */
2416  parent = item->parent;
2417  while (parent != infoPtr->root)
2418  {
2419  int pcenterx = (parent->linesOffset + parent->stateOffset) / 2;
2420 
2421  if (parent->nextSibling
2422  /* skip top-levels unless TVS_LINESATROOT */
2423  && parent->stateOffset > parent->linesOffset)
2424  {
2425  MoveToEx(hdc, pcenterx, item->rect.top, NULL);
2426  LineTo(hdc, pcenterx, item->rect.bottom + 1);
2427  }
2428 
2429  parent = parent->parent;
2430  }
2431 
2432  SelectObject(hdc, hOldPen);
2433  DeleteObject(hNewPen);
2434  }
2435 
2436  /*
2437  * Display the (+/-) signs
2438  */
2439 
2440  if (infoPtr->dwStyle & TVS_HASBUTTONS)
2441  {
2442  if (item->cChildren)
2443  {
2444  HTHEME theme = GetWindowTheme(infoPtr->hwnd);
2445  if (theme)
2446  {
2447  RECT glyphRect = item->rect;
2448  glyphRect.left = item->linesOffset;
2449  glyphRect.right = item->stateOffset;
2452  &glyphRect, NULL);
2453  }
2454  else
2455  {
2456  LONG height = item->rect.bottom - item->rect.top;
2457  LONG width = item->stateOffset - item->linesOffset;
2458  LONG rectsize = min(height, width) / 4;
2459  /* plussize = ceil(rectsize * 3/4) */
2460  LONG plussize = (rectsize + 1) * 3 / 4;
2461 
2462  HPEN new_pen = CreatePen(PS_SOLID, 0, GETLINECOLOR(infoPtr->clrLine));
2463  HPEN old_pen = SelectObject(hdc, new_pen);
2464 
2465  Rectangle(hdc, centerx - rectsize - 1, centery - rectsize - 1,
2466  centerx + rectsize + 2, centery + rectsize + 2);
2467 
2468  SelectObject(hdc, old_pen);
2469  DeleteObject(new_pen);
2470 
2471  /* draw +/- signs with current text color */
2472  new_pen = CreatePen(PS_SOLID, 0, GETTXTCOLOR(infoPtr->clrText));
2473  old_pen = SelectObject(hdc, new_pen);
2474 
2475  if (height < 18 || width < 18)
2476  {
2477  MoveToEx(hdc, centerx - plussize + 1, centery, NULL);
2478  LineTo(hdc, centerx + plussize, centery);
2479 
2480  if (!(item->state & TVIS_EXPANDED) ||
2481  (item->state & TVIS_EXPANDPARTIAL))
2482  {
2483  MoveToEx(hdc, centerx, centery - plussize + 1, NULL);
2484  LineTo(hdc, centerx, centery + plussize);
2485  }
2486  }
2487  else
2488  {
2489  Rectangle(hdc, centerx - plussize + 1, centery - 1,
2490  centerx + plussize, centery + 2);
2491 
2492  if (!(item->state & TVIS_EXPANDED) ||
2493  (item->state & TVIS_EXPANDPARTIAL))
2494  {
2495  Rectangle(hdc, centerx - 1, centery - plussize + 1,
2496  centerx + 2, centery + plussize);
2497  SetPixel(hdc, centerx - 1, centery, clrBk);
2498  SetPixel(hdc, centerx + 1, centery, clrBk);
2499  }
2500  }
2501 
2502  SelectObject(hdc, old_pen);
2503  DeleteObject(new_pen);
2504  }
2505  }
2506  }
2507  SelectObject(hdc, hbrOld);
2508  DeleteObject(hbr);
2509 }
#define GETLINECOLOR(x)
Definition: treeview.c:202
COLORREF clrText
Definition: treeview.c:109
#define TVIS_EXPANDPARTIAL
Definition: commctrl.h:3253
HTREEITEM prevSibling
Definition: treeview.c:159
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
HTREEITEM nextSibling
Definition: treeview.c:143
UINT lbStyle
Definition: wingdi.h:1724
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
RECT rect
Definition: treeview.c:160
LONG linesOffset
Definition: treeview.c:161
#define TVS_LINESATROOT
Definition: commctrl.h:3216
LONG top
Definition: windef.h:297
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
int cChildren
Definition: treeview.c:154
COLORREF clrBk
Definition: treeview.c:108
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
#define GETBKCOLOR(x)
Definition: treeview.c:203
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:584
long LONG
Definition: pedump.c:60
int iLevel
Definition: treeview.c:157
#define TVS_HASBUTTONS
Definition: commctrl.h:3214
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
HTREEITEM root
Definition: treeview.c:77
#define PS_COSMETIC
Definition: wingdi.h:582
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
#define PS_ALTERNATE
Definition: wingdi.h:583
unsigned int BOOL
Definition: ntddk_ex.h:94
r parent
Definition: btrfs.c:2644
GLint GLint GLsizei width
Definition: gl.h:1546
COLORREF lbColor
Definition: wingdi.h:1725
UINT state
Definition: treeview.c:147
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
#define TVIS_EXPANDED
Definition: commctrl.h:3251
#define min(a, b)
Definition: monoChain.cc:55
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define TVS_HASLINES
Definition: commctrl.h:3215
HTREEITEM parent
Definition: treeview.c:142
LONG bottom
Definition: windef.h:299
LONG stateOffset
Definition: treeview.c:162
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
#define BS_SOLID
Definition: wingdi.h:1067
DWORD COLORREF
Definition: windef.h:290
#define GETTXTCOLOR(x)
Definition: treeview.c:204
COLORREF clrLine
Definition: treeview.c:110
static LRESULT CALLBACK TREEVIEW_Edit_SubclassProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 3755 of file treeview.c.

Referenced by TREEVIEW_EditLabel().

3756 {
3758  BOOL bCancel = FALSE;
3759  LRESULT rc;
3760 
3761  switch (uMsg)
3762  {
3763  case WM_PAINT:
3764  TRACE("WM_PAINT start\n");
3765  rc = CallWindowProcW(infoPtr->wpEditOrig, hwnd, uMsg, wParam,
3766  lParam);
3767  TRACE("WM_PAINT done\n");
3768  return rc;
3769 
3770  case WM_KILLFOCUS:
3771  if (infoPtr->bIgnoreEditKillFocus)
3772  return TRUE;
3773  break;
3774 
3775  case WM_DESTROY:
3776  {
3777  WNDPROC editProc = infoPtr->wpEditOrig;
3778  infoPtr->wpEditOrig = 0;
3780  return CallWindowProcW(editProc, hwnd, uMsg, wParam, lParam);
3781  }
3782 
3783  case WM_GETDLGCODE:
3785 
3786  case WM_KEYDOWN:
3787  if (wParam == VK_ESCAPE)
3788  {
3789  bCancel = TRUE;
3790  break;
3791  }
3792  else if (wParam == VK_RETURN)
3793  {
3794  break;
3795  }
3796 
3797  /* fall through */
3798  default:
3799  return CallWindowProcW(infoPtr->wpEditOrig, hwnd, uMsg, wParam, lParam);
3800  }
3801 
3802  /* Processing TVN_ENDLABELEDIT message could kill the focus */
3803  /* eg. Using a messagebox */
3804 
3805  infoPtr->bIgnoreEditKillFocus = TRUE;
3806  TREEVIEW_EndEditLabelNow(infoPtr, bCancel || !infoPtr->bLabelChanged);
3807  infoPtr->bIgnoreEditKillFocus = FALSE;
3808 
3809  return 0;
3810 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define WM_GETDLGCODE
Definition: winuser.h:1671
static LRESULT TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
Definition: treeview.c:3995
WNDPROC wpEditOrig
Definition: treeview.c:121
UINT uMsg
Definition: precomp.h:45
#define VK_ESCAPE
Definition: winuser.h:2168
#define VK_RETURN
Definition: winuser.h:2155
static TREEVIEW_INFO * TREEVIEW_GetInfoPtr(HWND hwnd)
Definition: treeview.c:228
#define FALSE
Definition: types.h:117
#define WM_KEYDOWN
Definition: winuser.h:1691
#define WM_DESTROY
Definition: winuser.h:1591
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_KILLFOCUS
Definition: winuser.h:1596
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT WPARAM wParam
Definition: precomp.h:45
BOOL bIgnoreEditKillFocus
Definition: treeview.c:122
#define WM_PAINT
Definition: winuser.h:1602
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define DLGC_WANTALLKEYS
Definition: winuser.h:2566
#define GWLP_WNDPROC
Definition: treelist.c:66
HWND WINAPI GetParent(_In_ HWND)
UINT WPARAM LPARAM lParam
Definition: precomp.h:45
BOOL bLabelChanged
Definition: treeview.c:123
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetWindowLongPtrW
Definition: winuser.h:5215
LONG_PTR LRESULT
Definition: windef.h:209
#define DLGC_WANTARROWS
Definition: winuser.h:2564
static HWND TREEVIEW_EditLabel ( TREEVIEW_INFO infoPtr,
HTREEITEM  hItem 
)
static

Definition at line 3893 of file treeview.c.

Referenced by TREEVIEW_HandleTimer(), and TREEVIEW_WindowProc().

3894 {
3895  HWND hwnd = infoPtr->hwnd;
3896  HWND hwndEdit;
3897  SIZE sz;
3899  HDC hdc;
3900  HFONT hOldFont=0;
3901  TEXTMETRICW textMetric;
3902 
3903  TRACE("%p %p\n", hwnd, hItem);
3904  if (!(infoPtr->dwStyle & TVS_EDITLABELS))
3905  return NULL;
3906 
3907  if (!TREEVIEW_ValidItem(infoPtr, hItem))
3908  return NULL;
3909 
3910  if (infoPtr->hwndEdit)
3911  return infoPtr->hwndEdit;
3912 
3913  infoPtr->bLabelChanged = FALSE;
3914 
3915  /* make edit item visible */
3916  TREEVIEW_EnsureVisible(infoPtr, hItem, TRUE);
3917 
3918  TREEVIEW_UpdateDispInfo(infoPtr, hItem, TVIF_TEXT);
3919 
3920  hdc = GetDC(hwnd);
3921  /* Select the font to get appropriate metric dimensions */
3922  if (infoPtr->hFont != 0)
3923  {
3924  hOldFont = SelectObject(hdc, infoPtr->hFont);
3925  }
3926 
3927  /* Get string length in pixels */
3928  if (hItem->pszText)
3929  GetTextExtentPoint32W(hdc, hItem->pszText, strlenW(hItem->pszText),
3930  &sz);
3931  else
3932  GetTextExtentPoint32A(hdc, "", 0, &sz);
3933 
3934  /* Add Extra spacing for the next character */
3935  GetTextMetricsW(hdc, &textMetric);
3936  sz.cx += (textMetric.tmMaxCharWidth * 2);
3937 
3938  sz.cx = max(sz.cx, textMetric.tmMaxCharWidth * 3);
3939  sz.cx = min(sz.cx, infoPtr->clientWidth - hItem->textOffset + 2);
3940 
3941  if (infoPtr->hFont != 0)
3942  {
3943  SelectObject(hdc, hOldFont);
3944  }
3945 
3946  ReleaseDC(hwnd, hdc);
3947 
3948  infoPtr->editItem = hItem;
3949 
3950  hwndEdit = CreateWindowExW(WS_EX_LEFT,
3951  WC_EDITW,
3952  0,
3955  ES_LEFT, hItem->textOffset - 2,
3956  hItem->rect.top - 1, sz.cx + 3,
3957  hItem->rect.bottom -
3958  hItem->rect.top + 3, hwnd, 0, hinst, 0);
3959 /* FIXME: (HMENU)IDTVEDIT,pcs->hInstance,0); */
3960 
3961  infoPtr->hwndEdit = hwndEdit;
3962 
3963  /* Get a 2D border. */
3964  SetWindowLongW(hwndEdit, GWL_EXSTYLE,
3966  SetWindowLongW(hwndEdit, GWL_STYLE,
3967  GetWindowLongW(hwndEdit, GWL_STYLE) | WS_BORDER);
3968 
3969  SendMessageW(hwndEdit, WM_SETFONT,
3970  (WPARAM)TREEVIEW_FontForItem(infoPtr, hItem), FALSE);
3971 
3972  infoPtr->wpEditOrig = (WNDPROC)SetWindowLongPtrW(hwndEdit, GWLP_WNDPROC,
3973  (DWORD_PTR)
3975  if (hItem->pszText)
3976  SetWindowTextW(hwndEdit, hItem->pszText);
3977 
3978  if (TREEVIEW_BeginLabelEditNotify(infoPtr, hItem))
3979  {
3980  DestroyWindow(hwndEdit);
3981  infoPtr->hwndEdit = 0;
3982  infoPtr->editItem = NULL;
3983  return NULL;
3984  }
3985 
3986  SetFocus(hwndEdit);
3987  SendMessageW(hwndEdit, EM_SETSEL, 0, -1);
3988  ShowWindow(hwndEdit, SW_SHOW);
3989 
3990  return hwndEdit;
3991 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
LONG tmMaxCharWidth
Definition: wingdi.h:2366
#define HDC
Definition: msvc.h:22
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
#define WC_EDITW
Definition: commctrl.h:4647
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HTREEITEM editItem
Definition: treeview.c:98
HDC WINAPI GetDC(_In_opt_ HWND)
RECT rect
Definition: treeview.c:160
static HFONT TREEVIEW_FontForItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
Definition: treeview.c:325
WNDPROC wpEditOrig
Definition: treeview.c:121
LONG top
Definition: windef.h:297
HANDLE HWND
Definition: compat.h:13
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define GWL_EXSTYLE
Definition: winuser.h:845
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WS_CHILD
Definition: pedump.c:617
#define GetWindowLongPtrW
Definition: winuser.h:4698
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
#define FALSE
Definition: types.h:117
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HTREEITEM hItem
Definition: treelist.h:37
HDC hdc
Definition: msvc.h:53
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define ES_WANTRETURN
Definition: pedump.c:676
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:324
#define SW_SHOW
Definition: winuser.h:769
#define WS_EX_LEFT
Definition: winuser.h:391
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define TRACE(s)
Definition: solgame.cpp:4
LONG textOffset
Definition: treeview.c:164
#define EM_SETSEL
Definition: winuser.h:1979
HANDLE HINSTANCE
Definition: typedefs.h:75
LPWSTR pszText
Definition: treeview.c:149
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWL_STYLE
Definition: winuser.h:846
static LRESULT TREEVIEW_EnsureVisible(TREEVIEW_INFO *, HTREEITEM, BOOL)
Definition: treeview.c:4726
HWND hwndEdit
Definition: combotst.c:65
#define WS_BORDER
Definition: pedump.c:625
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define TVIF_TEXT
Definition: commctrl.h:3233
static LRESULT CALLBACK TREEVIEW_Edit_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: treeview.c:3755
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define min(a, b)
Definition: monoChain.cc:55
#define WM_SETFONT
Definition: winuser.h:1632
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL bLabelChanged
Definition: treeview.c:123
#define GWLP_HINSTANCE
Definition: winuser.h:850
LONG clientWidth
Definition: treeview.c:88
static HINSTANCE hinst
Definition: edit.c:551
LONG bottom
Definition: windef.h:299
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define ES_LEFT
Definition: pedump.c:664
static void TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT mask)
Definition: treeview.c:703
#define ES_AUTOHSCROLL
Definition: pedump.c:672
static BOOL TREEVIEW_BeginLabelEditNotify(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editItem)
Definition: treeview.c:686
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define TVS_EDITLABELS
Definition: commctrl.h:3217
static BOOL TREEVIEW_ValidItem(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:282
static LRESULT TREEVIEW_EndEditLabelNow ( TREEVIEW_INFO infoPtr,
BOOL  bCancel 
)
static

Definition at line 3995 of file treeview.c.

Referenced by TREEVIEW_Command(), TREEVIEW_Edit_SubclassProc(), TREEVIEW_Paint(), TREEVIEW_StyleChanged(), and TREEVIEW_WindowProc().

3996 {
3997  TREEVIEW_ITEM *editedItem = infoPtr->editItem;
3998  NMTVDISPINFOW tvdi;
3999  BOOL bCommit;
4000  WCHAR tmpText[1024] = { '\0' };
4001  WCHAR *newText = tmpText;
4002  int iLength = 0;
4003 
4004  if (!IsWindow(infoPtr->hwndEdit)) return FALSE;
4005 
4006  tvdi.item.mask = 0;
4007  tvdi.item.hItem = editedItem;
4008  tvdi.item.state = editedItem->state;
4009  tvdi.item.lParam = editedItem->lParam;
4010 
4011  if (!bCancel)
4012  {
4013  if (!infoPtr->bNtfUnicode)
4014  iLength = GetWindowTextA(infoPtr->hwndEdit, (LPSTR)tmpText, 1023);
4015  else
4016  iLength = GetWindowTextW(infoPtr->hwndEdit, tmpText, 1023);
4017 
4018  if (iLength >= 1023)
4019  {
4020  ERR("Insufficient space to retrieve new item label\n");
4021  }
4022 
4023  tvdi.item.mask = TVIF_TEXT;
4024  tvdi.item.pszText = tmpText;
4025  tvdi.item.cchTextMax = iLength + 1;
4026  }
4027  else
4028  {
4029  tvdi.item.pszText = NULL;
4030  tvdi.item.cchTextMax = 0;
4031  }
4032 
4033  bCommit = TREEVIEW_SendRealNotify(infoPtr, TVN_ENDLABELEDITW, &tvdi.hdr);
4034 
4035  if (!bCancel && bCommit) /* Apply the changes */
4036  {
4037  if (!infoPtr->bNtfUnicode)
4038  {
4039  DWORD len = MultiByteToWideChar( CP_ACP, 0, (LPSTR)tmpText, -1, NULL, 0 );
4040  newText = heap_alloc(len * sizeof(WCHAR));
4041  MultiByteToWideChar( CP_ACP, 0, (LPSTR)tmpText, -1, newText, len );
4042  iLength = len - 1;
4043  }
4044 
4045  if (strcmpW(newText, editedItem->pszText) != 0)
4046  {
4047  WCHAR *ptr = heap_realloc(editedItem->pszText, sizeof(WCHAR)*(iLength + 1));
4048  if (ptr == NULL)
4049  {
4050  ERR("OutOfMemory, cannot allocate space for label\n");
4051  if (newText != tmpText) heap_free(newText);
4052  DestroyWindow(infoPtr->hwndEdit);
4053  infoPtr->hwndEdit = 0;
4054  infoPtr->editItem = NULL;
4055  return FALSE;
4056  }
4057  else
4058  {
4059  editedItem->pszText = ptr;
4060  editedItem->cchTextMax = iLength + 1;
4061  strcpyW(editedItem->pszText, newText);
4062  TREEVIEW_ComputeTextWidth(infoPtr, editedItem, 0);
4063  }
4064  }
4065  if (newText != tmpText) heap_free(newText);
4066  }
4067 
4068  ShowWindow(infoPtr->hwndEdit, SW_HIDE);
4069  DestroyWindow(infoPtr->hwndEdit);
4070  infoPtr->hwndEdit = 0;
4071  infoPtr->editItem = NULL;
4072  return TRUE;
4073 }
static VOID TREEVIEW_ComputeTextWidth(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, HDC hDC)
Definition: treeview.c:881
int cchTextMax
Definition: commctrl.h:3288
#define TRUE
Definition: types.h:120
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1296
HTREEITEM editItem
Definition: treeview.c:98
BOOL WINAPI IsWindow(_In_opt_ HWND)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SW_HIDE
Definition: winuser.h:762
static BOOL TREEVIEW_SendRealNotify(const TREEVIEW_INFO *infoPtr, UINT code, NMHDR *hdr)
Definition: treeview.c:521
#define CP_ACP
Definition: compat.h:99
LPARAM lParam
Definition: commctrl.h:3292
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
UINT mask
Definition: commctrl.h:3283
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI DestroyWindow(_In_ HWND)
LPWSTR pszText
Definition: commctrl.h:3287
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
DWORD DWORD
Definition: winlogon.h:84
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3679
#define FALSE
Definition: types.h:117
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
LPARAM lParam
Definition: treeview.c:155
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT state
Definition: treeview.c:147
LPWSTR pszText
Definition: treeview.c:149
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
#define TVIF_TEXT
Definition: commctrl.h:3233
HTREEITEM hItem
Definition: commctrl.h:3284
#define MultiByteToWideChar
Definition: compat.h:100
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
TVITEMW item
Definition: commctrl.h:3639
UINT state
Definition: commctrl.h:3285
int cchTextMax
Definition: treeview.c:150
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static LRESULT TREEVIEW_EnsureVisible ( TREEVIEW_INFO infoPtr,
HTREEITEM  item,
BOOL  bHScroll 
)
static

Definition at line 4726 of file treeview.c.

Referenced by TREEVIEW_DoSelectItem(), TREEVIEW_EditLabel(), TREEVIEW_KeyDown(), TREEVIEW_ProcessLetterKeys(), and TREEVIEW_WindowProc().

4727 {
4728  int viscount;
4729  BOOL hasFirstVisible = infoPtr->firstVisible != NULL;
4730  HTREEITEM newFirstVisible = NULL;
4731  int visible_pos = -1;
4732 
4733  if (!TREEVIEW_ValidItem(infoPtr, item))
4734  return FALSE;
4735 
4736  if (!ISVISIBLE(item))
4737  {
4738  /* Expand parents as necessary. */
4739  HTREEITEM parent;
4740 
4741  /* see if we are trying to ensure that root is visible */
4742  if((item != infoPtr->root) && TREEVIEW_ValidItem(infoPtr, item))
4743  parent = item->parent;
4744  else
4745  parent = item; /* this item is the topmost item */
4746 
4747  while (parent != infoPtr->root)
4748  {
4749  if (!(parent->state & TVIS_EXPANDED))
4750  TREEVIEW_Expand(infoPtr, parent, FALSE, TRUE);
4751 
4752  parent = parent->parent;
4753  }
4754  }
4755 
4756  viscount = TREEVIEW_GetVisibleCount(infoPtr);
4757 
4758  TRACE("%p (%s) %d - %d viscount(%d)\n", item, TREEVIEW_ItemName(item), item->visibleOrder,
4759  hasFirstVisible ? infoPtr->firstVisible->visibleOrder : -1, viscount);
4760 
4761  if (hasFirstVisible)
4762  visible_pos = item->visibleOrder - infoPtr->firstVisible->visibleOrder;
4763 
4764  if (visible_pos < 0)
4765  {
4766  /* item is before the start of the list: put it at the top. */
4767  newFirstVisible = item;
4768  }
4769  else if (visible_pos >= viscount
4770  /* Sometimes, before we are displayed, GVC is 0, causing us to
4771  * spuriously scroll up. */
4772  && visible_pos > 0 && !(infoPtr->dwStyle & TVS_NOSCROLL) )
4773  {
4774  /* item is past the end of the list. */
4775  int scroll = visible_pos - viscount;
4776 
4777  newFirstVisible = TREEVIEW_GetListItem(infoPtr, infoPtr->firstVisible,
4778  scroll + 1);
4779  }
4780 
4781  if (bHScroll)
4782  {
4783  /* Scroll window so item's text is visible as much as possible */
4784  /* Calculation of amount of extra space is taken from EditLabel code */
4785  INT pos, x;
4786  TEXTMETRICW textMetric;
4787  HDC hdc = GetWindowDC(infoPtr->hwnd);
4788 
4789  x = item->textWidth;
4790 
4791  GetTextMetricsW(hdc, &textMetric);
4792  ReleaseDC(infoPtr->hwnd, hdc);
4793 
4794  x += (textMetric.tmMaxCharWidth * 2);
4795  x = max(x, textMetric.tmMaxCharWidth * 3);
4796 
4797  if (item->textOffset < 0)
4798  pos = item->textOffset;
4799  else if (item->textOffset + x > infoPtr->clientWidth)
4800  {
4801  if (x > infoPtr->clientWidth)
4802  pos = item->textOffset;
4803  else
4804  pos = item->textOffset + x - infoPtr->clientWidth;
4805  }
4806  else
4807  pos = 0;
4808 
4809  TREEVIEW_HScroll(infoPtr, MAKEWPARAM(SB_THUMBPOSITION, infoPtr->scrollX + pos));
4810  }
4811 
4812  if (newFirstVisible != NULL && newFirstVisible != infoPtr->firstVisible)
4813  {
4814  TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE);
4815 
4816  return TRUE;
4817  }
4818 
4819  return FALSE;
4820 }
LONG tmMaxCharWidth
Definition: wingdi.h:2366
#define HDC
Definition: msvc.h:22
static int pos
Definition: treeview.c:383
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
#define TVS_NOSCROLL
Definition: commctrl.h:3227
HTREEITEM firstVisible
Definition: treeview.c:100
LONG visibleOrder
Definition: treeview.c:166
static const char * TREEVIEW_ItemName(const TREEVIEW_ITEM *item)
Definition: treeview.c:336
int32_t INT
Definition: typedefs.h:56
static TREEVIEW_ITEM * TREEVIEW_GetListItem(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, LONG count)
Definition: treeview.c:466
#define FALSE
Definition: types.h:117
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
#define SB_THUMBPOSITION
Definition: winuser.h:572
HTREEITEM root
Definition: treeview.c:77
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG textOffset
Definition: treeview.c:164
LONG textWidth
Definition: treeview.c:165
r parent
Definition: btrfs.c:2644
UINT state
Definition: treeview.c:147
static BOOL TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, BOOL partial, BOOL user)
Definition: treeview.c:3439
#define TVIS_EXPANDED
Definition: commctrl.h:3251
static ATOM item
Definition: dde.c:856
#define ISVISIBLE(x)
Definition: treeview.c:200
HDC WINAPI GetWindowDC(_In_opt_ HWND)
static LRESULT TREEVIEW_HScroll(TREEVIEW_INFO *, WPARAM)
Definition: treeview.c:4957
HTREEITEM parent
Definition: treeview.c:142
LONG clientWidth
Definition: treeview.c:88
static LRESULT TREEVIEW_GetVisibleCount(const TREEVIEW_INFO *infoPtr)
Definition: treeview.c:2079
static VOID TREEVIEW_SetFirstVisible(TREEVIEW_INFO *, TREEVIEW_ITEM *, BOOL)
Definition: treeview.c:4823
static BOOL TREEVIEW_ValidItem(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:282
INT x
Definition: msvc.h:62
static LRESULT TREEVIEW_EraseBackground ( const TREEVIEW_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 2884 of file treeview.c.

Referenced by TREEVIEW_PrintClient(), and TREEVIEW_WindowProc().

2885 {
2886  RECT rect;
2887 
2888  TRACE("%p\n", infoPtr);
2889 
2890  GetClientRect(infoPtr->hwnd, &rect);
2891  TREEVIEW_FillBkgnd(infoPtr, hdc, &rect);
2892 
2893  return 1;
2894 }
& rect
Definition: startmenu.cpp:1413
HDC hdc
Definition: msvc.h:53
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
static void TREEVIEW_FillBkgnd(const TREEVIEW_INFO *infoPtr, HDC hdc, const RECT *rc)
Definition: treeview.c:2872
static BOOL TREEVIEW_Expand ( TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM item,
BOOL  partial,
BOOL  user 
)
static

Definition at line 3439 of file treeview.c.

Referenced by TREEVIEW_EnsureVisible(), TREEVIEW_ExpandAll(), TREEVIEW_ExpandMsg(), TREEVIEW_KeyDown(), TREEVIEW_SingleExpand(), and TREEVIEW_Toggle().

3441 {
3442  LONG scrollDist;
3443  LONG orgNextTop = 0;
3444  RECT scrollRect;
3445  TREEVIEW_ITEM *nextItem, *tmpItem;
3446  BOOL sendsNotifications;
3447 
3448  TRACE("(%p, %p, partial=%d, %d)\n", infoPtr, item, partial, user);
3449 
3450  if (!TREEVIEW_HasChildren(infoPtr, item))
3451  return FALSE;
3452 
3453  tmpItem = item; nextItem = NULL;
3454  while (tmpItem)
3455  {
3456  if (tmpItem->nextSibling)
3457  {
3458  nextItem = tmpItem->nextSibling;
3459  break;
3460  }
3461  tmpItem = tmpItem->parent;
3462  }
3463 
3464  if (nextItem)
3465  orgNextTop = nextItem->rect.top;
3466 
3467  TRACE("TVE_EXPAND %p %s\n", item, TREEVIEW_ItemName(item));
3468 
3469  sendsNotifications = user || ((item->cChildren != 0) &&
3470  !(item->state & TVIS_EXPANDEDONCE));
3471  if (sendsNotifications)
3472  {
3473  if (!TREEVIEW_SendExpanding(infoPtr, item, TVE_EXPAND))
3474  {
3475  TRACE(" TVN_ITEMEXPANDING returned TRUE, exiting...\n");
3476  return FALSE;
3477  }
3478  }
3479  if (!item->firstChild)
3480  return FALSE;
3481 
3482  item->state |= TVIS_EXPANDED;
3483 
3484  if (partial)
3485  FIXME("TVE_EXPANDPARTIAL not implemented\n");
3486 
3487  if (ISVISIBLE(item))
3488  {
3489  TREEVIEW_RecalculateVisibleOrder(infoPtr, item);
3490  TREEVIEW_UpdateSubTree(infoPtr, item);
3491  TREEVIEW_UpdateScrollBars(infoPtr);
3492 
3493  scrollRect.left = 0;
3494  scrollRect.bottom = infoPtr->treeHeight;
3495  scrollRect.right = infoPtr->clientWidth;
3496  if (nextItem)
3497  {
3498  scrollDist = nextItem->rect.top - orgNextTop;
3499  scrollRect.top = orgNextTop;
3500 
3501  ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL,
3503  TREEVIEW_Invalidate (infoPtr, item);
3504  } else {
3505  scrollRect.top = item->rect.top;
3506  InvalidateRect(infoPtr->hwnd, &scrollRect, FALSE);
3507  }
3508 
3509  /* Scroll up so that as many children as possible are visible.
3510  * This fails when expanding causes an HScroll bar to appear, but we
3511  * don't know that yet, so the last item is obscured. */
3512  if (item->firstChild != NULL)
3513  {
3514  int nChildren = item->lastChild->visibleOrder
3515  - item->firstChild->visibleOrder + 1;
3516 
3517  int visible_pos = item->visibleOrder
3518  - infoPtr->firstVisible->visibleOrder;
3519 
3520  int rows_below = TREEVIEW_GetVisibleCount(infoPtr) - visible_pos - 1;
3521 
3522  if (visible_pos > 0 && nChildren > rows_below)
3523  {
3524  int scroll = nChildren - rows_below;
3525 
3526  if (scroll > visible_pos)
3527  scroll = visible_pos;
3528 
3529  if (scroll > 0)
3530  {
3531  TREEVIEW_ITEM *newFirstVisible
3532  = TREEVIEW_GetListItem(infoPtr, infoPtr->firstVisible,
3533  scroll);
3534 
3535 
3536  TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE);
3537  }
3538  }
3539  }
3540  }
3541 
3542  if (sendsNotifications) {
3543  TREEVIEW_SendExpanded(infoPtr, item, TVE_EXPAND);
3544  item->state |= TVIS_EXPANDEDONCE;
3545  }
3546 
3547  return TRUE;
3548 }
#define TRUE
Definition: types.h:120
static VOID TREEVIEW_Invalidate(const TREEVIEW_INFO *, const TREEVIEW_ITEM *)
Definition: treeview.c:2955
HTREEITEM nextSibling
Definition: treeview.c:143
HTREEITEM firstVisible
Definition: treeview.c:100
RECT rect
Definition: treeview.c:160
LONG visibleOrder
Definition: treeview.c:166
LONG top
Definition: windef.h:297
static const char * TREEVIEW_ItemName(const TREEVIEW_ITEM *item)
Definition: treeview.c:336
int cChildren
Definition: treeview.c:154
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3252
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
static VOID TREEVIEW_SendExpanded(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT action)
Definition: treeview.c:3315
HTREEITEM firstChild
Definition: treeview.c:144
static TREEVIEW_ITEM * TREEVIEW_GetListItem(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, LONG count)
Definition: treeview.c:466
static VOID TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr)
Definition: treeview.c:2743
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define FIXME(fmt,...)
Definition: debug.h:110
#define SW_ERASE
Definition: winuser.h:2534
smooth NULL
Definition: ftsmooth.c:416
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
UINT state
Definition: treeview.c:147
#define TVE_EXPAND
Definition: commctrl.h:3390
static VOID TREEVIEW_UpdateSubTree(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *root)
Definition: treeview.c:965
#define SW_INVALIDATE
Definition: winuser.h:2533
#define TVIS_EXPANDED
Definition: commctrl.h:3251
static ATOM item
Definition: dde.c:856
HTREEITEM lastChild
Definition: treeview.c:158
#define ISVISIBLE(x)
Definition: treeview.c:200
static BOOL TREEVIEW_SendExpanding(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, UINT action)
Definition: treeview.c:3305
HTREEITEM parent
Definition: treeview.c:142
static BOOL TREEVIEW_HasChildren(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
Definition: treeview.c:834
LONG clientWidth
Definition: treeview.c:88
LONG bottom
Definition: windef.h:299
static LRESULT TREEVIEW_GetVisibleCount(const TREEVIEW_INFO *infoPtr)
Definition: treeview.c:2079
static VOID TREEVIEW_SetFirstVisible(TREEVIEW_INFO *, TREEVIEW_ITEM *, BOOL)
Definition: treeview.c:4823
static void TREEVIEW_RecalculateVisibleOrder(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *start)
Definition: treeview.c:929
void user(int argc, const char *argv[])
Definition: cmds.c:1350
static VOID TREEVIEW_ExpandAll ( TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM item 
)
static

Definition at line 3598 of file treeview.c.

Referenced by TREEVIEW_KeyDown().

3599 {
3600  TREEVIEW_Expand(infoPtr, item, FALSE, TRUE);
3601 
3602  for (item = item->firstChild; item != NULL; item = item->nextSibling)
3603  {
3604  if (TREEVIEW_HasChildren(infoPtr, item))
3605  TREEVIEW_ExpandAll(infoPtr, item);
3606  }
3607 }
#define TRUE
Definition: types.h:120
HTREEITEM nextSibling
Definition: treeview.c:143
HTREEITEM firstChild
Definition: treeview.c:144
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
static BOOL TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, BOOL partial, BOOL user)
Definition: treeview.c:3439
static VOID TREEVIEW_ExpandAll(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
Definition: treeview.c:3598
static BOOL TREEVIEW_HasChildren(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
Definition: treeview.c:834
static LRESULT TREEVIEW_ExpandMsg ( TREEVIEW_INFO infoPtr,
UINT  flag,
HTREEITEM  item 
)
static

Definition at line 3616 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

3617 {
3618  if (!TREEVIEW_ValidItem(infoPtr, item))
3619  return 0;
3620 
3621  TRACE("For (%s) item:%d, flags 0x%x, state:%d\n",
3622  TREEVIEW_ItemName(item), TREEVIEW_GetItemIndex(infoPtr, item),
3623  flag, item->state);
3624 
3625  switch (flag & TVE_TOGGLE)
3626  {
3627  case TVE_COLLAPSE:
3628  return TREEVIEW_Collapse(infoPtr, item, flag & TVE_COLLAPSERESET,
3629  FALSE);
3630 
3631  case TVE_EXPAND:
3632  return TREEVIEW_Expand(infoPtr, item, flag & TVE_EXPANDPARTIAL,
3633  FALSE);
3634 
3635  case TVE_TOGGLE:
3636  return TREEVIEW_Toggle(infoPtr, item, FALSE);
3637 
3638  default:
3639  return 0;
3640  }
3641 }
#define TVE_TOGGLE
Definition: commctrl.h:3391
static const char * TREEVIEW_ItemName(const TREEVIEW_ITEM *item)
Definition: treeview.c:336
#define FALSE
Definition: types.h:117
#define TVE_EXPANDPARTIAL
Definition: commctrl.h:3392
#define TVE_COLLAPSE
Definition: commctrl.h:3389
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean flag
Definition: glfuncs.h:72
static BOOL TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, BOOL bRemoveChildren, BOOL bUser)
Definition: treeview.c:3328
UINT state
Definition: treeview.c:147
#define TVE_EXPAND
Definition: commctrl.h:3390
static BOOL TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, BOOL partial, BOOL user)
Definition: treeview.c:3439
static int TREEVIEW_GetItemIndex(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:235
static BOOL TREEVIEW_Toggle(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, BOOL user)
Definition: treeview.c:3587
static BOOL TREEVIEW_ValidItem(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
Definition: treeview.c:282
#define TVE_COLLAPSERESET
Definition: commctrl.h:3393
static void TREEVIEW_FillBkgnd ( const TREEVIEW_INFO infoPtr,
HDC  hdc,
const RECT rc 
)
static

Definition at line 2872 of file treeview.c.

Referenced by TREEVIEW_EraseBackground(), and TREEVIEW_Paint().

2873 {
2874  HBRUSH hBrush;
2875  COLORREF clrBk = GETBKCOLOR(infoPtr->clrBk);
2876 
2877  hBrush = CreateSolidBrush(clrBk);
2878  FillRect(hdc, rc, hBrush);
2879  DeleteObject(hBrush);
2880 }
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
COLORREF clrBk
Definition: treeview.c:108
#define GETBKCOLOR(x)
Definition: treeview.c:203
HDC hdc
Definition: msvc.h:53
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
DWORD COLORREF
Definition: windef.h:290
static HFONT TREEVIEW_FontForItem ( const TREEVIEW_INFO infoPtr,
const TREEVIEW_ITEM item 
)
inlinestatic

Definition at line 325 of file treeview.c.

Referenced by TREEVIEW_ComputeTextWidth(), TREEVIEW_DrawItem(), TREEVIEW_EditLabel(), and TREEVIEW_UpdateSubTree().

326 {
327  if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (item == infoPtr->hotItem))
328  return item->state & TVIS_BOLD ? infoPtr->hBoldUnderlineFont : infoPtr->hUnderlineFont;
329  if (item->state & TVIS_BOLD)
330  return infoPtr->hBoldFont;
331  return infoPtr->hFont;
332 }
HTREEITEM hotItem
Definition: treeview.c:96
HFONT hUnderlineFont
Definition: treeview.c:115
UINT state
Definition: treeview.c:147
#define TVS_TRACKSELECT
Definition: commctrl.h:3223
HFONT hBoldUnderlineFont
Definition: treeview.c:116
#define TVIS_BOLD
Definition: commctrl.h:3250
static void TREEVIEW_FreeItem ( TREEVIEW_INFO infoPtr,
TREEVIEW_ITEM item 
)
static

Definition at line 1031 of file treeview.c.

Referenced by TREEVIEW_Destroy(), and TREEVIEW_RemoveItem().

1032 {
1033  DPA_DeletePtr(infoPtr->items, DPA_GetPtrIndex(infoPtr->items, item));
1034  if (infoPtr->selectedItem == item)
1035  infoPtr->selectedItem = NULL;
1036  if (infoPtr->hotItem == item)
1037  infoPtr->hotItem = NULL;
1038  if (infoPtr->focusedItem == item)
1039  infoPtr->focusedItem = NULL;
1040  if (infoPtr->firstVisible == item)
1041  infoPtr->firstVisible = NULL;
1042  if (infoPtr->dropItem == item)
1043  infoPtr->dropItem = NULL;
1044  if (infoPtr->insertMarkItem == item)
1045  infoPtr->insertMarkItem = NULL;
1046  heap_free(item);
1047 }
HTREEITEM firstVisible
Definition: treeview.c:100
HTREEITEM insertMarkItem
Definition: treeview.c:103
HTREEITEM dropItem
Definition: treeview.c:102
HTREEITEM hotItem
Definition: treeview.c:96
smooth NULL
Definition: ftsmooth.c:416
INT WINAPI DPA_GetPtrIndex(HDPA hdpa, LPCVOID p)
Definition: dpa.c:561
HTREEITEM selectedItem
Definition: treeview.c:95
LPVOID WINAPI DPA_DeletePtr(HDPA hdpa, INT i)
Definition: dpa.c:677
HTREEITEM focusedItem
Definition: treeview.c:97
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static LRESULT TREEVIEW_GetBkColor ( const TREEVIEW_INFO infoPtr)
static

Definition at line 1975 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

1976 {
1977  TRACE("\n");
1978  return (LRESULT)infoPtr->clrBk;
1979 }
COLORREF clrBk
Definition: treeview.c:108
#define TRACE(s)
Definition: solgame.cpp:4
LONG_PTR LRESULT
Definition: windef.h:209
static LRESULT TREEVIEW_GetCount ( const TREEVIEW_INFO infoPtr)
static

Definition at line 2331 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

2332 {
2333  TRACE(" %d\n", infoPtr->uNumItems);
2334  return (LRESULT)infoPtr->uNumItems;
2335 }
#define TRACE(s)
Definition: solgame.cpp:4
LONG_PTR LRESULT
Definition: windef.h:209
static LRESULT TREEVIEW_GetEditControl ( const TREEVIEW_INFO infoPtr)
static

Definition at line 3749 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

3750 {
3751  return (LRESULT)infoPtr->hwndEdit;
3752 }
LONG_PTR LRESULT
Definition: windef.h:209
static LRESULT TREEVIEW_GetFont ( const TREEVIEW_INFO infoPtr)
static

Definition at line 1883 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

1884 {
1885  TRACE("%p\n", infoPtr->hFont);
1886  return (LRESULT)infoPtr->hFont;
1887 }
#define TRACE(s)
Definition: solgame.cpp:4
LONG_PTR LRESULT
Definition: windef.h:209
static LRESULT TREEVIEW_GetImageList ( const TREEVIEW_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 1712 of file treeview.c.

Referenced by TREEVIEW_WindowProc().

1713 {
1714  TRACE("\n");
1715 
1716  switch (wParam)
1717  {
1718  case TVSIL_NORMAL:
1719  return (LRESULT)infoPtr->himlNormal;
1720 
1721  case TVSIL_STATE:
1722  return (