1 #if !defined(AFX_PROPTREEITEMEDIT_H__642536B1_1162_4F99_B09D_9B1BD2CF88B6__INCLUDED_)
2 #define AFX_PROPTREEITEMEDIT_H__642536B1_1162_4F99_B09D_9B1BD2CF88B6__INCLUDED_
3 
4 #if _MSC_VER > 1000
5 #pragma once
6 #endif // _MSC_VER > 1000
7 // PropTreeItemEdit.h : header file
8 //
9 //  Copyright (C) 1998-2001 Scott Ramsay
10 //	sramsay@gonavi.com
11 //	http://www.gonavi.com
12 //
13 //  This material is provided "as is", with absolutely no warranty expressed
14 //  or implied. Any use is at your own risk.
15 //
16 //  Permission to use or copy this software for any purpose is hereby granted
17 //  without fee, provided the above notices are retained on all copies.
18 //  Permission to modify the code and to distribute modified code is granted,
19 //  provided the above notices are retained, and a notice that the code was
20 //  modified is included with the above copyright notice.
21 //
22 //	If you use this code, drop me an email.  I'd like to know if you find the code
23 //	useful.
24 
25 #include "PropTreeItem.h"
26 
27 /////////////////////////////////////////////////////////////////////////////
28 // CPropTreeItemEdit window
29 
30 class PROPTREE_API CPropTreeItemEdit : public CEdit, public CPropTreeItem
31 {
32 // Construction
33 public:
34 	CPropTreeItemEdit();
35 	virtual ~CPropTreeItemEdit();
36 
37 // Attributes
38 public:
39 	// The attribute area needs drawing
40 	virtual void DrawAttribute(CDC* pDC, const RECT& rc);
41 
42 	// Retrieve the item's attribute value
43 	virtual LPARAM GetItemValue();
44 
45 	// Set the item's attribute value
46 	virtual void SetItemValue(LPARAM lParam);
47 
48 	// Called when attribute area has changed size
49 	virtual void OnMove();
50 
51 	// Called when the item needs to refresh its data
52 	virtual void OnRefresh();
53 
54 	// Called when the item needs to commit its changes
55 	virtual void OnCommit();
56 
57 	// Called to activate the item
58 	virtual void OnActivate(int activateType, CPoint point);
59 
60 
61 	enum ValueFormat
62 	{
63 		ValueFormatText,
64 		ValueFormatNumber,
65 		ValueFormatFloatPointer
66 	};
67 
68 	// Set to specifify format of SetItemValue/GetItemValue
69 	void SetValueFormat(ValueFormat nFormat);
70 
71 	// Set to TRUE for to use a password edit control
72 	void SetAsPassword(BOOL bPassword);
73 
74 protected:
75 	CString		m_sEdit;
76 	float		m_fValue;
77 
78 	ValueFormat m_nFormat;
79 	BOOL		m_bPassword;
80 
81 // Operations
82 public:
83 
84 // Overrides
85 	// ClassWizard generated virtual function overrides
86 	//{{AFX_VIRTUAL(CPropTreeItemEdit)
87 	//}}AFX_VIRTUAL
88 
89 // Implementation
90 public:
91 
92 	// Generated message map functions
93 protected:
94 	//{{AFX_MSG(CPropTreeItemEdit)
95 	afx_msg UINT OnGetDlgCode();
96 	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
97 	afx_msg void OnKillfocus();
98 	//}}AFX_MSG
99 
100 	DECLARE_MESSAGE_MAP()
101 };
102 
103 /////////////////////////////////////////////////////////////////////////////
104 
105 //{{AFX_INSERT_LOCATION}}
106 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
107 
108 #endif // !defined(AFX_PROPTREEITEMEDIT_H__642536B1_1162_4F99_B09D_9B1BD2CF88B6__INCLUDED_)
109