]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/object.tex
documented 2nd prototype of wxListCtrl::SetItem
[wxWidgets.git] / docs / latex / wx / object.tex
CommitLineData
a660d684
KB
1\section{\class{wxObject}}\label{wxobject}
2
3This is the root class of all wxWindows classes.
4It declares a virtual destructor which ensures that
5destructors get called for all derived class objects where necessary.
6
7wxObject is the hub of a dynamic object creation
8scheme, enabling a program to create instances of a class only knowing
9its string class name, and to query the class hierarchy.
10
11The class contains optional debugging versions
12of {\bf new} and {\bf delete}, which can help trace memory allocation
13and deallocation problems.
14
15wxObject can be used to implement reference counted objects, such as
16wxPen, wxBitmap and others.
17
18\wxheading{See also}
19
20\helpref{wxClassInfo}{wxclassinfo}, \helpref{Debugging overview}{debuggingoverview},\rtfsp
21\helpref{wxObjectRefData}{wxobjectrefdata}
22
23\latexignore{\rtfignore{\wxheading{Members}}}
24
25\membersection{wxObject::wxObject}\label{wxobjectconstr}
26
27\func{}{wxObject}{\void}
28
29Default constructor.
30
31\membersection{wxObject::\destruct{wxObject}}
32
33\func{}{wxObject}{\void}
34
35Destructor. Performs dereferencing, for those objects
36that use reference counting.
37
38\membersection{wxObject::m\_refData}\label{wxobjectmrefdata}
39
40\member{wxObjectRefData* }{m\_refData}
41
42Pointer to an object which is the object's reference-counted data.
43
44\wxheading{See also}
45
46\helpref{wxObject::Ref}{wxobjectref}, \helpref{wxObject::UnRef}{wxobjectunref},\rtfsp
47\helpref{wxObject::SetRefData}{wxobjectsetrefdata},\rtfsp
48\helpref{wxObject::GetRefData}{wxobjectgetrefdata},\rtfsp
49\helpref{wxObjectRefData}{wxobjectrefdata}
50
51\membersection{wxObject::Dump}\label{wxobjectdump}
52
53\func{void}{Dump}{\param{ostream\&}{ stream}}
54
55A virtual function that should be redefined by derived classes to allow dumping of
56memory states.
57
58\wxheading{Parameters}
59
60\docparam{stream}{Stream on which to output dump information.}
61
62\wxheading{Remarks}
63
64Currently wxWindows does not define Dump for derived classes, but
65programmers may wish to use it for their own applications. Be sure to
66call the Dump member of the class's base class to allow all information to be dumped.
67
fe26d444
VZ
68The implementation of this function just writes the class name of the object
69in debug build (\_\_WXDEBUG\_\_ defined), otherwise it does nothing.
a660d684
KB
70
71\membersection{wxObject::GetClassInfo}\label{wxobjectgetclassinfo}
72
73\func{wxClassInfo *}{GetClassInfo}{\void}
74
75This virtual function is redefined for every class that requires run-time
76type information, when using DECLARE\_CLASS macros.
77
78\membersection{wxObject::GetRefData}\label{wxobjectgetrefdata}
79
80\constfunc{wxObjectRefData*}{GetRefData}{\void}
81
82Returns the {\bf m\_refData} pointer.
83
84\wxheading{See also}
85
86\helpref{wxObject::Ref}{wxobjectref}, \helpref{wxObject::UnRef}{wxobjectunref}, \helpref{wxObject::m\_refData}{wxobjectmrefdata},\rtfsp
87\helpref{wxObject::SetRefData}{wxobjectsetrefdata},\rtfsp
88\helpref{wxObjectRefData}{wxobjectrefdata}
89
90\membersection{wxObject::IsKindOf}\label{wxobjectiskindof}
91
92\func{bool}{IsKindOf}{\param{wxClassInfo *}{info}}
93
94Determines whether this class is a subclass of (or the same class as)
95the given class.
96
97\wxheading{Parameters}
98
99\docparam{info}{A pointer to a class information object, which may be obtained
100by using the CLASSINFO macro.}
101
102\wxheading{Return value}
103
104TRUE if the class represented by {\it info} is the same class as
105this one or is derived from it.
106
107\wxheading{Example}
108
109\begin{verbatim}
110 bool tmp = obj->IsKindOf(CLASSINFO(wxFrame));
111\end{verbatim}
112
113\membersection{wxObject::Ref}\label{wxobjectref}
114
115\func{void}{Ref}{\param{const wxObject\& }{clone}}
116
117Makes this object refer to the data in {\it clone}.
118
119\wxheading{Parameters}
120
121\docparam{clone}{The object to `clone'.}
122
123\wxheading{Remarks}
124
125First this function calls \helpref{wxObject::UnRef}{wxobjectunref} on itself
126to decrement (and perhaps free) the data it is currently referring to.
127
128It then sets its own m\_refData to point to that of {\it clone}, and increments the reference count
129inside the data.
130
131\wxheading{See also}
132
133\helpref{wxObject::UnRef}{wxobjectunref}, \helpref{wxObject::m\_refData}{wxobjectmrefdata},\rtfsp
134\helpref{wxObject::SetRefData}{wxobjectsetrefdata}, \helpref{wxObject::GetRefData}{wxobjectgetrefdata},\rtfsp
135\helpref{wxObjectRefData}{wxobjectrefdata}
136
137\membersection{wxObject::SetRefData}\label{wxobjectsetrefdata}
138
139\func{void}{SetRefData}{\param{wxObjectRefData*}{ data}}
140
141Sets the {\bf m\_refData} pointer.
142
143\wxheading{See also}
144
145\helpref{wxObject::Ref}{wxobjectref}, \helpref{wxObject::UnRef}{wxobjectunref}, \helpref{wxObject::m\_refData}{wxobjectmrefdata},\rtfsp
146\helpref{wxObject::GetRefData}{wxobjectgetrefdata},\rtfsp
147\helpref{wxObjectRefData}{wxobjectrefdata}
148
149\membersection{wxObject::UnRef}\label{wxobjectunref}
150
151\func{void}{UnRef}{\void}
152
153Decrements the reference count in the associated data, and if it is zero, deletes the data.
154The {\bf m\_refData} member is set to NULL.
155
156\wxheading{See also}
157
158\helpref{wxObject::Ref}{wxobjectref}, \helpref{wxObject::m\_refData}{wxobjectmrefdata},\rtfsp
159\helpref{wxObject::SetRefData}{wxobjectsetrefdata}, \helpref{wxObject::GetRefData}{wxobjectgetrefdata},\rtfsp
160\helpref{wxObjectRefData}{wxobjectrefdata}
161
162\membersection{wxObject::operator new}\label{wxobjectnew}
163
164\func{void *}{new}{\param{size\_t }{size}, \param{const wxString\& }{filename = NULL}, \param{int}{ lineNum = 0}}
165
166The {\it new} operator is defined for debugging versions of the library only, when
fe26d444 167the identifier \_\_WXDEBUG\_\_ is defined. It takes over memory allocation, allowing
a660d684
KB
168wxDebugContext operations.
169
170\membersection{wxObject::operator delete}\label{wxobjectdelete}
171
172\func{void}{delete}{\param{void }{buf}}
173
174The {\it delete} operator is defined for debugging versions of the library only, when
fe26d444 175the identifier \_\_WXDEBUG\_\_ is defined. It takes over memory deallocation, allowing
a660d684
KB
176wxDebugContext operations.
177
178\section{\class{wxObjectRefData}}\label{wxobjectrefdata}
179
180This class is used to store reference-counted data. Derive classes from this to
181store your own data. When retrieving information from a {\bf wxObject}'s reference data,
182you will need to cast to your own derived class.
183
184\wxheading{Friends}
185
186\helpref{wxObject}{wxobject}
187
188\wxheading{See also}
189
190\helpref{wxObject}{wxobject}
191
192\latexignore{\rtfignore{\wxheading{Members}}}
193
194\membersection{wxObjectRefData::m\_count}
195
196\member{int}{m\_count}
197
198Reference count. When this goes to zero during a \helpref{wxObject::UnRef}{wxobjectunref}, an object
199can delete the {\bf wxObjectRefData} object.
200
201\membersection{wxObjectRefData::wxObjectRefData}\label{wxobjectrefdataconstr}
202
203\func{}{wxObjectRefData}{\void}
204
205Default constructor. Initialises the {\bf m\_count} member to 1.
206
207\membersection{wxObjectRefData::\destruct{wxObjectRefData}}
208
209\func{}{wxObjectRefData}{\void}
210
211Destructor.
212
213