/////////////////////////////////////////////////////////////////////////////
-// Name: textctrl.cpp
+// Name: msw/textctrl.cpp
// Purpose: wxTextCtrl
// Author: Julian Smart
// Modified by:
if (m_windowStyle & wxTE_PASSWORD) // hidden input
msStyle |= ES_PASSWORD;
+ if (m_windowStyle & wxTE_AUTO_SCROLL)
+ msStyle |= ES_AUTOHSCROLL;
+
+
// we always want the characters and the arrows
m_lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
if ( (value.length() > 0x400) || (value != GetValue()) )
{
wxString valueDos = wxTextFile::Translate(value, wxTextFileType_Dos);
-
+
SetWindowText(GetHwnd(), valueDos.c_str());
AdjustSpaceLimit();
SendMessage(hWnd, EM_SETSEL, 0, MAKELPARAM(pos, pos));
#endif // Win32/16
- static const char *nothing = "";
+ static const wxChar *nothing = _T("");
SendMessage(hWnd, EM_REPLACESEL, 0, (LPARAM)nothing);
}
wxString wxTextCtrl::GetLineText(long lineNo) const
{
+ // TODO this should probably be optimized by using GetWriteBuf()
+
size_t len = (size_t)GetLineLength(lineNo) + 1;
+ if ( len < sizeof(WORD) )
+ {
+ // there must be at least enough place for the length WORD in the
+ // buffer
+ len += sizeof(WORD);
+ }
+
char *buf = (char *)malloc(len);
*(WORD *)buf = len;
int noChars = (int)SendMessage(GetHwnd(), EM_GETLINE, lineNo, (LPARAM)buf);
// implemenation details
// ----------------------------------------------------------------------------
-/*
void wxTextCtrl::Command(wxCommandEvent & event)
{
SetValue(event.GetString());
ProcessCommand (event);
}
-*/
void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
{
if ( !(m_windowStyle & wxTE_MULTILINE) )
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
- event.SetEventObject( this );
+ InitCommandEvent(event);
if ( GetEventHandler()->ProcessEvent(event) )
return;
}
case EN_CHANGE:
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
- event.SetEventObject( this );
- event.SetString( GetValue() );
- ProcessCommand( event );
+ InitCommandEvent(event);
+ event.SetString(GetValue());
+ ProcessCommand(event);
}
break;
// standard handlers for standard edit menu events
// ----------------------------------------------------------------------------
-void wxTextCtrl::OnCut(wxCommandEvent& event)
+void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event))
{
Cut();
}
-void wxTextCtrl::OnCopy(wxCommandEvent& event)
+void wxTextCtrl::OnCopy(wxCommandEvent& WXUNUSED(event))
{
Copy();
}
-void wxTextCtrl::OnPaste(wxCommandEvent& event)
+void wxTextCtrl::OnPaste(wxCommandEvent& WXUNUSED(event))
{
Paste();
}
-void wxTextCtrl::OnUndo(wxCommandEvent& event)
+void wxTextCtrl::OnUndo(wxCommandEvent& WXUNUSED(event))
{
Undo();
}
-void wxTextCtrl::OnRedo(wxCommandEvent& event)
+void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event))
{
Redo();
}