]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/listbox.cpp
restore checks for SM_SWAPBUTTON, it is not defined in WinCE SDK
[wxWidgets.git] / src / gtk / listbox.cpp
index f1e5f96b1ebd071bcb212f15853b40014b6d6705..97530d7a49beb917b78eda4eb7c561f1cf0d5510 100644 (file)
@@ -203,6 +203,7 @@ gtk_listbox_key_press_callback( GtkWidget *WXUNUSED(widget),
         int index = listbox->GetSelection();
         if (index != wxNOT_FOUND)
         {
+        
             wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
             event.SetEventObject( listbox );
             
@@ -221,11 +222,12 @@ gtk_listbox_key_press_callback( GtkWidget *WXUNUSED(widget),
             else if ( listbox->HasClientUntypedData() )
                 event.SetClientData( gtk_tree_entry_get_userdata(entry) );
 
-            bool ret = listbox->HandleWindowEvent( event );
+            /* bool ret = */ listbox->HandleWindowEvent( event );
 
             g_object_unref (entry);
             
-            if (!ret)
+//          wxMac and wxMSW always invoke default action
+//          if (!ret)
             {
                 // DClick not handled -> invoke default action
                 wxWindow *tlw = wxGetTopLevelParent( listbox );
@@ -844,7 +846,7 @@ void wxListBox::GtkSetSelection(int n, const bool select, const bool blockEvent)
     m_blockEvent = false;
 }
 
-void wxListBox::DoSetFirstItem( int n )
+void wxListBox::DoScrollToCell(int n, float alignY, float alignX)
 {
     wxCHECK_RET( m_treeview, wxT("invalid listbox") );
     wxCHECK_RET( IsValid(n), wxT("invalid index"));
@@ -862,11 +864,21 @@ void wxListBox::DoSetFirstItem( int n )
 
     // Scroll to the desired cell (0.0 == topleft alignment)
     gtk_tree_view_scroll_to_cell(m_treeview, path, NULL,
-                                 TRUE, 0.0f, 0.0f);
+                                 TRUE, alignY, alignX);
 
     gtk_tree_path_free(path);
 }
 
+void wxListBox::DoSetFirstItem(int n)
+{
+    DoScrollToCell(n, 0, 0);
+}
+
+void wxListBox::EnsureVisible(int n)
+{
+    DoScrollToCell(n, 0.5, 0);
+}
+
 // ----------------------------------------------------------------------------
 // hittest
 // ----------------------------------------------------------------------------