]>
git.saurik.com Git - wxWidgets.git/blob - src/common/ctrlsub.cpp
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 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 wxString
wxItemContainer::GetStringSelection() const
48 int sel
= GetSelection();
55 // ----------------------------------------------------------------------------
57 // ----------------------------------------------------------------------------
59 void wxItemContainer::SetClientObject(int n
, wxClientData
*data
)
61 wxASSERT_MSG( m_clientDataItemsType
!= wxClientData_Void
,
62 wxT("can't have both object and void client data") );
64 // when we call SetClientObject() for the first time, m_clientDataItemsType
65 // is still wxClientData_None and so calling DoGetItemClientObject() would
66 // fail (in addition to being useless) - don't do it
67 if ( m_clientDataItemsType
== wxClientData_Object
)
69 wxClientData
*clientDataOld
= DoGetItemClientObject(n
);
73 else // m_clientDataItemsType == wxClientData_None
75 // now we have object client data
76 m_clientDataItemsType
= wxClientData_Object
;
79 DoSetItemClientObject(n
, data
);
82 wxClientData
*wxItemContainer::GetClientObject(int n
) const
84 wxASSERT_MSG( m_clientDataItemsType
== wxClientData_Object
,
85 wxT("this window doesn't have object client data") );
87 return DoGetItemClientObject(n
);
90 void wxItemContainer::SetClientData(int n
, void *data
)
92 wxASSERT_MSG( m_clientDataItemsType
!= wxClientData_Object
,
93 wxT("can't have both object and void client data") );
95 DoSetItemClientData(n
, data
);
96 m_clientDataItemsType
= wxClientData_Void
;
99 void *wxItemContainer::GetClientData(int n
) const
101 wxASSERT_MSG( m_clientDataItemsType
== wxClientData_Void
,
102 wxT("this window doesn't have void client data") );
104 return DoGetItemClientData(n
);
107 #endif // wxUSE_CONTROLS