]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/Utils/win32/StringEdit.cpp
Initial revision
[karo-tx-redboot.git] / tools / src / tools / Utils / win32 / StringEdit.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 // StringEdit.cpp : implementation file
26 //
27 //
28 //===========================================================================
29 //#####DESCRIPTIONBEGIN####
30 //
31 // Author(s):   sdf
32 // Contact(s):  sdf
33 // Date:                1998/08/11
34 // Version:             0.01
35 // Purpose:     
36 // Description: This is the implementation of the masked edit control as used 
37 //                              in integer in-cell edits by the control view.
38 // Requires:    
39 // Provides:    
40 // See also:    
41 // Known bugs:  
42 // Usage:       
43 //
44 //####DESCRIPTIONEND####
45 //
46 //===========================================================================
47
48 #include "stdafx.h"
49 #include "StringEdit.h"
50 #include "MultiLineEditDialog.h"
51
52 #ifdef _DEBUG
53 #define new DEBUG_NEW
54 #undef THIS_FILE
55 static char THIS_FILE[] = __FILE__;
56 #endif
57
58 /////////////////////////////////////////////////////////////////////////////
59 // CStringEdit
60
61 CStringEdit::CStringEdit(LPCTSTR pszInitialValue):
62   CCellEdit(pszInitialValue),
63   m_bDoubleClickEdit(false)
64   //,CI(_T("Double-click to edit in a dialog"))
65 {
66 }
67
68 CStringEdit::~CStringEdit()
69 {
70 }
71
72
73 BEGIN_MESSAGE_MAP(CStringEdit, CCellEdit)
74         //{{AFX_MSG_MAP(CStringEdit)
75         ON_WM_LBUTTONDBLCLK()
76         ON_WM_CREATE()
77         //}}AFX_MSG_MAP
78 END_MESSAGE_MAP()
79
80 /////////////////////////////////////////////////////////////////////////////
81 // CStringEdit message handlers
82
83 void CStringEdit::OnLButtonDblClk(UINT nFlags, CPoint point) 
84 {
85   if(m_bDoubleClickEdit){
86     UNUSED_ALWAYS(nFlags);
87     UNUSED_ALWAYS(point);
88     CMultiLineEditDialog dlg(NULL,m_idEdit);
89     GetWindowText(dlg.m_strText);
90     // Change /n to /r/n endings
91     dlg.m_strText.Replace(_T("\n"),_T("\r\n"));
92     //CI.Reset();
93     if(IDOK==dlg.DoModal()){
94       // Change /r/n to /n endings
95       dlg.m_strText.Replace(_T("\r\n"),_T("\n"));
96       SendMessage(WM_SETTEXT,0,(LPARAM)(LPCTSTR)dlg.m_strText);                 
97     }
98     //CI.Set(_T("Double-click to edit in a dialog"));
99     SetFocus();
100   } else {
101     Default();
102   }
103 }
104
105 int CStringEdit::OnCreate(LPCREATESTRUCT lpCreateStruct) 
106 {
107         if (CCellEdit::OnCreate(lpCreateStruct) == -1)
108                 return -1;
109         
110         // TODO: Add your specialized creation code here
111         
112         return 0;
113 }
114