git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@640
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// Name: msw/checklst.cpp
// Purpose: implementation of wxCheckListBox class
// Author: Vadim Zeitlin
// Name: msw/checklst.cpp
// Purpose: implementation of wxCheckListBox class
// Author: Vadim Zeitlin
// Created: 16.11.97
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Created: 16.11.97
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
* check until you click to the right of it, which is OK for WIN32.
*/
* 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() )
wxODAction act, wxODStatus stat)
{
if ( IsChecked() )
// ## using native API for performance and precision
size_t nCheckWidth = GetDefaultMarginWidth(),
nCheckHeight = m_pParent->GetItemHeight();
// ## using native API for performance and precision
size_t nCheckWidth = GetDefaultMarginWidth(),
nCheckHeight = m_pParent->GetItemHeight();
y = rc.GetY();
HDC hdc = (HDC)dc.GetHDC();
y = rc.GetY();
HDC hdc = (HDC)dc.GetHDC();
// create pens
HPEN hpenBack = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_WINDOW)),
hpenGray = CreatePen(PS_SOLID, 0, RGB(128, 128, 128)),
// 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);
// we erase the 1-pixel border
Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight);
// first create a monochrome bitmap in a memory DC
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmpCheck = CreateBitmap(nCheckWidth, nCheckHeight, 1, 1, 0);
// 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 };
// then draw a check mark into it
RECT rect = { 0, 0, nCheckWidth, nCheckHeight };
#endif
// finally copy it to screen DC and clean up
#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);
hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmpOld);
// draw hollow gray rectangle
(void)SelectObject(hdc, hpenGray);
// 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
Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight);
// clean up
// change the state of the item and redraw it
void wxCheckListBoxItem::Toggle()
// change the state of the item and redraw it
void wxCheckListBoxItem::Toggle()
m_bChecked = !m_bChecked;
size_t nHeight = m_pParent->GetItemHeight();
m_bChecked = !m_bChecked;
size_t nHeight = m_pParent->GetItemHeight();