]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/common/win32/ControlView.h
Initial revision
[karo-tx-redboot.git] / tools / src / tools / configtool / common / win32 / ControlView.h
1 //####COPYRIGHTBEGIN####
2 //                                                                          
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it 
9 // under the terms of the GNU General Public License as published by the Free 
10 // Software Foundation; either version 2 of the License, or (at your option) 
11 // any later version.
12 // 
13 // This program is distributed in the hope that it will be useful, but WITHOUT 
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
15 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
16 // more details.
17 // 
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc., 
20 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //                                                                          
24 //####COPYRIGHTEND####
25 //===========================================================================
26 //#####DESCRIPTIONBEGIN####
27 //
28 // Author(s):   sdf
29 // Contact(s):  sdf
30 // Date:                1998/08/11
31 // Version:             0.01
32 // Purpose:     
33 // Description: Interface of the tree (control) view class
34 // Requires:    
35 // Provides:    
36 // See also:    
37 // Known bugs:  
38 // Usage:       
39 //
40 //####DESCRIPTIONEND####
41 //
42 //===========================================================================
43 #if !defined(AFX_CONTROLVIEW_H__A4845250_05EE_11D2_80BE_00A0C949ADAC__INCLUDED_)
44 #define AFX_CONTROLVIEW_H__A4845250_05EE_11D2_80BE_00A0C949ADAC__INCLUDED_
45
46 #if _MSC_VER >= 1000
47 #pragma once
48 #endif // _MSC_VER >= 1000
49 // ControlView.h : header file
50 //
51 /////////////////////////////////////////////////////////////////////////////
52 // CControlView view
53 class CConfigItem;
54 #include <afxcview.h>
55
56 class CCellView;
57 class CConfigToolDoc;
58 class CConfigViewOptionsDialog;
59 class CFindDialog;
60
61 class CControlView : public CTreeView
62 {
63   friend class CConfigItem;
64 protected:
65         CControlView();           // protected constructor used by dynamic creation
66         DECLARE_DYNCREATE(CControlView)
67
68 // Attributes
69 public:
70 // Attributes
71         // Let us use the View as a control:
72         #include "TreeCtrlToView.inl"   
73     friend class CCellView;
74 // Operations
75 public:
76         int GetItemHeight() const { return m_nItemHeight; }
77         CConfigItem &TI (HTREEITEM h) const {
78                 return *(CConfigItem *)GetItemData(h);
79         }
80
81         BOOL IsActive(HTREEITEM h) const;
82
83 // Overrides
84         // ClassWizard generated virtual function overrides
85         //{{AFX_VIRTUAL(CControlView)
86         public:
87         virtual void OnInitialUpdate();
88         virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
89         virtual BOOL PreTranslateMessage(MSG* pMsg);
90         protected:
91         virtual void OnDraw(CDC* pDC);      // overridden to draw this view
92         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
93         //}}AFX_VIRTUAL
94
95 // Implementation
96 protected:
97         void Refresh (HTREEITEM h);
98   CPen m_GrayPen;
99         int m_nMaxWidth;
100         BOOL m_bHasHScroll;
101         void SetHScrollPos();
102         void SetHScrollRangePos();
103         BOOL m_bHasVScroll;
104         void SetScrollRangePos();
105         void SetScrollPos();
106         void KillScrollBars();
107         virtual ~CControlView();
108 #ifdef _DEBUG
109         virtual void AssertValid() const;
110         virtual void Dump(CDumpContext& dc) const;
111 #endif
112
113         // Generated message map functions
114 protected:
115         void ShowPopupMenu (HTREEITEM h,CPoint point=CPoint(-1,-1));
116         void RecalcWorkSpaceSize();
117         int m_TreeXOffsetAdjustment;
118         int m_nWorkspace; // Height of the virtual workspace
119         int TotalDescendantHeight(HTREEITEM hItem)const; // Visible height of descendants (not including hItem itself)
120         CSize m_Size;
121         int m_nItemHeight; // Height of an item (can use GetItemHeight() in IE4)
122         bool BumpItem (HTREEITEM h,int nInc=1); // Increment the item (do what clicking on the icon achieves)
123         void AdjustItemImage (HTREEITEM h);
124 protected:
125         bool m_bFindInProgress;
126         static bool IsWordChar (TCHAR c);
127     CConfigItem *DoFind(LPCTSTR pszWhat,DWORD dwFlags,WhereType where);
128         HTREEITEM m_hExpandedForFind;
129         CConfigToolDoc * GetDocument();
130         void InvalidateItem (HTREEITEM h);
131         BOOL IsChanged (HTREEITEM h, BOOL bRecurse);
132         void RestoreDefault (HTREEITEM h, BOOL bRecurse = FALSE, BOOL bTopLevel = TRUE);
133         HTREEITEM m_hContext; // Where the right-click occurred
134         ItemIntegerType Value(HTREEITEM h) const; // Value (taking into account any in-cell activity)
135         CImageList m_il; // Image list for the control
136         //{{AFX_MSG(CControlView)
137         afx_msg void OnPaint();
138         afx_msg void OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult);
139         afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
140         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
141         afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
142         afx_msg void OnSize(UINT nType, int cx, int cy);
143         afx_msg void OnRestoreDefaults();
144         afx_msg void OnPopupProperties();
145         afx_msg void OnUnload();
146   afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
147         afx_msg void OnViewUrl();
148         afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
149         afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
150         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
151         afx_msg void OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult);
152         afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
153         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
154         afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
155         afx_msg void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags);
156         afx_msg void OnViewHeader();
157   afx_msg LONG OnFind(WPARAM wParam, LPARAM lParam);
158         afx_msg void OnEditFind();
159         afx_msg void OnEditFindAgain();
160         afx_msg void OnUpdateEditFindAgain(CCmdUI* pCmdUI);
161         afx_msg void OnUpdateEditFind(CCmdUI* pCmdUI);
162         afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
163         afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
164         afx_msg void OnWhatsThis();
165         afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
166         afx_msg LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu);
167         //}}AFX_MSG
168     afx_msg LRESULT OnSetFont(WPARAM, LPARAM lParam);
169 public:
170         void Refresh (LPCTSTR pszMacroName);
171         bool SelectItem (const CConfigItem *pItem);
172         DECLARE_MESSAGE_MAP()
173 private:
174 };
175
176 /////////////////////////////////////////////////////////////////////////////
177
178 //{{AFX_INSERT_LOCATION}}
179 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
180
181 #endif // !defined(AFX_CONTROLVIEW_H__A4845250_05EE_11D2_80BE_00A0C949ADAC__INCLUDED_)