+wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget,
+ const wxWindow* window )
+{
+ Dimension xmargin, ymargin, highlight, shadow;
+ char* value;
+
+ XtVaGetValues( textWidget,
+ XmNmarginWidth, &xmargin,
+ XmNmarginHeight, &ymargin,
+ XmNvalue, &value,
+ XmNhighlightThickness, &highlight,
+ XmNshadowThickness, &shadow,
+ NULL );
+
+ if( !value )
+ value = wxMOTIF_STR("|");
+
+ int x, y;
+ window->GetTextExtent( value, &x, &y );
+
+ if( x < 90 )
+ x = 90;
+
+ return wxSize( x + 2 * xmargin + 2 * highlight + 2 * shadow,
+ // MBN: +2 necessary: Lesstif bug or mine?
+ y + 2 * ymargin + 2 * highlight + 2 * shadow + 2 );
+}
+
+wxSize wxTextCtrl::DoGetBestSize() const
+{
+ if( IsSingleLine() )
+ {
+ wxSize best = wxControl::DoGetBestSize();
+#if wxCHECK_MOTIF_VERSION( 2, 3 )
+ // OpenMotif 2.3 gives way too big X sizes
+ wxSize other_best = wxDoGetSingleTextCtrlBestSize
+ ( (Widget) GetTopWidget(), this );
+ return wxSize( other_best.x, best.y );
+#else
+ if( best.x < 90 ) best.x = 90;
+
+ return best;
+#endif
+ }
+ else
+ return wxWindow::DoGetBestSize();
+}
+