]> git.saurik.com Git - wxWidgets.git/blame - src/common/ctrlsub.cpp
added stat.h include
[wxWidgets.git] / src / common / ctrlsub.cpp
CommitLineData
6c8a980f
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: common/ctrlsub.cpp
1e6feb95 3// Purpose: wxItemContainer implementation
6c8a980f
VZ
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 22.10.99
7// RCS-ID: $Id$
8// Copyright: (c) wxWindows team
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#ifdef __GNUG__
21 #pragma implementation "controlwithitems.h"
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
1e6feb95
VZ
31#if wxUSE_CONTROLS
32
6c8a980f
VZ
33#ifndef WX_PRECOMP
34 #include "wx/ctrlsub.h"
35#endif
36
37// ============================================================================
38// implementation
39// ============================================================================
40
41// ----------------------------------------------------------------------------
42// selection
43// ----------------------------------------------------------------------------
44
1e6feb95 45wxString wxItemContainer::GetStringSelection() const
6c8a980f
VZ
46{
47 wxString s;
48 int sel = GetSelection();
49 if ( sel != -1 )
50 s = GetString(sel);
51
52 return s;
53}
54
55// ----------------------------------------------------------------------------
56// client data
57// ----------------------------------------------------------------------------
58
1e6feb95 59void wxItemContainer::SetClientObject(int n, wxClientData *data)
6c8a980f 60{
1e6feb95 61 wxASSERT_MSG( m_clientDataItemsType != wxClientData_Void,
6c8a980f
VZ
62 wxT("can't have both object and void client data") );
63
64 wxClientData *clientDataOld = DoGetItemClientObject(n);
65 if ( clientDataOld )
66 delete clientDataOld;
67
68 DoSetItemClientObject(n, data);
1e6feb95 69 m_clientDataItemsType = wxClientData_Object;
6c8a980f
VZ
70}
71
1e6feb95 72wxClientData *wxItemContainer::GetClientObject(int n) const
6c8a980f 73{
1e6feb95 74 wxASSERT_MSG( m_clientDataItemsType == wxClientData_Object,
6c8a980f
VZ
75 wxT("this window doesn't have object client data") );
76
77 return DoGetItemClientObject(n);
78}
79
1e6feb95 80void wxItemContainer::SetClientData(int n, void *data)
6c8a980f 81{
1e6feb95 82 wxASSERT_MSG( m_clientDataItemsType != wxClientData_Object,
6c8a980f
VZ
83 wxT("can't have both object and void client data") );
84
85 DoSetItemClientData(n, data);
1e6feb95 86 m_clientDataItemsType = wxClientData_Void;
6c8a980f
VZ
87}
88
1e6feb95 89void *wxItemContainer::GetClientData(int n) const
6c8a980f 90{
1e6feb95 91 wxASSERT_MSG( m_clientDataItemsType == wxClientData_Void,
6c8a980f
VZ
92 wxT("this window doesn't have void client data") );
93
94 return DoGetItemClientData(n);
95}
96
1e6feb95 97#endif // wxUSE_CONTROLS