projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated instructions for XML Tools.
[wxWidgets.git]
/
src
/
os2
/
textctrl.cpp
diff --git
a/src/os2/textctrl.cpp
b/src/os2/textctrl.cpp
index c98efebc7d1d1e161d7217d40fd49aefe6917c8c..3be381a95f154c62551524b43d0bb9327f2a8698 100644
(file)
--- a/
src/os2/textctrl.cpp
+++ b/
src/os2/textctrl.cpp
@@
-55,9
+55,7
@@
// event tables and other macros
// ----------------------------------------------------------------------------
// event tables and other macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
-
-BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
+BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
@@
-125,6
+123,7
@@
bool wxTextCtrl::Create(
m_windowStyle = lStyle;
m_bIsMLE = false;
m_windowStyle = lStyle;
m_bIsMLE = false;
+ m_bSkipUpdate = false;
long lSstyle = WS_VISIBLE | WS_TABSTOP;
long lSstyle = WS_VISIBLE | WS_TABSTOP;
@@
-159,7
+158,7
@@
bool wxTextCtrl::Create(
{
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_MLE // Window class
{
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_MLE // Window class
- ,
(PSZ)
rsValue.c_str() // Initial Text
+ ,rsValue.c_str() // Initial Text
,(ULONG)lSstyle // Style flags
,(LONG)0 // X pos of origin
,(LONG)0 // Y pos of origin
,(ULONG)lSstyle // Style flags
,(LONG)0 // X pos of origin
,(LONG)0 // Y pos of origin
@@
-176,7
+175,7
@@
bool wxTextCtrl::Create(
{
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_ENTRYFIELD // Window class
{
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_ENTRYFIELD // Window class
- ,
(PSZ)
rsValue.c_str() // Initial Text
+ ,rsValue.c_str() // Initial Text
,(ULONG)lSstyle // Style flags
,(LONG)0 // X pos of origin
,(LONG)0 // Y pos of origin
,(ULONG)lSstyle // Style flags
,(LONG)0 // X pos of origin
,(LONG)0 // Y pos of origin
@@
-328,7
+327,8
@@
void wxTextCtrl::SetupColours()
wxString wxTextCtrl::GetValue() const
{
wxString sStr = wxGetWindowText(GetHWND());
wxString wxTextCtrl::GetValue() const
{
wxString sStr = wxGetWindowText(GetHWND());
- char* zStr = (char*)sStr.c_str();
+ wxCharBuffer buf(sStr.char_str());
+ char* zStr = buf.data();
for ( ; *zStr; zStr++ )
{
for ( ; *zStr; zStr++ )
{
@@
-340,11
+340,12
@@
wxString wxTextCtrl::GetValue() const
if (*zStr == '\r')
*zStr = '\n';
}
if (*zStr == '\r')
*zStr = '\n';
}
- return
s
Str;
+ return
z
Str;
} // end of wxTextCtrl::GetValue
} // end of wxTextCtrl::GetValue
-void wxTextCtrl::SetValue(
- const wxString& rsValue
+void wxTextCtrl::DoSetValue(
+ const wxString& rsValue,
+ int flags
)
{
//
)
{
//
@@
-355,7
+356,10
@@
void wxTextCtrl::SetValue(
//
if ((rsValue.length() > 0x400) || (rsValue != GetValue()))
{
//
if ((rsValue.length() > 0x400) || (rsValue != GetValue()))
{
- ::WinSetWindowText(GetHwnd(), (PSZ)rsValue.c_str());
+ if ( flags & SetValue_SendEvent )
+ m_bSkipUpdate = true;
+
+ ::WinSetWindowText(GetHwnd(), rsValue.c_str());
AdjustSpaceLimit();
}
} // end of wxTextCtrl::SetValue
AdjustSpaceLimit();
}
} // end of wxTextCtrl::SetValue
@@
-365,9
+369,9
@@
void wxTextCtrl::WriteText(
)
{
if (m_bIsMLE)
)
{
if (m_bIsMLE)
- ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM(
(PCHAR)rsValue.c
_str()), MPARAM(0));
+ ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM(
rsValue.wx
_str()), MPARAM(0));
else
else
- ::WinSetWindowText(GetHwnd(),
(PSZ)
rsValue.c_str());
+ ::WinSetWindowText(GetHwnd(), rsValue.c_str());
AdjustSpaceLimit();
} // end of wxTextCtrl::WriteText
AdjustSpaceLimit();
} // end of wxTextCtrl::WriteText
@@
-679,11
+683,12
@@
void wxTextCtrl::SetSelection(
::WinSendMsg(hWnd, EM_SETSEL, MPFROM2SHORT((USHORT)lFromChar, (USHORT)lToChar), (MPARAM)0);
} // end of wxTextCtrl::SetSelection
::WinSendMsg(hWnd, EM_SETSEL, MPFROM2SHORT((USHORT)lFromChar, (USHORT)lToChar), (MPARAM)0);
} // end of wxTextCtrl::SetSelection
-bool wxTextCtrl::LoadFile(
- const wxString& rsFile
+bool wxTextCtrl::DoLoadFile(
+ const wxString& rsFile,
+ int fileType
)
{
)
{
- if ( wxTextCtrlBase::
LoadFile(rsFil
e) )
+ if ( wxTextCtrlBase::
DoLoadFile(rsFile, fileTyp
e) )
{
//
// Update the size limit if needed
{
//
// Update the size limit if needed
@@
-692,7
+697,7
@@
bool wxTextCtrl::LoadFile(
return true;
}
return false;
return true;
}
return false;
-} // end of wxTextCtrl::LoadFile
+} // end of wxTextCtrl::
Do
LoadFile
bool wxTextCtrl::IsModified() const
{
bool wxTextCtrl::IsModified() const
{
@@
-711,7
+716,7
@@
void wxTextCtrl::MarkDirty()
::WinSendMsg(GetHwnd(), MLM_SETCHANGED, MPFROMLONG(TRUE), 0);
else
// EM controls do not have a SETCHANGED, what can we do??
::WinSendMsg(GetHwnd(), MLM_SETCHANGED, MPFROMLONG(TRUE), 0);
else
// EM controls do not have a SETCHANGED, what can we do??
- wxFAIL_MSG(
_
T("not implemented") );
+ wxFAIL_MSG(
wx
T("not implemented") );
}
//
}
//
@@
-1042,7
+1047,7
@@
void wxTextCtrl::OnChar(
wxCommandEvent vEvent(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
vEvent.SetEventObject(this);
wxCommandEvent vEvent(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
vEvent.SetEventObject(this);
- if (
GetEventHandler()->Process
Event(vEvent))
+ if (
HandleWindow
Event(vEvent))
return;
}
//else: multiline controls need Enter for themselves
return;
}
//else: multiline controls need Enter for themselves
@@
-1064,7
+1069,7
@@
void wxTextCtrl::OnChar(
vEventNav.SetWindowChange(false);
vEventNav.SetEventObject(this);
vEventNav.SetWindowChange(false);
vEventNav.SetEventObject(this);
- if (
GetEventHandler()->Process
Event(vEventNav) )
+ if (
HandleWindow
Event(vEventNav) )
return;
}
break;
return;
}
break;
@@
-1088,12
+1093,18
@@
bool wxTextCtrl::OS2Command(
);
vEvent.SetEventObject(this);
);
vEvent.SetEventObject(this);
-
GetEventHandler()->Process
Event(vEvent);
+
HandleWindow
Event(vEvent);
}
break;
case EN_CHANGE:
{
}
break;
case EN_CHANGE:
{
+ if (m_bSkipUpdate)
+ {
+ m_bSkipUpdate = false;
+ break;
+ }
+
wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED
,m_windowId
);
wxCommandEvent vEvent( wxEVT_COMMAND_TEXT_UPDATED
,m_windowId
);
@@
-1158,11
+1169,17
@@
void wxTextCtrl::AdjustSpaceLimit()
}
if (uLen >= uLimit)
{
}
if (uLen >= uLimit)
{
- uLimit = uLen + 0x8000; // 32Kb
- if (uLimit > 0xffff)
+ if (m_bIsMLE)
{
{
- uLimit = 0L;
+ uLimit = uLen + 0x8000; // 32Kb
+ if (uLimit > 0xffff)
+ {
+ uLimit = 0L;
+ }
}
}
+ else
+ uLimit = 0x7fff;
+
if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETTEXTLIMIT, MPFROMLONG(uLimit), 0);
else
if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETTEXTLIMIT, MPFROMLONG(uLimit), 0);
else