SysAllocStringLen16 needs to handle NULL pointers, too.
[wine] / include / treeview.h
1 /*
2  * Treeview class extra info
3  *
4  * Copyright 1998 Eric Kohl
5  * Copyright 1998 Alex Priem
6  */
7
8 #ifndef __WINE_TREEVIEW_H
9 #define __WINE_TREEVIEW_H
10
11 #include "commctrl.h"
12
13 #define MINIMUM_INDENT 10
14 #define TV_REFRESH_DELAY 100     /* 100 ms delay between two refreshes */
15 #define TV_DEFAULTITEMHEIGHT 16
16 #define TVITEM_ALLOC    16      /* default nr of items to allocate at first try */
17
18
19 /* internal structures */
20
21 typedef struct {
22   UINT      mask;
23   HTREEITEM hItem;
24   UINT      state;
25   UINT      stateMask;
26   LPSTR     pszText;
27   int       cchTextMax;
28   int       iImage;
29   int       iSelectedImage;
30   int       cChildren;
31   LPARAM    lParam;
32   int       iIntegral;
33   int       iLevel;         /* indentation level:0=root level */
34   COLORREF  clrText;
35   HTREEITEM parent;         /* handle to parent or 0 if at root*/
36   HTREEITEM firstChild;     /* handle to first child or 0 if no child*/
37   HTREEITEM sibling;        /* handle to next item in list, 0 if last */
38   HTREEITEM upsibling;      /* handle to previous item in list, 0 if first */
39   int       visible;
40   RECT      rect;
41   RECT      text;
42   RECT      expandBox;      /* expand box (+/-) coordinate */
43 } TREEVIEW_ITEM;
44
45
46 typedef struct tagTREEVIEW_INFO
47 {
48   UINT          uInternalStatus;    
49   UINT          bAutoSize;      /* merge with uInternalStatus */
50   INT           Timer;
51   UINT          uNumItems;      /* number of valid TREEVIEW_ITEMs */
52   UINT          uNumPtrsAlloced; 
53   HTREEITEM     uMaxHandle;     /* needed for delete_item */
54   HTREEITEM     TopRootItem;    /* handle to first item in treeview */
55   INT           cdmode;         /* last custom draw setting */
56   UINT          uScrollTime;    /* max. time for scrolling in milliseconds*/
57   UINT          uItemHeight;    /* item height, -1 for default item height */
58   UINT          uRealItemHeight;/* current item height in pixels */
59   UINT          uVisibleHeight; /* visible height of treeview in pixels */
60   UINT          uTotalHeight;   /* total height of treeview in pixels */
61   UINT          uVisibleWidth;      
62   UINT          uTotalWidth;  
63   UINT          uIndent;        /* indentation in pixels */
64   HTREEITEM     selectedItem;   /* handle to selected item or 0 if none */
65   HTREEITEM     focusItem;      /* handle to item that has focus, 0 if none */
66   HTREEITEM     hotItem;        /* handle currently under cursor, 0 if none */
67   HTREEITEM     editItem;       /* handle to item currently editted, 0 if none */
68   HTREEITEM     firstVisible;   /* handle to first visible item */
69   HTREEITEM     dropItem;       /* handle to item selected by drag cursor */
70   HIMAGELIST    dragList;       /* Bitmap of dragged item */
71   INT           cx,cy;          /* current x/y place in list */
72   COLORREF      clrBk;    
73   COLORREF      clrText;
74   COLORREF      clrLine;
75   HFONT         hFont;
76   HFONT         hBoldFont;
77   HWND          hwndToolTip;
78   HWND          hwndEdit;
79   WNDPROC       wpEditOrig;     /* needed for subclassing edit control */
80   HIMAGELIST    himlNormal;  
81   HIMAGELIST    himlState;
82   LPTVSORTCB    pCallBackSort; /* ptr to TVSORTCB struct for callback sorting */
83   TREEVIEW_ITEM *items;        /* itemlist */
84   INT           *freeList;     /* bitmap indicating which elements are valid */
85                                /* 1=valid, 0=free;   */
86                                /* size of list= uNumPtrsAlloced/32 */
87 } TREEVIEW_INFO;
88
89
90
91 /* bitflags for infoPtr->uInternalStatus */
92
93 #define TV_HSCROLL      0x01    /* treeview too large to fit in window */
94 #define TV_VSCROLL      0x02    /* (horizontal/vertical) */
95 #define TV_LDRAG                0x04    /* Lbutton pushed to start drag */
96 #define TV_LDRAGGING    0x08    /* Lbutton pushed, mouse moved.  */
97 #define TV_RDRAG                0x10    /* dito Rbutton */
98 #define TV_RDRAGGING    0x20    
99
100 /* bitflags for infoPtr->timer */
101
102 #define TV_REFRESH_TIMER 1      
103 #define TV_EDIT_TIMER    2
104 #define TV_REFRESH_TIMER_SET 1  
105 #define TV_EDIT_TIMER_SET 2  
106
107
108 extern VOID TREEVIEW_Register (VOID);
109 extern VOID TREEVIEW_Unregister (VOID);
110
111 #endif  /* __WINE_TREEVIEW_H */