]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/checklst.cpp
using native key handling, closes #10406
[wxWidgets.git] / src / os2 / checklst.cpp
index 3bb67b387b54e44cf895cbfcefce7e07bc4458bc..f0a3ac723bc88e2b18527d57b4a673e2849e5885 100644 (file)
 
 #if wxUSE_CHECKLISTBOX && wxUSE_OWNER_DRAWN
 
-#include "wx/object.h"
-#include "wx/colour.h"
-#include "wx/font.h"
-#include "wx/bitmap.h"
-#include "wx/window.h"
-#include "wx/listbox.h"
-#include "wx/ownerdrw.h"
-#include "wx/settings.h"
-#include "wx/dcmemory.h"
-#include "wx/dcscreen.h"
 #include "wx/checklst.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/object.h"
+    #include "wx/log.h"
+    #include "wx/window.h"
+    #include "wx/dcmemory.h"
+    #include "wx/dcscreen.h"
+    #include "wx/settings.h"
+    #include "wx/listbox.h"
+    #include "wx/bitmap.h"
+    #include "wx/colour.h"
+    #include "wx/font.h"
+#endif
+
+#include "wx/os2/dc.h"
+#include "wx/ownerdrw.h"
 
 #define INCL_PM
 #include <os2.h>
@@ -58,9 +63,7 @@ public:
     //
     // ctor
     //
-    wxCheckListBoxItem( wxCheckListBox* pParent,
-                        size_t          nIndex
-                      );
+    wxCheckListBoxItem(wxCheckListBox* pParent, size_t nIndex);
 
     //
     // Drawing functions
@@ -86,8 +89,7 @@ private:
 
 
 
-wxCheckListBoxItem::wxCheckListBoxItem ( wxCheckListBox* pParent,
-                                         size_t nIndex)
+wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox* pParent, size_t nIndex)
                    :wxOwnerDrawn( wxEmptyString, true /* checkable */ )
 {
     m_bChecked = false;
@@ -111,7 +113,9 @@ bool wxCheckListBoxItem::OnDrawItem ( wxDC& rDc,
 {
     wxRect vRect = rRect;
 
-    ::WinQueryWindowRect( m_pParent->GetHWND(), &rDc.m_vRclPaint );
+
+    wxPMDCImpl *impl = (wxPMDCImpl*) rDc.GetImpl();
+    ::WinQueryWindowRect( m_pParent->GetHWND(), &impl->m_vRclPaint );
     if (IsChecked())
         eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked);
 
@@ -166,8 +170,8 @@ bool wxCheckListBoxItem::OnDrawItem ( wxDC& rDc,
             //
             HBITMAP hChkBmp = ::WinGetSysBitmap( HWND_DESKTOP, SBMP_MENUCHECK );
             POINTL  vPoint = {nX, nOldY + 3};
-
-            ::WinDrawBitmap( rDc.GetHPS(),
+            wxPMDCImpl *impl = (wxPMDCImpl*) rDc.GetImpl();
+            ::WinDrawBitmap( impl->GetHPS(),
                              hChkBmp,
                              NULL,
                              &vPoint,
@@ -184,7 +188,7 @@ bool wxCheckListBoxItem::OnDrawItem ( wxDC& rDc,
 //
 // Change the state of the item and redraw it
 //
-void wxCheckListBoxItem::Check ( bool bCheck )
+void wxCheckListBoxItem::Check( bool bCheck )
 {
     m_bChecked = bCheck;
 
@@ -270,7 +274,7 @@ wxCheckListBox::wxCheckListBox ( wxWindow* pParent,
             lStyle | wxLB_OWNERDRAW, rVal, rsName );
 } // end of wxCheckListBox::wxCheckListBox
 
-void wxCheckListBox::Delete( int n )
+void wxCheckListBox::Delete(unsigned int n)
 {
     wxCHECK_RET( IsValid(n),
                  wxT("invalid index in wxCheckListBox::Delete") );
@@ -283,28 +287,9 @@ void wxCheckListBox::Delete( int n )
     m_aItems.RemoveAt(n);
 } // end of wxCheckListBox::Delete
 
-void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos)
-{
-    // pos is validated in wxListBox
-    wxListBox::DoInsertItems( items, pos );
-    int n = items.GetCount();
-    for (int i = 0; i < n; i++)
-    {
-        wxOwnerDrawn* pNewItem = CreateItem((size_t)(pos + i));
-
-        pNewItem->SetName(items[i]);
-        m_aItems.Insert(pNewItem, (size_t)(pos + i));
-        ::WinSendMsg( (HWND)GetHWND(),
-                      LM_SETITEMHANDLE,
-                      (MPARAM)(i + pos),
-                      MPFROMP(pNewItem)
-                    );
-    }
-} // end of wxCheckListBox::InsertItems
-
 bool wxCheckListBox::SetFont ( const wxFont& rFont )
 {
-    for (size_t i = 0; i < m_aItems.GetCount(); i++)
+    for (unsigned int i = 0; i < m_aItems.GetCount(); i++)
         m_aItems[i]->SetFont(rFont);
     wxListBox::SetFont(rFont);
     return true;
@@ -320,7 +305,7 @@ bool wxCheckListBox::SetFont ( const wxFont& rFont )
 //
 // Create a check list box item
 //
-wxOwnerDrawn* wxCheckListBox::CreateItem ( size_t nIndex )
+wxOwnerDrawn* wxCheckListBox::CreateItem(size_t nIndex)
 {
     wxCheckListBoxItem* pItem = new wxCheckListBoxItem( this, nIndex );
     return pItem;
@@ -360,12 +345,12 @@ long wxCheckListBox::OS2OnMeasure ( WXMEASUREITEMSTRUCT* pItem )
 // Check items
 // -----------
 //
-bool wxCheckListBox::IsChecked ( size_t uiIndex) const
+bool wxCheckListBox::IsChecked(unsigned int uiIndex) const
 {
     return GetItem(uiIndex)->IsChecked();
 } // end of wxCheckListBox::IsChecked
 
-void wxCheckListBox::Check ( size_t uiIndex, bool bCheck )
+void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck)
 {
     GetItem(uiIndex)->Check(bCheck);
 } // end of wxCheckListBox::Check