X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c86f1403c3737c07d58676a203f4707942684a01..f11f454d85f2eaabd5e2cfbba02b4cfc0b3e7088:/src/msw/checklst.cpp diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index f0c2c0ee23..9ab8c3ceb7 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -2,17 +2,13 @@ // Name: msw/checklst.cpp // Purpose: implementation of wxCheckListBox class // Author: Vadim Zeitlin -// Modified by: +// Modified by: // Created: 16.11.97 // RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// -// ============================================================================ -// headers & declarations -// ============================================================================ - #ifdef __GNUG__ #pragma implementation "checklst.h" #endif @@ -24,13 +20,21 @@ #pragma hdrstop #endif -#if USE_OWNER_DRAWN - -#include +#if 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/msw/checklst.h" +#include + // ============================================================================ // implementation // ============================================================================ @@ -87,7 +91,7 @@ wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex) * check until you click to the right of it, which is OK for WIN32. */ -bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, +bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) { if ( IsChecked() ) @@ -97,8 +101,8 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, // ## using native API for performance and precision size_t nCheckWidth = GetDefaultMarginWidth(), nCheckHeight = m_pParent->GetItemHeight(); - - int x = rc.GetX(), + + int x = rc.GetX(), y = rc.GetY(); HDC hdc = (HDC)dc.GetHDC(); @@ -106,7 +110,7 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, // create pens HPEN hpenBack = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_WINDOW)), hpenGray = CreatePen(PS_SOLID, 0, RGB(128, 128, 128)), - hpenPrev = SelectObject(hdc, hpenBack); + hpenPrev = (HPEN)SelectObject(hdc, hpenBack); // we erase the 1-pixel border Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight); @@ -118,13 +122,15 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, // first create a monochrome bitmap in a memory DC HDC hdcMem = CreateCompatibleDC(hdc); HBITMAP hbmpCheck = CreateBitmap(nCheckWidth, nCheckHeight, 1, 1, 0); - HBITMAP hbmpOld = SelectObject(hdcMem, hbmpCheck); + HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpCheck); // then draw a check mark into it RECT rect = { 0, 0, nCheckWidth, nCheckHeight }; #ifdef __WIN32__ +#ifndef __SC__ DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK); +#endif #else // In WIN16, draw a cross HPEN blackPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); @@ -143,7 +149,7 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, #endif // finally copy it to screen DC and clean up - BitBlt(hdc, x, y, nCheckWidth - 1, nCheckHeight, + BitBlt(hdc, x, y, nCheckWidth - 1, nCheckHeight, hdcMem, 0, 0, SRCCOPY); SelectObject(hdcMem, hbmpOld); @@ -158,7 +164,7 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, // draw hollow gray rectangle (void)SelectObject(hdc, hpenGray); - HBRUSH hbrPrev = SelectObject(hdc, GetStockObject(NULL_BRUSH)); + HBRUSH hbrPrev = (HBRUSH)SelectObject(hdc, GetStockObject(NULL_BRUSH)); Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight); // clean up @@ -185,7 +191,7 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, // change the state of the item and redraw it void wxCheckListBoxItem::Toggle() -{ +{ m_bChecked = !m_bChecked; size_t nHeight = m_pParent->GetItemHeight();