X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f5c479ccfc9adf26d4cc8515bfbdb3230bd934b6..49c48f81905323f2a1fdd719b093528048e538aa:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index ee141260ec..28e4547c3c 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -837,11 +837,7 @@ protected: // get the colour to be used for drawing the rules wxColour GetRuleColour() const { -#ifdef __WXMAC__ - return *wxWHITE; -#else return wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT); -#endif } private: @@ -1932,7 +1928,7 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) // end of the current column int xpos = 0; - // find the column where this event occured + // find the column where this event occurred int col, countCol = m_owner->GetColumnCount(); for (col = 0; col < countCol; col++) @@ -2147,7 +2143,7 @@ void wxListTextCtrl::OnKeyUp( wxKeyEvent &event ) void wxListTextCtrl::OnKillFocus( wxFocusEvent &event ) { - if ( !m_finished ) + if ( !m_finished && !m_aboutToFinish ) { // We must finish regardless of success, otherwise we'll get // focus problems: @@ -2247,9 +2243,6 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxSOLID ); - wxSize sz = size; - sz.y = 25; - SetScrollbars( 0, 0, 0, 0, 0, 0 ); wxVisualAttributes attr = wxGenericListCtrl::GetClassDefaultAttributes(); @@ -2263,6 +2256,7 @@ wxListMainWindow::~wxListMainWindow() { DoDeleteAllItems(); WX_CLEAR_LIST(wxListHeaderDataList, m_columns); + WX_CLEAR_ARRAY(m_aColWidths); delete m_highlightBrush; delete m_highlightUnfocusedBrush; @@ -3013,11 +3007,11 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) HighlightAll( false ); ReverseHighlight(m_lineSelectSingleOnUp); } - else if (m_lastOnSame) + if (m_lastOnSame) { if ((current == m_current) && (hitResult == wxLIST_HITTEST_ONITEMLABEL) && - HasFlag(wxLC_EDIT_LABELS) ) + HasFlag(wxLC_EDIT_LABELS) ) { m_renameTimer->Start( 100, true ); } @@ -3027,7 +3021,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) } else { - // This is neccessary , because after a DnD operation in + // This is necessary, because after a DnD operation in // from and to ourself, the up event is swallowed by the // DnD code. So on next non-up event (which means here and // now) m_lineSelectSingleOnUp should be reset. @@ -3060,6 +3054,8 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) m_lineLastClicked = current; size_t oldCurrent = m_current; + bool oldWasSelected = IsHighlighted(m_current); + bool cmdModifierDown = event.CmdDown(); if ( IsSingleSel() || !(cmdModifierDown || event.ShiftDown()) ) { @@ -3113,7 +3109,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) } // forceClick is only set if the previous click was on another item - m_lastOnSame = !forceClick && (m_current == oldCurrent); + m_lastOnSame = !forceClick && (m_current == oldCurrent) && oldWasSelected; } } @@ -3720,8 +3716,8 @@ void wxListMainWindow::SetItemState( long litem, long state, long stateMask ) return; } - wxCHECK_RET( litem >= 0 && (size_t)litem < GetItemCount(), - _T("invalid list ctrl item index in SetItem") ); + wxCHECK_RET( litem >= 0 && (size_t)litem < GetItemCount(), + _T("invalid list ctrl item index in SetItem") ); size_t oldCurrent = m_current; size_t item = (size_t)litem; // safe because of the check above @@ -4353,7 +4349,7 @@ void wxListMainWindow::DoDeleteAllItems() ResetVisibleLinesRange(); for (size_t i = 0; i < m_aColWidths.GetCount(); i++) { - delete m_aColWidths.Item(i); + m_aColWidths.Item(i)->bNeedsUpdate = true; } } @@ -4370,6 +4366,7 @@ void wxListMainWindow::DeleteAllItems() void wxListMainWindow::DeleteEverything() { WX_CLEAR_LIST(wxListHeaderDataList, m_columns); + WX_CLEAR_ARRAY(m_aColWidths); DeleteAllItems(); } @@ -4634,7 +4631,7 @@ void wxListMainWindow::OnScroll(wxScrollWinEvent& event) ResetVisibleLinesRange(); // FIXME -#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__) +#if ( defined(__WXGTK__) || defined(__WXMAC__) ) && !defined(__WXUNIVERSAL__) wxScrolledWindow::OnScroll(event); #else HandleOnScroll( event ); @@ -5097,6 +5094,22 @@ wxColour wxGenericListCtrl::GetItemBackgroundColour( long item ) const return info.GetBackgroundColour(); } +void wxGenericListCtrl::SetItemFont( long item, const wxFont &f ) +{ + wxListItem info; + info.m_itemId = item; + info.SetFont( f ); + m_mainWin->SetItem( info ); +} + +wxFont wxGenericListCtrl::GetItemFont( long item ) const +{ + wxListItem info; + info.m_itemId = item; + m_mainWin->GetItem( info ); + return info.GetFont(); +} + int wxGenericListCtrl::GetSelectedItemCount() const { return m_mainWin->GetSelectedItemCount();