X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/35c2acd4a81a3b41ced9253f744a00e64de2a423..0ad966eeac4c245a745c6a2056613f9c7367e4b2:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 578af99fef..b23125349f 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -17,11 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "listctrl.h" - #pragma implementation "listctrlbase.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -62,7 +57,8 @@ #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(NMLVFINDITEM) #define HAVE_NMLVFINDITEM 1 #elif defined(__DMC__) || defined(NM_FINDITEM) - #define HAVE_NM_FINDITEM 1 + #define HAVE_NMLVFINDITEM 1 + #define NMLVFINDITEM NM_FINDITEM #endif // ---------------------------------------------------------------------------- @@ -123,7 +119,7 @@ public: } // init with conversion - void Init(LV_ITEM_OTHER& item) + void Init(const LV_ITEM_OTHER& item) { // avoid unnecessary dynamic memory allocation, jjust make m_pItem // point to our own m_item @@ -366,6 +362,10 @@ bool wxListCtrl::Create(wxWindow *parent, // versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build wxSetCCUnicodeFormat(GetHwnd()); + // We must set the default text colour to the system/theme color, otherwise + // GetTextColour will always return black + SetTextColour(GetDefaultAttributes().colFg); + // for comctl32.dll v 4.70+ we want to have some non default extended // styles because it's prettier (and also because wxGTK does it like this) if ( InReportView() && wxApp::GetComCtl32Version() >= 470 ) @@ -663,7 +663,7 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const } // Sets information about this column -bool wxListCtrl::SetColumn(int col, wxListItem& item) +bool wxListCtrl::SetColumn(int col, const wxListItem& item) { LV_COLUMN lvCol; wxConvertToMSWListCol(col, item, lvCol); @@ -1490,7 +1490,7 @@ long wxListCtrl::HitTest(const wxPoint& point, int& flags) // Inserts an item, returning the index of the new item if successful, // -1 otherwise. -long wxListCtrl::InsertItem(wxListItem& info) +long wxListCtrl::InsertItem(const wxListItem& info) { wxASSERT_MSG( !IsVirtual(), _T("can't be used with virtual controls") ); @@ -1563,7 +1563,7 @@ long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex) } // For list view mode (only), inserts a column. -long wxListCtrl::InsertColumn(long col, wxListItem& item) +long wxListCtrl::InsertColumn(long col, const wxListItem& item) { LV_COLUMN lvCol; wxConvertToMSWListCol(col, item, lvCol); @@ -1656,7 +1656,7 @@ int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM l return internalData->user_fn(d1, d2, internalData->data); -}; +} bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data) { @@ -2160,7 +2160,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } break; -#if HAVE_NMLVFINDITEM || HAVE_NM_FINDITEM +#ifdef HAVE_NMLVFINDITEM case LVN_ODFINDITEM: // this message is only used with the virtual list control but // even there we don't want to always use it: in a control with @@ -2169,11 +2169,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // application waiting while it performs linear search if ( IsVirtual() && GetItemCount() <= 1000 ) { -#if HAVE_NMLVFINDITEM NMLVFINDITEM* pFindInfo = (NMLVFINDITEM*)lParam; -#else - NM_FINDITEM* pFindInfo = (NM_FINDITEM*)lParam; -#endif // no match by default *result = -1; @@ -2234,7 +2230,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) processed = false; } break; -#endif // HAVE_NMLVFINDITEM || HAVE_NM_FINDITEM +#endif // HAVE_NMLVFINDITEM case LVN_GETDISPINFO: if ( IsVirtual() ) @@ -2589,20 +2585,20 @@ static wxListItemInternalData *wxGetInternalData(HWND hwnd, long itemId) return NULL; return (wxListItemInternalData *) it.lParam; -}; +} static wxListItemInternalData *wxGetInternalData(const wxListCtrl *ctl, long itemId) { return wxGetInternalData(GetHwndOf(ctl), itemId); -}; +} static wxListItemAttr *wxGetInternalDataAttr(wxListCtrl *ctl, long itemId) { wxListItemInternalData *data = wxGetInternalData(ctl, itemId); return data ? data->attr : NULL; -}; +} static void wxDeleteInternalData(wxListCtrl* ctl, long itemId) { @@ -2828,7 +2824,8 @@ static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item, // // we don't use LVCFMT_COL_HAS_IMAGES because it doesn't seem to // make any difference in my tests -- but maybe we should? - lvCol.fmt |= LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE; + if ( item.m_image != -1 ) + lvCol.fmt |= LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE; lvCol.iImage = item.m_image; }