+ if (m_bIsMLE)
+ {
+ m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
+ ,WC_MLE // Window class
+ ,rsValue.c_str() // Initial Text
+ ,(ULONG)lSstyle // Style flags
+ ,(LONG)0 // X pos of origin
+ ,(LONG)0 // Y pos of origin
+ ,(LONG)0 // field width
+ ,(LONG)0 // 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
+ ,rsValue.c_str() // Initial Text
+ ,(ULONG)lSstyle // Style flags
+ ,(LONG)0 // X pos of origin
+ ,(LONG)0 // Y pos of origin
+ ,(LONG)0 // field width
+ ,(LONG)0 // 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
+ );
+ }
+
+ if (m_hWnd == 0)
+ {
+ return false;
+ }
+
+ SubclassWin(GetHWND());
+
+ //
+ // Set font, position, size and initial value
+ //
+ wxFont* pTextFont = new wxFont( 8
+ ,wxMODERN
+ ,wxNORMAL
+ ,wxNORMAL
+ );
+ SetFont(*pTextFont);
+ if (!rsValue.empty())
+ {
+ SetValue(rsValue);
+ }
+ SetupColours();
+ //
+ // If X and/or Y are not zero the difference is the compensation value
+ // for margins for OS/2 controls.
+ //
+ ::WinQueryWindowPos(m_hWnd, &vSwp);
+ SetXComp(vSwp.x);
+ SetYComp(vSwp.y);
+ SetSize( vPos.x - GetXComp()
+ ,vPos.y - GetYComp()
+ ,rSize.x
+ ,rSize.y
+ );
+ delete pTextFont;
+ return true;
+} // end of wxTextCtrl::Create
+
+//
+// Make sure the window style (etc.) reflects the HWND style (roughly)
+//
+void wxTextCtrl::AdoptAttributesFromHWND()
+{
+ HWND hWnd = GetHwnd();
+ LONG lStyle = ::WinQueryWindowULong(hWnd, QWL_STYLE);
+
+ wxWindow::AdoptAttributesFromHWND();
+
+ if (m_bIsMLE)
+ {
+ m_windowStyle |= wxTE_MULTILINE;
+ if (lStyle & MLS_READONLY)
+ m_windowStyle |= wxTE_READONLY;
+ }
+ else
+ {
+ if (lStyle & ES_UNREADABLE)
+ m_windowStyle |= wxTE_PASSWORD;
+ if (lStyle & ES_READONLY)
+ m_windowStyle |= wxTE_READONLY;
+ }
+} // 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::GetColour(wxSYS_COLOUR_WINDOW);
+ SetBackgroundColour(vBkgndColour);
+ SetForegroundColour(GetParent()->GetForegroundColour());
+ if (m_bIsMLE)
+ {
+ ::WinSendMsg( GetHwnd()
+ ,MLM_SETTEXTCOLOR
+ ,(MPARAM)GetParent()->GetForegroundColour().GetPixel()
+ ,(MPARAM)MLE_RGB
+ );
+ }
+} // end of wxTextCtrl::SetupColours
+
+// ----------------------------------------------------------------------------
+// set/get the controls text
+// ----------------------------------------------------------------------------