:streambuf()
#endif
{
- fileName = "";
+ m_fileName = "";
m_isRich = FALSE;
}
const wxValidator& validator,
const wxString& name)
{
- fileName = "";
+ m_fileName = "";
SetName(name);
SetValidator(validator);
if (parent) parent->AddChild(this);
HWND edit = CreateWindowEx(exStyle, windowClass, NULL,
msStyle,
0, 0, 0, 0, (HWND) ((wxWindow*)parent)->GetHWND(), (HMENU)m_windowId,
- m_globalHandle ? (HANDLE) m_globalHandle : wxGetInstance(), NULL);
+ m_globalHandle ? (HINSTANCE) m_globalHandle : wxGetInstance(), NULL);
#if CTL3D
if ( want3D )
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
int cx; // button font dimensions
int cy;
SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0);
// Now replace with 'value', by pasting.
- wxSetClipboardData(wxCF_TEXT, (wxObject *) (const char *)value, 0, 0);
+ wxSetClipboardData(wxDF_TEXT, (wxObject *) (const char *)value, 0, 0);
// Paste into edit control
SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L);
if (!FileExists(WXSTRINGCAST file))
return FALSE;
- fileName = file;
+ m_fileName = file;
Clear();
// Returns TRUE if succeeds.
bool wxTextCtrl::SaveFile(const wxString& file)
{
- wxString theFile;
- if (file == "")
- theFile = fileName;
- if (file == "")
+ wxString theFile(file);
+ if (theFile == "")
+ theFile = m_fileName;
+ if (theFile == "")
return FALSE;
- fileName = theFile;
+ m_fileName = theFile;
- ofstream output(WXSTRINGCAST file);
+ ofstream output((char*) (const char*) theFile);
if (output.bad())
return FALSE;
wxTextCtrl& wxTextCtrl::operator<<(float f)
{
- static char buf[100];
- sprintf(buf, "%.2f", f);
- WriteText(buf);
- return *this;
+ wxString str;
+ str.Printf("%.2f", f);
+ WriteText(str);
+ return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(double d)
{
- static char buf[100];
- sprintf(buf, "%.2f", d);
- WriteText(buf);
- return *this;
+ wxString str;
+ str.Printf("%.2f", d);
+ WriteText(str);
+ return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(int i)
{
- static char buf[100];
- sprintf(buf, "%i", i);
- WriteText(buf);
- return *this;
+ wxString str;
+ str.Printf("%d", i);
+ WriteText(str);
+ return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(long i)
{
- static char buf[100];
- sprintf(buf, "%ld", i);
- WriteText(buf);
- return *this;
+ wxString str;
+ str.Printf("%ld", i);
+ WriteText(str);
+ return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(const char c)
{
- char buf[2];
+ char buf[2];
- buf[0] = c;
- buf[1] = 0;
- WriteText(buf);
- return *this;
+ buf[0] = c;
+ buf[1] = 0;
+ WriteText(buf);
+ return *this;
}
-
WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
event.SetEventObject( this );
- if ( !GetEventHandler()->ProcessEvent(event) )
- event.Skip();
+ if ( GetEventHandler()->ProcessEvent(event) )
+ return;
}
- else
- event.Skip();
+ else if ( event.KeyCode() == WXK_TAB ) {
+ wxNavigationKeyEvent event;
+ event.SetDirection(!(::GetKeyState(VK_SHIFT) & 0x100));
+ event.SetWindowChange(FALSE);
+ event.SetEventObject(this);
+
+ if ( GetEventHandler()->ProcessEvent(event) )
+ return;
+ }
+
+ event.Skip();
}
-long wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+long wxTextCtrl::MSWGetDlgCode()
{
-/*
- switch (nMsg)
- {
- case WM_GETDLGCODE:
- {
- if (GetWindowStyleFlag() & wxPROCESS_ENTER)
- return DLGC_WANTALLKEYS;
- break;
- }
- case WM_CHAR: // Always an ASCII character
- {
- if (wParam == VK_RETURN)
- {
- wxCommandEvent event(wxEVENT_TYPE_TEXT_ENTER_COMMAND);
- event.commandString = ((wxTextCtrl *)item)->GetValue();
- event.eventObject = item;
- item->ProcessCommand(event);
- return FALSE;
- }
- break;
- }
- default:
- break;
- }
-*/
+ long lRc = DLGC_WANTCHARS | DLGC_WANTARROWS;
+ if ( m_windowStyle & wxPROCESS_ENTER )
+ lRc |= DLGC_WANTMESSAGE;
+ else if ( m_windowStyle & wxTE_MULTILINE )
+ lRc |= DLGC_WANTMESSAGE;
- return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
+ return lRc;
}
void wxTextCtrl::OnEraseBackground(wxEraseEvent& event)
break;
}
*/
- wxEventType eventTyp = wxEVT_NULL;
switch (param)
{
case EN_SETFOCUS:
- eventTyp = wxEVENT_TYPE_SET_FOCUS;
- break;
case EN_KILLFOCUS:
- eventTyp = wxEVENT_TYPE_KILL_FOCUS;
+ {
+ wxFocusEvent event(param == EN_KILLFOCUS ? wxEVT_KILL_FOCUS
+ : wxEVT_SET_FOCUS,
+ m_windowId);
+ event.SetEventObject( this );
+ ProcessEvent(event);
+ }
break;
- case EN_UPDATE:
- break;
+
case EN_CHANGE:
- eventTyp = wxEVENT_TYPE_TEXT_COMMAND;
+ {
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
+ wxString val(GetValue());
+ if ( !val.IsNull() )
+ event.m_commandString = WXSTRINGCAST val;
+ event.SetEventObject( this );
+ ProcessCommand(event);
+ }
break;
+
+ // the other notification messages are not processed
+ case EN_UPDATE:
case EN_ERRSPACE:
- break;
case EN_MAXTEXT:
- break;
case EN_HSCROLL:
- break;
case EN_VSCROLL:
- break;
default:
- break;
+ return FALSE;
}
- if (eventTyp != 0)
- {
- wxCommandEvent event(eventTyp, m_windowId);
- wxString val(GetValue());
- if ( !val.IsNull() )
- event.m_commandString = WXSTRINGCAST val;
- event.SetEventObject( this );
- ProcessCommand(event);
- return TRUE;
- }
- else
- return FALSE;
+ // processed
+ return TRUE;
}