]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/listbox.cpp
Restricted column/row resizing in cell window to left button for consistency
[wxWidgets.git] / src / gtk1 / listbox.cpp
index 93815ed498c7e74d37900ab990322024a9e59619..9c89f4584c649fd322c0023ffc463b11cbca04ab 100644 (file)
@@ -93,9 +93,9 @@ static gint wxlistbox_idle_callback( gpointer gdata )
 //-----------------------------------------------------------------------------
 
 extern "C" {
-static gint gtk_listitem_focus_in_callback( GtkWidget *widget,
-                                          GdkEvent *WXUNUSED(event),
-                                          wxWindow *win )
+static gint gtk_listitem_focus_in_callback( GtkWidget *WXUNUSED(widget),
+                                            GdkEvent *WXUNUSED(event),
+                                            wxWindow *win )
 {
     if (g_isIdle)
         wxapp_install_idle_handler();
@@ -110,12 +110,12 @@ static gint gtk_listitem_focus_in_callback( GtkWidget *widget,
         win->m_hasFocus = true;
 
         wxChildFocusEvent eventChildFocus(win);
-        (void)win->GetEventHandler()->ProcessEvent(eventChildFocus);
+        (void)win->HandleWindowEvent(eventChildFocus);
 
         wxFocusEvent eventFocus(wxEVT_SET_FOCUS, win->GetId());
         eventFocus.SetEventObject(win);
 
-        (void)win->GetEventHandler()->ProcessEvent(eventFocus);
+        (void)win->HandleWindowEvent(eventFocus);
     }
 
     return FALSE;
@@ -127,7 +127,9 @@ static gint gtk_listitem_focus_in_callback( GtkWidget *widget,
 //-----------------------------------------------------------------------------
 
 extern "C" {
-static gint gtk_listitem_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win )
+static gint gtk_listitem_focus_out_callback( GtkWidget *WXUNUSED(widget),
+                                             GdkEventFocus *WXUNUSED(gdk_event),
+                                             wxWindowGTK *win )
 {
     if (g_isIdle)
         wxapp_install_idle_handler();
@@ -147,7 +149,7 @@ static gint gtk_listitem_focus_out_callback( GtkWidget *widget, GdkEventFocus *g
         // process it too as otherwise bad things happen, especially in GTK2
         // where the text control simply aborts the program if it doesn't get
         // the matching focus out event
-        (void)win->GetEventHandler()->ProcessEvent( event );
+        (void)win->HandleWindowEvent( event );
     }
 
     return FALSE;
@@ -200,7 +202,7 @@ gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget),
 
     event.SetInt(n);
 
-    listbox->GetEventHandler()->ProcessEvent( event );
+    listbox->HandleWindowEvent( event );
 
     return FALSE;
 }
@@ -235,7 +237,7 @@ gtk_listbox_button_press_callback( GtkWidget *widget,
         wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
         event.SetEventObject( listbox );
         event.SetInt( sel );
-        listbox->GetEventHandler()->ProcessEvent( event );
+        listbox->HandleWindowEvent( event );
     }
 #endif // wxUSE_CHECKLISTBOX
 
@@ -286,7 +288,7 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
         /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
         new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
         new_event.SetCurrentFocus( listbox );
-        ret = listbox->GetEventHandler()->ProcessEvent( new_event );
+        ret = listbox->HandleWindowEvent( new_event );
     }
 
     if ((gdk_event->keyval == GDK_Return) && (!ret))
@@ -307,7 +309,7 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
         wxCommandEvent new_event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
         new_event.SetEventObject( listbox );
         new_event.SetInt( sel );
-        ret = listbox->GetEventHandler()->ProcessEvent( new_event );
+        ret = listbox->HandleWindowEvent( new_event );
     }
 #endif // wxUSE_CHECKLISTBOX
 
@@ -345,7 +347,7 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
                 n = -1;
             }
             new_event.SetInt(n);
-            listbox->GetEventHandler()->ProcessEvent( new_event );
+            listbox->HandleWindowEvent( new_event );
         }
     }
 
@@ -410,7 +412,7 @@ static void gtk_listitem_select_cb( GtkWidget *widget,
 
 //    No longer required with new code in wxLB_SINGLE
 //    listbox->GetEventHandler()->AddPendingEvent( event );
-    listbox->GetEventHandler()->ProcessEvent( event );
+    listbox->HandleWindowEvent( event );
 }
 
 extern "C" {
@@ -433,7 +435,7 @@ static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbo
 
 extern "C" {
 static gint
-gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win )
+gtk_listbox_realized_callback( GtkWidget *WXUNUSED(widget), wxListBox *win )
 {
     if (g_isIdle)
         wxapp_install_idle_handler();
@@ -450,7 +452,7 @@ gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win )
 // wxListBox
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems)
 
 // ----------------------------------------------------------------------------
 // construction
@@ -565,8 +567,7 @@ wxListBox::~wxListBox()
 
     Clear();
 
-    if (m_strings)
-      delete m_strings;
+    delete m_strings;
 }
 
 // ----------------------------------------------------------------------------
@@ -600,7 +601,7 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items,
         const unsigned idx = m_strings ? m_strings->Add(item)
                                        : pos;
 
-        GtkAddItem(item, idx == GetCount() ? -1 : idx);
+        GtkAddItem(item, idx == GetCount() ? (unsigned) -1 : idx);
 
         m_clientList.Insert(idx, NULL);
 
@@ -1007,23 +1008,8 @@ GtkWidget *wxListBox::GetConnectWidget()
 
 bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
 {
-    return true;
-
-#if 0
-    if (m_widget->window == window) return true;
-
-    if (GTK_WIDGET(m_list)->window == window) return true;
-
-    GList *child = m_list->children;
-    while (child)
-    {
-        GtkWidget *bin = GTK_WIDGET( child->data );
-        if (bin->window == window) return true;
-        child = child->next;
-    }
-
-    return false;
-#endif
+    return m_widget->window == window ||
+                GTK_WIDGET(m_list)->window == window;
 }
 
 void wxListBox::DoApplyWidgetStyle(GtkRcStyle *style)