]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listctrl.cpp
Reverted wxChoice size fix due to problems in W2K and below
[wxWidgets.git] / src / generic / listctrl.cpp
index 52fc578774f518468f1b9c0ca83fe8783fd72716..043001015ce431a81df8eb6c6b6d49a67d71a6f2 100644 (file)
@@ -2858,6 +2858,7 @@ void wxListMainWindow::OnRenameCancelled(size_t itemEdit)
 
 void wxListMainWindow::OnMouse( wxMouseEvent &event )
 {
+
 #ifdef __WXMAC__
     // On wxMac we can't depend on the EVT_KILL_FOCUS event to properly
     // shutdown the edit control when the mouse is clicked elsewhere on the
@@ -2879,7 +2880,15 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
     }
 
     if ( !HasCurrent() || IsEmpty() )
+    {
+        if (event.RightDown())
+        {
+            SendNotify( (size_t)-1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, event.GetPosition() );
+            // Allow generation of context menu event
+            event.Skip();
+        }
         return;
+    }
 
     if (m_dirty)
         return;
@@ -2949,8 +2958,19 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
 
     if ( !hitResult )
     {
-        // outside of any item, reset the selection and bail out
-        HighlightAll(false);
+        // outside of any item
+        if (event.RightDown())
+        {
+            SendNotify( (size_t) -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, event.GetPosition() );
+            // Allow generation of context menu event
+            event.Skip();
+        }
+        else
+        {
+            // reset the selection and bail out
+            HighlightAll(false);
+        }
+        
         return;
     }
 
@@ -3264,6 +3284,10 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
 
         case WXK_PAGEUP:
             {
+                // we get a floating point exception without this
+                if (m_linesPerPage == 0)
+                    m_linesPerPage = 1;
+                    
                 int steps = InReportView() ? m_linesPerPage - 1 : m_current % m_linesPerPage;
 
                 int index = m_current - steps;
@@ -3276,6 +3300,10 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
 
         case WXK_PAGEDOWN:
             {
+                // we get a floating point exception without this
+                if (m_linesPerPage == 0)
+                    m_linesPerPage = 1;
+                    
                 int steps = InReportView()
                                ? m_linesPerPage - 1
                                : m_linesPerPage - (m_current % m_linesPerPage) - 1;
@@ -4588,7 +4616,13 @@ void wxListMainWindow::SortItems( wxListCtrlCompare fn, long data )
 
 void wxListMainWindow::OnScroll(wxScrollWinEvent& event)
 {
-    // update our idea of which lines are shown when we redraw the window the
+       int cw, ch, vw, vh;
+       GetVirtualSize(&vw, &vh);  
+       GetClientSize(&cw, &ch);
+
+       if( event.GetOrientation() == wxVERTICAL && ch >= vh)
+               return;
+       // update our idea of which lines are shown when we redraw the window the
     // next time
     ResetVisibleLinesRange();
 
@@ -5486,12 +5520,12 @@ bool wxGenericListCtrl::DoPopupMenu( wxMenu *menu, int x, int y )
 
 void wxGenericListCtrl::DoClientToScreen( int *x, int *y ) const
 {
-    return m_mainWin->DoClientToScreen(x, y);
+    m_mainWin->DoClientToScreen(x, y);
 }
 
 void wxGenericListCtrl::DoScreenToClient( int *x, int *y ) const
 {
-    return m_mainWin->DoScreenToClient(x, y);
+    m_mainWin->DoScreenToClient(x, y);
 }
 
 void wxGenericListCtrl::SetFocus()