1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>GTK+ Foundation Classes</title>
<link href="gfc.css" rel="stylesheet" type="text/css">
<meta content="The GFC Development Team" name="author">
<meta content="Core Library Reference Manual" name="description">
</head>
<body style="color: rgb(0, 0, 0); background-color: rgb(243, 244, 248);"
alink="#000099" link="#000099" vlink="#990099">
<table style="text-align: left; width: 1227px; height: 117px;"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="text-align: center; background-color: rgb(255, 255, 255); width: 220px; vertical-align: top;"><img
alt="GFC Logo" src="../images/gfc.png"
style="width: 207px; height: 92px;"></td>
<td
style="text-align: center; background-color: rgb(87, 107, 152); vertical-align: middle;"><img
alt="GFC Title Logo" src="../images/gfc-title.png"
style="width: 418px; height: 76px;"><br>
</td>
</tr>
<tr>
<td
style="text-align: center; background-color: rgb(65, 77, 104); vertical-align: middle;"><big><span
style="color: rgb(255, 255, 153); font-weight: bold;">Reference Manual</span></big><br>
</td>
<td
style="text-align: center; background-color: rgb(148, 164, 200); vertical-align: middle;"><small
style="font-family: helvetica,arial,sans-serif;"><a
href="../html/index.html">Main Page</a> | <a
href="../html/namespaces.html">Namespace List</a> | <a
href="classes.html">Alphabetical List</a> | <a
href="../html/annotated.html">Class List</a> | <a
href="../html/files.html">File List</a></small><br>
</td>
</tr>
</tbody>
</table>
<small> </small>
</body>
</html>
<!-- Generated by Doxygen 1.3.8 -->
<h1>GFC::Gtk::Object Class Reference</h1>A GtkObject C++ wrapper class.
<a href="#_details">More...</a>
<p>
<code>#include <gfc/gtk/object.hh></code>
<p>
<p>Inheritance diagram for GFC::Gtk::Object:
<p><center><img src="classGFC_1_1Gtk_1_1Object.png" usemap="#GFC::Gtk::Object_map" border="0" alt=""></center>
<map name="GFC::Gtk::Object_map">
<area doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html" alt="GFC::G::Object" shape="rect" coords="477,112,658,136">
<area doxygen="gfccore.tag:" href="classGFC_1_1G_1_1TypeInstance.html" alt="GFC::G::TypeInstance" shape="rect" coords="477,56,658,80">
<area doxygen="gfccore.tag:" href="classGFC_1_1Trackable.html" alt="GFC::Trackable" shape="rect" coords="477,0,658,24">
<area href="classGFC_1_1Gtk_1_1Adjustment.html" alt="GFC::Gtk::Adjustment" shape="rect" coords="0,224,181,248">
<area href="classGFC_1_1Gtk_1_1CellRenderer.html" alt="GFC::Gtk::CellRenderer" shape="rect" coords="191,224,372,248">
<area href="classGFC_1_1Gtk_1_1FileFilter.html" alt="GFC::Gtk::FileFilter" shape="rect" coords="382,224,563,248">
<area href="classGFC_1_1Gtk_1_1Tooltips.html" alt="GFC::Gtk::Tooltips" shape="rect" coords="573,224,754,248">
<area href="classGFC_1_1Gtk_1_1TreeViewColumn.html" alt="GFC::Gtk::TreeViewColumn" shape="rect" coords="764,224,945,248">
<area href="classGFC_1_1Gtk_1_1Widget.html" alt="GFC::Gtk::Widget" shape="rect" coords="955,224,1136,248">
<area href="classGFC_1_1Gtk_1_1CellRendererPixbuf.html" alt="GFC::Gtk::CellRendererPixbuf" shape="rect" coords="382,280,563,304">
<area href="classGFC_1_1Gtk_1_1CellRendererText.html" alt="GFC::Gtk::CellRendererText" shape="rect" coords="382,336,563,360">
<area href="classGFC_1_1Gtk_1_1CellRendererToggle.html" alt="GFC::Gtk::CellRendererToggle" shape="rect" coords="382,392,563,416">
<area href="classGFC_1_1Gtk_1_1Calendar.html" alt="GFC::Gtk::Calendar" shape="rect" coords="1146,280,1327,304">
<area href="classGFC_1_1Gtk_1_1Container.html" alt="GFC::Gtk::Container" shape="rect" coords="1146,336,1327,360">
<area href="classGFC_1_1Gtk_1_1DrawingArea.html" alt="GFC::Gtk::DrawingArea" shape="rect" coords="1146,392,1327,416">
<area href="classGFC_1_1Gtk_1_1Entry.html" alt="GFC::Gtk::Entry" shape="rect" coords="1146,448,1327,472">
<area href="classGFC_1_1Gtk_1_1Invisible.html" alt="GFC::Gtk::Invisible" shape="rect" coords="1146,504,1327,528">
<area href="classGFC_1_1Gtk_1_1Misc.html" alt="GFC::Gtk::Misc" shape="rect" coords="1146,560,1327,584">
<area href="classGFC_1_1Gtk_1_1ProgressBar.html" alt="GFC::Gtk::ProgressBar" shape="rect" coords="1146,616,1327,640">
<area href="classGFC_1_1Gtk_1_1Range.html" alt="GFC::Gtk::Range" shape="rect" coords="1146,672,1327,696">
<area href="classGFC_1_1Gtk_1_1Ruler.html" alt="GFC::Gtk::Ruler" shape="rect" coords="1146,728,1327,752">
<area href="classGFC_1_1Gtk_1_1Separator.html" alt="GFC::Gtk::Separator" shape="rect" coords="1146,784,1327,808">
</map>
<a href="classGFC_1_1Gtk_1_1Object-members.html">List of all members.</a><h2>Signal Prototypes</h2>
<ul>
<li>const <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Signal.html">DestroySignalType</a> <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z678_2">destroy_signal</a>
<dl class="el"><dd class="mdescRight">Destroy signal (see <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z682_0">sig_destroy()</a>). <a href="#z678_2"></a><br></dl></ul>
<h2>Public Member Functions</h2>
<tr><td colspan="2"><div class="groupHeader">Constructors</div></td></tr>
<ul>
<li><a class="anchor" name="z679_0" doxytag="GFC::Gtk::Object::~Object" ></a>
virtual <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z679_0">~Object</a> ()
<dl class="el"><dd class="mdescRight">Desructor. <br></dl></ul>
<tr><td colspan="2"><div class="groupHeader">Accessors</div></td></tr>
<ul>
<li><a class="anchor" name="z680_0" doxytag="GFC::Gtk::Object::gtk_object" ></a>
GtkObject * <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z680_0">gtk_object</a> () const
<dl class="el"><dd class="mdescRight">Get a pointer to the GtkObject structure. <br></dl><li><a class="anchor" name="z680_1" doxytag="GFC::Gtk::Object::operator GtkObject *" ></a>
<a class="el" href="classGFC_1_1Gtk_1_1Object.html#z680_1">operator GtkObject *</a> () const
<dl class="el"><dd class="mdescRight">Conversion operator; safely converts an <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Object</a> to a GtkObject pointer. <br></dl></ul>
<tr><td colspan="2"><div class="groupHeader">Methods</div></td></tr>
<ul>
<li>void <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_0">sink</a> ()
<dl class="el"><dd class="mdescRight">Removes the floating reference from an object, if it exists; otherwise does nothing. <a href="#z681_0"></a><br></dl><li>virtual void <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_1">ref</a> ()
<dl class="el"><dd class="mdescRight">Increases the reference count of the object. <a href="#z681_1"></a><br></dl><li>virtual void <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_2">dispose</a> ()
<dl class="el"><dd class="mdescRight">Emits the "destroy" signal notifying all reference holders that they should release the object. <a href="#z681_2"></a><br></dl></ul>
<tr><td colspan="2"><div class="groupHeader">Signal Proxies</div></td></tr>
<ul>
<li><a class="anchor" name="z682_0" doxytag="GFC::Gtk::Object::sig_destroy" ></a>
const <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1SignalProxy.html">DestroySignalProxy</a> <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z682_0">sig_destroy</a> ()
<dl class="el"><dd class="mdescRight">Connect to the destroy_signal; emitted when the holder of a reference should release the reference that they hold. <br></dl></ul>
<h2>Protected Member Functions</h2>
<tr><td colspan="2"><div class="groupHeader">Constructors</div></td></tr>
<ul>
<li><a class="el" href="classGFC_1_1Gtk_1_1Object.html#z677_0">Object</a> (GtkObject *object, bool <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1Trackable.html#z143_1">owns_reference</a>=false)
<dl class="el"><dd class="mdescRight">Construct a new <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Object</a> from an existing GtkObject. <a href="#z677_0"></a><br></dl></ul>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A GtkObject C++ wrapper class.
<p>
<a class="el" href="classGFC_1_1Gtk_1_1Object.html">Object</a> is the base class for all widgets, and for a few non-widget objects such as <a class="el" href="classGFC_1_1Gtk_1_1Adjustment.html">Adjustment</a>. <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Object</a> predates <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html">G::Object</a>; non-widgets that derive from <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Gtk::Object</a> rather than <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html">G::Object</a> do so for backward compatibility reasons. The most interesting difference between <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Gtk::Object</a> and <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html">G::Object</a> is the "floating" reference count. A <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html">G::Object</a> is created with a reference count of 1, owned by the creator of the <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html">G::Object</a>. (The owner of a reference is the code section that has the right to call <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html#z72_1">G::Object::unref()</a> in order to remove that reference.) A <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Gtk::Object</a> is created with a reference count of 1 also, but it isn't owned by anyone. Calling <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html#z72_1">G::Object::unref()</a> on the newly-created <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Gtk::Object</a> is incorrect. Instead, the initial reference count of a <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Gtk::Object</a> is "floating". The floating reference can be removed by anyone at any time, by calling <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_0">sink()</a>. Sinking an object does nothing if the object is already sunk (has no floating reference).<p>
When you add a widget to its parent container, the parent GTK+ container will do this: <div class="fragment"><pre> g_object_ref (G_OBJECT (child_widget));
gtk_object_sink (GTK_OBJECT (child_widget));
</pre></div>This means that the container now owns a reference to the child widget (since it called g_object_ref()), and the child widget has no floating reference. If you want to hold onto a reference to the child widget you would have to reference then sink the child widget yourself. In <a class="elRef" doxygen="gfccore.tag:" href="namespaceGFC.html">GFC</a>, <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_1">Gtk::Object::ref()</a> does this for you, by sinking any widget with a floating reference.<p>
The purpose of the floating reference is to keep the child widget alive until you add it to a parent container: <div class="fragment"><pre> Gtk::Button *button = <span class="keyword">new</span> Gtk::Button;
<span class="comment">// button has one floating reference to keep it alive.</span>
container->add(*button);
<span class="comment">// button has one non-floating reference owned by the container.</span>
</pre></div><p>
<a class="el" href="classGFC_1_1Gtk_1_1Window.html">Gtk::Window</a> is a special case, because GTK+ itself will ref/sink it on creation. That is, after constructing a new <a class="el" href="classGFC_1_1Gtk_1_1Window.html">Gtk::Window</a> it will have one reference which is owned by GTK+, and is not a floating reference.<p>
One more factor comes into play: the "destroy" signal, emitted by the <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_2">Gtk::Object::dispose()</a> method. The "destroy" signal asks all code owning a reference to an object to release said reference. So, for example, if you call <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_2">Gtk::Object::dispose()</a> on a <a class="el" href="classGFC_1_1Gtk_1_1Window.html">Gtk::Window</a>, GTK+ will release the reference count that it owns; if you call <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_2">Gtk::Object::dispose()</a> on a <a class="el" href="classGFC_1_1Gtk_1_1Button.html">Button</a>, then the button will be removed from its parent container and the parent container will release its reference to the button. Because these references are released, calling <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_2">dispose()</a> should result in freeing all memory associated with an object, unless some buggy code fails to release its references in response to the "destroy" signal. Freeing memory (referred to as finalization) only happens if the reference count reaches zero.<p>
Some simple rules for handling <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Gtk::Object</a>'s:<ul>
<li>Never call <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html#z72_1">unref()</a> unless you have previously called <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_1">ref()</a>, even if you created the object. (Note: this is not true for <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html">G::Object</a>; for <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html">G::Object</a>, the creator of the object owns a reference.)</li><li>Call <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_2">dispose()</a> to get rid of most objects in most cases. In particular, widgets are almost always destroyed in this way.</li><li>Because of the floating reference count, you don't need to worry about reference counting for widgets and toplevel windows, unless you explicitly call <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_1">ref()</a> yourself. </li></ul>
<p>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="z677_0" doxytag="GFC::Gtk::Object::Object" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> GFC::Gtk::Object::Object </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">GtkObject * </td>
<td class="mdname" nowrap> <em>object</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>bool </td>
<td class="mdname" nowrap> <em>owns_reference</em> = <code>false</code></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [explicit, protected]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Construct a new <a class="el" href="classGFC_1_1Gtk_1_1Object.html">Object</a> from an existing GtkObject.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>object</em> </td><td>A pointer to a GtkObject. </td></tr>
<tr><td></td><td valign=top><em>owns_reference</em> </td><td>Set false if the initial reference count is floating, set true if it's not.</td></tr>
</table>
</dl>
<br>
The <em>object</em> can be a newly created GtkObject or an existing GtkObject (see <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html#z68_0">G::Object::Object</a>). </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="z681_2" doxytag="GFC::Gtk::Object::dispose" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> virtual void GFC::Gtk::Object::dispose </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Emits the "destroy" signal notifying all reference holders that they should release the object.
<p>
See the overview documentation at the top of the page for more details. The memory for the object itself won't be deleted until its reference count actually drops to 0; <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_2">dispose()</a> merely asks reference holders to release their references, it does not free the object. This method is declared virtual for GFC's use only.
<p>
Reimplemented from <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html#z72_2">GFC::G::Object</a>.
<p>
</td>
</tr>
</table>
<a class="anchor" name="z681_1" doxytag="GFC::Gtk::Object::ref" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> virtual void GFC::Gtk::Object::ref </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Increases the reference count of the object.
<p>
This method calls <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html#z72_0">G::Object::ref()</a> first and then <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_0">sink()</a> to sink the object if it has a floating reference.
<p>
Reimplemented from <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Object.html#z72_0">GFC::G::Object</a>.
<p>
</td>
</tr>
</table>
<a class="anchor" name="z681_0" doxytag="GFC::Gtk::Object::sink" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void GFC::Gtk::Object::sink </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Removes the floating reference from an object, if it exists; otherwise does nothing.
<p>
The <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z681_1">ref()</a> method calls this function to sink any object with a floating reference. So as a rule you shouldn't need to call this method at all. </td>
</tr>
</table>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="z678_2" doxytag="GFC::Gtk::Object::destroy_signal" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const <a class="elRef" doxygen="gfccore.tag:" href="classGFC_1_1G_1_1Signal.html">DestroySignalType</a> <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z678_2">GFC::Gtk::Object::destroy_signal</a><code> [static, protected]</code> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Destroy signal (see <a class="el" href="classGFC_1_1Gtk_1_1Object.html#z682_0">sig_destroy()</a>).
<p>
Calls a slot with the signature: <div class="fragment"><pre> <span class="keywordtype">void</span> function();
</pre></div> </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="gtk_2object_8hh-source.html">gtk/object.hh</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Aug 24 00:34:41 2004 for GFC-UI by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
</body>
</html>
|