]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listctrl.cpp
minor additions to wxCmdLineParser tests
[wxWidgets.git] / src / generic / listctrl.cpp
index b556a2e8eb27fe50c09d56080533cb22728ca228..c19161b5c2981ecd170ed82c7c7d5a82966d1656 100644 (file)
@@ -2044,6 +2044,14 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
                                     : wxEVT_COMMAND_LIST_COL_RIGHT_CLICK,
                                 parent->GetId() );
                 le.SetEventObject( parent );
                                     : wxEVT_COMMAND_LIST_COL_RIGHT_CLICK,
                                 parent->GetId() );
                 le.SetEventObject( parent );
+                le.m_pointDrag = event.GetPosition();
+
+                // the position should be relative to the parent window, not
+                // this one for compatibility with MSW and common sense: the
+                // user code doesn't know anything at all about this header
+                // window, so why should it get positions relative to it?
+                le.m_pointDrag.y -= GetSize().y;
+
                 le.m_col = m_column;
                 parent->GetEventHandler()->ProcessEvent( le );
             }
                 le.m_col = m_column;
                 parent->GetEventHandler()->ProcessEvent( le );
             }
@@ -2613,6 +2621,14 @@ void wxListMainWindow::RefreshSelected()
         to = GetItemCount() - 1;
     }
 
         to = GetItemCount() - 1;
     }
 
+    // VZ: this code would work fine if wxGTK wxWindow::Refresh() were
+    //     reasonable, i.e. if it only generated one expose event for
+    //     several calls to it - as it is, each Refresh() results in a
+    //     repaint which provokes flicker too horrible to be seen
+    //
+    //     when/if wxGTK is fixed, this code should be restored as normally it
+    //     should generate _less_ flicker than the version below
+#ifndef __WXGTK__
     if ( HasCurrent() && m_current >= from && m_current <= to )
     {
         RefreshLine(m_current);
     if ( HasCurrent() && m_current >= from && m_current <= to )
     {
         RefreshLine(m_current);
@@ -2626,6 +2642,26 @@ void wxListMainWindow::RefreshSelected()
             RefreshLine(line);
         }
     }
             RefreshLine(line);
         }
     }
+#else // __WXGTK__
+    size_t selMin = (size_t)-1,
+           selMax = 0;
+
+    for ( size_t line = from; line <= to; line++ )
+    {
+        if ( IsHighlighted(line) || (line == m_current) )
+        {
+            if ( line < selMin )
+                selMin = line;
+            if ( line > selMax )
+                selMax = line;
+        }
+    }
+
+    if ( selMin != (size_t)-1 )
+    {
+        RefreshLines(selMin, selMax);
+    }
+#endif // !__WXGTK__/__WXGTK__
 }
 
 void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
 }
 
 void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
@@ -3353,12 +3389,19 @@ extern wxWindow *g_focusWindow;
 
 void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
 {
 
 void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
 {
-    m_hasFocus = TRUE;
+    // wxGTK sends us EVT_SET_FOCUS events even if we had never got
+    // EVT_KILL_FOCUS before which means that we finish by redrawing the items
+    // which are already drawn correctly resulting in horrible flicker - avoid
+    // it
+    if ( !m_hasFocus )
+    {
+        m_hasFocus = TRUE;
 
 
-    if (!GetParent())
-        return;
+        RefreshSelected();
+    }
 
 
-    RefreshSelected();
+    if ( !GetParent() )
+        return;
 
 #ifdef __WXGTK__
     g_focusWindow = GetParent();
 
 #ifdef __WXGTK__
     g_focusWindow = GetParent();