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