X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22f3361e1cf25c52a2da8fdfc5cb081809e18fb9..e4a8a172020d5e3ee08660420142e702799c7878:/src/msw/checklst.cpp?ds=sidebyside diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index f74f6dd59c..b9fcce299c 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -6,7 +6,7 @@ // Created: 16.11.97 // RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin -// 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 @@ -47,9 +47,11 @@ #include "wx/ownerdrw.h" #include "wx/checklst.h" -#include +#include "wx/msw/wrapwin.h" #include +#include "wx/msw/private.h" + #if defined(__GNUWIN32_OLD__) #include "wx/msw/gnuwin32/extra.h" #endif @@ -65,8 +67,65 @@ // implementation // ============================================================================ +// TODO: wxCONSTRUCTOR +#if 0 // wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxCheckListBoxStyle ) + +wxBEGIN_FLAGS( wxCheckListBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxLB_SINGLE) + wxFLAGS_MEMBER(wxLB_MULTIPLE) + wxFLAGS_MEMBER(wxLB_EXTENDED) + wxFLAGS_MEMBER(wxLB_HSCROLL) + wxFLAGS_MEMBER(wxLB_ALWAYS_SB) + wxFLAGS_MEMBER(wxLB_NEEDED_SB) + wxFLAGS_MEMBER(wxLB_SORT) + +wxEND_FLAGS( wxCheckListBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox,"wx/checklst.h") + +wxBEGIN_PROPERTIES_TABLE(wxCheckListBox) + wxEVENT_PROPERTY( Toggle , wxEVT_COMMAND_CHECKLISTBOX_TOGGLED , wxCommandEvent ) + + wxPROPERTY_FLAGS( WindowStyle , wxCheckListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +#else IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox) +#endif +/* +TODO PROPERTIES + list content + item , checked (no) +*/ // ---------------------------------------------------------------------------- // declaration and implementation of wxCheckListBoxItem class // ---------------------------------------------------------------------------- @@ -154,29 +213,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 @@ -395,7 +442,7 @@ void wxCheckListBox::OnKeyDown(wxKeyEvent& event) Clear } oper; - switch ( event.KeyCode() ) + switch ( event.GetKeyCode() ) { case WXK_SPACE: oper = Toggle; @@ -418,15 +465,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++ )