]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/listbox.cpp
use correct way to get a pointer to vector elements in DoGetPartialTextExtents()
[wxWidgets.git] / src / os2 / listbox.cpp
index 5621ec8cd3c20eb2105e33bf6abc0dc65663f206..6d56ce18909a32c3dad9b9201f0a3257528b0ed4 100644 (file)
@@ -21,6 +21,7 @@
 #include "wx/brush.h"
 #include "wx/font.h"
 #include "wx/dc.h"
 #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
 #include "wx/utils.h"
 #include "wx/scrolwin.h"
 #endif
@@ -84,6 +85,23 @@ wxListBox::wxListBox()
     m_nSelected = 0;
 } // end of wxListBox::wxListBox
 
     m_nSelected = 0;
 } // end of wxListBox::wxListBox
 
+bool wxListBox::Create(
+  wxWindow*                         pParent
+, wxWindowID                        vId
+, const wxPoint&                    rPos
+, const wxSize&                     rSize
+, const wxArrayString&              asChoices
+, long                              lStyle
+, const wxValidator&                rValidator
+, const wxString&                   rsName
+)
+{
+    wxCArrayString chs(asChoices);
+
+    return Create(pParent, vId, rPos, rSize, chs.GetCount(), chs.GetStrings(),
+                  lStyle, rValidator, rsName);
+}
+
 bool wxListBox::Create(
   wxWindow*                         pParent
 , wxWindowID                        vId
 bool wxListBox::Create(
   wxWindow*                         pParent
 , wxWindowID                        vId
@@ -92,9 +110,7 @@ bool wxListBox::Create(
 , int                               n
 , const wxString                    asChoices[]
 , long                              lStyle
 , int                               n
 , const wxString                    asChoices[]
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rValidator
 , const wxValidator&                rValidator
-#endif
 , const wxString&                   rsName
 )
 {
 , const wxString&                   rsName
 )
 {
@@ -279,6 +295,9 @@ int wxListBox::DoAppend(
     if (m_windowStyle & wxLB_OWNERDRAW)
     {
         wxOwnerDrawn*               pNewItem = CreateItem(nIndex); // dummy argument
     if (m_windowStyle & wxLB_OWNERDRAW)
     {
         wxOwnerDrawn*               pNewItem = CreateItem(nIndex); // dummy argument
+        wxScreenDC                  vDc;
+        wxCoord                     vHeight;
+
 
         pNewItem->SetName(rsItem);
         m_aItems.Insert(pNewItem, nIndex);
 
         pNewItem->SetName(rsItem);
         m_aItems.Insert(pNewItem, nIndex);
@@ -809,7 +828,7 @@ bool wxListBox::OS2Command(
 //
 #define OWNER_DRAWN_LISTBOX_EXTRA_SPACE    (1)
 
 //
 #define OWNER_DRAWN_LISTBOX_EXTRA_SPACE    (1)
 
-bool wxListBox::OS2OnMeasure(
+long wxListBox::OS2OnMeasure(
   WXMEASUREITEMSTRUCT*              pItem
 )
 {
   WXMEASUREITEMSTRUCT*              pItem
 )
 {
@@ -827,21 +846,21 @@ bool wxListBox::OS2OnMeasure(
     vDc.SetFont(GetFont());
 
     wxCoord                         vHeight;
     vDc.SetFont(GetFont());
 
     wxCoord                         vHeight;
+    wxCoord                         vWidth;
+
+    GetSize( &vWidth
+            ,NULL
+           );
 
 
-    pMeasureStruct->rclItem.xRight = 0;
+    pMeasureStruct->rclItem.xRight = (USHORT)vWidth;
     pMeasureStruct->rclItem.xLeft  = 0;
     pMeasureStruct->rclItem.yTop   = 0;
     pMeasureStruct->rclItem.yBottom = 0;
 
     vHeight = vDc.GetCharHeight() * 2.5;
     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 (
 } // end of wxListBox::OS2OnMeasure
 
 bool wxListBox::OS2OnDraw (