]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/common/win32/cellview.h
Initial revision
[karo-tx-redboot.git] / tools / src / tools / configtool / common / win32 / cellview.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 a the cell window view class
34 // Requires:    
35 // Provides:    
36 // See also:    
37 // Known bugs:  
38 // Usage:       
39 //
40 //####DESCRIPTIONEND####
41 //
42 //===========================================================================
43 #if !defined(AFX_CELLVIEW_H__71506369_375A_11D2_80C1_00A0C949ADAC__INCLUDED_)
44 #define AFX_CELLVIEW_H__71506369_375A_11D2_80C1_00A0C949ADAC__INCLUDED_
45
46 #if _MSC_VER >= 1000
47 #pragma once
48 #endif // _MSC_VER >= 1000
49 // CellView.h : header file
50 //
51
52 /////////////////////////////////////////////////////////////////////////////
53 // CCellView view
54 class CConfigItem;
55 class CCell;
56 #include "ControlView.h"
57 #include "ConfigTool.h"
58
59 class CCellView : public CView
60 {
61 protected:
62         // Convert an HTREEITEM to a CConfigItem:
63         CConfigItem &TI (HTREEITEM h) const { 
64         return *(CConfigItem *)(CConfigTool::GetControlView()->GetItemData(h));
65     }
66
67         CCellView();           // protected constructor used by dynamic creation
68         DECLARE_DYNCREATE(CCellView)
69
70         // Create a control for in-cell editing:
71         BOOL InCell(HTREEITEM h);
72
73         // Get the value from the cell control
74         ItemIntegerType GetCellValue() const;
75
76         // retrieve the bounding rectangle for hItem
77         void GetItemRect(HTREEITEM hItem,CRect & rect) const;
78         
79         // bounding rectangle for cells (this is a little smaller than the item rectangle
80         // in the case of editboxes).  bDropped tells us what we want to know about comboboxes
81         void GetInCellRect(HTREEITEM h, CRect & rect,BOOL bDropped=TRUE) const;
82         
83         int m_nFirstVisibleItem;
84
85     CPen m_GrayPen;
86
87 // Attributes
88 public:
89
90         // return the handle of the item with an in-cell edit control, or NULL if none
91         HTREEITEM ActiveCell() const { return m_hInCell; }
92
93 // Operations
94 public:
95
96         // Scroll to match our buddy
97         void Sync();
98
99         // Destroy any in-cell editing
100         void CancelCellEdit(bool bApplyChanges=true);
101
102 // Overrides
103         // ClassWizard generated virtual function overrides
104         //{{AFX_VIRTUAL(CCellView)
105         public:
106         virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
107         virtual BOOL PreTranslateMessage(MSG* pMsg);
108         protected:
109         virtual void OnDraw(CDC* pDC);      // overridden to draw this view
110         virtual void OnInitialUpdate();     // first time after construct
111         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
112         //}}AFX_VIRTUAL
113
114 // Implementation
115 protected:
116         CString m_strInitialCell;
117         HTREEITEM HitTest();
118         bool m_bComboSellPending;
119         CCell * m_pwndCell;   // Window for the in-cell editing
120         HTREEITEM m_hInCell; // hItem being in-cell edited
121         virtual ~CCellView();
122 #ifdef _DEBUG
123         virtual void AssertValid() const;
124         virtual void Dump(CDumpContext& dc) const;
125 #endif
126
127         // Generated message map functions
128         //{{AFX_MSG(CCellView)
129         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
130         afx_msg void OnSize(UINT nType, int cx, int cy);
131         afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
132         afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
133         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
134         afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
135     afx_msg void OnEditFind(); 
136     afx_msg void OnEditFindAgain(); 
137         afx_msg void OnUpdateEditFindAgain(CCmdUI* pCmdUI);
138         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
139         afx_msg void OnUpdateEditFind(CCmdUI* pCmdUI);
140         afx_msg BOOL OnEraseBkgnd(CDC* pDC);
141         afx_msg void OnEditCopy();
142         afx_msg void OnEditCut();
143         afx_msg void OnEditPaste();
144         afx_msg void OnEditDelete();
145         afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
146         afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
147         afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
148         afx_msg void OnUpdateEditDelete(CCmdUI* pCmdUI);
149         afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
150   afx_msg LRESULT OnCancelEdit(WPARAM wParam, LPARAM);
151         //}}AFX_MSG
152         DECLARE_MESSAGE_MAP()
153 };
154
155 /////////////////////////////////////////////////////////////////////////////
156
157 //{{AFX_INSERT_LOCATION}}
158 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
159
160 #endif // !defined(AFX_CELLVIEW_H__71506369_375A_11D2_80C1_00A0C949ADAC__INCLUDED_)