]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/combobox.cpp
This weeks interface and compile catchup
[wxWidgets.git] / src / gtk1 / combobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: combobox.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifdef __GNUG__
11 #pragma implementation "combobox.h"
12 #endif
13
14 #include "wx/combobox.h"
15
16 #if wxUSE_COMBOBOX
17
18 #include "wx/settings.h"
19 #include "wx/intl.h"
20
21 #include "wx/textctrl.h" // for wxEVT_COMMAND_TEXT_UPDATED
22
23 #include <gdk/gdk.h>
24 #include <gtk/gtk.h>
25
26 //-----------------------------------------------------------------------------
27 // idle system
28 //-----------------------------------------------------------------------------
29
30 extern void wxapp_install_idle_handler();
31 extern bool g_isIdle;
32
33 //-----------------------------------------------------------------------------
34 // data
35 //-----------------------------------------------------------------------------
36
37 extern bool g_blockEventsOnDrag;
38
39 //-----------------------------------------------------------------------------
40 // "select"
41 //-----------------------------------------------------------------------------
42
43 static void
44 gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
45 {
46 if (g_isIdle) wxapp_install_idle_handler();
47
48 if (!combo->m_hasVMT) return;
49
50 if (g_blockEventsOnDrag) return;
51
52 if (combo->m_alreadySent)
53 {
54 combo->m_alreadySent = FALSE;
55 return;
56 }
57
58 combo->m_alreadySent = TRUE;
59
60 int curSelection = combo->GetSelection();
61
62 if (combo->m_prevSelection != curSelection)
63 {
64 GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
65 gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );
66 }
67
68 combo->m_prevSelection = curSelection;
69
70 wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
71 event.SetInt( curSelection );
72 event.SetString( combo->GetStringSelection() );
73 event.SetEventObject( combo );
74
75 combo->GetEventHandler()->ProcessEvent( event );
76 }
77
78 //-----------------------------------------------------------------------------
79 // "changed"
80 //-----------------------------------------------------------------------------
81
82 static void
83 gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
84 {
85 if (g_isIdle) wxapp_install_idle_handler();
86
87 if (!combo->m_hasVMT) return;
88
89 wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
90 event.SetString( combo->GetValue() );
91 event.SetEventObject( combo );
92 combo->GetEventHandler()->ProcessEvent( event );
93 }
94
95 //-----------------------------------------------------------------------------
96 // wxComboBox
97 //-----------------------------------------------------------------------------
98
99 IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
100
101 BEGIN_EVENT_TABLE(wxComboBox, wxControl)
102 EVT_SIZE(wxComboBox::OnSize)
103 EVT_CHAR(wxComboBox::OnChar)
104 END_EVENT_TABLE()
105
106 bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
107 const wxPoint& pos, const wxSize& size,
108 int n, const wxString choices[],
109 long style, const wxValidator& validator,
110 const wxString& name )
111 {
112 m_alreadySent = FALSE;
113 m_needParent = TRUE;
114 m_acceptsFocus = TRUE;
115 m_prevSelection = 0;
116
117 if (!PreCreation( parent, pos, size ) ||
118 !CreateBase( parent, id, pos, size, style, validator, name ))
119 {
120 wxFAIL_MSG( wxT("wxComboBox creation failed") );
121 return FALSE;
122 }
123
124 m_widget = gtk_combo_new();
125
126 // make it more useable
127 gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
128
129 // and case-sensitive
130 gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE );
131
132
133 GtkWidget *list = GTK_COMBO(m_widget)->list;
134
135 gtk_list_set_selection_mode( GTK_LIST(list), GTK_SELECTION_MULTIPLE );
136
137 for (int i = 0; i < n; i++)
138 {
139 /* don't send first event, which GTK sends aways when
140 inserting the first item */
141 m_alreadySent = TRUE;
142
143 GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
144
145 m_clientDataList.Append( (wxObject*)NULL );
146 m_clientObjectList.Append( (wxObject*)NULL );
147
148 gtk_container_add( GTK_CONTAINER(list), list_item );
149
150 gtk_signal_connect( GTK_OBJECT(list_item), "select",
151 GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
152
153 gtk_widget_show( list_item );
154 }
155
156 m_parent->DoAddChild( this );
157
158 m_focusWidget = GTK_COMBO(m_widget)->entry;
159
160 PostCreation();
161
162 ConnectWidget( GTK_COMBO(m_widget)->button );
163
164 if (!value.IsNull()) SetValue( value );
165
166 if (style & wxCB_READONLY)
167 gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO(m_widget)->entry ), FALSE );
168
169 gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
170 GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
171
172 wxSize size_best( DoGetBestSize() );
173 wxSize new_size( size );
174 if (new_size.x == -1)
175 new_size.x = size_best.x;
176 if (new_size.y == -1)
177 new_size.y = size_best.y;
178 if (new_size.y > size_best.y)
179 new_size.y = size_best.y;
180 if ((new_size.x != size.x) || (new_size.y != size.y))
181 {
182 SetSize( new_size.x, new_size.y );
183
184 // This is required for tool bar support
185 gtk_widget_set_usize( m_widget, new_size.x, new_size.y );
186 }
187
188
189 SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
190 SetForegroundColour( parent->GetForegroundColour() );
191
192 Show( TRUE );
193
194 return TRUE;
195 }
196
197 wxComboBox::~wxComboBox()
198 {
199 wxNode *node = m_clientObjectList.First();
200 while (node)
201 {
202 wxClientData *cd = (wxClientData*)node->Data();
203 if (cd) delete cd;
204 node = node->Next();
205 }
206 m_clientObjectList.Clear();
207
208 m_clientDataList.Clear();
209 }
210
211 void wxComboBox::AppendCommon( const wxString &item )
212 {
213 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
214
215 GtkWidget *list = GTK_COMBO(m_widget)->list;
216
217 GtkWidget *list_item = gtk_list_item_new_with_label( item.mbc_str() );
218
219 gtk_container_add( GTK_CONTAINER(list), list_item );
220
221 gtk_signal_connect( GTK_OBJECT(list_item), "select",
222 GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
223
224 if (GTK_WIDGET_REALIZED(m_widget))
225 {
226 gtk_widget_realize( list_item );
227 gtk_widget_realize( GTK_BIN(list_item)->child );
228
229 if (m_widgetStyle) ApplyWidgetStyle();
230 }
231
232 gtk_widget_show( list_item );
233 }
234
235 void wxComboBox::Append( const wxString &item )
236 {
237 m_clientDataList.Append( (wxObject*) NULL );
238 m_clientObjectList.Append( (wxObject*) NULL );
239
240 AppendCommon( item );
241 }
242
243 void wxComboBox::Append( const wxString &item, void *clientData )
244 {
245 m_clientDataList.Append( (wxObject*) clientData );
246 m_clientObjectList.Append( (wxObject*)NULL );
247
248 AppendCommon( item );
249 }
250
251 void wxComboBox::Append( const wxString &item, wxClientData *clientData )
252 {
253 m_clientDataList.Append( (wxObject*) NULL );
254 m_clientObjectList.Append( (wxObject*) clientData );
255
256 AppendCommon( item );
257 }
258
259 void wxComboBox::SetClientData( int n, void* clientData )
260 {
261 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
262
263 wxNode *node = m_clientDataList.Nth( n );
264 if (!node) return;
265
266 node->SetData( (wxObject*) clientData );
267 }
268
269 void* wxComboBox::GetClientData( int n )
270 {
271 wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") );
272
273 wxNode *node = m_clientDataList.Nth( n );
274 if (!node) return NULL;
275
276 return node->Data();
277 }
278
279 void wxComboBox::SetClientObject( int n, wxClientData* clientData )
280 {
281 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
282
283 wxNode *node = m_clientObjectList.Nth( n );
284 if (!node) return;
285
286 wxClientData *cd = (wxClientData*) node->Data();
287 if (cd) delete cd;
288
289 node->SetData( (wxObject*) clientData );
290 }
291
292 wxClientData* wxComboBox::GetClientObject( int n )
293 {
294 wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") );
295
296 wxNode *node = m_clientObjectList.Nth( n );
297 if (!node) return (wxClientData*) NULL;
298
299 return (wxClientData*) node->Data();
300 }
301
302 void wxComboBox::Clear()
303 {
304 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
305
306 GtkWidget *list = GTK_COMBO(m_widget)->list;
307 gtk_list_clear_items( GTK_LIST(list), 0, Number() );
308
309 wxNode *node = m_clientObjectList.First();
310 while (node)
311 {
312 wxClientData *cd = (wxClientData*)node->Data();
313 if (cd) delete cd;
314 node = node->Next();
315 }
316 m_clientObjectList.Clear();
317
318 m_clientDataList.Clear();
319 }
320
321 void wxComboBox::Delete( int n )
322 {
323 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
324
325 GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
326
327 GList *child = g_list_nth( listbox->children, n );
328
329 if (!child)
330 {
331 wxFAIL_MSG(wxT("wrong index"));
332 return;
333 }
334
335 GList *list = g_list_append( (GList*) NULL, child->data );
336 gtk_list_remove_items( listbox, list );
337 g_list_free( list );
338
339 wxNode *node = m_clientObjectList.Nth( n );
340 if (node)
341 {
342 wxClientData *cd = (wxClientData*)node->Data();
343 if (cd) delete cd;
344 m_clientObjectList.DeleteNode( node );
345 }
346
347 node = m_clientDataList.Nth( n );
348 if (node)
349 {
350 m_clientDataList.DeleteNode( node );
351 }
352 }
353
354 int wxComboBox::FindString( const wxString &item )
355 {
356 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
357
358 GtkWidget *list = GTK_COMBO(m_widget)->list;
359
360 GList *child = GTK_LIST(list)->children;
361 int count = 0;
362 while (child)
363 {
364 GtkBin *bin = GTK_BIN( child->data );
365 GtkLabel *label = GTK_LABEL( bin->child );
366 if (item == wxString(label->label,*wxConvCurrent))
367 return count;
368 count++;
369 child = child->next;
370 }
371
372 return wxNOT_FOUND;
373 }
374
375 int wxComboBox::GetSelection() const
376 {
377 wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
378
379 GtkWidget *list = GTK_COMBO(m_widget)->list;
380
381 GList *selection = GTK_LIST(list)->selection;
382 if (selection)
383 {
384 GList *child = GTK_LIST(list)->children;
385 int count = 0;
386 while (child)
387 {
388 if (child->data == selection->data) return count;
389 count++;
390 child = child->next;
391 }
392 }
393
394 return -1;
395 }
396
397 wxString wxComboBox::GetString( int n ) const
398 {
399 wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid combobox") );
400
401 GtkWidget *list = GTK_COMBO(m_widget)->list;
402
403 wxString str;
404 GList *child = g_list_nth( GTK_LIST(list)->children, n );
405 if (child)
406 {
407 GtkBin *bin = GTK_BIN( child->data );
408 GtkLabel *label = GTK_LABEL( bin->child );
409 str = wxString(label->label,*wxConvCurrent);
410 }
411 else
412 {
413 wxFAIL_MSG( wxT("wxComboBox: wrong index") );
414 }
415
416 return str;
417 }
418
419 wxString wxComboBox::GetStringSelection() const
420 {
421 wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid combobox") );
422
423 GtkWidget *list = GTK_COMBO(m_widget)->list;
424
425 GList *selection = GTK_LIST(list)->selection;
426 if (selection)
427 {
428 GtkBin *bin = GTK_BIN( selection->data );
429 wxString tmp = wxString(GTK_LABEL( bin->child )->label,*wxConvCurrent);
430 return tmp;
431 }
432
433 wxFAIL_MSG( wxT("wxComboBox: no selection") );
434
435 return wxT("");
436 }
437
438 int wxComboBox::Number() const
439 {
440 wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
441
442 GtkWidget *list = GTK_COMBO(m_widget)->list;
443
444 GList *child = GTK_LIST(list)->children;
445 int count = 0;
446 while (child) { count++; child = child->next; }
447 return count;
448 }
449
450 void wxComboBox::SetSelection( int n )
451 {
452 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
453
454 DisableEvents();
455
456 GtkWidget *list = GTK_COMBO(m_widget)->list;
457 gtk_list_unselect_item( GTK_LIST(list), m_prevSelection );
458 gtk_list_select_item( GTK_LIST(list), n );
459 m_prevSelection = n;
460
461 EnableEvents();
462 }
463
464 void wxComboBox::SetStringSelection( const wxString &string )
465 {
466 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
467
468 int res = FindString( string );
469 if (res == -1) return;
470 SetSelection( res );
471 }
472
473 wxString wxComboBox::GetValue() const
474 {
475 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
476 wxString tmp = wxString(gtk_entry_get_text( GTK_ENTRY(entry) ),*wxConvCurrent);
477 return tmp;
478 }
479
480 void wxComboBox::SetValue( const wxString& value )
481 {
482 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
483
484 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
485 wxString tmp = wxT("");
486 if (!value.IsNull()) tmp = value;
487 gtk_entry_set_text( GTK_ENTRY(entry), tmp.mbc_str() );
488 }
489
490 void wxComboBox::Copy()
491 {
492 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
493
494 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
495 #if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
496 gtk_editable_copy_clipboard( GTK_EDITABLE(entry) );
497 #else
498 gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
499 #endif
500 }
501
502 void wxComboBox::Cut()
503 {
504 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
505
506 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
507 #if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
508 gtk_editable_cut_clipboard( GTK_EDITABLE(entry) );
509 #else
510 gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
511 #endif
512 }
513
514 void wxComboBox::Paste()
515 {
516 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
517
518 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
519 #if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
520 gtk_editable_paste_clipboard( GTK_EDITABLE(entry) );
521 #else
522 gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
523 #endif
524 }
525
526 void wxComboBox::SetInsertionPoint( long pos )
527 {
528 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
529
530 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
531 gtk_entry_set_position( GTK_ENTRY(entry), (int)pos );
532 }
533
534 void wxComboBox::SetInsertionPointEnd()
535 {
536 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
537
538 SetInsertionPoint( -1 );
539 }
540
541 long wxComboBox::GetInsertionPoint() const
542 {
543 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
544 return (long) GTK_EDITABLE(entry)->current_pos;
545 }
546
547 long wxComboBox::GetLastPosition() const
548 {
549 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
550 int pos = GTK_ENTRY(entry)->text_length;
551 return (long) pos-1;
552 }
553
554 void wxComboBox::Replace( long from, long to, const wxString& value )
555 {
556 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
557 // FIXME: not quite sure how to do this method right in multibyte mode
558
559 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
560 gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
561 if (value.IsNull()) return;
562 gint pos = (gint)to;
563 gtk_editable_insert_text( GTK_EDITABLE(entry), value.mbc_str(), value.Length(), &pos );
564 }
565
566 void wxComboBox::Remove(long from, long to)
567 {
568 wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
569
570 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
571 gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
572 }
573
574 void wxComboBox::SetSelection( long from, long to )
575 {
576 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
577 gtk_editable_select_region( GTK_EDITABLE(entry), (gint)from, (gint)to );
578 }
579
580 void wxComboBox::SetEditable( bool editable )
581 {
582 GtkWidget *entry = GTK_COMBO(m_widget)->entry;
583 gtk_entry_set_editable( GTK_ENTRY(entry), editable );
584 }
585
586 void wxComboBox::OnChar( wxKeyEvent &event )
587 {
588 if ( event.KeyCode() == WXK_RETURN )
589 {
590 wxString value = GetValue();
591
592 if ( Number() == 0 )
593 {
594 // make Enter generate "selected" event if there is only one item
595 // in the combobox - without it, it's impossible to select it at
596 // all!
597 wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() );
598 event.SetInt( 0 );
599 event.SetString( value );
600 event.SetEventObject( this );
601 GetEventHandler()->ProcessEvent( event );
602 }
603 else
604 {
605 // add the item to the list if it's not there yet
606 if ( FindString(value) == wxNOT_FOUND )
607 {
608 Append(value);
609 SetStringSelection(value);
610
611 // and generate the selected event for it
612 wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() );
613 event.SetInt( Number() - 1 );
614 event.SetString( value );
615 event.SetEventObject( this );
616 GetEventHandler()->ProcessEvent( event );
617 }
618 else
619 {
620 // This will invoke the dialog default action, such
621 // as the clicking the default button.
622
623 wxWindow *top_frame = m_parent;
624 while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
625 top_frame = top_frame->GetParent();
626
627 if (top_frame && GTK_IS_WINDOW(top_frame->m_widget))
628 {
629 GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
630
631 if (window->default_widget)
632 {
633 gtk_widget_activate (window->default_widget);
634 return;
635 }
636 }
637 }
638 }
639 }
640
641 event.Skip();
642 }
643
644 void wxComboBox::DisableEvents()
645 {
646 GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
647 GList *child = list->children;
648 while (child)
649 {
650 gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
651 GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
652
653 child = child->next;
654 }
655 }
656
657 void wxComboBox::EnableEvents()
658 {
659 GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
660 GList *child = list->children;
661 while (child)
662 {
663 gtk_signal_connect( GTK_OBJECT(child->data), "select",
664 GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
665
666 child = child->next;
667 }
668 }
669
670 void wxComboBox::OnSize( wxSizeEvent &event )
671 {
672 event.Skip();
673
674 #if 0
675 int w = 21;
676 gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height );
677
678 gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y );
679 gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height );
680 #endif // 0
681 }
682
683 void wxComboBox::ApplyWidgetStyle()
684 {
685 SetWidgetStyle();
686
687 // gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
688 gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
689 gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );
690
691 GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
692 GList *child = list->children;
693 while (child)
694 {
695 gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
696
697 GtkBin *bin = GTK_BIN(child->data);
698 gtk_widget_set_style( bin->child, m_widgetStyle );
699
700 child = child->next;
701 }
702 }
703
704 GtkWidget* wxComboBox::GetConnectWidget()
705 {
706 return GTK_COMBO(m_widget)->entry;
707 }
708
709 bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
710 {
711 return ( (window == GTK_ENTRY( GTK_COMBO(m_widget)->entry )->text_area) ||
712 (window == GTK_COMBO(m_widget)->button->window ) );
713 }
714
715 wxSize wxComboBox::DoGetBestSize() const
716 {
717 wxSize ret( wxControl::DoGetBestSize() );
718
719 // we know better our horizontal extent: it depends on the longest string
720 // in the combobox
721 ret.x = 0;
722 if ( m_widget )
723 {
724 GdkFont *font = m_font.GetInternalFont();
725
726 wxCoord width;
727 size_t count = Number();
728 for ( size_t n = 0; n < count; n++ )
729 {
730 width = (wxCoord)gdk_string_width(font, GetString(n).mbc_str());
731 if ( width > ret.x )
732 ret.x = width;
733 }
734 }
735
736 // empty combobox should have some reasonable default size too
737 if ( ret.x < 100 )
738 ret.x = 100;
739 return ret;
740 }
741
742 #endif