Filling out common controls now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9737 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -80,136 +80,158 @@ wxTextCtrl::wxTextCtrl()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
bool wxTextCtrl::Create(
|
||||||
const wxString& value,
|
wxWindow* pParent
|
||||||
const wxPoint& pos,
|
, wxWindowID vId
|
||||||
const wxSize& size,
|
, const wxString& rsValue
|
||||||
long style,
|
, const wxPoint& rPos
|
||||||
|
, const wxSize& rSize
|
||||||
|
, long lStyle
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator,
|
, const wxValidator& rValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name)
|
, const wxString& rsName
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// base initialization
|
//
|
||||||
if ( !CreateBase(parent, id, pos, size, style, validator, name) )
|
// Base initialization
|
||||||
|
//
|
||||||
|
if ( !CreateBase( pParent
|
||||||
|
,vId
|
||||||
|
,rPos
|
||||||
|
,rSize
|
||||||
|
,lStyle
|
||||||
|
#if wxUSE_VALIDATORS
|
||||||
|
,rValidator
|
||||||
|
#endif
|
||||||
|
,rsName
|
||||||
|
))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Validator was set in CreateBase
|
if (pParent )
|
||||||
//SetValidator(validator);
|
pParent->AddChild(this);
|
||||||
if ( parent )
|
|
||||||
parent->AddChild(this);
|
|
||||||
|
|
||||||
// set colours
|
m_windowStyle = lStyle;
|
||||||
SetupColours();
|
|
||||||
|
|
||||||
// translate wxWin style flags to MSW ones, checking for consistency while
|
long lSstyle = WS_VISIBLE | WS_TABSTOP;
|
||||||
// doing it
|
|
||||||
// TODO:
|
//
|
||||||
/*
|
// Single and multiline edit fields are two different controls in PM
|
||||||
long msStyle = ES_LEFT | WS_VISIBLE | WS_CHILD | WS_TABSTOP;
|
//
|
||||||
if ( m_windowStyle & wxTE_MULTILINE )
|
if ( m_windowStyle & wxTE_MULTILINE )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER),
|
m_bIsMLE = TRUE;
|
||||||
wxT("wxTE_PROCESS_ENTER style is ignored for multiline "
|
|
||||||
"text controls (they always process it)") );
|
|
||||||
|
|
||||||
msStyle |= ES_MULTILINE | ES_WANTRETURN;
|
|
||||||
if ((m_windowStyle & wxTE_NO_VSCROLL) == 0)
|
|
||||||
msStyle |= WS_VSCROLL;
|
|
||||||
m_windowStyle |= wxTE_PROCESS_ENTER;
|
m_windowStyle |= wxTE_PROCESS_ENTER;
|
||||||
|
|
||||||
|
if ((m_windowStyle & wxTE_NO_VSCROLL) == 0)
|
||||||
|
lSstyle |= MLS_VSCROLL;
|
||||||
|
if (m_windowStyle & wxHSCROLL)
|
||||||
|
lSstyle |= MLS_HSCROLL;
|
||||||
|
if (m_windowStyle & wxTE_READONLY)
|
||||||
|
lSstyle |= MLS_READONLY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
msStyle |= ES_AUTOHSCROLL;
|
{
|
||||||
|
lSstyle |= ES_LEFT;
|
||||||
|
|
||||||
if (m_windowStyle & wxHSCROLL)
|
if (m_windowStyle & wxHSCROLL)
|
||||||
msStyle |= (WS_HSCROLL | ES_AUTOHSCROLL);
|
lSstyle |= ES_AUTOSCROLL;
|
||||||
|
|
||||||
if (m_windowStyle & wxTE_READONLY)
|
if (m_windowStyle & wxTE_READONLY)
|
||||||
msStyle |= ES_READONLY;
|
lSstyle |= ES_READONLY;
|
||||||
|
|
||||||
if (m_windowStyle & wxHSCROLL)
|
|
||||||
msStyle |= (WS_HSCROLL | ES_AUTOHSCROLL);
|
|
||||||
if (m_windowStyle & wxTE_PASSWORD) // hidden input
|
if (m_windowStyle & wxTE_PASSWORD) // hidden input
|
||||||
msStyle |= ES_PASSWORD;
|
lSstyle |= ES_UNREADABLE;
|
||||||
|
}
|
||||||
|
if (m_bIsMLE)
|
||||||
|
{
|
||||||
|
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
|
||||||
|
,WC_MLE // Window class
|
||||||
|
,(PSZ)rsValue.c_str() // Initial Text
|
||||||
|
,(ULONG)lSstyle // Style flags
|
||||||
|
,(LONG)rPos.x // X pos of origin
|
||||||
|
,(LONG)rPos.y // Y pos of origin
|
||||||
|
,(LONG)rSize.x // field width
|
||||||
|
,(LONG)rSize.y // field height
|
||||||
|
,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
|
||||||
|
,HWND_TOP // initial z position
|
||||||
|
,(ULONG)vId // Window identifier
|
||||||
|
,NULL // no control data
|
||||||
|
,NULL // no Presentation parameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
|
||||||
|
,WC_ENTRYFIELD // Window class
|
||||||
|
,(PSZ)rsValue.c_str() // Initial Text
|
||||||
|
,(ULONG)lSstyle // Style flags
|
||||||
|
,(LONG)rPos.x // X pos of origin
|
||||||
|
,(LONG)rPos.y // Y pos of origin
|
||||||
|
,(LONG)rSize.x // field width
|
||||||
|
,(LONG)rSize.y // field height
|
||||||
|
,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
|
||||||
|
,HWND_TOP // initial z position
|
||||||
|
,(ULONG)vId // Window identifier
|
||||||
|
,NULL // no control data
|
||||||
|
,NULL // no Presentation parameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// we always want the characters and the arrows
|
if (m_hWnd == 0)
|
||||||
m_lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// we may have several different cases:
|
|
||||||
// 1. normal case: both TAB and ENTER are used for dialog navigation
|
|
||||||
// 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
|
|
||||||
// control in the dialog
|
|
||||||
// 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
|
|
||||||
// 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
|
|
||||||
// the next control
|
|
||||||
if ( m_windowStyle & wxTE_PROCESS_ENTER )
|
|
||||||
m_lDlgCode |= DLGC_WANTMESSAGE;
|
|
||||||
if ( m_windowStyle & wxTE_PROCESS_TAB )
|
|
||||||
m_lDlgCode |= DLGC_WANTTAB;
|
|
||||||
|
|
||||||
// do create the control - either an EDIT or RICHEDIT
|
|
||||||
const wxChar *windowClass = wxT("EDIT");
|
|
||||||
|
|
||||||
bool want3D;
|
|
||||||
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
|
|
||||||
|
|
||||||
// Even with extended styles, need to combine with WS_BORDER for them to
|
|
||||||
// look right.
|
|
||||||
if ( want3D || wxStyleHasBorder(m_windowStyle) )
|
|
||||||
msStyle |= WS_BORDER;
|
|
||||||
|
|
||||||
// NB: don't use pos and size as CreateWindowEx arguments because they
|
|
||||||
// might be -1 in which case we should use the default values (and
|
|
||||||
// SetSize called below takes care of it)
|
|
||||||
m_hWnd = (WXHWND)::CreateWindowEx(exStyle,
|
|
||||||
windowClass,
|
|
||||||
NULL,
|
|
||||||
msStyle,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
GetHwndOf(parent),
|
|
||||||
(HMENU)m_windowId,
|
|
||||||
wxGetInstance(),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create text ctrl") );
|
|
||||||
*/
|
|
||||||
SubclassWin(GetHWND());
|
SubclassWin(GetHWND());
|
||||||
|
|
||||||
// set font, position, size and initial value
|
//
|
||||||
wxFont& fontParent = parent->GetFont();
|
// Set font, position, size and initial value
|
||||||
if ( fontParent.Ok() )
|
//
|
||||||
|
wxFont& vFontParent = pParent->GetFont();
|
||||||
|
|
||||||
|
if (vFontParent.Ok())
|
||||||
{
|
{
|
||||||
SetFont(fontParent);
|
SetFont(vFontParent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
|
SetFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
|
||||||
}
|
}
|
||||||
|
if (!rsValue.IsEmpty())
|
||||||
SetSize(pos.x, pos.y, size.x, size.y);
|
{
|
||||||
|
SetValue(rsValue);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
SetupColours();
|
||||||
|
SetSize( rPos.x
|
||||||
|
,rPos.y
|
||||||
|
,rSize.x
|
||||||
|
,rSize.y
|
||||||
|
);
|
||||||
|
return TRUE;
|
||||||
|
} // end of wxTextCtrl::Create
|
||||||
|
|
||||||
|
//
|
||||||
// Make sure the window style (etc.) reflects the HWND style (roughly)
|
// Make sure the window style (etc.) reflects the HWND style (roughly)
|
||||||
|
//
|
||||||
void wxTextCtrl::AdoptAttributesFromHWND()
|
void wxTextCtrl::AdoptAttributesFromHWND()
|
||||||
{
|
{
|
||||||
|
HWND hWnd = GetHwnd();
|
||||||
|
LONG lStyle = ::WinQueryWindowULong(hWnd, QWL_STYLE);
|
||||||
|
|
||||||
wxWindow::AdoptAttributesFromHWND();
|
wxWindow::AdoptAttributesFromHWND();
|
||||||
|
|
||||||
HWND hWnd = GetHwnd();
|
if (m_bIsMLE)
|
||||||
// TODO:
|
{
|
||||||
/*
|
|
||||||
long style = GetWindowLong(hWnd, GWL_STYLE);
|
|
||||||
|
|
||||||
if (style & ES_MULTILINE)
|
|
||||||
m_windowStyle |= wxTE_MULTILINE;
|
m_windowStyle |= wxTE_MULTILINE;
|
||||||
if (style & ES_PASSWORD)
|
if (lStyle & MLS_READONLY)
|
||||||
m_windowStyle |= wxTE_PASSWORD;
|
|
||||||
if (style & ES_READONLY)
|
|
||||||
m_windowStyle |= wxTE_READONLY;
|
m_windowStyle |= wxTE_READONLY;
|
||||||
if (style & ES_WANTRETURN)
|
}
|
||||||
m_windowStyle |= wxTE_PROCESS_ENTER;
|
else
|
||||||
*/
|
{
|
||||||
|
if (lStyle & ES_UNREADABLE)
|
||||||
|
m_windowStyle |= wxTE_PASSWORD;
|
||||||
|
if (lStyle & ES_READONLY)
|
||||||
|
m_windowStyle |= wxTE_READONLY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetupColours()
|
void wxTextCtrl::SetupColours()
|
||||||
@@ -275,16 +297,23 @@ void wxTextCtrl::Copy()
|
|||||||
if (CanCopy())
|
if (CanCopy())
|
||||||
{
|
{
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
// SendMessage(hWnd, WM_COPY, 0, 0L);
|
if (m_bIsMLE)
|
||||||
}
|
::WinSendMsg(hWnd, MLM_COPY, 0, 0);
|
||||||
|
else
|
||||||
|
::WinSendMsg(hWnd, EM_COPY, 0, 0);
|
||||||
}
|
}
|
||||||
|
} // end of wxTextCtrl::Copy
|
||||||
|
|
||||||
void wxTextCtrl::Cut()
|
void wxTextCtrl::Cut()
|
||||||
{
|
{
|
||||||
if (CanCut())
|
if (CanCut())
|
||||||
{
|
{
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
// SendMessage(hWnd, WM_CUT, 0, 0L);
|
|
||||||
|
if (m_bIsMLE)
|
||||||
|
::WinSendMsg(hWnd, MLM_CUT, 0, 0);
|
||||||
|
else
|
||||||
|
::WinSendMsg(hWnd, EM_CUT, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,21 +346,21 @@ bool wxTextCtrl::CanCut() const
|
|||||||
|
|
||||||
bool wxTextCtrl::CanPaste() const
|
bool wxTextCtrl::CanPaste() const
|
||||||
{
|
{
|
||||||
|
bool bIsTextAvailable = FALSE;
|
||||||
|
|
||||||
if (!IsEditable())
|
if (!IsEditable())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Standard edit control: check for straight text on clipboard
|
//
|
||||||
bool isTextAvailable = FALSE;
|
// Check for straight text on clipboard
|
||||||
//TODO:
|
//
|
||||||
/*
|
if (::WinOpenClipbrd(vHabmain))
|
||||||
if ( ::OpenClipboard(GetHwndOf(wxTheApp->GetTopWindow())) )
|
|
||||||
{
|
{
|
||||||
isTextAvailable = (::IsClipboardFormatAvailable(CF_TEXT) != 0);
|
bIsTextAvailable = (::WinQueryClipbrdData(vHabmain, CF_TEXT) != 0);
|
||||||
::CloseClipboard();
|
::WinCloseClipbrd(vHabmain);
|
||||||
}
|
|
||||||
*/
|
|
||||||
return isTextAvailable;
|
|
||||||
}
|
}
|
||||||
|
return bIsTextAvailable;
|
||||||
|
} // end of wxTextCtrl::CanPaste
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Accessors
|
// Accessors
|
||||||
@@ -359,43 +388,56 @@ void wxTextCtrl::SetInsertionPoint(long pos)
|
|||||||
|
|
||||||
void wxTextCtrl::SetInsertionPointEnd()
|
void wxTextCtrl::SetInsertionPointEnd()
|
||||||
{
|
{
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
long pos = GetLastPosition();
|
|
||||||
SetInsertionPoint(pos);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxTextCtrl::GetInsertionPoint() const
|
long wxTextCtrl::GetInsertionPoint() const
|
||||||
{
|
{
|
||||||
// TODO:
|
WXDWORD dwPos = 0L;
|
||||||
/*
|
|
||||||
DWORD Pos = (DWORD)SendMessage(GetHwnd(), EM_GETSEL, 0, 0L);
|
if (m_bIsMLE)
|
||||||
return Pos & 0xFFFF;
|
dwPos = (WXDWORD)::WinSendMsg(GetHwnd(), MLM_QUERYSEL, (MPARAM)MLFQS_MINSEL, 0);
|
||||||
*/
|
else
|
||||||
return 0;
|
{
|
||||||
|
dwPos = (WXDWORD)::WinSendMsg(GetHwnd(), EM_QUERYSEL, 0, 0);
|
||||||
|
dwPos = SHORT1FROMMP((MPARAM)dwPos); // the first 16 bit value is the min pos
|
||||||
}
|
}
|
||||||
|
return (dwPos & 0xFFFF);
|
||||||
|
} // end of wxTextCtrl::GetInsertionPoint
|
||||||
|
|
||||||
long wxTextCtrl::GetLastPosition() const
|
long wxTextCtrl::GetLastPosition() const
|
||||||
{
|
{
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
|
long lCharIndex;
|
||||||
|
long lLineLength;
|
||||||
|
|
||||||
// TODO:
|
if (m_bIsMLE)
|
||||||
/*
|
{
|
||||||
// Will always return a number > 0 (according to docs)
|
lCharIndex = 0;
|
||||||
int noLines = (int)SendMessage(hWnd, EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0L);
|
|
||||||
|
|
||||||
// This gets the char index for the _beginning_ of the last line
|
//
|
||||||
int charIndex = (int)SendMessage(hWnd, EM_LINEINDEX, (WPARAM)(noLines-1), (LPARAM)0L);
|
// This just gets the total text length. The last will be this value
|
||||||
|
//
|
||||||
// Get number of characters in the last line. We'll add this to the character
|
lLineLength = (long)::WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0);
|
||||||
// index for the last line, 1st position.
|
|
||||||
int lineLength = (int)SendMessage(hWnd, EM_LINELENGTH, (WPARAM)charIndex, (LPARAM)0L);
|
|
||||||
|
|
||||||
return (long)(charIndex + lineLength);
|
|
||||||
*/
|
|
||||||
return 0L;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WNDPARAMS vParams;
|
||||||
|
|
||||||
|
lCharIndex = 0;
|
||||||
|
vParams.fsStatus = WPM_CCHTEXT;
|
||||||
|
if (::WinSendMsg( GetHwnd()
|
||||||
|
,WM_QUERYWINDOWPARAMS
|
||||||
|
,&vParams
|
||||||
|
,0
|
||||||
|
))
|
||||||
|
{
|
||||||
|
lLineLength = (long)vParams.cchText;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lLineLength = 0;
|
||||||
|
}
|
||||||
|
return(lCharIndex + lLineLength);
|
||||||
|
} // end of wxTextCtrl::GetLastPosition
|
||||||
|
|
||||||
// If the return values from and to are the same, there is no
|
// If the return values from and to are the same, there is no
|
||||||
// selection.
|
// selection.
|
||||||
@@ -497,11 +539,19 @@ bool wxTextCtrl::IsModified() const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// Makes 'unmodified'
|
// Makes 'unmodified'
|
||||||
|
//
|
||||||
void wxTextCtrl::DiscardEdits()
|
void wxTextCtrl::DiscardEdits()
|
||||||
{
|
{
|
||||||
// SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L);
|
if (m_bIsMLE)
|
||||||
}
|
::WinSendMsg(GetHwnd(), MLM_SETCHANGED, MPFROMLONG(FALSE), 0);
|
||||||
|
else
|
||||||
|
//
|
||||||
|
// EM controls do not have a SETCHANGED but issuing a query should reset it
|
||||||
|
//
|
||||||
|
::WinSendMsg(GetHwnd(), EM_QUERYCHANGED, 0, 0);
|
||||||
|
} // end of wxTextCtrl::DiscardEdits
|
||||||
|
|
||||||
int wxTextCtrl::GetNumberOfLines() const
|
int wxTextCtrl::GetNumberOfLines() const
|
||||||
{
|
{
|
||||||
@@ -580,17 +630,32 @@ void wxTextCtrl::ShowPosition(long pos)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxTextCtrl::GetLineLength(long lineNo) const
|
int wxTextCtrl::GetLineLength(
|
||||||
|
long lLineNo
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
// TODO:
|
long lLen = 0L;
|
||||||
/*
|
|
||||||
|
|
||||||
long charIndex = XYToPosition(0, lineNo);
|
if (m_bIsMLE)
|
||||||
int len = (int)SendMessage(GetHwnd(), EM_LINELENGTH, charIndex, 0);
|
lLen = (long)::WinSendMsg(GetHwnd(), MLM_QUERYLINELENGTH, 0, 0);
|
||||||
return len;
|
else
|
||||||
*/
|
{
|
||||||
return 0;
|
WNDPARAMS vParams;
|
||||||
|
|
||||||
|
vParams.fsStatus = WPM_CCHTEXT;
|
||||||
|
if (::WinSendMsg( GetHwnd()
|
||||||
|
,WM_QUERYWINDOWPARAMS
|
||||||
|
,&vParams
|
||||||
|
,0
|
||||||
|
))
|
||||||
|
{
|
||||||
|
lLen = vParams.cchText;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
lLen = 32;
|
||||||
|
}
|
||||||
|
return lLen;
|
||||||
|
} // end of
|
||||||
|
|
||||||
wxString wxTextCtrl::GetLineText(long lineNo) const
|
wxString wxTextCtrl::GetLineText(long lineNo) const
|
||||||
{
|
{
|
||||||
@@ -630,15 +695,25 @@ void wxTextCtrl::Redo()
|
|||||||
|
|
||||||
bool wxTextCtrl::CanUndo() const
|
bool wxTextCtrl::CanUndo() const
|
||||||
{
|
{
|
||||||
// return (::SendMessage(GetHwnd(), EM_CANUNDO, 0, 0) != 0);
|
bool bOk;
|
||||||
return FALSE;
|
|
||||||
}
|
if (m_bIsMLE)
|
||||||
|
bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0);
|
||||||
|
else
|
||||||
|
bOk = FALSE; // can't undo regular edit fields in PM
|
||||||
|
return bOk;
|
||||||
|
} // end of wxTextCtrl::CanUndo
|
||||||
|
|
||||||
bool wxTextCtrl::CanRedo() const
|
bool wxTextCtrl::CanRedo() const
|
||||||
{
|
{
|
||||||
// return (::SendMessage(GetHwnd(), EM_CANUNDO, 0, 0) != 0);
|
bool bOk;
|
||||||
return FALSE;
|
|
||||||
}
|
if (m_bIsMLE)
|
||||||
|
bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0);
|
||||||
|
else
|
||||||
|
bOk = FALSE; // can't undo regular edit fields in PM
|
||||||
|
return bOk;
|
||||||
|
} // end of wxTextCtrl::CanRedo
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// implemenation details
|
// implemenation details
|
||||||
@@ -776,21 +851,51 @@ bool wxTextCtrl::OS2Command(WXUINT param, WXWORD WXUNUSED(id))
|
|||||||
|
|
||||||
void wxTextCtrl::AdjustSpaceLimit()
|
void wxTextCtrl::AdjustSpaceLimit()
|
||||||
{
|
{
|
||||||
// TODO:
|
unsigned int uLen = 0;
|
||||||
/*
|
unsigned int uLimit = 0;
|
||||||
unsigned int len = ::GetWindowTextLength(GetHwnd()),
|
|
||||||
limit = ::SendMessage(GetHwnd(), EM_GETLIMITTEXT, 0, 0);
|
|
||||||
if ( len > limit )
|
|
||||||
{
|
|
||||||
limit = len + 0x8000; // 32Kb
|
|
||||||
|
|
||||||
if ( limit > 0xffff )
|
uLen = ::WinQueryWindowTextLength(GetHwnd());
|
||||||
::SendMessage(GetHwnd(), EM_LIMITTEXT, 0, limit);
|
if (m_bIsMLE)
|
||||||
|
{
|
||||||
|
uLimit = (unsigned int)::WinSendMsg( GetHwnd()
|
||||||
|
,MLM_QUERYTEXTLIMIT
|
||||||
|
,0
|
||||||
|
,0
|
||||||
|
);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
::SendMessage(GetHwnd(), EM_LIMITTEXT, limit, 0);
|
{
|
||||||
|
ENTRYFDATA* pEfd;
|
||||||
|
WNDPARAMS vParams;
|
||||||
|
|
||||||
|
vParams.fsStatus = WPM_CBCTLDATA;
|
||||||
|
vParams.cbCtlData = sizeof(ENTRYFDATA);
|
||||||
|
|
||||||
|
if (::WinSendMsg( GetHwnd()
|
||||||
|
,WM_QUERYWINDOWPARAMS
|
||||||
|
,&vParams
|
||||||
|
,0
|
||||||
|
))
|
||||||
|
{
|
||||||
|
pEfd = (ENTRYFDATA*)vParams.pCtlData;
|
||||||
|
uLimit = (unsigned int)pEfd->cchEditLimit;
|
||||||
}
|
}
|
||||||
*/
|
else
|
||||||
|
uLimit = 32; //PM's default
|
||||||
}
|
}
|
||||||
|
if (uLen >= uLimit)
|
||||||
|
{
|
||||||
|
uLimit = uLen + 0x8000; // 32Kb
|
||||||
|
if (uLimit > 0xffff)
|
||||||
|
{
|
||||||
|
uLimit = 0L;
|
||||||
|
}
|
||||||
|
if (m_bIsMLE)
|
||||||
|
::WinSendMsg(GetHwnd(), MLM_SETTEXTLIMIT, MPFROMLONG(uLimit), 0);
|
||||||
|
else
|
||||||
|
::WinSendMsg(GetHwnd(), EM_SETTEXTLIMIT, MPFROMLONG(uLimit), 0);
|
||||||
|
}
|
||||||
|
} // end of wxTextCtrl::AdjustSpaceLimit
|
||||||
|
|
||||||
bool wxTextCtrl::AcceptsFocus() const
|
bool wxTextCtrl::AcceptsFocus() const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user