///////////////////////////////////////////////////////////////////////////////////////
//
//
// TreeList Control For Win32
// Create by Eitan Michaelson 4/2011 , Noyasoft@gmail.com
//
// Revision History
//
// Version 1.71
// 4/26/2011: Fixed width of edit box when not the last column
//
///////////////////////////////////////////////////////////////////////////////////////
#pragma warning(disable : 4996) // CRT Secure - off
#include "TreeList.h"
///////////////////////////////////////////////////////////////////////////////////////
//
//
// MACRO\defines and Helpers
//
//
///////////////////////////////////////////////////////////////////////////////////////
#define TREELIST_FONT_EXTRA_HEIGHT 7
#define TREELIST_FONT_TEXT_CELL_OFFSET 9
#define TREELIST_PRNTCTLSIZE(TreeDim) TreeDim.X,TreeDim.Y,TreeDim.Width,TreeDim.Hight
#define TREELIST_MIN(a, b) (((a) < (b)) ? (a) : (b))
#define TREELIST_MAX(a, b) (((a) > (b)) ? (a) : (b))
#define TREELIST_WM_EDIT_NODE (WM_USER + 100)
#define TREELIST_WM_EDIT_ENTER (WM_USER + 101)
#define TREELIST_ELEMENTS_PER_INSTANCE 4
#define TREELIST_PROP_VAL "TREELIST_PTR"
//#define TREELIST_DOUBLE_BUFFEING
typedef HANDLE (CALLBACK* LPREMOVEPROP)(HWND,LPCTSTR); // VC2010 issue
///////////////////////////////////////////////////////////////////////////////////////
//
//
// Internal tree data type
//
//
///////////////////////////////////////////////////////////////////////////////////////
// a single node (linked list) member
static struct tag_TreeListNode
{
int NodeDataCount; // Count of items in pNodeData
HTREEITEM TreeItemHandle;
struct tag_TreeListNode *pParennt;
struct tag_TreeListNode *pSibling;
struct tag_TreeListNode *pBrother;
TreeListNodeData **pNodeData; // Array of NodeData for each column
};
typedef struct tag_TreeListNode TreeListNode;
///////////////////////////////////////////////////////////////
// a column (header) struct
typedef struct tag_TreeListColumnInfo
{
char ColumnName[TREELIST_MAX_STRING+1];
int Width;
};
typedef struct tag_TreeListColumnInfo TreeListColumnInfo;
///////////////////////////////////////////////////////////////
// It's more convenient then RECT
static struct tag_TreeListDimensions
{
int X;
int Y;
int Width;
int Hight;
};
typedef struct tag_TreeListDimensions TreeListDimensions;
///////////////////////////////////////////////////////////////
// The is the session, the internal data for a control instance
static struct tag_TreeListSession
{
HINSTANCE InstanceParent;
HWND HwndParent;
HWND HwndTreeView;
HWND HwndHeader;
HWND HwndEditBox;
HFONT FontHandleTreeList;
HFONT FontHandleHeader;
HFONT FontHandleEdit;
LOGFONT FontInfoTreeList;
LOGFONT FontInfoHeader;
LOGFONT FontInfoEdit;
PAINTSTRUCT PaintStruct;
WNDPROC ProcEdit;
WNDPROC ProcTreeList;
WNDPROC ProcParent;
HDITEM HeaderItem;
HTREEITEM EditedTreeItem;
RECT RectParent;
RECT RectTree;
RECT RectHeader;
RECT RectRequested;
RECT RectBorder;
RECT RectClientOnParent;
HDC DCListView;
HDC DCHeader;
TVINSERTSTRUCT TreeStruct;
TreeListDimensions SizeTree;
TreeListDimensions SizeHeader;
TreeListDimensions SizeParent;
TreeListDimensions SizeRequested;
TreeListDimensions SizeEdit;
BOOL ColumnsLocked;
BOOL ColumnDoAutoAdjust;
BOOL WaitingForCaller;
BOOL UseFullSize;
BOOL UseAnchors;
BOOL GotAnchors;
BOOL ParentResizing;
BOOL ItemWasSelected;
DWORD EditBoxStyleNormal;
DWORD CreateFlags;
POINT PointAnchors;
int ColumnsCount;
int ColumnsTotalWidth;
int ColumnsFirstWidth;
int EditedColumn;
int AllocatedTreeBytes;
char EditBoxBuffer[TREELIST_MAX_STRING+1];
char EditBoxOverrideBuffer[TREELIST_MAX_STRING+1];
TreeListColumnInfo **pColumnsInfo;
TreeListNode *pRootNode;
TREELIST_CB *pCBValidateEdit;
};
typedef struct tag_TreeListSession TreeListSession;
///////////////////////////////////////////////////////////////
// Dictionary pointer that will hold the ref count and HWND for each instance of the control
// a pointer to the dictionary will be attached to the parent window of the control.
// This array will be updated with each instance and destroyed when the last control will be terminated.
static struct tag_TreeListDict
{
int ReferenceCount;
HWND HwndParent [TREELIST_MAX_INSTANCES];
HWND HwndInstances [TREELIST_MAX_INSTANCES][TREELIST_ELEMENTS_PER_INSTANCE];
TreeListSession *pSessionPtr [TREELIST_MAX_INSTANCES];
};
typedef struct tag_TreeListDict TreeListDict;
/////////////////////////////////////////////////////////////////
// Visual Studeo 2010 Can't find RemoveProc so..
static HINSTANCE hDllHandle; // Handle to DLL
#if _MSC_VER > 1200
static LPREMOVEPROP pRemoveProp = 0; // Function pointer
#else
static LPREMOVEPROP pRemoveProp = RemoveProp;
#endif
///////////////////////////////////////////////////////////////////////////////////////
//
//
// CRC32 Static tables
//
//
///////////////////////////////////////////////////////////////////////////////////////
static const unsigned long TreeListCRC32Table[] =
{
0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,
0x9E6495A3,0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,
0xE7B82D07,0x90BF1D91,0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,
0x6DDDE4EB,0xF4D4B551,0x83D385C7,0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,
0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5,0x3B6E20C8,0x4C69105E,0xD56041E4,
0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B,0x35B5A8FA,0x42B2986C,
0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59,0x26D930AC,
0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F,
0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB,
0xB6662D3D,0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,
0x9FBFE4A5,0xE8B8D433,0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,
0x086D3D2D,0x91646C97,0xE6635C01,0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E,
0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457,
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
TreeList_ListView.zip (8个子文件)
Container.h 421B
TreeList.c 86KB
Container.c 12KB
TreeList.h 6KB
TreeList.dsw 539B
TreeList.dsp 4KB
TreeList.rc 3KB
resource.h 457B
共 8 条
- 1
资源评论
- zqzmm2012-11-13C++语言的呀
- sdjnbw2013-12-15基本和我的不符合,我想要c#,不过也谢谢啦
- liuluying912012-12-05本来是想要VB的 不过也挺好的 辛苦辛苦~
sargewhy
- 粉丝: 3
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功