]> git.saurik.com Git - wxWidgets.git/blob - src/common/checklstcmn.cpp
adding x server license terms for polygon methods
[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 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_CHECKLISTBOX
28
29 #include "wx/checklst.h"
30
31 #ifndef WX_PRECOMP
32 #include "wx/object.h"
33 #include "wx/colour.h"
34 #include "wx/font.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"
40 #include "wx/log.h"
41 #endif
42
43 // ----------------------------------------------------------------------------
44 // XTI
45 // ----------------------------------------------------------------------------
46
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)
57
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)
65
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)
75
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)
84
85 wxEND_FLAGS( wxCheckListBoxStyle )
86
87 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox, "wx/checklst.h")
88
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()
95
96 wxEMPTY_HANDLERS_TABLE(wxCheckListBox)
97
98 wxCONSTRUCTOR_4( wxCheckListBox, wxWindow*, Parent, wxWindowID, Id, \
99 wxPoint, Position, wxSize, Size )
100
101
102 // ============================================================================
103 // implementation
104 // ============================================================================
105
106 unsigned int wxCheckListBoxBase::GetCheckedItems(wxArrayInt& checkedItems) const
107 {
108 unsigned int const numberOfItems = GetCount();
109
110 checkedItems.clear();
111 for ( unsigned int i = 0; i < numberOfItems; ++i )
112 {
113 if ( IsChecked(i) )
114 checkedItems.push_back(i);
115 }
116
117 return checkedItems.size();
118 }
119
120 #endif