]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/textctrl.cpp
GTK asserts disappeared - but surprizngly, SetInsertionPoint() still doesn't
[wxWidgets.git] / src / gtk1 / textctrl.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textctrl.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifdef __GNUG__
11 #pragma implementation "textctrl.h"
12 #endif
13
14 #include "wx/textctrl.h"
15 #include "wx/utils.h"
16 #include "wx/intl.h"
17 #include "wx/settings.h"
18
19 #include <sys/types.h>
20 #include <sys/stat.h>
21 #include <ctype.h>
22
23 #include "gdk/gdk.h"
24 #include "gtk/gtk.h"
25 #include "gdk/gdkkeysyms.h"
26
27 //-----------------------------------------------------------------------------
28 // data
29 //-----------------------------------------------------------------------------
30
31 extern bool g_blockEventsOnDrag;
32
33 //-----------------------------------------------------------------------------
34 // "changed"
35 //-----------------------------------------------------------------------------
36
37 static void
38 gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
39 {
40 win->SetModified();
41
42 win->CalculateScrollbar();
43
44 wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
45 event.SetString( copystring(win->GetValue()) );
46 event.SetEventObject( win );
47 win->GetEventHandler()->ProcessEvent( event );
48 delete[] event.GetString();
49 }
50
51 //-----------------------------------------------------------------------------
52 // "size_allocate"
53 //-----------------------------------------------------------------------------
54
55 static void
56 gtk_text_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* WXUNUSED(alloc), wxTextCtrl *win )
57 {
58 win->CalculateScrollbar();
59 }
60
61 //-----------------------------------------------------------------------------
62 // wxTextCtrl
63 //-----------------------------------------------------------------------------
64
65 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
66
67 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
68 EVT_CHAR(wxTextCtrl::OnChar)
69 END_EVENT_TABLE()
70
71 #ifndef NO_TEXT_WINDOW_STREAM
72 wxTextCtrl::wxTextCtrl() : streambuf()
73 {
74 if (allocate()) setp(base(),ebuf());
75
76 m_modified = FALSE;
77 }
78 #else
79 wxTextCtrl::wxTextCtrl()
80 {
81 m_modified = FALSE;
82 }
83 #endif
84
85 #ifndef NO_TEXT_WINDOW_STREAM
86 wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
87 const wxPoint &pos, const wxSize &size,
88 int style, const wxValidator& validator, const wxString &name ) : streambuf()
89 {
90 if (allocate()) setp(base(),ebuf());
91
92 m_modified = FALSE;
93 Create( parent, id, value, pos, size, style, validator, name );
94 }
95 #else
96 wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
97 const wxPoint &pos, const wxSize &size,
98 int style, const wxValidator& validator, const wxString &name )
99 {
100 m_modified = FALSE;
101 Create( parent, id, value, pos, size, style, validator, name );
102 }
103 #endif
104
105 bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
106 const wxPoint &pos, const wxSize &size,
107 int style, const wxValidator& validator, const wxString &name )
108 {
109 m_needParent = TRUE;
110 m_acceptsFocus = TRUE;
111
112 PreCreation( parent, id, pos, size, style, name );
113
114 SetValidator( validator );
115
116 m_vScrollbarVisible = TRUE;
117
118 bool multi_line = (style & wxTE_MULTILINE) != 0;
119 if ( multi_line )
120 {
121 // a multi-line edit control: create a vertical scrollbar by default and
122 // horizontal if requested
123 bool bHasHScrollbar = (style & wxHSCROLL) != 0;
124
125 // create our control...
126 m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
127
128 // ... and put into the upper left hand corner of the table
129 m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
130 gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
131 (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
132 (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
133 0, 0);
134
135 // put the horizontal scrollbar in the lower left hand corner
136 if (bHasHScrollbar)
137 {
138 GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
139 gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
140 (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
141 GTK_FILL,
142 0, 0);
143 gtk_widget_show(hscrollbar);
144 }
145
146 // finally, put the vertical scrollbar in the upper right corner
147 m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
148 gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
149 GTK_FILL,
150 (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
151 0, 0);
152 gtk_widget_show( m_vScrollbar );
153
154 gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
155 GTK_SIGNAL_FUNC(gtk_text_size_callback), (gpointer)this );
156 }
157 else
158 {
159 // a single-line text control: no need for scrollbars
160 m_widget =
161 m_text = gtk_entry_new();
162 }
163
164 wxSize newSize = size;
165 if (newSize.x == -1) newSize.x = 80;
166 if (newSize.y == -1) newSize.y = 26;
167 SetSize( newSize.x, newSize.y );
168
169 m_parent->AddChild( this );
170
171 (m_parent->m_insertCallback)( m_parent, this );
172
173 PostCreation();
174
175 if (multi_line)
176 {
177 gtk_widget_realize(m_text);
178 gtk_widget_show(m_text);
179 }
180
181 // we want to be notified about text changes
182 gtk_signal_connect( GTK_OBJECT(m_text), "changed",
183 GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
184
185 if (!value.IsNull())
186 {
187 gint tmp = 0;
188 gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp );
189 SetInsertionPointEnd();
190 }
191
192 if (style & wxTE_PASSWORD)
193 {
194 if (!multi_line)
195 gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE );
196 }
197
198 if (style & wxTE_READONLY)
199 {
200 if (!multi_line)
201 gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE );
202 }
203 else
204 {
205 if (multi_line)
206 gtk_text_set_editable( GTK_TEXT(m_text), 1 );
207 }
208
209 Show( TRUE );
210
211 SetBackgroundColour( parent->GetBackgroundColour() );
212 SetForegroundColour( parent->GetForegroundColour() );
213
214 return TRUE;
215 }
216
217 void wxTextCtrl::CalculateScrollbar()
218 {
219 if ((m_windowStyle & wxTE_MULTILINE) == 0) return;
220
221 GtkAdjustment *adj = GTK_TEXT(m_text)->vadj;
222
223 if (adj->upper - adj->page_size < 0.8)
224 {
225 if (m_vScrollbarVisible)
226 {
227 gtk_widget_hide( m_vScrollbar );
228
229 m_vScrollbarVisible = FALSE;
230 }
231 }
232 else
233 {
234 if (!m_vScrollbarVisible)
235 {
236 gtk_widget_show( m_vScrollbar );
237
238 m_vScrollbarVisible = TRUE;
239 }
240 }
241 }
242
243 wxString wxTextCtrl::GetValue() const
244 {
245 wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" );
246
247 wxString tmp;
248 if (m_windowStyle & wxTE_MULTILINE)
249 {
250 gint len = gtk_text_get_length( GTK_TEXT(m_text) );
251 char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
252 tmp = text;
253 g_free( text );
254 }
255 else
256 {
257 tmp = gtk_entry_get_text( GTK_ENTRY(m_text) );
258 }
259 return tmp;
260 }
261
262 void wxTextCtrl::SetValue( const wxString &value )
263 {
264 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
265
266 wxString tmp = "";
267 if (!value.IsNull()) tmp = value;
268 if (m_windowStyle & wxTE_MULTILINE)
269 {
270 gint len = gtk_text_get_length( GTK_TEXT(m_text) );
271 gtk_editable_delete_text( GTK_EDITABLE(m_text), 0, len );
272 len = 0;
273 gtk_editable_insert_text( GTK_EDITABLE(m_text), tmp, tmp.Length(), &len );
274 }
275 else
276 {
277 gtk_entry_set_text( GTK_ENTRY(m_text), tmp );
278 }
279 }
280
281 void wxTextCtrl::WriteText( const wxString &text )
282 {
283 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
284
285 if (text.IsNull()) return;
286
287 if (m_windowStyle & wxTE_MULTILINE)
288 {
289 gint len = gtk_text_get_length( GTK_TEXT(m_text) );
290 gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
291 }
292 else
293 {
294 gtk_entry_append_text( GTK_ENTRY(m_text), text );
295 }
296 }
297
298 bool wxTextCtrl::LoadFile( const wxString &file )
299 {
300 wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
301
302 if (!wxFileExists(file)) return FALSE;
303
304 Clear();
305
306 FILE *fp = (FILE*) NULL;
307 struct stat statb;
308
309 if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
310 !(fp = fopen ((char*) (const char*) file, "r")))
311 {
312 return FALSE;
313 }
314 else
315 {
316 gint len = statb.st_size;
317 char *text;
318 if (!(text = (char*)malloc ((unsigned) (len + 1))))
319 {
320 fclose (fp);
321 return FALSE;
322 }
323 if (fread (text, sizeof (char), len, fp) != (size_t) len)
324 {
325 }
326 fclose (fp);
327
328 text[len] = 0;
329
330 if (m_windowStyle & wxTE_MULTILINE)
331 {
332 gint pos = 0;
333 gtk_editable_insert_text( GTK_EDITABLE(m_text), text, len, &pos );
334 }
335 else
336 {
337 gtk_entry_set_text( GTK_ENTRY(m_text), text );
338 }
339
340 free (text);
341 m_modified = FALSE;
342 return TRUE;
343 }
344 return FALSE;
345 }
346
347 bool wxTextCtrl::SaveFile( const wxString &file )
348 {
349 wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
350
351 if (file == "") return FALSE;
352
353 FILE *fp;
354
355 if (!(fp = fopen ((char*) (const char*) file, "w")))
356 {
357 return FALSE;
358 }
359 else
360 {
361 char *text = (char*) NULL;
362 gint len = 0;
363
364 if (m_windowStyle & wxTE_MULTILINE)
365 {
366 len = gtk_text_get_length( GTK_TEXT(m_text) );
367 text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
368 }
369 else
370 {
371 text = gtk_entry_get_text( GTK_ENTRY(m_text) );
372 }
373
374 if (fwrite (text, sizeof (char), len, fp) != (size_t) len)
375 {
376 // Did not write whole file
377 }
378
379 // Make sure newline terminates the file
380 if (text[len - 1] != '\n')
381 fputc ('\n', fp);
382
383 fclose (fp);
384
385 if (m_windowStyle & wxTE_MULTILINE) g_free( text );
386
387 m_modified = FALSE;
388 return TRUE;
389 }
390
391 return TRUE;
392 }
393
394 wxString wxTextCtrl::GetLineText( long lineNo ) const
395 {
396 if (m_windowStyle & wxTE_MULTILINE)
397 {
398 gint len = gtk_text_get_length( GTK_TEXT(m_text) );
399 char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
400
401 if (text)
402 {
403 wxString buf("");
404 long i;
405 int currentLine = 0;
406 for (i = 0; currentLine != lineNo && text[i]; i++ )
407 if (text[i] == '\n')
408 currentLine++;
409 // Now get the text
410 int j;
411 for (j = 0; text[i] && text[i] != '\n'; i++, j++ )
412 buf += text[i];
413
414 g_free( text );
415 return buf;
416 }
417 else
418 return wxEmptyString;
419 }
420 else
421 {
422 if (lineNo == 0) return GetValue();
423 return wxEmptyString;
424 }
425 }
426
427 void wxTextCtrl::OnDropFiles( wxDropFilesEvent &WXUNUSED(event) )
428 {
429 wxFAIL_MSG( "wxTextCtrl::OnDropFiles not implemented" );
430 }
431
432 long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
433 {
434 if ( m_windowStyle & wxTE_MULTILINE )
435 {
436 wxString text = GetValue();
437
438 if( pos >= (long)text.Len() )
439 return FALSE;
440
441 *x=1; // Col 1
442 *y=1; // Line 1
443 for ( const char *p = text.c_str(); *p; p++ )
444 {
445 if (*p == '\n')
446 {
447 (*y)++;
448 *x=1;
449 }
450 else
451 (*x)++;
452 }
453 }
454 else // single line control
455 {
456 if ( pos < GTK_ENTRY(m_text)->text_length )
457 {
458 *y = 1;
459 *x = pos;
460 }
461 else
462 {
463 // index out of bounds
464 return FALSE;
465 }
466 }
467
468 return TRUE;
469 }
470
471 long wxTextCtrl::XYToPosition(long x, long y ) const
472 {
473 if (!(m_windowStyle & wxTE_MULTILINE)) return 0;
474
475 long pos=0;
476
477 for( int i=1; i<y; i++ ) pos += GetLineLength(i);
478
479 pos +=x-1; // Pos start with 0
480 return pos;
481 }
482
483 int wxTextCtrl::GetLineLength(long lineNo) const
484 {
485 wxString str = GetLineText (lineNo);
486 return (int) str.Length();
487 }
488
489 int wxTextCtrl::GetNumberOfLines() const
490 {
491 if (m_windowStyle & wxTE_MULTILINE)
492 {
493 gint len = gtk_text_get_length( GTK_TEXT(m_text) );
494 char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
495
496 if (text)
497 {
498 int currentLine = 0;
499 for (int i = 0; i < len; i++ )
500 {
501 if (text[i] == '\n')
502 currentLine++;
503 }
504 g_free( text );
505 return currentLine;
506 }
507 else
508 {
509 return 0;
510 }
511 }
512 else
513 {
514 return 1;
515 }
516 }
517
518 void wxTextCtrl::SetInsertionPoint( long pos )
519 {
520 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
521
522 if (m_windowStyle & wxTE_MULTILINE)
523 gtk_text_set_point( GTK_TEXT(m_text), (int)pos );
524 else
525 gtk_entry_set_position( GTK_ENTRY(m_text), (int)pos );
526 }
527
528 void wxTextCtrl::SetInsertionPointEnd()
529 {
530 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
531
532 if (m_windowStyle & wxTE_MULTILINE)
533 SetInsertionPoint(gtk_text_get_length(GTK_TEXT(m_text)));
534 else
535 gtk_entry_set_position( GTK_ENTRY(m_text), -1 );
536 }
537
538 void wxTextCtrl::SetEditable( bool editable )
539 {
540 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
541
542 if (m_windowStyle & wxTE_MULTILINE)
543 gtk_text_set_editable( GTK_TEXT(m_text), editable );
544 else
545 gtk_entry_set_editable( GTK_ENTRY(m_text), editable );
546 }
547
548 void wxTextCtrl::SetSelection( long from, long to )
549 {
550 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
551
552 gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
553 }
554
555 void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
556 {
557 wxFAIL_MSG( "wxTextCtrl::ShowPosition not implemented" );
558 }
559
560 long wxTextCtrl::GetInsertionPoint() const
561 {
562 wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
563
564 return (long) GTK_EDITABLE(m_text)->current_pos;
565 }
566
567 long wxTextCtrl::GetLastPosition() const
568 {
569 wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
570
571 int pos = 0;
572 if (m_windowStyle & wxTE_MULTILINE)
573 pos = gtk_text_get_length( GTK_TEXT(m_text) );
574 else
575 pos = GTK_ENTRY(m_text)->text_length;
576
577 return (long)pos-1;
578 }
579
580 void wxTextCtrl::Remove( long from, long to )
581 {
582 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
583
584 gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
585 }
586
587 void wxTextCtrl::Replace( long from, long to, const wxString &value )
588 {
589 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
590
591 gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
592 if (value.IsNull()) return;
593 gint pos = (gint)from;
594 gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos );
595 }
596
597 void wxTextCtrl::Cut()
598 {
599 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
600
601 #if (GTK_MINOR_VERSION == 1)
602 gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
603 #else
604 gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 );
605 #endif
606 }
607
608 void wxTextCtrl::Copy()
609 {
610 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
611
612 #if (GTK_MINOR_VERSION == 1)
613 gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
614 #else
615 gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 );
616 #endif
617 }
618
619 void wxTextCtrl::Paste()
620 {
621 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
622
623 #if (GTK_MINOR_VERSION == 1)
624 gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
625 #else
626 gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 );
627 #endif
628 }
629
630 void wxTextCtrl::Clear()
631 {
632 SetValue( "" );
633 }
634
635 void wxTextCtrl::OnChar( wxKeyEvent &key_event )
636 {
637 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
638
639 if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
640 {
641 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
642 event.SetEventObject(this);
643 if (GetEventHandler()->ProcessEvent(event)) return;
644 }
645
646 key_event.Skip();
647 }
648
649 #ifndef NO_TEXT_WINDOW_STREAM
650 int wxTextCtrl::overflow( int WXUNUSED(c) )
651 {
652 int len = pptr() - pbase();
653 char *txt = new char[len+1];
654 strncpy(txt, pbase(), len);
655 txt[len] = '\0';
656 (*this) << txt;
657 setp(pbase(), epptr());
658 delete[] txt;
659 return EOF;
660 }
661
662 int wxTextCtrl::sync()
663 {
664 int len = pptr() - pbase();
665 char *txt = new char[len+1];
666 strncpy(txt, pbase(), len);
667 txt[len] = '\0';
668 (*this) << txt;
669 setp(pbase(), epptr());
670 delete[] txt;
671 return 0;
672 }
673
674 int wxTextCtrl::underflow()
675 {
676 return EOF;
677 }
678
679 wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
680 {
681 WriteText(s);
682 return *this;
683 }
684
685 wxTextCtrl& wxTextCtrl::operator<<(float f)
686 {
687 static char buf[100];
688 sprintf(buf, "%.2f", f);
689 WriteText(buf);
690 return *this;
691 }
692
693 wxTextCtrl& wxTextCtrl::operator<<(double d)
694 {
695 static char buf[100];
696 sprintf(buf, "%.2f", d);
697 WriteText(buf);
698 return *this;
699 }
700
701 wxTextCtrl& wxTextCtrl::operator<<(int i)
702 {
703 static char buf[100];
704 sprintf(buf, "%i", i);
705 WriteText(buf);
706 return *this;
707 }
708
709 wxTextCtrl& wxTextCtrl::operator<<(long i)
710 {
711 static char buf[100];
712 sprintf(buf, "%ld", i);
713 WriteText(buf);
714 return *this;
715 }
716
717 wxTextCtrl& wxTextCtrl::operator<<(const char c)
718 {
719 char buf[2];
720
721 buf[0] = c;
722 buf[1] = 0;
723 WriteText(buf);
724 return *this;
725 }
726 #endif
727
728 GtkWidget* wxTextCtrl::GetConnectWidget()
729 {
730 return GTK_WIDGET(m_text);
731 }
732
733 bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
734 {
735 if (m_windowStyle & wxTE_MULTILINE)
736 return (window == GTK_TEXT(m_text)->text_area);
737 else
738 return (window == GTK_ENTRY(m_text)->text_area);
739 }
740
741 void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
742 {
743 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
744
745 // doesn't work
746 }
747
748 void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
749 {
750 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
751
752 // doesn't work
753 }
754
755 void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
756 {
757 wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
758
759 wxControl::SetBackgroundColour( colour );
760
761 wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
762 if (sysbg.Red() == colour.Red() &&
763 sysbg.Green() == colour.Green() &&
764 sysbg.Blue() == colour.Blue())
765 {
766 return;
767 }
768
769 if (!m_backgroundColour.Ok()) return;
770
771 if (m_windowStyle & wxTE_MULTILINE)
772 {
773 GdkWindow *window = GTK_TEXT(m_text)->text_area;
774 m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
775 gdk_window_set_background( window, m_backgroundColour.GetColor() );
776 gdk_window_clear( window );
777 }
778 }
779
780 void wxTextCtrl::ApplyWidgetStyle()
781 {
782 if (m_windowStyle & wxTE_MULTILINE)
783 {
784 // how ?
785 }
786 else
787 {
788 SetWidgetStyle();
789 gtk_widget_set_style( m_text, m_widgetStyle );
790 }
791 }
792