]>
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
7 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
26 #if wxUSE_CHECKLISTBOX
28 #include "wx/checklst.h"
31 #include "wx/object.h"
32 #include "wx/colour.h"
34 #include "wx/bitmap.h"
35 #include "wx/window.h"
36 #include "wx/listbox.h"
37 #include "wx/dcmemory.h"
38 #include "wx/settings.h"
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 wxDEFINE_FLAGS( wxCheckListBoxStyle
)
47 wxBEGIN_FLAGS( wxCheckListBoxStyle
)
48 // new style border flags, we put them first to
49 // use them for streaming out
50 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
51 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
52 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
53 wxFLAGS_MEMBER(wxBORDER_RAISED
)
54 wxFLAGS_MEMBER(wxBORDER_STATIC
)
55 wxFLAGS_MEMBER(wxBORDER_NONE
)
57 // old style border flags
58 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
59 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
60 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
61 wxFLAGS_MEMBER(wxRAISED_BORDER
)
62 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
63 wxFLAGS_MEMBER(wxBORDER
)
65 // standard window styles
66 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
67 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
68 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
69 wxFLAGS_MEMBER(wxWANTS_CHARS
)
70 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
71 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
72 wxFLAGS_MEMBER(wxVSCROLL
)
73 wxFLAGS_MEMBER(wxHSCROLL
)
75 wxFLAGS_MEMBER(wxLB_SINGLE
)
76 wxFLAGS_MEMBER(wxLB_MULTIPLE
)
77 wxFLAGS_MEMBER(wxLB_EXTENDED
)
78 wxFLAGS_MEMBER(wxLB_HSCROLL
)
79 wxFLAGS_MEMBER(wxLB_ALWAYS_SB
)
80 wxFLAGS_MEMBER(wxLB_NEEDED_SB
)
81 wxFLAGS_MEMBER(wxLB_SORT
)
82 wxFLAGS_MEMBER(wxLB_OWNERDRAW
)
84 wxEND_FLAGS( wxCheckListBoxStyle
)
86 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox
, wxListBox
, "wx/checklst.h")
88 wxBEGIN_PROPERTIES_TABLE(wxCheckListBox
)
89 wxEVENT_PROPERTY( Toggle
, wxEVT_CHECKLISTBOX
, wxCommandEvent
)
90 wxPROPERTY_FLAGS( WindowStyle
, wxCheckListBoxStyle
, long, SetWindowStyleFlag
, \
91 GetWindowStyleFlag
, wxEMPTY_PARAMETER_VALUE
, wxLB_OWNERDRAW
/*flags*/, \
92 wxT("Helpstring"), wxT("group")) // style
93 wxEND_PROPERTIES_TABLE()
95 wxEMPTY_HANDLERS_TABLE(wxCheckListBox
)
97 wxCONSTRUCTOR_4( wxCheckListBox
, wxWindow
*, Parent
, wxWindowID
, Id
, \
98 wxPoint
, Position
, wxSize
, Size
)
101 // ============================================================================
103 // ============================================================================
105 unsigned int wxCheckListBoxBase::GetCheckedItems(wxArrayInt
& checkedItems
) const
107 unsigned int const numberOfItems
= GetCount();
109 checkedItems
.clear();
110 for ( unsigned int i
= 0; i
< numberOfItems
; ++i
)
113 checkedItems
.push_back(i
);
116 return checkedItems
.size();