X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d8eb95b3536b0702122fa65b02ad9c3feab87af..04236b74cd5c82645aff3c99736291ebe2f52cc5:/src/os2/listbox.cpp diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index 7d226adb3b..688ccfbf51 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -29,6 +29,7 @@ #include "wx/window.h" #endif +#include "wx/os2/dcclient.h" #include "wx/os2/private.h" #define INCL_M @@ -307,7 +308,6 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter & items, pNewItem->SetName(items[i]); m_aItems.Insert(pNewItem, n); - ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, (MPARAM)n, MPFROMP(pNewItem)); pNewItem->SetFont(GetFont()); } #endif @@ -384,17 +384,6 @@ void wxListBox::DoSetItemClientData(unsigned int n, void* pClientData) wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetClientData") ); -#if wxUSE_OWNER_DRAWN - if ( m_windowStyle & wxLB_OWNERDRAW ) - { - // - // Client data must be pointer to wxOwnerDrawn, otherwise we would crash - // in OnMeasure/OnDraw. - // - wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes")); - } -#endif // wxUSE_OWNER_DRAWN - ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(n), MPFROMP(pClientData)); } // end of wxListBox::DoSetItemClientData @@ -660,7 +649,7 @@ bool wxListBox::OS2Command( n = -1; } vEvent.SetInt(n); - return GetEventHandler()->ProcessEvent(vEvent); + return HandleWindowEvent(vEvent); } // end of wxListBox::OS2Command // ---------------------------------------------------------------------------- @@ -713,7 +702,6 @@ bool wxListBox::OS2OnDraw ( ) { POWNERITEM pDrawStruct = (POWNERITEM)pItem; - LONG lItemID = pDrawStruct->idItem; int eAction = 0; int eStatus = 0; @@ -726,24 +714,18 @@ bool wxListBox::OS2OnDraw ( // // The item may be -1 for an empty listbox // - if (lItemID == -1L) + if (pDrawStruct->idItem == -1L) return false; - wxListBoxItem* pData = (wxListBoxItem*)PVOIDFROMMR( ::WinSendMsg( GetHwnd() - ,LM_QUERYITEMHANDLE - ,MPFROMLONG(pDrawStruct->idItem) - ,(MPARAM)0 - ) - ); - - wxCHECK(pData, false ); + wxListBoxItem* pData = (wxListBoxItem*)m_aItems[pDrawStruct->idItem]; - wxDC vDc; + wxClientDC vDc(this); + wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl(); wxPoint pt1( pDrawStruct->rclItem.xLeft, pDrawStruct->rclItem.yTop ); wxPoint pt2( pDrawStruct->rclItem.xRight, pDrawStruct->rclItem.yBottom ); wxRect vRect( pt1, pt2 ); - vDc.SetHPS(pDrawStruct->hps); + impl->SetHPS(pDrawStruct->hps); if (pDrawStruct->fsAttribute == pDrawStruct->fsAttributeOld) {