+ // translate wxWin style flags to MSW ones, checking for consistency while
+ // doing it
+ long msStyle = ES_LEFT | WS_VISIBLE | WS_CHILD | WS_TABSTOP;
+ if ( m_windowStyle & wxTE_MULTILINE )
+ {
+ wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER),
+ 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;
+ }
+ else
+ msStyle |= ES_AUTOHSCROLL;
+
+ if (m_windowStyle & wxHSCROLL)
+ msStyle |= (WS_HSCROLL | ES_AUTOHSCROLL);
+
+ if (m_windowStyle & wxTE_READONLY)
+ msStyle |= ES_READONLY;
+
+ if (m_windowStyle & wxHSCROLL)
+ msStyle |= (WS_HSCROLL | ES_AUTOHSCROLL);
+ if (m_windowStyle & wxTE_PASSWORD) // hidden input
+ msStyle |= ES_PASSWORD;
+
+ // we always want the characters and the arrows
+ m_lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
+
+ // 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");
+
+#if wxUSE_RICHEDIT
+ if ( m_windowStyle & wxTE_RICH )
+ {
+ msStyle |= ES_AUTOVSCROLL;
+ m_isRich = TRUE;
+ windowClass = wxT("RICHEDIT");
+ }
+ else
+ m_isRich = FALSE;
+#endif
+
+ 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") );
+
+#if wxUSE_CTL3D
+ if ( want3D )
+ {
+ Ctl3dSubclassCtl(GetHwnd());
+ m_useCtl3D = TRUE;
+ }