1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: common/ctrlsub.cpp
3 // Purpose: wxItemContainer implementation
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "controlwithitems.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
34 #include "wx/ctrlsub.h"
37 // ============================================================================
39 // ============================================================================
41 wxItemContainer::~wxItemContainer()
43 // this destructor is required for Darwin
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 wxString
wxItemContainer::GetStringSelection() const
53 int sel
= GetSelection();
60 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
64 void wxItemContainer::Append(const wxArrayString
& strings
)
66 size_t count
= strings
.GetCount();
67 for ( size_t n
= 0; n
< count
; n
++ )
73 // ----------------------------------------------------------------------------
75 // ----------------------------------------------------------------------------
77 void wxItemContainer::SetClientObject(int n
, wxClientData
*data
)
79 wxASSERT_MSG( m_clientDataItemsType
!= wxClientData_Void
,
80 wxT("can't have both object and void client data") );
82 // when we call SetClientObject() for the first time, m_clientDataItemsType
83 // is still wxClientData_None and so calling DoGetItemClientObject() would
84 // fail (in addition to being useless) - don't do it
85 if ( m_clientDataItemsType
== wxClientData_Object
)
87 wxClientData
*clientDataOld
= DoGetItemClientObject(n
);
91 else // m_clientDataItemsType == wxClientData_None
93 // now we have object client data
94 m_clientDataItemsType
= wxClientData_Object
;
97 DoSetItemClientObject(n
, data
);
100 wxClientData
*wxItemContainer::GetClientObject(int n
) const
102 wxASSERT_MSG( m_clientDataItemsType
== wxClientData_Object
,
103 wxT("this window doesn't have object client data") );
105 return DoGetItemClientObject(n
);
108 void wxItemContainer::SetClientData(int n
, void *data
)
110 wxASSERT_MSG( m_clientDataItemsType
!= wxClientData_Object
,
111 wxT("can't have both object and void client data") );
113 DoSetItemClientData(n
, data
);
114 m_clientDataItemsType
= wxClientData_Void
;
117 void *wxItemContainer::GetClientData(int n
) const
119 wxASSERT_MSG( m_clientDataItemsType
== wxClientData_Void
,
120 wxT("this window doesn't have void client data") );
122 return DoGetItemClientData(n
);
125 #endif // wxUSE_CONTROLS