X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a6d57d0388f29fca011b0e168e926b61be0f465c..8b3fddc49326c0b6019cd7082218726aa17a5727:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 4ec58a8c93..79c094ccf7 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -124,7 +124,7 @@ static const int IMAGE_MARGIN_IN_REPORT_MODE = 5; int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) { return n1 - n2; } -WX_DEFINE_SORTED_EXPORTED_ARRAY(size_t, wxIndexArray); +WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(size_t, wxIndexArray); // this class is used to store the selected items in the virtual list control // (but it is not tied to list control and so can be used with other controls @@ -518,7 +518,7 @@ public: void OnKillFocus( wxFocusEvent &event ); private: - DECLARE_DYNAMIC_CLASS(wxListTextCtrl); + DECLARE_DYNAMIC_CLASS(wxListTextCtrl) DECLARE_EVENT_TABLE() }; @@ -859,7 +859,7 @@ private: // if this is > 0, the control is frozen and doesn't redraw itself size_t m_freezeCount; - DECLARE_DYNAMIC_CLASS(wxListMainWindow); + DECLARE_DYNAMIC_CLASS(wxListMainWindow) DECLARE_EVENT_TABLE() }; @@ -1751,7 +1751,7 @@ void wxListLineData::ReverseHighlight( void ) // wxListHeaderWindow //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow,wxWindow); +IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow,wxWindow) BEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow) EVT_PAINT (wxListHeaderWindow::OnPaint) @@ -2116,7 +2116,7 @@ void wxListRenameTimer::Notify() // wxListTextCtrl (internal) //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl,wxTextCtrl); +IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl,wxTextCtrl) BEGIN_EVENT_TABLE(wxListTextCtrl,wxTextCtrl) EVT_CHAR (wxListTextCtrl::OnChar) @@ -2226,7 +2226,7 @@ void wxListTextCtrl::OnKillFocus( wxFocusEvent &event ) // wxListMainWindow //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow); +IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow) BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow) EVT_PAINT (wxListMainWindow::OnPaint) @@ -2662,14 +2662,6 @@ void wxListMainWindow::RefreshSelected() 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); @@ -2683,26 +2675,6 @@ void wxListMainWindow::RefreshSelected() 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::Freeze() @@ -3076,7 +3048,15 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) m_renameTimer->Stop(); m_lastOnSame = FALSE; +#ifdef __WXGTK__ + // FIXME: wxGTK generates bad sequence of events prior to doubleclick + // ("down, up, down, double, up" while other ports + // do "down, up, double, up"). We have to have this hack + // in place till somebody fixes wxGTK... if ( current == m_lineBeforeLastClicked ) +#else + if ( current == m_lineLastClicked ) +#endif { SendNotify( current, wxEVT_COMMAND_LIST_ITEM_ACTIVATED ); @@ -3426,10 +3406,6 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) // focus handling // ---------------------------------------------------------------------------- -#ifdef __WXGTK__ -extern wxWindow *g_focusWindow; -#endif - void wxListMainWindow::SetFocus() { // VS: wxListMainWindow derives from wxPanel (via wxScrolledWindow) and wxPanel @@ -3440,7 +3416,7 @@ void wxListMainWindow::SetFocus() wxWindow *oldFocus = FindFocus(); - if ( oldFocus->GetParent() == this ) + if ( oldFocus && oldFocus->GetParent() == this ) { wxWindow::SetFocus(); } @@ -3466,10 +3442,6 @@ void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) ) if ( !GetParent() ) return; -#ifdef __WXGTK__ - g_focusWindow = GetParent(); -#endif - wxFocusEvent event( wxEVT_SET_FOCUS, GetParent()->GetId() ); event.SetEventObject( GetParent() ); GetParent()->GetEventHandler()->ProcessEvent( event ); @@ -4437,10 +4409,8 @@ void wxListMainWindow::OnScroll(wxScrollWinEvent& event) wxListCtrl* lc = GetListCtrl(); wxCHECK_RET( lc, _T("no listctrl window?") ); - lc->m_headerWin->Refresh() ; -#ifdef __WXMAC__ - lc->m_headerWin->MacUpdateImmediately() ; -#endif + lc->m_headerWin->Refresh(); + lc->m_headerWin->Update(); } } @@ -4603,7 +4573,7 @@ bool wxListCtrl::Create(wxWindow *parent, style = style | wxLC_LIST; } - if ( !wxControl::Create( parent, id, pos, size, style, validator, "listctrl" ) ) + if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return FALSE; // don't create the inner window with the border