X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1de4baa31f17548b32a376a71ce50fee6a3e759c..e4ffab299a1a214fbdd9e3941909323875b32e28:/src/os2/listbox.cpp diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index 5621ec8cd3..69ba786869 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -21,6 +21,7 @@ #include "wx/brush.h" #include "wx/font.h" #include "wx/dc.h" +#include "wx/dcscreen.h" #include "wx/utils.h" #include "wx/scrolwin.h" #endif @@ -92,9 +93,7 @@ bool wxListBox::Create( , int n , const wxString asChoices[] , long lStyle -#if wxUSE_VALIDATORS , const wxValidator& rValidator -#endif , const wxString& rsName ) { @@ -279,6 +278,9 @@ int wxListBox::DoAppend( if (m_windowStyle & wxLB_OWNERDRAW) { wxOwnerDrawn* pNewItem = CreateItem(nIndex); // dummy argument + wxScreenDC vDc; + wxCoord vHeight; + pNewItem->SetName(rsItem); m_aItems.Insert(pNewItem, nIndex); @@ -809,7 +811,7 @@ bool wxListBox::OS2Command( // #define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1) -bool wxListBox::OS2OnMeasure( +long wxListBox::OS2OnMeasure( WXMEASUREITEMSTRUCT* pItem ) { @@ -827,21 +829,21 @@ bool wxListBox::OS2OnMeasure( vDc.SetFont(GetFont()); wxCoord vHeight; + wxCoord vWidth; - pMeasureStruct->rclItem.xRight = 0; + GetSize( &vWidth + ,NULL + ); + + pMeasureStruct->rclItem.xRight = (USHORT)vWidth; pMeasureStruct->rclItem.xLeft = 0; pMeasureStruct->rclItem.yTop = 0; pMeasureStruct->rclItem.yBottom = 0; vHeight = vDc.GetCharHeight() * 2.5; - pMeasureStruct->rclItem.yTop = vHeight; + pMeasureStruct->rclItem.yTop = (USHORT)vHeight; - ::WinSendMsg( GetHWND() - ,LM_SETITEMHEIGHT - ,MPFROMLONG(vHeight) - ,MPFROMLONG(pMeasureStruct->idItem) - ); - return TRUE; + return long(MRFROM2SHORT((USHORT)vHeight, (USHORT)vWidth)); } // end of wxListBox::OS2OnMeasure bool wxListBox::OS2OnDraw (