home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 February
/
PCWorld_2000-02_cd.bin
/
Software
/
TemaCD
/
tcvpa
/
data1.cab
/
MyFileGroup
/
INCLUDE
/
tcTree.h
< prev
next >
Wrap
Text File
|
1999-06-03
|
5KB
|
191 lines
#define WC_TcTreeCtrl "TcTreeCtrl"
#define WS_TREE_LINES 0x1
#define WS_TREE_BUTTONS 0x2
#define WS_TREE_ROOTLINES 0x4
#define WS_TREE_MULSEL 0x8
#define WS_TREE_AUTO 0x10
////////////////////////////////////////////////////////
typedef struct _TREE_DRAWPARAMS
{
NMHDR hdr;
void * pItem;
char text [256];
BOOL expanded;
BOOL selected;
unsigned attr; // 1-bold, 2-ital, 4-under, 8-strikeout, 16-drop_target
// BOOL gray;
int img_idx;
int my_be_exp;
COLORREF fColor;
COLORREF bColor;
HIMAGELIST xImgLst[4];
int xImgIdx[4];
}
TREE_DRAWPARAMS;
typedef struct _TREE_NOTIFY
{
NMHDR hdr;
void * pItem;
long arg;
}
TREE_NOTIFY;
/*typedef struct _TREE_DRAGDROP
{
NMHDR hdr;
POINT ms;
}
TREE_DRAGDROP;*/
////////////////////////////////////////////////////////
typedef struct _XTREE_ITEM
{
DWORD mask; // for INSERT or SET
DWORD item;
DWORD attr;
DWORD userData;
long image;
COLORREF fColorN;
COLORREF bColorN;
COLORREF fColorS;
COLORREF bColorS;
char text [256];
}
XTREE_ITEM;
#define XTREE_MASK_FCOLOR_N (1<<0)
#define XTREE_MASK_BCOLOR_N (1<<1)
#define XTREE_MASK_FCOLOR_S (1<<2)
#define XTREE_MASK_BCOLOR_S (1<<3)
#define XTREE_MASK_TEXT (1<<4)
#define XTREE_MASK_DATA (1<<5)
#define XTREE_MASK_ATTR (1<<6)
#define XTREE_MASK_IMAGE (1<<7)
////////////////////////////////////////////////////////
enum
{
TREE_N_None = -300,
TREE_N_DrawParams, //
TREE_N_Change, //
TREE_N_GetLevel, // Return Level
TREE_N_GetParent, // Return PTR
TREE_N_GetCount, // Return NUM
TREE_N_GetChild, // arg=number; Return PTR
TREE_N_CanMulSel, // Return BOOL(error)
TREE_N_Select, // BOOL(is_sel)
TREE_N_Expanded, //
TREE_N_Collapsed, //
TREE_N_XDelete, //
TREE_N_Changing, // Return ERR
TREE_N_CanDragDrop, // --
TREE_N_TryFill, //
};
enum
{
WM_TREE_SETIMAGELIST=(0x1400+1), // lParam = hImg
WM_TREE_REDRAW, //
WM_TREE_ONINSERT, // wParam = flags, lParam = (item *)
WM_TREE_ONDELETE, // wParam = BOOL(draw), lParam = (item *)
WM_TREE_GETINDEX, // lParam = (item *); Return INDEX
WM_TREE_SETPTR, // wParam = INT(index), lParam = (item *)
WM_TREE_GETFOCUSED, // Return (item *)
WM_TREE_SETFOCUSED, // wParam = BOOL(keep_sel), lParam = (item *); Return OK
WM_TREE_GETSEL, // lParam = (item*); Return BOOL
WM_TREE_SETSEL, // wParam = BOOL(sel), lParam = (item *)
WM_TREE_GETSELITEMS, // wParam = INT(max), lParam = (item **); Return COUNT
WM_TREE_GETITEMRECT, // wParam = flags, lParam = union {RECT; Item*;}; return OK
WM_TREE_COLLAPSE, // lParam = (item *)
WM_TREE_EXPAND, // lParam = (item *)
WM_TREE_SETCOLORS, // lParam = DWORD[8]
WM_XTREE_INSERT, // wParam = index, lParam = (XTREE_ITEM *) // item=PARENT
// Return xitem
WM_XTREE_DELETE, // lParam = (long)xitem
WM_XTREE_SET, // lParam = (XTREE_ITEM *)
WM_XTREE_GET, // lParam = (XTREE_ITEM *)
WM_XTREE_CHILD, // wParam = index, lParam = parent_xitem
WM_XTREE_PARENT, // lParam = xitem
WM_XTREE_COUNT, // lParam = xitem
WM_TREE_TOPVISUAL, // Return item*
WM_TREE_CLEAR, //
WM_TREE_EXPAND_ALL, // lParam = (item *)
WM_TREE_GETBYINDEX, // wParam = index; Return item*
WM_TREE_ITEMFROMPOINT, // lParam = MAKELONG(x,y); Return item*
};
#define TcTree_Redraw(hwnd) SendMessage(hwnd,WM_TREE_REDRAW,0,0)
#define TcTree_Insert(hwnd,uitem,flg) SendMessage(hwnd,WM_TREE_ONINSERT,flg,(LPARAM)(uitem))
#define TcTree_Delete(hwnd,uitem,flg) SendMessage(hwnd,WM_TREE_ONDELETE,flg,(LPARAM)(uitem))
#define TcTree_GetFocused(hwnd) SendMessage(hwnd,WM_TREE_GETFOCUSED,0,0)
#define TcTree_SetFocused(hwnd,uitem) SendMessage(hwnd,WM_TREE_SETFOCUSED,0,(LPARAM)(uitem))
#define TcTree_Collapse(hwnd,uitem) SendMessage(hwnd,WM_TREE_COLLAPSE,0,(LPARAM)(uitem))
#define TcTree_Expand(hwnd,uitem) SendMessage(hwnd,WM_TREE_EXPAND,0,(LPARAM)(uitem))
#define TcTree_ExpandAll(hwnd,uitem) SendMessage(hwnd,WM_TREE_EXPAND_ALL,0,(LPARAM)(uitem))
#define TcTree_SetImageList(hwnd,hil) SendMessage(hwnd,WM_TREE_SETIMAGELIST,0,(LPARAM)(hil))
#define TcTree_Clear(hwnd) SendMessage(hwnd,WM_TREE_CLEAR,0,0)
#define TcTree_ItemFromPoint(hwnd,x,y) SendMessage(hwnd,WM_TREE_ITEMFROMPOINT,0,MAKELONG(x,y))
/*
PROMOTE / DEMOTE
SendMessage( h_Tree, WM_TREE_COLLAPSE, 0, (LPARAM)item );
SendMessage( h_Tree, WM_TREE_ONDELETE, 1, (LPARAM)item );
item->Parent->Remove_Child(item);
new_par->Add_Child(item);
item->Parent = new_par;
SendMessage( h_Tree, WM_TREE_ONINSERT, 1, (LPARAM)item );
SendMessage( h_Tree, WM_TREE_EXPAND, 0, (LPARAM)new_par );
SendMessage( h_Tree, WM_TREE_SETFOCUSED, 0, (LPARAM)item );
SWAP
int i1 = SendMessage( h_Tree, WM_TREE_GETINDEX, 0, (LPARAM)item1 );
int i2 = SendMessage( h_Tree, WM_TREE_GETINDEX, 0, (LPARAM)item2 );
SendMessage( h_Tree, WM_TREE_SETPTR, i1, (LPARAM)item2 );
SendMessage( h_Tree, WM_TREE_SETPTR, i2, (LPARAM)item1 );
item1->Parent->Children.Replace( idx1+0, item2 );
item1->Parent->Children.Replace( idx1+1, item1 );
*/
#define TREE_CIDX_TEXT 0
#define TREE_CIDX_BACK 1
#define TREE_CIDX_STEXT 2
#define TREE_CIDX_SBACK 3
#define TREE_CIDX_STEXT2 4
#define TREE_CIDX_SBACK2 5
#define TREE_CIDX_PLUS 6
#define TREE_CIDX_LINES 7