]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/checklst.cpp
add a outside area for borders and focus rects of 3 pixels to a wxWindowDC's clip...
[wxWidgets.git] / src / os2 / checklst.cpp
index f3a639ff6a8aeda38d4b85a47def8d1d2dd9de0e..0f280685810fd28fe934d755e92688ee75654c33 100644 (file)
@@ -27,6 +27,7 @@
 #include "wx/ownerdrw.h"
 #include "wx/settings.h"
 #include "wx/dcmemory.h"
 #include "wx/ownerdrw.h"
 #include "wx/settings.h"
 #include "wx/dcmemory.h"
+#include "wx/dcscreen.h"
 #include "wx/os2/checklst.h"
 #include "wx/log.h"
 
 #include "wx/os2/checklst.h"
 #include "wx/log.h"
 
@@ -112,13 +113,16 @@ bool wxCheckListBoxItem::OnDrawItem (
 {
     wxRect                          vRect = rRect;
 
 {
     wxRect                          vRect = rRect;
 
+    ::WinQueryWindowRect( m_pParent->GetHWND()
+                         ,&rDc.m_vRclPaint
+                        );
     if (IsChecked())
         eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked);
 
     //
     // Unfortunately PM doesn't quite get the text position exact.  We need to alter
     // it down and to the right, just a little bit.  The coords in rRect are OS/2
     if (IsChecked())
         eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked);
 
     //
     // Unfortunately PM doesn't quite get the text position exact.  We need to alter
     // it down and to the right, just a little bit.  The coords in rRect are OS/2
-    // coords not wxWindows coords.
+    // coords not wxWidgets coords.
     //
     vRect.x += 5;
     vRect.y -= 3;
     //
     vRect.x += 5;
     vRect.y -= 3;
@@ -141,9 +145,6 @@ bool wxCheckListBoxItem::OnDrawItem (
         m_pParent->GetSize( NULL
                            ,&nParentHeight
                           );
         m_pParent->GetSize( NULL
                            ,&nParentHeight
                           );
-        ::WinQueryWindowRect( m_pParent->GetHWND()
-                             ,&rDc.m_vRclPaint
-                            );
 
         nY = nParentHeight - nY - nCheckHeight;
         vPenBack = wxPen(vColour, 1, wxSOLID);
 
         nY = nParentHeight - nY - nCheckHeight;
         vPenBack = wxPen(vColour, 1, wxSOLID);
@@ -225,9 +226,6 @@ void wxCheckListBoxItem::Check (
         m_nIndex = (size_t)nIndex;
     }
 
         m_nIndex = (size_t)nIndex;
     }
 
-    HWND                            hWndListbox = (HWND)m_pParent->GetHWND();
-    RECTL                           rUpdate;
-    MRESULT                         mRc;
 
     wxCommandEvent                  vEvent( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
                                            ,m_pParent->GetId()
 
     wxCommandEvent                  vEvent( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
                                            ,m_pParent->GetId()
@@ -273,9 +271,7 @@ wxCheckListBox::wxCheckListBox (
 , int                               nStrings
 , const wxString                    asChoices[]
 , long                              lStyle
 , int                               nStrings
 , const wxString                    asChoices[]
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rVal
 , const wxValidator&                rVal
-#endif
 , const wxString&                   rsName
 )
               : wxListBox()
 , const wxString&                   rsName
 )
               : wxListBox()
@@ -287,9 +283,32 @@ wxCheckListBox::wxCheckListBox (
            ,nStrings
            ,asChoices
            ,lStyle | wxLB_OWNERDRAW
            ,nStrings
            ,asChoices
            ,lStyle | wxLB_OWNERDRAW
-#if wxUSE_VALIDATORS
            ,rVal
            ,rVal
-#endif
+           ,rsName
+          );
+} // end of wxCheckListBox::wxCheckListBox
+
+wxCheckListBox::wxCheckListBox (
+  wxWindow*                         pParent
+, wxWindowID                        vId
+, const wxPoint&                    rPos
+, const wxSize&                     rSize
+, const wxArrayString&              asChoices
+, long                              lStyle
+, const wxValidator&                rVal
+, const wxString&                   rsName
+)
+              : wxListBox()
+{
+    wxCArrayString chs(asChoices);
+    Create( pParent
+           ,vId
+           ,rPos
+           ,rSize
+           ,chs.GetCount()
+           ,chs.GetStrings()
+           ,lStyle | wxLB_OWNERDRAW
+           ,rVal
            ,rsName
           );
 } // end of wxCheckListBox::wxCheckListBox
            ,rsName
           );
 } // end of wxCheckListBox::wxCheckListBox
@@ -372,7 +391,7 @@ wxOwnerDrawn* wxCheckListBox::CreateItem (
 // Return item size
 // ----------------
 //
 // Return item size
 // ----------------
 //
-bool wxCheckListBox::OS2OnMeasure (
+long wxCheckListBox::OS2OnMeasure (
   WXMEASUREITEMSTRUCT*             pItem
 )
 {
   WXMEASUREITEMSTRUCT*             pItem
 )
 {
@@ -391,9 +410,9 @@ bool wxCheckListBox::OS2OnMeasure (
         // Add place for the check mark
         //
         pStruct->rclItem.xRight += wxOwnerDrawn::GetDefaultMarginWidth();
         // Add place for the check mark
         //
         pStruct->rclItem.xRight += wxOwnerDrawn::GetDefaultMarginWidth();
-        return TRUE;
+        return long(MRFROM2SHORT((USHORT)m_nItemHeight, (USHORT)(pStruct->rclItem.xRight - pStruct->rclItem.xLeft)));
     }
     }
-    return FALSE;
+    return 0L;
 } // end of wxCheckListBox::CreateItem
 
 //
 } // end of wxCheckListBox::CreateItem
 
 //
@@ -423,7 +442,7 @@ void wxCheckListBox::OnChar (
   wxKeyEvent&                       rEvent
 )
 {
   wxKeyEvent&                       rEvent
 )
 {
-    if (rEvent.KeyCode() == WXK_SPACE)
+    if (rEvent.GetKeyCode() == WXK_SPACE)
         GetItem(GetSelection())->Toggle();
     else
         rEvent.Skip();
         GetItem(GetSelection())->Toggle();
     else
         rEvent.Skip();
@@ -446,7 +465,7 @@ void wxCheckListBox::OnLeftClick (
                 ,&nParentHeight
                );
         vDc.SetFont(GetFont());
                 ,&nParentHeight
                );
         vDc.SetFont(GetFont());
-        vHeight = vDc.GetCharHeight() * 2.5;
+        vHeight = (wxCoord)(vDc.GetCharHeight() * 2.5);
 
         //
         // This, of course, will not work if the LB is scrolled
 
         //
         // This, of course, will not work if the LB is scrolled