]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/Utils/win32/Cell.cpp
Initial revision
[karo-tx-redboot.git] / tools / src / tools / Utils / win32 / Cell.cpp
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 // CellEdit.cpp : implementation file
26 //
27
28 #include "stdafx.h"
29 #include "Cell.h"
30
31 #ifdef _DEBUG
32 #define new DEBUG_NEW
33 #undef THIS_FILE
34 static char THIS_FILE[] = __FILE__;
35 #endif
36
37 /////////////////////////////////////////////////////////////////////////////
38 // CCell
39
40 CCell::CCell(LPCTSTR pszInitialValue):
41   m_strInitialValue(pszInitialValue)
42 {
43 }
44
45 CCell::~CCell()
46 {
47 }
48
49
50 BEGIN_MESSAGE_MAP(CCell, CWnd)
51         //{{AFX_MSG_MAP(CCell)
52         ON_WM_CHAR()
53         //}}AFX_MSG_MAP
54 END_MESSAGE_MAP()
55
56
57 /////////////////////////////////////////////////////////////////////////////
58 // CCell message handlers
59
60 BOOL CCell::PreTranslateMessage(MSG* pMsg) 
61 {
62   if(pMsg->message==WM_KEYDOWN){
63     switch(pMsg->wParam){
64       case VK_ESCAPE:
65         GetParent()->SendMessage(WM_CANCEL_EDIT,0);
66         return TRUE;
67       case VK_RETURN:
68         GetParent()->SendMessage(WM_CANCEL_EDIT,1);
69         return TRUE;
70       default:
71         break;
72     }
73   }
74         
75         return CWnd::PreTranslateMessage(pMsg);
76 }
77
78 BOOL CCell::Create(DWORD, const RECT&, CWnd*, UINT, CCreateContext*)
79 {
80   ASSERT(false);
81   return false;
82 }
83
84 void CCell::OnChar(UINT nChar, UINT, UINT ) 
85 {
86   switch(nChar){
87     case VK_RETURN:
88       GetParent()->SendMessage(WM_CANCEL_EDIT,1);
89       break;
90     case VK_ESCAPE:
91       GetParent()->SendMessage(WM_CANCEL_EDIT,0);
92       break;
93     default:
94       // Prevent beep: do not pass message back
95       break;
96   }
97 }