+ m_tempCallbackStruct = NULL;
+ m_modified = false;
+ m_processedDefault = false;
+}
+
+bool wxTextCtrl::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ if( !CreateControl( parent, id, pos, size, style, validator, name ) )
+ return false;
+ PreCreation();
+
+ m_tempCallbackStruct = NULL;
+ m_modified = false;
+ m_processedDefault = false;
+
+ Widget parentWidget = (Widget) parent->GetClientWidget();
+
+ Bool wantHorizScroll = (m_windowStyle & wxHSCROLL) != 0 ? True : False;
+ // If we don't have horizontal scrollbars, we want word wrap.
+ // OpenMotif 2.1 crashes if wantWordWrap is True in Japanese
+ // locale (and probably other multibyte locales). The check might be
+ // more precise
+#if wxCHECK_LESSTIF() || wxCHECK_MOTIF_VERSION( 2, 2 )
+ Bool wantWordWrap = wantHorizScroll == True ? False : True;
+#else
+ Bool wantWordWrap = False;
+#endif
+
+ if (m_windowStyle & wxTE_MULTILINE)
+ {
+ Arg args[8];
+ int count = 0;
+ XtSetArg (args[count], XmNscrollHorizontal, wantHorizScroll); ++count;
+ if( m_font.IsOk() )
+ XtSetArg (args[count], (String) wxFont::GetFontTag(),
+ m_font.GetFontType( XtDisplay(parentWidget) ) ); ++count;
+ XtSetArg (args[count], XmNwordWrap, wantWordWrap); ++count;
+ XtSetArg (args[count], XmNvalue, (const char*)value.mb_str()); ++count;
+ XtSetArg (args[count], XmNeditable,
+ style & wxTE_READONLY ? False : True); ++count;
+ XtSetArg (args[count], XmNeditMode, XmMULTI_LINE_EDIT ); ++count;
+
+ m_mainWidget =
+ (WXWidget) XmCreateScrolledText(parentWidget,
+ name.char_str(),
+ args, count);
+
+ XtManageChild ((Widget) m_mainWidget);
+ }
+ else
+ {
+ m_mainWidget = (WXWidget)XtVaCreateManagedWidget
+ (
+ name.mb_str(),
+ xmTextWidgetClass,
+ parentWidget,
+ wxFont::GetFontTag(), m_font.GetFontType( XtDisplay(parentWidget) ),
+ XmNvalue, (const char*)value.mb_str(),
+ XmNeditable, (style & wxTE_READONLY) ?
+ False : True,
+ NULL
+ );
+
+#if 0
+ // TODO: Is this relevant? What does it do?
+ int noCols = 2;
+ if (!value.empty() && (value.length() > (unsigned int) noCols))
+ noCols = value.length();
+ XtVaSetValues((Widget) m_mainWidget,
+ XmNcolumns, noCols,
+ NULL);
+#endif
+ }
+
+ // remove border if asked for
+ if ( style & wxNO_BORDER )
+ {
+ XtVaSetValues((Widget)m_mainWidget,
+ XmNshadowThickness, 0,
+ NULL);
+ }
+
+ // install callbacks
+ XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this);
+
+ XtAddCallback((Widget) m_mainWidget, XmNmodifyVerifyCallback, (XtCallbackProc)wxTextWindowModifyProc, (XtPointer)this);
+
+ XtAddCallback((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc)wxTextWindowActivateProc, (XtPointer)this);
+
+ XtAddCallback((Widget) m_mainWidget, XmNfocusCallback, (XtCallbackProc)wxTextWindowGainFocusProc, (XtPointer)this);
+
+ XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
+
+ PostCreation();
+ AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
+ pos.x, pos.y, size.x, size.y);
+
+ return true;