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