-///////////////////////////////////////////////////////////////////////////////\r
-// Name: src/msw/textentry.cpp\r
-// Purpose: wxTextEntry implementation for wxMSW\r
-// Author: Vadim Zeitlin\r
-// Created: 2007-09-26\r
-// RCS-ID: $Id: wxhead.cpp,v 1.7 2007/01/09 16:22:45 zeitlin Exp $\r
-// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>\r
-// Licence: wxWindows licence\r
-///////////////////////////////////////////////////////////////////////////////\r
-\r
-// ============================================================================\r
-// declarations\r
-// ============================================================================\r
-\r
-// ----------------------------------------------------------------------------\r
-// headers\r
-// ----------------------------------------------------------------------------\r
-\r
-// for compilers that support precompilation, includes "wx.h".\r
-#include "wx/wxprec.h"\r
-\r
-#ifdef __BORLANDC__\r
- #pragma hdrstop\r
-#endif\r
-\r
-#ifndef WX_PRECOMP\r
-#endif // WX_PRECOMP\r
-\r
-#include "wx/textentry.h"\r
-\r
-#include "wx/msw/private.h"\r
-\r
-#define GetEditHwnd() ((HWND)(GetEditHWND()))\r
-\r
-// ============================================================================\r
-// wxTextEntry implementation\r
-// ============================================================================\r
-\r
-void wxTextEntry::WriteText(const wxString& text)\r
-{\r
- ::SendMessage(GetEditHwnd(), EM_REPLACESEL, 0, (LPARAM)text.wx_str());\r
-}\r
-\r
-wxString wxTextEntry::GetValue() const\r
-{\r
- return wxGetWindowText(GetEditHWND());\r
-}\r
-\r
-void wxTextEntry::Remove(long from, long to)\r
-{\r
- DoSetSelection(from, to, SetSel_NoScroll);\r
- WriteText(wxString());\r
-}\r
-\r
-void wxTextEntry::Copy()\r
-{\r
- ::SendMessage(GetEditHwnd(), WM_COPY, 0, 0);\r
-}\r
-\r
-void wxTextEntry::Cut()\r
-{\r
- ::SendMessage(GetEditHwnd(), WM_CUT, 0, 0);\r
-}\r
-\r
-void wxTextEntry::Paste()\r
-{\r
- ::SendMessage(GetEditHwnd(), WM_PASTE, 0, 0);\r
-}\r
-\r
-void wxTextEntry::Undo()\r
-{\r
- ::SendMessage(GetEditHwnd(), EM_UNDO, 0, 0);\r
-}\r
-\r
-void wxTextEntry::Redo()\r
-{\r
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/msw/textentry.cpp
+// Purpose: wxTextEntry implementation for wxMSW
+// Author: Vadim Zeitlin
+// Created: 2007-09-26
+// RCS-ID: $Id$
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif // WX_PRECOMP
+
+#include "wx/textentry.h"
+
+#include "wx/msw/private.h"
+
+#define GetEditHwnd() ((HWND)(GetEditHWND()))
+
+// ============================================================================
+// wxTextEntry implementation
+// ============================================================================
+
+void wxTextEntry::WriteText(const wxString& text)
+{
+ ::SendMessage(GetEditHwnd(), EM_REPLACESEL, 0, (LPARAM)text.wx_str());
+}
+
+wxString wxTextEntry::GetValue() const
+{
+ return wxGetWindowText(GetEditHWND());
+}
+
+void wxTextEntry::Remove(long from, long to)
+{
+ DoSetSelection(from, to, SetSel_NoScroll);
+ WriteText(wxString());
+}
+
+void wxTextEntry::Copy()
+{
+ ::SendMessage(GetEditHwnd(), WM_COPY, 0, 0);
+}
+
+void wxTextEntry::Cut()
+{
+ ::SendMessage(GetEditHwnd(), WM_CUT, 0, 0);
+}
+
+void wxTextEntry::Paste()
+{
+ ::SendMessage(GetEditHwnd(), WM_PASTE, 0, 0);
+}
+
+void wxTextEntry::Undo()
+{
+ ::SendMessage(GetEditHwnd(), EM_UNDO, 0, 0);
+}
+
+void wxTextEntry::Redo()
+{
// same as Undo, since Undo undoes the undo
- Undo();\r
- return;\r
-}\r
-\r
-bool wxTextEntry::CanUndo() const\r
-{\r
- return ::SendMessage(GetEditHwnd(), EM_CANUNDO, 0, 0) != 0;\r
-}\r
-\r
-bool wxTextEntry::CanRedo() const\r
-{\r
- // see comment in Redo()\r
- return CanUndo();\r
-}\r
-\r
-void wxTextEntry::SetInsertionPoint(long pos)\r
-{\r
- // be careful to call DoSetSelection() which is overridden in wxTextCtrl\r
- // and not just SetSelection() here\r
- DoSetSelection(pos, pos);\r
-}\r
-\r
-long wxTextEntry::GetInsertionPoint() const\r
-{\r
- long from;\r
- GetSelection(&from, NULL);\r
- return from;\r
-}\r
-\r
-long wxTextEntry::GetLastPosition() const\r
-{\r
- return ::SendMessage(GetEditHwnd(), EM_LINELENGTH, 0, 0);\r
-}\r
-\r
-void wxTextEntry::DoSetSelection(long from, long to, int WXUNUSED(flags))\r
-{\r
- // if from and to are both -1, it means (in wxWidgets) that all text should\r
- // be selected, translate this into Windows convention\r
- if ( (from == -1) && (to == -1) )\r
- {\r
- from = 0;\r
- }\r
-\r
- ::SendMessage(GetEditHwnd(), EM_SETSEL, from, to);\r
-}\r
-\r
-void wxTextEntry::GetSelection(long *from, long *to) const\r
-{\r
- DWORD dwStart, dwEnd;\r
- ::SendMessage(GetEditHwnd(), EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);\r
-\r
- if ( from )\r
- *from = dwStart;\r
- if ( to )\r
- *to = dwEnd;\r
-}\r
-\r
-bool wxTextEntry::IsEditable() const\r
-{\r
- return (::GetWindowLong(GetEditHwnd(), GWL_STYLE) & ES_READONLY) != 0;\r
-}\r
-\r
-void wxTextEntry::SetEditable(bool editable)\r
-{\r
- ::SendMessage(GetEditHwnd(), EM_SETREADONLY, !editable, 0);\r
-}\r
-\r
-void wxTextEntry::SetMaxLength(unsigned long len)\r
-{\r
- if ( len >= 0xffff )\r
- {\r
- // this will set it to a platform-dependent maximum (much more\r
- // than 64Kb under NT)\r
- len = 0;\r
- }\r
-\r
- ::SendMessage(GetEditHwnd(), EM_LIMITTEXT, len, 0);\r
-}\r
+ Undo();
+ return;
+}
+
+bool wxTextEntry::CanUndo() const
+{
+ return ::SendMessage(GetEditHwnd(), EM_CANUNDO, 0, 0) != 0;
+}
+
+bool wxTextEntry::CanRedo() const
+{
+ // see comment in Redo()
+ return CanUndo();
+}
+
+void wxTextEntry::SetInsertionPoint(long pos)
+{
+ // be careful to call DoSetSelection() which is overridden in wxTextCtrl
+ // and not just SetSelection() here
+ DoSetSelection(pos, pos);
+}
+
+long wxTextEntry::GetInsertionPoint() const
+{
+ long from;
+ GetSelection(&from, NULL);
+ return from;
+}
+
+long wxTextEntry::GetLastPosition() const
+{
+ return ::SendMessage(GetEditHwnd(), EM_LINELENGTH, 0, 0);
+}
+
+void wxTextEntry::DoSetSelection(long from, long to, int WXUNUSED(flags))
+{
+ // if from and to are both -1, it means (in wxWidgets) that all text should
+ // be selected, translate this into Windows convention
+ if ( (from == -1) && (to == -1) )
+ {
+ from = 0;
+ }
+
+ ::SendMessage(GetEditHwnd(), EM_SETSEL, from, to);
+}
+
+void wxTextEntry::GetSelection(long *from, long *to) const
+{
+ DWORD dwStart, dwEnd;
+ ::SendMessage(GetEditHwnd(), EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
+
+ if ( from )
+ *from = dwStart;
+ if ( to )
+ *to = dwEnd;
+}
+
+bool wxTextEntry::IsEditable() const
+{
+ return (::GetWindowLong(GetEditHwnd(), GWL_STYLE) & ES_READONLY) != 0;
+}
+
+void wxTextEntry::SetEditable(bool editable)
+{
+ ::SendMessage(GetEditHwnd(), EM_SETREADONLY, !editable, 0);
+}
+
+void wxTextEntry::SetMaxLength(unsigned long len)
+{
+ if ( len >= 0xffff )
+ {
+ // this will set it to a platform-dependent maximum (much more
+ // than 64Kb under NT)
+ len = 0;
+ }
+
+ ::SendMessage(GetEditHwnd(), EM_LIMITTEXT, len, 0);
+}