+
+ bool bMultiLine = (style & wxTE_MULTILINE) != 0;
+ if ( bMultiLine ) {
+ // a multi-line edit control: create a vertical scrollbar by default and
+ // horizontal if requested
+ bool bHasHScrollbar = (style & wxHSCROLL) != 0;
+
+ // create our control...
+ m_text = gtk_text_new( NULL, NULL );
+
+ // ... and put into the upper left hand corner of the table
+ m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
+ gtk_table_attach(GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
+ GTK_FILL | GTK_EXPAND,
+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
+ 0, 0);
+
+ // put the horizontal scrollbar in the lower left hand corner
+ if ( bHasHScrollbar ) {
+ GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
+ gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
+ GTK_EXPAND | GTK_FILL,
+ GTK_FILL,
+ 0, 0);
+ gtk_widget_show(hscrollbar);
+ }
+
+ // finally, put the vertical scrollbar in the upper right corner
+ GtkWidget *vscrollbar = gtk_vscrollbar_new(GTK_TEXT(m_text)->vadj);
+ gtk_table_attach(GTK_TABLE(m_widget), vscrollbar, 1, 2, 0, 1,
+ GTK_FILL,
+ GTK_EXPAND | GTK_FILL | GTK_SHRINK,
+ 0, 0);
+ gtk_widget_show(vscrollbar);
+ }
+ else {
+ // a single-line text control: no need for scrollbars
+ m_widget =
+ m_text = gtk_entry_new();
+ }
+