]>
git.saurik.com Git - wxWidgets.git/blob - src/common/checklstcmn.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/checklstcmn.cpp
3 // Purpose: wxCheckListBox common code
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #if wxUSE_CHECKLISTBOX
29 #include "wx/checklst.h"
32 #include "wx/object.h"
33 #include "wx/colour.h"
35 #include "wx/bitmap.h"
36 #include "wx/window.h"
37 #include "wx/listbox.h"
38 #include "wx/dcmemory.h"
39 #include "wx/settings.h"
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
47 wxDEFINE_FLAGS( wxCheckListBoxStyle
)
48 wxBEGIN_FLAGS( wxCheckListBoxStyle
)
49 // new style border flags, we put them first to
50 // use them for streaming out
51 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
52 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
53 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
54 wxFLAGS_MEMBER(wxBORDER_RAISED
)
55 wxFLAGS_MEMBER(wxBORDER_STATIC
)
56 wxFLAGS_MEMBER(wxBORDER_NONE
)
58 // old style border flags
59 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
60 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
61 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
62 wxFLAGS_MEMBER(wxRAISED_BORDER
)
63 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
64 wxFLAGS_MEMBER(wxBORDER
)
66 // standard window styles
67 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
68 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
69 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
70 wxFLAGS_MEMBER(wxWANTS_CHARS
)
71 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
72 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
73 wxFLAGS_MEMBER(wxVSCROLL
)
74 wxFLAGS_MEMBER(wxHSCROLL
)
76 wxFLAGS_MEMBER(wxLB_SINGLE
)
77 wxFLAGS_MEMBER(wxLB_MULTIPLE
)
78 wxFLAGS_MEMBER(wxLB_EXTENDED
)
79 wxFLAGS_MEMBER(wxLB_HSCROLL
)
80 wxFLAGS_MEMBER(wxLB_ALWAYS_SB
)
81 wxFLAGS_MEMBER(wxLB_NEEDED_SB
)
82 wxFLAGS_MEMBER(wxLB_SORT
)
83 wxFLAGS_MEMBER(wxLB_OWNERDRAW
)
85 wxEND_FLAGS( wxCheckListBoxStyle
)
87 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox
, wxListBox
, "wx/checklst.h")
89 wxBEGIN_PROPERTIES_TABLE(wxCheckListBox
)
90 wxEVENT_PROPERTY( Toggle
, wxEVT_CHECKLISTBOX
, wxCommandEvent
)
91 wxPROPERTY_FLAGS( WindowStyle
, wxCheckListBoxStyle
, long, SetWindowStyleFlag
, \
92 GetWindowStyleFlag
, wxEMPTY_PARAMETER_VALUE
, wxLB_OWNERDRAW
/*flags*/, \
93 wxT("Helpstring"), wxT("group")) // style
94 wxEND_PROPERTIES_TABLE()
96 wxEMPTY_HANDLERS_TABLE(wxCheckListBox
)
98 wxCONSTRUCTOR_4( wxCheckListBox
, wxWindow
*, Parent
, wxWindowID
, Id
, \
99 wxPoint
, Position
, wxSize
, Size
)
102 // ============================================================================
104 // ============================================================================
106 unsigned int wxCheckListBoxBase::GetCheckedItems(wxArrayInt
& checkedItems
) const
108 unsigned int const numberOfItems
= GetCount();
110 checkedItems
.clear();
111 for ( unsigned int i
= 0; i
< numberOfItems
; ++i
)
114 checkedItems
.push_back(i
);
117 return checkedItems
.size();