}
m_windowStyle = lStyle;
+ m_bIsMLE = FALSE;
long lSstyle = WS_VISIBLE | WS_TABSTOP;
if (m_windowStyle & wxTE_PASSWORD) // hidden input
lSstyle |= ES_UNREADABLE;
}
- //
- // If the parent is a scrolled window the controls must
- // have this style or they will overlap the scrollbars
- //
- if (pParent)
- if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
- pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
- lSstyle |= WS_CLIPSIBLINGS;
if (m_bIsMLE)
{
//
// Set font, position, size and initial value
//
- wxFont& vFontParent = pParent->GetFont();
-
- if (vFontParent.Ok())
- {
- SetFont(vFontParent);
- }
- else
- {
- SetFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT));
- }
+ wxFont* pTextFont = new wxFont( 8
+ ,wxMODERN
+ ,wxNORMAL
+ ,wxNORMAL
+ );
+ SetFont(*pTextFont);
if (!rsValue.IsEmpty())
{
SetValue(rsValue);
::WinQueryWindowPos(m_hWnd, &vSwp);
SetXComp(vSwp.x);
SetYComp(vSwp.y);
- SetSize( vPos.x
- ,vPos.y
+ SetSize( vPos.x - GetXComp()
+ ,vPos.y - GetYComp()
,rSize.x
,rSize.y
);
+ delete pTextFont;
return TRUE;
} // end of wxTextCtrl::Create
}
} // end of wxTextCtrl::AdoptAttributesFromHWND
+WXDWORD wxTextCtrl::OS2GetStyle(
+ long lStyle
+, WXDWORD* pdwExstyle
+) const
+{
+ //
+ // Default border for the text controls is the sunken one
+ //
+ if ((lStyle & wxBORDER_MASK) == wxBORDER_DEFAULT )
+ {
+ lStyle |= wxBORDER_SUNKEN;
+ }
+
+ long dwStyle = wxControl::OS2GetStyle( lStyle
+ ,pdwExstyle
+ );
+
+ dwStyle = WS_VISIBLE | WS_TABSTOP;
+
+ //
+ // Single and multiline edit fields are two different controls in PM
+ //
+ if ( m_windowStyle & wxTE_MULTILINE )
+ {
+ dwStyle |= MLS_BORDER | MLS_WORDWRAP;
+ if ((m_windowStyle & wxTE_NO_VSCROLL) == 0)
+ dwStyle |= MLS_VSCROLL;
+ if (m_windowStyle & wxHSCROLL)
+ dwStyle |= MLS_HSCROLL;
+ if (m_windowStyle & wxTE_READONLY)
+ dwStyle |= MLS_READONLY;
+ }
+ else
+ {
+ dwStyle |= ES_LEFT | ES_AUTOSCROLL | ES_MARGIN;
+ if (m_windowStyle & wxHSCROLL)
+ dwStyle |= ES_AUTOSCROLL;
+ if (m_windowStyle & wxTE_READONLY)
+ dwStyle |= ES_READONLY;
+ if (m_windowStyle & wxTE_PASSWORD) // hidden input
+ dwStyle |= ES_UNREADABLE;
+ }
+ return dwStyle;
+} // end of wxTextCtrl::OS2GetStyle
+
+void wxTextCtrl::SetWindowStyleFlag(
+ long lStyle
+)
+{
+ wxControl::SetWindowStyleFlag(lStyle);
+} // end of wxTextCtrl::SetWindowStyleFlag
+
void wxTextCtrl::SetupColours()
{
wxColour vBkgndColour;
- vBkgndColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
+ vBkgndColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(vBkgndColour);
SetForegroundColour(GetParent()->GetForegroundColour());
if (m_bIsMLE)
if (*zStr == '\r')
*zStr = '\n';
}
- sStr = zStr;
return sStr;
} // end of wxTextCtrl::GetValue
const wxString& rsValue
)
{
- ::WinSetWindowText(GetHwnd(), rsValue.c_str());
+ if (m_bIsMLE)
+ ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM((PCHAR)rsValue.c_str()), MPARAM(0));
+ else
+ ::WinSetWindowText(GetHwnd(), rsValue.c_str());
AdjustSpaceLimit();
} // end of wxTextCtrl::WriteText
::WinSetWindowText(GetHwnd(), "");
} // end of wxTextCtrl::Clear
+bool wxTextCtrl::EmulateKeyPress(
+ const wxKeyEvent& rEvent
+)
+{
+ SetFocus();
+ return(wxTextCtrlBase::EmulateKeyPress(rEvent));
+} // end of wxTextCtrl::EmulateKeyPress
+
// ----------------------------------------------------------------------------
// Clipboard operations
// ----------------------------------------------------------------------------
else
::GpiSetBackMix(hPS, BM_OVERPAINT);
if (!IsEnabled() && (GetWindowStyle() & wxTE_MULTILINE) == 0)
- vColBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+ vColBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
::GpiSetBackColor(hPS, vColBack.GetPixel());
::GpiSetColor(hPS, vColFore.GetPixel());
return (WXHBRUSH)pBackgroundBrush->GetResourceHandle();
} // end of wxTextCtrl::OnCtlColor
+bool wxTextCtrl::OS2ShouldPreProcessMessage(
+ WXMSG* pMsg
+)
+{
+ return wxControl::OS2ShouldPreProcessMessage(pMsg);
+} // end of wxTextCtrl::OS2ShouldPreProcessMessage
+
void wxTextCtrl::OnChar(
wxKeyEvent& rEvent
)
if (m_windowStyle & wxTE_MULTILINE)
{
- hText *= wxMin(GetNumberOfLines(), 5);
+ hText *= wxMax(GetNumberOfLines(), 5);
}
//else: for single line control everything is ok
return wxSize(wText, hText);