]> git.saurik.com Git - wxWidgets.git/blob - src/common/checklstcmn.cpp
Workaround for #15404: wxRichTextCtrl: caret does not disappear when focus is lost...
[wxWidgets.git] / src / common / checklstcmn.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/checklstcmn.cpp
3 // Purpose: wxCheckListBox common code
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 16.11.97
7 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_CHECKLISTBOX
27
28 #include "wx/checklst.h"
29
30 #ifndef WX_PRECOMP
31 #include "wx/object.h"
32 #include "wx/colour.h"
33 #include "wx/font.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"
39 #include "wx/log.h"
40 #endif
41
42 // ----------------------------------------------------------------------------
43 // XTI
44 // ----------------------------------------------------------------------------
45
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)
56
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)
64
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)
74
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)
83
84 wxEND_FLAGS( wxCheckListBoxStyle )
85
86 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox, "wx/checklst.h")
87
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()
94
95 wxEMPTY_HANDLERS_TABLE(wxCheckListBox)
96
97 wxCONSTRUCTOR_4( wxCheckListBox, wxWindow*, Parent, wxWindowID, Id, \
98 wxPoint, Position, wxSize, Size )
99
100
101 // ============================================================================
102 // implementation
103 // ============================================================================
104
105 unsigned int wxCheckListBoxBase::GetCheckedItems(wxArrayInt& checkedItems) const
106 {
107 unsigned int const numberOfItems = GetCount();
108
109 checkedItems.clear();
110 for ( unsigned int i = 0; i < numberOfItems; ++i )
111 {
112 if ( IsChecked(i) )
113 checkedItems.push_back(i);
114 }
115
116 return checkedItems.size();
117 }
118
119 #endif