]> git.saurik.com Git - wxWidgets.git/blame - src/common/clntdata.cpp
Avoid using wxHtmlTag::HasParam() unnecessarily.
[wxWidgets.git] / src / common / clntdata.cpp
CommitLineData
88a9f974 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/common/clntdata.cpp
88a9f974
RD
3// Purpose: A mixin class for holding a wxClientData or void pointer
4// Author: Robin Dunn
5// Modified by:
6// Created: 9-Oct-2001
77ffb593 7// Copyright: (c) wxWidgets team
65571936 8// Licence: wxWindows licence
88a9f974
RD
9/////////////////////////////////////////////////////////////////////////////
10
88a9f974
RD
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
18#include "wx/clntdata.h"
19
20
21// ----------------------------------------------------------------------------
2aab8f16 22
88a9f974
RD
23
24wxClientDataContainer::wxClientDataContainer()
25{
26 // no client data (yet)
27 m_clientData = NULL;
28 m_clientDataType = wxClientData_None;
29}
30
31wxClientDataContainer::~wxClientDataContainer()
32{
33 // we only delete object data, not untyped
34 if ( m_clientDataType == wxClientData_Object )
35 delete m_clientObject;
36}
37
38void wxClientDataContainer::DoSetClientObject( wxClientData *data )
39{
40 wxASSERT_MSG( m_clientDataType != wxClientData_Void,
41 wxT("can't have both object and void client data") );
42
43 if ( m_clientObject )
44 delete m_clientObject;
45
46 m_clientObject = data;
47 m_clientDataType = wxClientData_Object;
48}
49
50wxClientData *wxClientDataContainer::DoGetClientObject() const
51{
52 // it's not an error to call GetClientObject() on a window which doesn't
53 // have client data at all - NULL will be returned
54 wxASSERT_MSG( m_clientDataType != wxClientData_Void,
55 wxT("this window doesn't have object client data") );
56
57 return m_clientObject;
58}
59
60void wxClientDataContainer::DoSetClientData( void *data )
61{
62 wxASSERT_MSG( m_clientDataType != wxClientData_Object,
63 wxT("can't have both object and void client data") );
64
65 m_clientData = data;
66 m_clientDataType = wxClientData_Void;
67}
68
69void *wxClientDataContainer::DoGetClientData() const
70{
71 // it's not an error to call GetClientData() on a window which doesn't have
72 // client data at all - NULL will be returned
73 wxASSERT_MSG( m_clientDataType != wxClientData_Object,
74 wxT("this window doesn't have void client data") );
75
76 return m_clientData;
77}
78
2aab8f16 79
88a9f974
RD
80// ----------------------------------------------------------------------------
81
82