1 \section{\class{wxObject
}}\label{wxobject
}
3 This is the root class of all wxWindows 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{wxobjectconstr
}
27 \func{}{wxObject
}{\void}
31 \membersection{wxObject::
\destruct{wxObject
}}
33 \func{}{wxObject
}{\void}
35 Destructor. Performs dereferencing, for those objects
36 that use reference counting.
38 \membersection{wxObject::m
\_refData}\label{wxobjectmrefdata
}
40 \member{wxObjectRefData*
}{m
\_refData}
42 Pointer to an object which is the object's reference-counted data.
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
}
51 \membersection{wxObject::Dump
}\label{wxobjectdump
}
53 \func{void
}{Dump
}{\param{ostream\&
}{ stream
}}
55 A virtual function that should be redefined by derived classes to allow dumping of
58 \wxheading{Parameters
}
60 \docparam{stream
}{Stream on which to output dump information.
}
64 Currently wxWindows does not define Dump for derived classes, but
65 programmers may wish to use it for their own applications. Be sure to
66 call the Dump member of the class's base class to allow all information to be dumped.
68 The implementation of this function just writes the class name of the object
69 in debug build (
\_\_WXDEBUG\_\_ defined), otherwise it does nothing.
71 \membersection{wxObject::GetClassInfo
}\label{wxobjectgetclassinfo
}
73 \func{wxClassInfo *
}{GetClassInfo
}{\void}
75 This virtual function is redefined for every class that requires run-time
76 type information, when using DECLARE
\_CLASS macros.
78 \membersection{wxObject::GetRefData
}\label{wxobjectgetrefdata
}
80 \constfunc{wxObjectRefData*
}{GetRefData
}{\void}
82 Returns the
{\bf m
\_refData} pointer.
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
}
90 \membersection{wxObject::IsKindOf
}\label{wxobjectiskindof
}
92 \func{bool
}{IsKindOf
}{\param{wxClassInfo *
}{info
}}
94 Determines whether this class is a subclass of (or the same class as)
97 \wxheading{Parameters
}
99 \docparam{info
}{A pointer to a class information object, which may be obtained
100 by using the CLASSINFO macro.
}
102 \wxheading{Return value
}
104 TRUE if the class represented by
{\it info
} is the same class as
105 this one or is derived from it.
110 bool tmp = obj->IsKindOf(CLASSINFO(wxFrame));
113 \membersection{wxObject::Ref
}\label{wxobjectref
}
115 \func{void
}{Ref
}{\param{const wxObject\&
}{clone
}}
117 Makes this object refer to the data in
{\it clone
}.
119 \wxheading{Parameters
}
121 \docparam{clone
}{The object to `clone'.
}
125 First this function calls
\helpref{wxObject::UnRef
}{wxobjectunref
} on itself
126 to decrement (and perhaps free) the data it is currently referring to.
128 It then sets its own m
\_refData to point to that of
{\it clone
}, and increments the reference count
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
}
137 \membersection{wxObject::SetRefData
}\label{wxobjectsetrefdata
}
139 \func{void
}{SetRefData
}{\param{wxObjectRefData*
}{ data
}}
141 Sets the
{\bf m
\_refData} pointer.
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
}
149 \membersection{wxObject::UnRef
}\label{wxobjectunref
}
151 \func{void
}{UnRef
}{\void}
153 Decrements the reference count in the associated data, and if it is zero, deletes the data.
154 The
{\bf m
\_refData} member is set to NULL.
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
}
162 \membersection{wxObject::operator new
}\label{wxobjectnew
}
164 \func{void *
}{new
}{\param{size
\_t }{size
},
\param{const wxString\&
}{filename = NULL
},
\param{int
}{ lineNum =
0}}
166 The
{\it new
} operator is defined for debugging versions of the library only, when
167 the identifier
\_\_WXDEBUG\_\_ is defined. It takes over memory allocation, allowing
168 wxDebugContext operations.
170 \membersection{wxObject::operator delete
}\label{wxobjectdelete
}
172 \func{void
}{delete
}{\param{void
}{buf
}}
174 The
{\it delete
} operator is defined for debugging versions of the library only, when
175 the identifier
\_\_WXDEBUG\_\_ is defined. It takes over memory deallocation, allowing
176 wxDebugContext operations.
178 \section{\class{wxObjectRefData
}}\label{wxobjectrefdata
}
180 This class is used to store reference-counted data. Derive classes from this to
181 store your own data. When retrieving information from a
{\bf wxObject
}'s reference data,
182 you will need to cast to your own derived class.
186 \helpref{wxObject
}{wxobject
}
190 \helpref{wxObject
}{wxobject
}
192 \latexignore{\rtfignore{\wxheading{Members
}}}
194 \membersection{wxObjectRefData::m
\_count}
196 \member{int
}{m
\_count}
198 Reference count. When this goes to zero during a
\helpref{wxObject::UnRef
}{wxobjectunref
}, an object
199 can delete the
{\bf wxObjectRefData
} object.
201 \membersection{wxObjectRefData::wxObjectRefData
}\label{wxobjectrefdataconstr
}
203 \func{}{wxObjectRefData
}{\void}
205 Default constructor. Initialises the
{\bf m
\_count} member to
1.
207 \membersection{wxObjectRefData::
\destruct{wxObjectRefData
}}
209 \func{}{wxObjectRefData
}{\void}