1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
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)
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
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.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 // CellEdit.cpp : implementation file
31 #include "Configtool.h"
36 static char THIS_FILE[] = __FILE__;
39 /////////////////////////////////////////////////////////////////////////////
42 CCellEdit::CCellEdit(LPCTSTR pszInitialValue):
43 CCell(pszInitialValue)
47 CCellEdit::~CCellEdit()
52 BEGIN_MESSAGE_MAP(CCellEdit, CCell)
53 //{{AFX_MSG_MAP(CCellEdit)
60 /////////////////////////////////////////////////////////////////////////////
61 // CCellEdit message handlers
63 BOOL CCellEdit::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext*)
65 return CWnd::CreateEx(WS_EX_CLIENTEDGE,_T("EDIT"), NULL, dwStyle, rect, pParentWnd, nID);
68 int CCellEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
70 if (CCell::OnCreate(lpCreateStruct) == -1)
73 SendMessage(WM_SETFONT,(WPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT),0);
74 SendMessage(WM_SETTEXT,0,(LPARAM)(LPCTSTR)m_strInitialValue);
78 void CCellEdit::OnKillFocus(CWnd*)
80 CConfigTool::GetCellView()->CancelCellEdit();
83 void CCellEdit::OnEditCopy ()
85 SendMessage(WM_COPY,0,0);
88 void CCellEdit::OnEditDelete ()
90 SendMessage(WM_CLEAR,0,0);
93 void CCellEdit::OnEditPaste ()
95 SendMessage(WM_PASTE,0,0);
98 void CCellEdit::OnEditCut ()
100 SendMessage(WM_CUT,0,0);
103 void CCellEdit::OnUpdateEditCopy (CCmdUI *pCmdUI)
105 LRESULT l=SendMessage(EM_GETSEL,0,0);
106 pCmdUI->Enable(LOWORD(l)!=HIWORD(l));
109 void CCellEdit::OnUpdateEditDelete (CCmdUI *pCmdUI)
111 LRESULT l=SendMessage(EM_GETSEL,0,0);
112 pCmdUI->Enable(LOWORD(l)!=HIWORD(l));
115 void CCellEdit::OnUpdateEditPaste (CCmdUI *pCmdUI)
118 pCmdUI->Enable(NULL!=::GetClipboardData(CF_TEXT));
121 pCmdUI->Enable(false);
125 void CCellEdit::OnUpdateEditCut (CCmdUI *pCmdUI)
127 LRESULT l=SendMessage(EM_GETSEL,0,0);
128 pCmdUI->Enable(LOWORD(l)!=HIWORD(l));
132 void CCellEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
136 SendMessage(EM_SETSEL,0,-1);
139 SendMessage(WM_COPY,0,0);
142 SendMessage(WM_PASTE,0,0);
145 SendMessage(WM_CUT,0,0);
148 SendMessage(EM_UNDO,0,0);
154 CCell::OnChar(nChar, nRepCnt, nFlags);