From e72c4af1c604bce533c68488cdb5802b461ec179 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 5 Apr 2020 08:54:46 +1000 Subject: Feature [feature-requests:1345]. Use ListBox_ macros in preference to LB_ messages. Modify types to match. --- win32/PlatWin.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index e2a220e35..2206c026e 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -2536,7 +2536,7 @@ int ListBoxX::CaretFromEdge() { } void ListBoxX::Clear() { - ::SendMessage(lb, LB_RESETCONTENT, 0, 0); + ListBox_ResetContent(lb); maxItemCharacters = 0; widestItem = nullptr; lti.Clear(); @@ -2557,13 +2557,13 @@ void ListBoxX::Select(int n) { // selected states SetRedraw(false); CentreItem(n); - ::SendMessage(lb, LB_SETCURSEL, n, 0); + ListBox_SetCurSel(lb, n); OnSelChange(); SetRedraw(true); } int ListBoxX::GetSelection() { - return static_cast(::SendMessage(lb, LB_GETCURSEL, 0, 0)); + return ListBox_GetCurSel(lb); } // This is not actually called at present @@ -2723,8 +2723,8 @@ void ListBoxX::SetList(const char *list, char separator, char typesep) { // Finally populate the listbox itself with the correct number of items const int count = lti.Count(); ::SendMessage(lb, LB_INITSTORAGE, count, 0); - for (int j=0; j (top + half)) - ::SendMessage(lb, LB_SETTOPINDEX, n - half , 0); + ListBox_SetTopIndex(lb, n - half); } } } @@ -2987,7 +2987,7 @@ LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT iMessage, WPARAM wParam, const LRESULT lResult = ::SendMessage(hWnd, LB_ITEMFROMPOINT, 0, lParam); const int item = LOWORD(lResult); if (HIWORD(lResult) == 0 && item >= 0) { - ::SendMessage(hWnd, LB_SETCURSEL, item, 0); + ListBox_SetCurSel(hWnd, item); if (lbx) { lbx->OnSelChange(); } @@ -3130,11 +3130,11 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam linesToScroll = 3; } linesToScroll *= (wheelDelta / WHEEL_DELTA); - LRESULT top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0) + linesToScroll; + int top = ListBox_GetTopIndex(lb) + linesToScroll; if (top < 0) { top = 0; } - ::SendMessage(lb, LB_SETTOPINDEX, top, 0); + ListBox_SetTopIndex(lb, top); // update wheel delta residue if (wheelDelta >= 0) wheelDelta = wheelDelta % WHEEL_DELTA; -- cgit v1.2.3