1 \section{\class{wxObject
}}\label{wxobject
}
3 This is the root class of all wxWidgets classes.
4 It declares a virtual destructor which ensures that
5 destructors get called for all derived class objects where necessary.
7 wxObject is the hub of a dynamic object creation
8 scheme, enabling a program to create instances of a class only knowing
9 its string class name, and to query the class hierarchy.
11 The class contains optional debugging versions
12 of
{\bf new
} and
{\bf delete
}, which can help trace memory allocation
13 and deallocation problems.
15 wxObject can be used to implement reference counted objects, such as
16 wxPen, wxBitmap and others.
20 \helpref{wxClassInfo
}{wxclassinfo
},
\helpref{Debugging overview
}{debuggingoverview
},
\rtfsp
21 \helpref{wxObjectRefData
}{wxobjectrefdata
}
23 \latexignore{\rtfignore{\wxheading{Members
}}}
25 \membersection{wxObject::wxObject
}\label{wxobjectctor
}
27 \func{}{wxObject
}{\void}
29 \func{}{wxObject
}{\param{const wxObject\&
}{ other
}}
31 Default and copy constructors.
33 \membersection{wxObject::
\destruct{wxObject
}}\label{wxobjectdtor
}
35 \func{}{wxObject
}{\void}
37 Destructor. Performs dereferencing, for those objects
38 that use reference counting.
40 \membersection{wxObject::m
\_refData}\label{wxobjectmrefdata
}
42 \member{wxObjectRefData*
}{m
\_refData}
44 Pointer to an object which is the object's reference-counted data.
48 \helpref{wxObject::Ref
}{wxobjectref
},
\helpref{wxObject::UnRef
}{wxobjectunref
},
\rtfsp
49 \helpref{wxObject::SetRefData
}{wxobjectsetrefdata
},
\rtfsp
50 \helpref{wxObject::GetRefData
}{wxobjectgetrefdata
},
\rtfsp
51 \helpref{wxObjectRefData
}{wxobjectrefdata
}
53 \membersection{wxObject::Dump
}\label{wxobjectdump
}
55 \func{void
}{Dump
}{\param{ostream\&
}{ stream
}}
57 A virtual function that may be redefined by derived classes to allow dumping of
60 This function is only defined in debug build and doesn't exist at all if
61 {\tt \_\_WXDEBUG\_\_} is not defined.
63 \wxheading{Parameters
}
65 \docparam{stream
}{Stream on which to output dump information.
}
69 Currently wxWidgets does not define Dump for derived classes, but
70 programmers may wish to use it for their own applications. Be sure to
71 call the Dump member of the class's base class to allow all information to be
74 The implementation of this function in wxObject just writes the class name of
77 \membersection{wxObject::GetClassInfo
}\label{wxobjectgetclassinfo
}
79 \func{wxClassInfo *
}{GetClassInfo
}{\void}
81 This virtual function is redefined for every class that requires run-time
82 type information, when using DECLARE
\_CLASS macros.
84 \membersection{wxObject::GetRefData
}\label{wxobjectgetrefdata
}
86 \constfunc{wxObjectRefData*
}{GetRefData
}{\void}
88 Returns the
{\bf m
\_refData} pointer.
92 \helpref{wxObject::Ref
}{wxobjectref
},
\helpref{wxObject::UnRef
}{wxobjectunref
},
\helpref{wxObject::m
\_refData}{wxobjectmrefdata
},
\rtfsp
93 \helpref{wxObject::SetRefData
}{wxobjectsetrefdata
},
\rtfsp
94 \helpref{wxObjectRefData
}{wxobjectrefdata
}
96 \membersection{wxObject::IsKindOf
}\label{wxobjectiskindof
}
98 \func{bool
}{IsKindOf
}{\param{wxClassInfo *
}{info
}}
100 Determines whether this class is a subclass of (or the same class as)
103 \wxheading{Parameters
}
105 \docparam{info
}{A pointer to a class information object, which may be obtained
106 by using the CLASSINFO macro.
}
108 \wxheading{Return value
}
110 true if the class represented by
{\it info
} is the same class as
111 this one or is derived from it.
116 bool tmp = obj->IsKindOf(CLASSINFO(wxFrame));
119 \membersection{wxObject::Ref
}\label{wxobjectref
}
121 \func{void
}{Ref
}{\param{const wxObject\&
}{clone
}}
123 Makes this object refer to the data in
{\it clone
}.
125 \wxheading{Parameters
}
127 \docparam{clone
}{The object to `clone'.
}
131 First this function calls
\helpref{wxObject::UnRef
}{wxobjectunref
} on itself
132 to decrement (and perhaps free) the data it is currently referring to.
134 It then sets its own m
\_refData to point to that of
{\it clone
}, and increments the reference count
139 \helpref{wxObject::UnRef
}{wxobjectunref
},
\helpref{wxObject::m
\_refData}{wxobjectmrefdata
},
\rtfsp
140 \helpref{wxObject::SetRefData
}{wxobjectsetrefdata
},
\helpref{wxObject::GetRefData
}{wxobjectgetrefdata
},
\rtfsp
141 \helpref{wxObjectRefData
}{wxobjectrefdata
}
143 \membersection{wxObject::SetRefData
}\label{wxobjectsetrefdata
}
145 \func{void
}{SetRefData
}{\param{wxObjectRefData*
}{ data
}}
147 Sets the
{\bf m
\_refData} pointer.
151 \helpref{wxObject::Ref
}{wxobjectref
},
\helpref{wxObject::UnRef
}{wxobjectunref
},
\helpref{wxObject::m
\_refData}{wxobjectmrefdata
},
\rtfsp
152 \helpref{wxObject::GetRefData
}{wxobjectgetrefdata
},
\rtfsp
153 \helpref{wxObjectRefData
}{wxobjectrefdata
}
155 \membersection{wxObject::UnRef
}\label{wxobjectunref
}
157 \func{void
}{UnRef
}{\void}
159 Decrements the reference count in the associated data, and if it is zero, deletes the data.
160 The
{\bf m
\_refData} member is set to NULL.
164 \helpref{wxObject::Ref
}{wxobjectref
},
\helpref{wxObject::m
\_refData}{wxobjectmrefdata
},
\rtfsp
165 \helpref{wxObject::SetRefData
}{wxobjectsetrefdata
},
\helpref{wxObject::GetRefData
}{wxobjectgetrefdata
},
\rtfsp
166 \helpref{wxObjectRefData
}{wxobjectrefdata
}
168 \membersection{wxObject::operator new
}\label{wxobjectnew
}
170 \func{void *
}{new
}{\param{size
\_t }{size
},
\param{const wxString\&
}{filename = NULL
},
\param{int
}{ lineNum =
0}}
172 The
{\it new
} operator is defined for debugging versions of the library only, when
173 the identifier
\_\_WXDEBUG\_\_ is defined. It takes over memory allocation, allowing
174 wxDebugContext operations.
176 \membersection{wxObject::operator delete
}\label{wxobjectdelete
}
178 \func{void
}{delete
}{\param{void
}{buf
}}
180 The
{\it delete
} operator is defined for debugging versions of the library only, when
181 the identifier
\_\_WXDEBUG\_\_ is defined. It takes over memory deallocation, allowing
182 wxDebugContext operations.
184 \section{\class{wxObjectRefData
}}\label{wxobjectrefdata
}
186 This class is used to store reference-counted data. Derive classes from this to
187 store your own data. When retrieving information from a
{\bf wxObject
}'s reference data,
188 you will need to cast to your own derived class.
192 \helpref{wxObject
}{wxobject
}
196 \helpref{wxObject
}{wxobject
}
198 \latexignore{\rtfignore{\wxheading{Members
}}}
200 \membersection{wxObjectRefData::m
\_count}\label{wxobjectrefdatamcount
}
202 \member{int
}{m
\_count}
204 Reference count. When this goes to zero during a
\helpref{wxObject::UnRef
}{wxobjectunref
}, an object
205 can delete the
{\bf wxObjectRefData
} object.
207 \membersection{wxObjectRefData::wxObjectRefData
}\label{wxobjectrefdatactor
}
209 \func{}{wxObjectRefData
}{\void}
211 Default constructor. Initialises the
{\bf m
\_count} member to
1.
213 \membersection{wxObjectRefData::
\destruct{wxObjectRefData
}}\label{wxobjectrefdatadtor
}
215 \func{}{wxObjectRefData
}{\void}