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
;
317 SetSize( newSize
.x
, newSize
.y
);
319 if ( style
& wxLB_SORT
)
321 // this will change DoAppend() behaviour
322 m_strings
= new wxSortedArrayString
;
326 m_strings
= (wxSortedArrayString
*)NULL
;
329 for (int i
= 0; i
< n
; i
++)
332 DoAppend(choices
[i
]);
335 m_parent
->DoAddChild( this );
339 SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW
) );
340 SetForegroundColour( parent
->GetForegroundColour() );
341 SetFont( parent
->GetFont() );
348 wxListBox::~wxListBox()
353 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
355 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
357 // VZ: notice that InsertItems knows nothing about sorting, so calling it
358 // from outside (and not from our own Append) is likely to break
361 // code elsewhere supposes we have as many items in m_clientList as items
363 wxASSERT_MSG( m_clientList
.GetCount() == (size_t)GetCount(),
364 wxT("bug in client data management") );
366 GList
*children
= m_list
->children
;
367 int length
= g_list_length(children
);
369 wxCHECK_RET( pos
<= length
, wxT("invalid index in wxListBox::InsertItems") );
371 size_t nItems
= items
.GetCount();
375 for ( size_t n
= 0; n
< nItems
; n
++ )
377 GtkAddItem( items
[n
] );
379 m_clientList
.Append((wxObject
*)NULL
);
384 wxNode
*node
= m_clientList
.Nth( pos
);
385 for ( size_t n
= 0; n
< nItems
; n
++ )
387 GtkAddItem( items
[n
], pos
+n
);
389 m_clientList
.Insert( node
, (wxObject
*)NULL
);
393 wxASSERT_MSG( m_clientList
.GetCount() == (size_t)GetCount(),
394 wxT("bug in client data management") );
397 int wxListBox::DoAppend( const wxString
& item
)
401 // need to determine the index
402 int index
= m_strings
->Add( item
);
404 // only if not at the end anyway
405 if (index
!= GetCount())
407 GtkAddItem( item
, index
);
409 wxNode
*node
= m_clientList
.Nth( index
);
410 m_clientList
.Insert( node
, (wxObject
*)NULL
);
418 m_clientList
.Append((wxObject
*)NULL
);
420 return GetCount() - 1;
423 void wxListBox::GtkAddItem( const wxString
&item
, int pos
)
425 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
427 GtkWidget
*list_item
;
429 wxString
label(item
);
430 #if wxUSE_CHECKLISTBOX
433 label
.Prepend(CHECKBOX_STRING
);
435 #endif // wxUSE_CHECKLISTBOX
437 list_item
= gtk_list_item_new_with_label( label
.mbc_str() );
439 GList
*gitem_list
= g_list_alloc ();
440 gitem_list
->data
= list_item
;
443 gtk_list_append_items( GTK_LIST (m_list
), gitem_list
);
445 gtk_list_insert_items( GTK_LIST (m_list
), gitem_list
, pos
);
447 gtk_signal_connect( GTK_OBJECT(list_item
), "select",
448 GTK_SIGNAL_FUNC(gtk_listitem_select_callback
), (gpointer
)this );
450 if (HasFlag(wxLB_MULTIPLE
))
451 gtk_signal_connect( GTK_OBJECT(list_item
), "deselect",
452 GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback
), (gpointer
)this );
454 gtk_signal_connect( GTK_OBJECT(list_item
),
455 "button_press_event",
456 (GtkSignalFunc
)gtk_listbox_button_press_callback
,
459 gtk_signal_connect_after( GTK_OBJECT(list_item
),
460 "button_release_event",
461 (GtkSignalFunc
)gtk_listbox_button_release_callback
,
464 #if wxUSE_CHECKLISTBOX
467 gtk_signal_connect( GTK_OBJECT(list_item
),
469 (GtkSignalFunc
)gtk_listbox_key_press_callback
,
472 #endif // wxUSE_CHECKLISTBOX
474 gtk_widget_show( list_item
);
476 ConnectWidget( list_item
);
478 if (GTK_WIDGET_REALIZED(m_widget
))
480 gtk_widget_realize( list_item
);
481 gtk_widget_realize( GTK_BIN(list_item
)->child
);
483 // Apply current widget style to the new list_item
486 gtk_widget_set_style( GTK_WIDGET( list_item
), m_widgetStyle
);
487 GtkBin
*bin
= GTK_BIN( list_item
);
488 GtkWidget
*label
= GTK_WIDGET( bin
->child
);
489 gtk_widget_set_style( label
, m_widgetStyle
);
493 if (m_tooltip
) m_tooltip
->Apply( this );
498 void wxListBox::DoSetItems( const wxArrayString
& items
,
503 DoInsertItems(items
, 0);
507 size_t count
= items
.GetCount();
508 for ( size_t n
= 0; n
< count
; n
++ )
510 SetClientData(n
, clientData
[n
]);
515 // ----------------------------------------------------------------------------
517 // ----------------------------------------------------------------------------
519 void wxListBox::DoSetItemClientData( int n
, void* clientData
)
521 wxCHECK_RET( m_widget
!= NULL
, wxT("invalid listbox control") );
523 wxNode
*node
= m_clientList
.Nth( n
);
524 wxCHECK_RET( node
, wxT("invalid index in wxListBox::DoSetItemClientData") );
526 node
->SetData( (wxObject
*) clientData
);
529 void* wxListBox::DoGetItemClientData( int n
) const
531 wxCHECK_MSG( m_widget
!= NULL
, NULL
, wxT("invalid listbox control") );
533 wxNode
*node
= m_clientList
.Nth( n
);
534 wxCHECK_MSG( node
, NULL
, wxT("invalid index in wxListBox::DoGetItemClientData") );
539 void wxListBox::DoSetItemClientObject( int n
, wxClientData
* clientData
)
541 wxCHECK_RET( m_widget
!= NULL
, wxT("invalid listbox control") );
543 wxNode
*node
= m_clientList
.Nth( n
);
544 wxCHECK_RET( node
, wxT("invalid index in wxListBox::DoSetItemClientObject") );
546 wxClientData
*cd
= (wxClientData
*) node
->Data();
549 node
->SetData( (wxObject
*) clientData
);
552 wxClientData
* wxListBox::DoGetItemClientObject( int n
) const
554 wxCHECK_MSG( m_widget
!= NULL
, (wxClientData
*) NULL
, wxT("invalid listbox control") );
556 wxNode
*node
= m_clientList
.Nth( n
);
557 wxCHECK_MSG( node
, (wxClientData
*)NULL
,
558 wxT("invalid index in wxListBox::DoGetItemClientObject") );
560 return (wxClientData
*) node
->Data();
563 void wxListBox::Clear()
565 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
567 gtk_list_clear_items( m_list
, 0, Number() );
569 if ( HasClientObjectData() )
571 // destroy the data (due to Robert's idea of using wxList<wxObject>
572 // and not wxList<wxClientData> we can't just say
573 // m_clientList.DeleteContents(TRUE) - this would crash!
574 wxNode
*node
= m_clientList
.First();
577 delete (wxClientData
*)node
->Data();
581 m_clientList
.Clear();
587 void wxListBox::Delete( int n
)
589 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
591 GList
*child
= g_list_nth( m_list
->children
, n
);
593 wxCHECK_RET( child
, wxT("wrong listbox index") );
595 GList
*list
= g_list_append( (GList
*) NULL
, child
->data
);
596 gtk_list_remove_items( m_list
, list
);
599 wxNode
*node
= m_clientList
.Nth( n
);
602 if ( m_clientDataItemsType
== ClientData_Object
)
604 wxClientData
*cd
= (wxClientData
*)node
->Data();
608 m_clientList
.DeleteNode( node
);
612 m_strings
->Remove(n
);
615 // ----------------------------------------------------------------------------
616 // string list access
617 // ----------------------------------------------------------------------------
619 void wxListBox::SetString( int n
, const wxString
&string
)
621 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
623 GList
*child
= g_list_nth( m_list
->children
, n
);
626 GtkBin
*bin
= GTK_BIN( child
->data
);
627 GtkLabel
*label
= GTK_LABEL( bin
->child
);
630 #if wxUSE_CHECKLISTBOX
632 str
+= CHECKBOX_STRING
;
633 #endif // wxUSE_CHECKLISTBOX
636 gtk_label_set( label
, str
.mbc_str() );
640 wxFAIL_MSG(wxT("wrong listbox index"));
644 wxString
wxListBox::GetString( int n
) const
646 wxCHECK_MSG( m_list
!= NULL
, wxT(""), wxT("invalid listbox") );
648 GList
*child
= g_list_nth( m_list
->children
, n
);
651 GtkBin
*bin
= GTK_BIN( child
->data
);
652 GtkLabel
*label
= GTK_LABEL( bin
->child
);
654 wxString str
= wxString(GET_REAL_LABEL(label
->label
),*wxConvCurrent
);
659 wxFAIL_MSG(wxT("wrong listbox index"));
664 int wxListBox::GetCount() const
666 wxCHECK_MSG( m_list
!= NULL
, -1, wxT("invalid listbox") );
668 GList
*children
= m_list
->children
;
669 return g_list_length(children
);
672 int wxListBox::FindString( const wxString
&item
) const
674 wxCHECK_MSG( m_list
!= NULL
, -1, wxT("invalid listbox") );
676 GList
*child
= m_list
->children
;
680 GtkBin
*bin
= GTK_BIN( child
->data
);
681 GtkLabel
*label
= GTK_LABEL( bin
->child
);
683 wxString str
= wxString(GET_REAL_LABEL(label
->label
),*wxConvCurrent
);
692 // it's not an error if the string is not found -> no wxCHECK
697 // ----------------------------------------------------------------------------
699 // ----------------------------------------------------------------------------
701 int wxListBox::GetSelection() const
703 wxCHECK_MSG( m_list
!= NULL
, -1, wxT("invalid listbox") );
705 GList
*child
= m_list
->children
;
709 if (GTK_WIDGET(child
->data
)->state
== GTK_STATE_SELECTED
) return count
;
716 int wxListBox::GetSelections( wxArrayInt
& aSelections
) const
718 wxCHECK_MSG( m_list
!= NULL
, -1, wxT("invalid listbox") );
720 // get the number of selected items first
721 GList
*child
= m_list
->children
;
723 for (child
= m_list
->children
; child
!= NULL
; child
= child
->next
)
725 if (GTK_WIDGET(child
->data
)->state
== GTK_STATE_SELECTED
)
734 aSelections
.Alloc(count
); // optimization attempt
736 for (child
= m_list
->children
; child
!= NULL
; child
= child
->next
, i
++)
738 if (GTK_WIDGET(child
->data
)->state
== GTK_STATE_SELECTED
)
746 bool wxListBox::IsSelected( int n
) const
748 wxCHECK_MSG( m_list
!= NULL
, FALSE
, wxT("invalid listbox") );
750 GList
*target
= g_list_nth( m_list
->children
, n
);
753 GList
*child
= m_list
->selection
;
756 if (child
->data
== target
->data
) return TRUE
;
761 wxFAIL_MSG(wxT("wrong listbox index"));
766 void wxListBox::SetSelection( int n
, bool select
)
768 wxCHECK_RET( m_list
!= NULL
, wxT("invalid listbox") );
773 gtk_list_select_item( m_list
, n
);
775 gtk_list_unselect_item( m_list
, n
);
780 void wxListBox::DoSetFirstItem( int WXUNUSED(n
) )
782 wxFAIL_MSG(wxT("wxListBox::SetFirstItem not implemented"));
785 // ----------------------------------------------------------------------------
787 // ----------------------------------------------------------------------------
789 int wxListBox::GtkGetIndex( GtkWidget
*item
) const
793 GList
*child
= m_list
->children
;
797 if (GTK_WIDGET(child
->data
) == item
) return count
;
806 void wxListBox::ApplyToolTip( GtkTooltips
*tips
, const wxChar
*tip
)
808 GList
*child
= m_list
->children
;
811 gtk_tooltips_set_tip( tips
, GTK_WIDGET( child
->data
), wxConvCurrent
->cWX2MB(tip
), (gchar
*) NULL
);
815 #endif // wxUSE_TOOLTIPS
817 void wxListBox::GtkDisableEvents()
819 GList
*child
= m_list
->children
;
822 gtk_signal_disconnect_by_func( GTK_OBJECT(child
->data
),
823 GTK_SIGNAL_FUNC(gtk_listitem_select_callback
), (gpointer
)this );
825 if (HasFlag(wxLB_MULTIPLE
))
826 gtk_signal_disconnect_by_func( GTK_OBJECT(child
->data
),
827 GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback
), (gpointer
)this );
833 void wxListBox::GtkEnableEvents()
835 GList
*child
= m_list
->children
;
838 gtk_signal_connect( GTK_OBJECT(child
->data
), "select",
839 GTK_SIGNAL_FUNC(gtk_listitem_select_callback
), (gpointer
)this );
841 if (HasFlag(wxLB_MULTIPLE
))
842 gtk_signal_connect( GTK_OBJECT(child
->data
), "deselect",
843 GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback
), (gpointer
)this );
849 GtkWidget
*wxListBox::GetConnectWidget()
851 return GTK_WIDGET(m_list
);
854 bool wxListBox::IsOwnGtkWindow( GdkWindow
*window
)
856 if (wxWindow::IsOwnGtkWindow( window
)) return TRUE
;
858 GList
*child
= m_list
->children
;
861 GtkWidget
*bin
= GTK_WIDGET( child
->data
);
862 if (bin
->window
== window
) return TRUE
;
869 void wxListBox::ApplyWidgetStyle()
873 if (m_backgroundColour
.Ok())
875 GdkWindow
*window
= GTK_WIDGET(m_list
)->window
;
878 m_backgroundColour
.CalcPixel( gdk_window_get_colormap( window
) );
879 gdk_window_set_background( window
, m_backgroundColour
.GetColor() );
880 gdk_window_clear( window
);
884 GList
*child
= m_list
->children
;
887 gtk_widget_set_style( GTK_WIDGET(child
->data
), m_widgetStyle
);
889 GtkBin
*bin
= GTK_BIN( child
->data
);
890 GtkWidget
*label
= GTK_WIDGET( bin
->child
);
891 gtk_widget_set_style( label
, m_widgetStyle
);
897 void wxListBox::OnInternalIdle()
899 wxCursor cursor
= m_cursor
;
900 if (g_globalCursor
.Ok()) cursor
= g_globalCursor
;
902 if (GTK_WIDGET(m_list
)->window
&& cursor
.Ok())
904 /* I now set the cursor the anew in every OnInternalIdle call
905 as setting the cursor in a parent window also effects the
906 windows above so that checking for the current cursor is
909 gdk_window_set_cursor( GTK_WIDGET(m_list
)->window
, cursor
.GetCursor() );
911 GList
*child
= m_list
->children
;
914 GtkBin
*bin
= GTK_BIN( child
->data
);
915 GtkWidget
*label
= GTK_WIDGET( bin
->child
);
920 gdk_window_set_cursor( label
->window
, cursor
.GetCursor() );