]> git.saurik.com Git - wxWidgets.git/blob - src/common/ctrlsub.cpp
corrected wxGetWorkingDirectory for mac (stripping last char off)
[wxWidgets.git] / src / common / ctrlsub.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: common/ctrlsub.cpp
3 // Purpose: wxItemContainer implementation
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
31 #if wxUSE_CONTROLS
32
33 #ifndef WX_PRECOMP
34 #include "wx/ctrlsub.h"
35 #endif
36
37 // ============================================================================
38 // implementation
39 // ============================================================================
40
41 // ----------------------------------------------------------------------------
42 // selection
43 // ----------------------------------------------------------------------------
44
45 wxString wxItemContainer::GetStringSelection() const
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
59 void wxItemContainer::SetClientObject(int n, wxClientData *data)
60 {
61 wxASSERT_MSG( m_clientDataItemsType != wxClientData_Void,
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);
69 m_clientDataItemsType = wxClientData_Object;
70 }
71
72 wxClientData *wxItemContainer::GetClientObject(int n) const
73 {
74 wxASSERT_MSG( m_clientDataItemsType == wxClientData_Object,
75 wxT("this window doesn't have object client data") );
76
77 return DoGetItemClientObject(n);
78 }
79
80 void wxItemContainer::SetClientData(int n, void *data)
81 {
82 wxASSERT_MSG( m_clientDataItemsType != wxClientData_Object,
83 wxT("can't have both object and void client data") );
84
85 DoSetItemClientData(n, data);
86 m_clientDataItemsType = wxClientData_Void;
87 }
88
89 void *wxItemContainer::GetClientData(int n) const
90 {
91 wxASSERT_MSG( m_clientDataItemsType == wxClientData_Void,
92 wxT("this window doesn't have void client data") );
93
94 return DoGetItemClientData(n);
95 }
96
97 #endif // wxUSE_CONTROLS