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::CopyObject
}\label{wxobjectcopyobject
}
53 \func{virtual void
}{CopyObject
}{\param{wxObject\&
}{ object
\_dest}}
55 Create a copy of this object in object
\_dest. Must perform a full copy of self
56 so that object
\_dest will be valid after this object is deleted
58 \membersection{wxObject::Dump
}\label{wxobjectdump
}
60 \func{void
}{Dump
}{\param{ostream\&
}{ stream
}}
62 A virtual function that should be redefined by derived classes to allow dumping of
65 \wxheading{Parameters
}
67 \docparam{stream
}{Stream on which to output dump information.
}
71 Currently wxWindows does not define Dump for derived classes, but
72 programmers may wish to use it for their own applications. Be sure to
73 call the Dump member of the class's base class to allow all information to be dumped.
75 The implementation of this function just writes the class name of the object
76 in debug build (
\_\_WXDEBUG\_\_ defined), otherwise it does nothing.
78 \membersection{wxObject::GetClassInfo
}\label{wxobjectgetclassinfo
}
80 \func{wxClassInfo *
}{GetClassInfo
}{\void}
82 This virtual function is redefined for every class that requires run-time
83 type information, when using DECLARE
\_CLASS macros.
85 \membersection{wxObject::GetRefData
}\label{wxobjectgetrefdata
}
87 \constfunc{wxObjectRefData*
}{GetRefData
}{\void}
89 Returns the
{\bf m
\_refData} pointer.
93 \helpref{wxObject::Ref
}{wxobjectref
},
\helpref{wxObject::UnRef
}{wxobjectunref
},
\helpref{wxObject::m
\_refData}{wxobjectmrefdata
},
\rtfsp
94 \helpref{wxObject::SetRefData
}{wxobjectsetrefdata
},
\rtfsp
95 \helpref{wxObjectRefData
}{wxobjectrefdata
}
97 \membersection{wxObject::IsKindOf
}\label{wxobjectiskindof
}
99 \func{bool
}{IsKindOf
}{\param{wxClassInfo *
}{info
}}
101 Determines whether this class is a subclass of (or the same class as)
104 \wxheading{Parameters
}
106 \docparam{info
}{A pointer to a class information object, which may be obtained
107 by using the CLASSINFO macro.
}
109 \wxheading{Return value
}
111 TRUE if the class represented by
{\it info
} is the same class as
112 this one or is derived from it.
117 bool tmp = obj->IsKindOf(CLASSINFO(wxFrame));
120 \membersection{wxObject::Ref
}\label{wxobjectref
}
122 \func{void
}{Ref
}{\param{const wxObject\&
}{clone
}}
124 Makes this object refer to the data in
{\it clone
}.
126 \wxheading{Parameters
}
128 \docparam{clone
}{The object to `clone'.
}
132 First this function calls
\helpref{wxObject::UnRef
}{wxobjectunref
} on itself
133 to decrement (and perhaps free) the data it is currently referring to.
135 It then sets its own m
\_refData to point to that of
{\it clone
}, and increments the reference count
140 \helpref{wxObject::UnRef
}{wxobjectunref
},
\helpref{wxObject::m
\_refData}{wxobjectmrefdata
},
\rtfsp
141 \helpref{wxObject::SetRefData
}{wxobjectsetrefdata
},
\helpref{wxObject::GetRefData
}{wxobjectgetrefdata
},
\rtfsp
142 \helpref{wxObjectRefData
}{wxobjectrefdata
}
144 \membersection{wxObject::SetRefData
}\label{wxobjectsetrefdata
}
146 \func{void
}{SetRefData
}{\param{wxObjectRefData*
}{ data
}}
148 Sets the
{\bf m
\_refData} pointer.
152 \helpref{wxObject::Ref
}{wxobjectref
},
\helpref{wxObject::UnRef
}{wxobjectunref
},
\helpref{wxObject::m
\_refData}{wxobjectmrefdata
},
\rtfsp
153 \helpref{wxObject::GetRefData
}{wxobjectgetrefdata
},
\rtfsp
154 \helpref{wxObjectRefData
}{wxobjectrefdata
}
156 \membersection{wxObject::UnRef
}\label{wxobjectunref
}
158 \func{void
}{UnRef
}{\void}
160 Decrements the reference count in the associated data, and if it is zero, deletes the data.
161 The
{\bf m
\_refData} member is set to NULL.
165 \helpref{wxObject::Ref
}{wxobjectref
},
\helpref{wxObject::m
\_refData}{wxobjectmrefdata
},
\rtfsp
166 \helpref{wxObject::SetRefData
}{wxobjectsetrefdata
},
\helpref{wxObject::GetRefData
}{wxobjectgetrefdata
},
\rtfsp
167 \helpref{wxObjectRefData
}{wxobjectrefdata
}
169 \membersection{wxObject::operator new
}\label{wxobjectnew
}
171 \func{void *
}{new
}{\param{size
\_t }{size
},
\param{const wxString\&
}{filename = NULL
},
\param{int
}{ lineNum =
0}}
173 The
{\it new
} operator is defined for debugging versions of the library only, when
174 the identifier
\_\_WXDEBUG\_\_ is defined. It takes over memory allocation, allowing
175 wxDebugContext operations.
177 \membersection{wxObject::operator delete
}\label{wxobjectdelete
}
179 \func{void
}{delete
}{\param{void
}{buf
}}
181 The
{\it delete
} operator is defined for debugging versions of the library only, when
182 the identifier
\_\_WXDEBUG\_\_ is defined. It takes over memory deallocation, allowing
183 wxDebugContext operations.
185 \section{\class{wxObjectRefData
}}\label{wxobjectrefdata
}
187 This class is used to store reference-counted data. Derive classes from this to
188 store your own data. When retrieving information from a
{\bf wxObject
}'s reference data,
189 you will need to cast to your own derived class.
193 \helpref{wxObject
}{wxobject
}
197 \helpref{wxObject
}{wxobject
}
199 \latexignore{\rtfignore{\wxheading{Members
}}}
201 \membersection{wxObjectRefData::m
\_count}
203 \member{int
}{m
\_count}
205 Reference count. When this goes to zero during a
\helpref{wxObject::UnRef
}{wxobjectunref
}, an object
206 can delete the
{\bf wxObjectRefData
} object.
208 \membersection{wxObjectRefData::wxObjectRefData
}\label{wxobjectrefdataconstr
}
210 \func{}{wxObjectRefData
}{\void}
212 Default constructor. Initialises the
{\bf m
\_count} member to
1.
214 \membersection{wxObjectRefData::
\destruct{wxObjectRefData
}}
216 \func{}{wxObjectRefData
}{\void}