1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "listbox.h"
15 #include "wx/listbox.h"
19 #include "wx/dynarray.h"
22 #include "wx/checklst.h"
23 #include "wx/settings.h"
26 #include "wx/tooltip.h"
29 #if wxUSE_DRAG_AND_DROP
36 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
40 extern void wxapp_install_idle_handler();
43 //-------------------------------------------------------------------------
44 // conditional compilation
45 //-------------------------------------------------------------------------
47 #if (GTK_MINOR_VERSION > 0)
48 #define NEW_GTK_SCROLL_CODE
51 //-----------------------------------------------------------------------------
53 //-----------------------------------------------------------------------------
55 #if wxUSE_CHECKLISTBOX
57 #define CHECKBOX_STRING "[-] "
59 // checklistboxes have "[±] " prepended to their lables, this macro removes it
60 // (NB: 4 below is the length of CHECKBOX_STRING above)
62 // the argument to it is a "const char *" pointer
63 #define GET_REAL_LABEL(label) ((m_hasCheckBoxes)?(label)+4 : (label))
65 #else // !wxUSE_CHECKLISTBOX
67 #define GET_REAL_LABEL(label) (label)
69 #endif // wxUSE_CHECKLISTBOX
71 //-----------------------------------------------------------------------------
73 //-----------------------------------------------------------------------------
75 extern bool g_blockEventsOnDrag
;
76 extern bool g_blockEventsOnScroll
;
77 extern wxCursor g_globalCursor
;
79 static bool g_hasDoubleClicked
= FALSE
;
81 //-----------------------------------------------------------------------------
82 // "button_release_event"
83 //-----------------------------------------------------------------------------
85 /* we would normally emit a wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event once
86 a GDK_2BUTTON_PRESS occurs, but this has the particular problem of the
87 listbox keeping the focus until it receives a GDK_BUTTON_RELEASE event.
88 this can lead to race conditions so that we emit the dclick event
89 after the GDK_BUTTON_RELEASE event after the GDK_2BUTTON_PRESS event */
92 gtk_listbox_button_release_callback( GtkWidget
* WXUNUSED(widget
),
93 GdkEventButton
* WXUNUSED(gdk_event
),
96 if (g_isIdle
) wxapp_install_idle_handler();
98 if (g_blockEventsOnDrag
) return FALSE
;
99 if (g_blockEventsOnScroll
) return FALSE
;
101 if (!listbox
->m_hasVMT
) return FALSE
;
103 if (!g_hasDoubleClicked
) return FALSE
;
105 wxCommandEvent
event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
, listbox
->GetId() );
106 event
.SetEventObject( listbox
);
108 wxArrayInt aSelections
;
109 int n
, count
= listbox
->GetSelections(aSelections
);
113 if ( listbox
->HasClientObjectData() )
114 event
.SetClientObject( listbox
->GetClientObject(n
) );
115 else if ( listbox
->HasClientUntypedData() )
116 event
.SetClientData( listbox
->GetClientData(n
) );
117 event
.SetString( listbox
->GetString(n
) );
124 event
.m_commandInt
= n
;
126 listbox
->GetEventHandler()->ProcessEvent( event
);
131 //-----------------------------------------------------------------------------
132 // "button_press_event"
133 //-----------------------------------------------------------------------------
136 gtk_listbox_button_press_callback( GtkWidget
*widget
,
137 GdkEventButton
*gdk_event
,
140 if (g_isIdle
) wxapp_install_idle_handler();
142 if (g_blockEventsOnDrag
) return FALSE
;
143 if (g_blockEventsOnScroll
) return FALSE
;
145 if (!listbox
->m_hasVMT
) return FALSE
;
147 int sel
= listbox
->GtkGetIndex( widget
);
149 #if wxUSE_CHECKLISTBOX
150 if ((listbox
->m_hasCheckBoxes
) && (gdk_event
->x
< 15) && (gdk_event
->type
!= GDK_2BUTTON_PRESS
))
152 wxCheckListBox
*clb
= (wxCheckListBox
*)listbox
;
154 clb
->Check( sel
, !clb
->IsChecked(sel
) );
156 wxCommandEvent
event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
, listbox
->GetId() );
157 event
.SetEventObject( listbox
);
159 listbox
->GetEventHandler()->ProcessEvent( event
);
161 #endif // wxUSE_CHECKLISTBOX
163 /* emit wxEVT_COMMAND_LISTBOX_DOUBLECLICKED later */
164 g_hasDoubleClicked
= (gdk_event
->type
== GDK_2BUTTON_PRESS
);
169 //-----------------------------------------------------------------------------
171 //-----------------------------------------------------------------------------
173 #if wxUSE_CHECKLISTBOX
175 gtk_listbox_key_press_callback( GtkWidget
*widget
, GdkEventKey
*gdk_event
, wxListBox
*listbox
)
177 if (g_isIdle
) wxapp_install_idle_handler();
179 if (g_blockEventsOnDrag
) return FALSE
;
181 if (!listbox
->m_hasVMT
) return FALSE
;
183 if (gdk_event
->keyval
!= ' ') return FALSE
;
185 int sel
= listbox
->GtkGetIndex( widget
);
187 wxCheckListBox
*clb
= (wxCheckListBox
*)listbox
;
189 clb
->Check( sel
, !clb
->IsChecked(sel
) );
191 wxCommandEvent
event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
, listbox
->GetId() );
192 event
.SetEventObject( listbox
);
194 listbox
->GetEventHandler()->ProcessEvent( event
);
198 #endif // wxUSE_CHECKLISTBOX
200 //-----------------------------------------------------------------------------
201 // "select" and "deselect"
202 //-----------------------------------------------------------------------------
204 static void gtk_listitem_select_callback( GtkWidget
*WXUNUSED(widget
), wxListBox
*listbox
);
206 static void gtk_listitem_deselect_callback( GtkWidget
*widget
, wxListBox
*listbox
)
208 gtk_listitem_select_callback( widget
, listbox
);
211 static void gtk_listitem_select_callback( GtkWidget
*WXUNUSED(widget
), wxListBox
*listbox
)
213 if (g_isIdle
) wxapp_install_idle_handler();
215 if (!listbox
->m_hasVMT
) return;
216 if (g_blockEventsOnDrag
) return;
218 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, listbox
->GetId() );
219 event
.SetEventObject( listbox
);
221 wxArrayInt aSelections
;
222 int n
, count
= listbox
->GetSelections(aSelections
);
226 if ( listbox
->HasClientObjectData() )
227 event
.SetClientObject( listbox
->GetClientObject(n
) );
228 else if ( listbox
->HasClientUntypedData() )
229 event
.SetClientData( listbox
->GetClientData(n
) );
230 event
.SetString( listbox
->GetString(n
) );
237 event
.m_commandInt
= n
;
239 listbox
->GetEventHandler()->ProcessEvent( event
);
242 //-----------------------------------------------------------------------------
244 //-----------------------------------------------------------------------------
246 IMPLEMENT_DYNAMIC_CLASS(wxListBox
,wxControl
)
248 // ----------------------------------------------------------------------------
250 // ----------------------------------------------------------------------------
252 wxListBox::wxListBox()
254 m_list
= (GtkList
*) NULL
;
255 #if wxUSE_CHECKLISTBOX
256 m_hasCheckBoxes
= FALSE
;
257 #endif // wxUSE_CHECKLISTBOX
260 bool wxListBox::Create( wxWindow
*parent
, wxWindowID id
,
261 const wxPoint
&pos
, const wxSize
&size
,
262 int n
, const wxString choices
[],
263 long style
, const wxValidator
& validator
,
264 const wxString
&name
)
267 m_acceptsFocus
= TRUE
;
269 if (!PreCreation( parent
, pos
, size
) ||
270 !CreateBase( parent
, id
, pos
, size
, style
, validator
, name
))
272 wxFAIL_MSG( wxT("wxListBox creation failed") );
276 m_widget
= gtk_scrolled_window_new( (GtkAdjustment
*) NULL
, (GtkAdjustment
*) NULL
);
277 if (style
& wxLB_ALWAYS_SB
)
279 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget
),
280 GTK_POLICY_AUTOMATIC
, GTK_POLICY_ALWAYS
);
284 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget
),
285 GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
288 m_list
= GTK_LIST( gtk_list_new() );
290 GtkSelectionMode mode
= GTK_SELECTION_BROWSE
;
291 if (style
& wxLB_MULTIPLE
)
292 mode
= GTK_SELECTION_MULTIPLE
;
293 else if (style
& wxLB_EXTENDED
)
294 mode
= GTK_SELECTION_EXTENDED
;
296 gtk_list_set_selection_mode( GTK_LIST(m_list
), mode
);
298 #ifdef NEW_GTK_SCROLL_CODE
299 gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget
), GTK_WIDGET(m_list
) );
301 gtk_container_add( GTK_CONTAINER(m_widget
), GTK_WIDGET(m_list
) );
304 /* make list scroll when moving the focus down using cursor keys */
305 gtk_container_set_focus_vadjustment(
306 GTK_CONTAINER(m_list
),
307 gtk_scrolled_window_get_vadjustment(
308 GTK_SCROLLED_WINDOW(m_widget
)));
310 gtk_widget_show( GTK_WIDGET(m_list
) );
312 wxSize newSize
= size
;
313 if (newSize
.x
== -1) newSize
.x
= 100;
314 if (newSize
.y
== -1) newSize
.y
= 110;
315 SetSize( newSize
.x
, newSize
.y
);
317 if ( style
& wxLB_SORT
)
319 // this will change DoAppend() behaviour
320 m_strings
= new wxSortedArrayString
;
323 for (int i
= 0; i
< n
; i
++)
326 DoAppend(choices
[i
]);
329 m_parent
->DoAddChild( this );
333 SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW
) );
334 SetForegroundColour( parent
->GetForegroundColour() );
335 SetFont( parent
->GetFont() );
342 wxListBox::~wxListBox()
347 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
349 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
351 // VZ: notice that InsertItems knows nothing about sorting, so calling it
352 // from outside (and not from our own Append) is likely to break
355 // code elsewhere supposes we have as many items in m_clientList as items
357 wxASSERT_MSG( m_clientList
.GetCount() == (size_t)GetCount(),
358 wxT("bug in client data management") );
360 GList
*children
= m_list
->children
;
361 int length
= g_list_length(children
);
363 wxCHECK_RET( pos
<= length
, wxT("invalid index in wxListBox::InsertItems") );
365 size_t nItems
= items
.GetCount();
369 for ( size_t n
= 0; n
< nItems
; n
++ )
371 GtkAddItem( items
[n
] );
373 m_clientList
.Append((wxObject
*)NULL
);
378 wxNode
*node
= m_clientList
.Nth( pos
);
379 for ( size_t n
= 0; n
< nItems
; n
++ )
381 GtkAddItem( items
[n
], pos
+n
);
383 m_clientList
.Insert( node
, (wxObject
*)NULL
);
387 wxASSERT_MSG( m_clientList
.GetCount() == (size_t)GetCount(),
388 wxT("bug in client data management") );
391 int wxListBox::DoAppend( const wxString
& item
)
395 // need to determine the index
396 int index
= m_strings
->Add( item
);
398 // only if not at the end anyway
399 if (index
!= GetCount())
401 GtkAddItem( item
, index
);
403 wxNode
*node
= m_clientList
.Nth( index
);
404 m_clientList
.Insert( node
, (wxObject
*)NULL
);
412 m_clientList
.Append((wxObject
*)NULL
);
414 return GetCount() - 1;
417 void wxListBox::GtkAddItem( const wxString
&item
, int pos
)
419 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
421 GtkWidget
*list_item
;
423 wxString
label(item
);
424 #if wxUSE_CHECKLISTBOX
427 label
.Prepend(CHECKBOX_STRING
);
429 #endif // wxUSE_CHECKLISTBOX
431 list_item
= gtk_list_item_new_with_label( label
.mbc_str() );
433 GList
*gitem_list
= g_list_alloc ();
434 gitem_list
->data
= list_item
;
437 gtk_list_append_items( GTK_LIST (m_list
), gitem_list
);
439 gtk_list_insert_items( GTK_LIST (m_list
), gitem_list
, pos
);
441 gtk_signal_connect( GTK_OBJECT(list_item
), "select",
442 GTK_SIGNAL_FUNC(gtk_listitem_select_callback
), (gpointer
)this );
444 if (HasFlag(wxLB_MULTIPLE
))
445 gtk_signal_connect( GTK_OBJECT(list_item
), "deselect",
446 GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback
), (gpointer
)this );
448 gtk_signal_connect( GTK_OBJECT(list_item
),
449 "button_press_event",
450 (GtkSignalFunc
)gtk_listbox_button_press_callback
,
453 gtk_signal_connect_after( GTK_OBJECT(list_item
),
454 "button_release_event",
455 (GtkSignalFunc
)gtk_listbox_button_release_callback
,
458 #if wxUSE_CHECKLISTBOX
461 gtk_signal_connect( GTK_OBJECT(list_item
),
463 (GtkSignalFunc
)gtk_listbox_key_press_callback
,
466 #endif // wxUSE_CHECKLISTBOX
468 gtk_widget_show( list_item
);
470 ConnectWidget( list_item
);
472 if (GTK_WIDGET_REALIZED(m_widget
))
474 gtk_widget_realize( list_item
);
475 gtk_widget_realize( GTK_BIN(list_item
)->child
);
477 // Apply current widget style to the new list_item
480 gtk_widget_set_style( GTK_WIDGET( list_item
), m_widgetStyle
);
481 GtkBin
*bin
= GTK_BIN( list_item
);
482 GtkWidget
*label
= GTK_WIDGET( bin
->child
);
483 gtk_widget_set_style( label
, m_widgetStyle
);
487 if (m_tooltip
) m_tooltip
->Apply( this );
492 void wxListBox::DoSetItems( const wxArrayString
& items
,
497 DoInsertItems(items
, 0);
501 size_t count
= items
.GetCount();
502 for ( size_t n
= 0; n
< count
; n
++ )
504 SetClientData(n
, clientData
[n
]);
509 // ----------------------------------------------------------------------------
511 // ----------------------------------------------------------------------------
513 void wxListBox::DoSetItemClientData( int n
, void* clientData
)
515 wxCHECK_RET( m_widget
!= NULL
, wxT("invalid listbox control") );
517 wxNode
*node
= m_clientList
.Nth( n
);
518 wxCHECK_RET( node
, wxT("invalid index in wxListBox::DoSetItemClientData") );
520 node
->SetData( (wxObject
*) clientData
);
523 void* wxListBox::DoGetItemClientData( int n
) const
525 wxCHECK_MSG( m_widget
!= NULL
, NULL
, wxT("invalid listbox control") );
527 wxNode
*node
= m_clientList
.Nth( n
);
528 wxCHECK_MSG( node
, NULL
, wxT("invalid index in wxListBox::DoGetItemClientData") );
533 void wxListBox::DoSetItemClientObject( int n
, wxClientData
* clientData
)
535 wxCHECK_RET( m_widget
!= NULL
, wxT("invalid listbox control") );
537 wxNode
*node
= m_clientList
.Nth( n
);
538 wxCHECK_RET( node
, wxT("invalid index in wxListBox::DoSetItemClientObject") );
540 wxClientData
*cd
= (wxClientData
*) node
->Data();
543 node
->SetData( (wxObject
*) clientData
);
546 wxClientData
* wxListBox::DoGetItemClientObject( int n
) const
548 wxCHECK_MSG( m_widget
!= NULL
, (wxClientData
*) NULL
, wxT("invalid listbox control") );
550 wxNode
*node
= m_clientList
.Nth( n
);
551 wxCHECK_MSG( node
, (wxClientData
*)NULL
,
552 wxT("invalid index in wxListBox::DoGetItemClientObject") );
554 return (wxClientData
*) node
->Data();
557 void wxListBox::Clear()
559 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
561 gtk_list_clear_items( m_list
, 0, Number() );
563 if ( HasClientObjectData() )
565 // destroy the data (due to Robert's idea of using wxList<wxObject>
566 // and not wxList<wxClientData> we can't just say
567 // m_clientList.DeleteContents(TRUE) - this would crash!
568 wxNode
*node
= m_clientList
.First();
571 delete (wxClientData
*)node
->Data();
575 m_clientList
.Clear();
581 void wxListBox::Delete( int n
)
583 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
585 GList
*child
= g_list_nth( m_list
->children
, n
);
587 wxCHECK_RET( child
, wxT("wrong listbox index") );
589 GList
*list
= g_list_append( (GList
*) NULL
, child
->data
);
590 gtk_list_remove_items( m_list
, list
);
593 wxNode
*node
= m_clientList
.Nth( n
);
596 if ( m_clientDataItemsType
== ClientData_Object
)
598 wxClientData
*cd
= (wxClientData
*)node
->Data();
602 m_clientList
.DeleteNode( node
);
606 m_strings
->Remove(n
);
609 // ----------------------------------------------------------------------------
610 // string list access
611 // ----------------------------------------------------------------------------
613 void wxListBox::SetString( int n
, const wxString
&string
)
615 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
617 GList
*child
= g_list_nth( m_list
->children
, n
);
620 GtkBin
*bin
= GTK_BIN( child
->data
);
621 GtkLabel
*label
= GTK_LABEL( bin
->child
);
624 #if wxUSE_CHECKLISTBOX
626 str
+= CHECKBOX_STRING
;
627 #endif // wxUSE_CHECKLISTBOX
630 gtk_label_set( label
, str
.mbc_str() );
634 wxFAIL_MSG(wxT("wrong listbox index"));
638 wxString
wxListBox::GetString( int n
) const
640 wxCHECK_MSG( m_list
!= NULL
, wxT(""), wxT("invalid listbox") );
642 GList
*child
= g_list_nth( m_list
->children
, n
);
645 GtkBin
*bin
= GTK_BIN( child
->data
);
646 GtkLabel
*label
= GTK_LABEL( bin
->child
);
648 wxString str
= wxString(GET_REAL_LABEL(label
->label
),*wxConvCurrent
);
653 wxFAIL_MSG(wxT("wrong listbox index"));
658 int wxListBox::GetCount() const
660 wxCHECK_MSG( m_list
!= NULL
, -1, wxT("invalid listbox") );
662 GList
*children
= m_list
->children
;
663 return g_list_length(children
);
666 int wxListBox::FindString( const wxString
&item
) const
668 wxCHECK_MSG( m_list
!= NULL
, -1, wxT("invalid listbox") );
670 GList
*child
= m_list
->children
;
674 GtkBin
*bin
= GTK_BIN( child
->data
);
675 GtkLabel
*label
= GTK_LABEL( bin
->child
);
677 wxString str
= wxString(GET_REAL_LABEL(label
->label
),*wxConvCurrent
);
686 // it's not an error if the string is not found -> no wxCHECK
691 // ----------------------------------------------------------------------------
693 // ----------------------------------------------------------------------------
695 int wxListBox::GetSelection() const
697 wxCHECK_MSG( m_list
!= NULL
, -1, wxT("invalid listbox") );
699 GList
*child
= m_list
->children
;
703 if (GTK_WIDGET(child
->data
)->state
== GTK_STATE_SELECTED
) return count
;
710 int wxListBox::GetSelections( wxArrayInt
& aSelections
) const
712 wxCHECK_MSG( m_list
!= NULL
, -1, wxT("invalid listbox") );
714 // get the number of selected items first
715 GList
*child
= m_list
->children
;
717 for (child
= m_list
->children
; child
!= NULL
; child
= child
->next
)
719 if (GTK_WIDGET(child
->data
)->state
== GTK_STATE_SELECTED
)
728 aSelections
.Alloc(count
); // optimization attempt
730 for (child
= m_list
->children
; child
!= NULL
; child
= child
->next
, i
++)
732 if (GTK_WIDGET(child
->data
)->state
== GTK_STATE_SELECTED
)
740 bool wxListBox::IsSelected( int n
) const
742 wxCHECK_MSG( m_list
!= NULL
, FALSE
, wxT("invalid listbox") );
744 GList
*target
= g_list_nth( m_list
->children
, n
);
747 GList
*child
= m_list
->selection
;
750 if (child
->data
== target
->data
) return TRUE
;
755 wxFAIL_MSG(wxT("wrong listbox index"));
760 void wxListBox::SetSelection( int n
, bool select
)
762 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
767 gtk_list_select_item( m_list
, n
);
769 gtk_list_unselect_item( m_list
, n
);
774 void wxListBox::DoSetFirstItem( int WXUNUSED(n
) )
776 wxFAIL_MSG(wxT("wxListBox::SetFirstItem not implemented"));
779 // ----------------------------------------------------------------------------
781 // ----------------------------------------------------------------------------
783 int wxListBox::GtkGetIndex( GtkWidget
*item
) const
787 GList
*child
= m_list
->children
;
791 if (GTK_WIDGET(child
->data
) == item
) return count
;
800 void wxListBox::ApplyToolTip( GtkTooltips
*tips
, const wxChar
*tip
)
802 GList
*child
= m_list
->children
;
805 gtk_tooltips_set_tip( tips
, GTK_WIDGET( child
->data
), wxConvCurrent
->cWX2MB(tip
), (gchar
*) NULL
);
809 #endif // wxUSE_TOOLTIPS
811 void wxListBox::GtkDisableEvents()
813 GList
*child
= m_list
->children
;
816 gtk_signal_disconnect_by_func( GTK_OBJECT(child
->data
),
817 GTK_SIGNAL_FUNC(gtk_listitem_select_callback
), (gpointer
)this );
819 if (HasFlag(wxLB_MULTIPLE
))
820 gtk_signal_disconnect_by_func( GTK_OBJECT(child
->data
),
821 GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback
), (gpointer
)this );
827 void wxListBox::GtkEnableEvents()
829 GList
*child
= m_list
->children
;
832 gtk_signal_connect( GTK_OBJECT(child
->data
), "select",
833 GTK_SIGNAL_FUNC(gtk_listitem_select_callback
), (gpointer
)this );
835 if (HasFlag(wxLB_MULTIPLE
))
836 gtk_signal_connect( GTK_OBJECT(child
->data
), "deselect",
837 GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback
), (gpointer
)this );
843 GtkWidget
*wxListBox::GetConnectWidget()
845 return GTK_WIDGET(m_list
);
848 bool wxListBox::IsOwnGtkWindow( GdkWindow
*window
)
850 if (wxWindow::IsOwnGtkWindow( window
)) return TRUE
;
852 GList
*child
= m_list
->children
;
855 GtkWidget
*bin
= GTK_WIDGET( child
->data
);
856 if (bin
->window
== window
) return TRUE
;
863 void wxListBox::ApplyWidgetStyle()
867 if (m_backgroundColour
.Ok())
869 GdkWindow
*window
= GTK_WIDGET(m_list
)->window
;
872 m_backgroundColour
.CalcPixel( gdk_window_get_colormap( window
) );
873 gdk_window_set_background( window
, m_backgroundColour
.GetColor() );
874 gdk_window_clear( window
);
878 GList
*child
= m_list
->children
;
881 gtk_widget_set_style( GTK_WIDGET(child
->data
), m_widgetStyle
);
883 GtkBin
*bin
= GTK_BIN( child
->data
);
884 GtkWidget
*label
= GTK_WIDGET( bin
->child
);
885 gtk_widget_set_style( label
, m_widgetStyle
);
891 void wxListBox::OnInternalIdle()
893 wxCursor cursor
= m_cursor
;
894 if (g_globalCursor
.Ok()) cursor
= g_globalCursor
;
896 if (GTK_WIDGET(m_list
)->window
&& cursor
.Ok())
898 /* I now set the cursor the anew in every OnInternalIdle call
899 as setting the cursor in a parent window also effects the
900 windows above so that checking for the current cursor is
903 gdk_window_set_cursor( GTK_WIDGET(m_list
)->window
, cursor
.GetCursor() );
905 GList
*child
= m_list
->children
;
908 GtkBin
*bin
= GTK_BIN( child
->data
);
909 GtkWidget
*label
= GTK_WIDGET( bin
->child
);
914 gdk_window_set_cursor( label
->window
, cursor
.GetCursor() );