]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/checklst.cpp
Moved wxToolBarSimple to deprecated library
[wxWidgets.git] / src / msw / checklst.cpp
index 9c688afc3b45458316a02bd512e46331ec5c05d0..b31e46e9996636c121d1415862dac3333234c1f5 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     16.11.97
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -17,7 +17,7 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "checklst.h"
 #endif
 
 #include "wx/ownerdrw.h"
 #include "wx/checklst.h"
 
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 #include <windowsx.h>
 
+#include "wx/msw/private.h"
+
 #if defined(__GNUWIN32_OLD__)
     #include "wx/msw/gnuwin32/extra.h"
 #endif
 
 IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
 
+/*
+TODO PROPERTIES
+       list content
+               item , checked (no)
+*/
 // ----------------------------------------------------------------------------
 // declaration and implementation of wxCheckListBoxItem class
 // ----------------------------------------------------------------------------
@@ -90,6 +97,8 @@ public:
   void SendEvent();
 
 private:
+
+    DECLARE_NO_COPY_CLASS(wxCheckListBoxItem)
   bool            m_bChecked;
   wxCheckListBox *m_pParent;
   size_t          m_nIndex;
@@ -152,29 +161,17 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc,
       HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpCheck);
 
       // then draw a check mark into it
-#if defined(__WIN32__) && !defined(__SC__)
+
       RECT rect;
       rect.left   = 0;
       rect.top    = 0;
       rect.right  = nCheckWidth;
       rect.bottom = nCheckHeight;
 
-      DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
+#ifdef __WXWINCE__
+      DrawFrameControl(hdcMem, &rect, DFC_BUTTON, DFCS_BUTTONCHECK);
 #else
-      // In WIN16, draw a cross
-      HPEN blackPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
-      HPEN whiteBrush = (HPEN)GetStockObject(WHITE_BRUSH);
-      HPEN hPenOld = (HPEN)::SelectObject(hdcMem, blackPen);
-      HPEN hBrushOld = (HPEN)::SelectObject(hdcMem, whiteBrush);
-      ::SetROP2(hdcMem, R2_COPYPEN);
-      Rectangle(hdcMem, 0, 0, nCheckWidth, nCheckHeight);
-      MoveTo(hdcMem, 0, 0);
-      LineTo(hdcMem, nCheckWidth, nCheckHeight);
-      MoveTo(hdcMem, nCheckWidth, 0);
-      LineTo(hdcMem, 0, nCheckHeight);
-      ::SelectObject(hdcMem, hPenOld);
-      ::SelectObject(hdcMem, hBrushOld);
-      ::DeleteObject(blackPen);
+      DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
 #endif
 
       // finally copy it to screen DC and clean up
@@ -393,7 +390,7 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event)
         Clear
     } oper;
 
-    switch ( event.KeyCode() )
+    switch ( event.GetKeyCode() )
     {
         case WXK_SPACE:
             oper = Toggle;
@@ -416,15 +413,19 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event)
     if ( oper != None )
     {
         wxArrayInt selections;
-        int count;
+        int count = 0;
         if ( HasMultipleSelection() )
         {
             count = GetSelections(selections);
         }
         else
         {
-            count = 1;
-            selections.Add(GetSelection());
+            int sel = GetSelection();
+            if (sel != -1)
+            {
+                count = 1;
+                selections.Add(sel);
+            }
         }
 
         for ( int i = 0; i < count; i++ )