?? sec-gdkresourcemgmt.html
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html> <head> <title> GDK Resource Management </title> <meta name="GENERATOR" content= "Modular DocBook HTML Stylesheet Version 1.45"> <link rel="HOME" title="GTK+ / Gnome Application Development" href="ggad.html"> <link rel="UP" title="GDK Basics" href="cha-gdk.html"> <link rel="PREVIOUS" title="Drawing" href="z132.html"> <link rel="NEXT" title="GtkStyle and Themes" href= "sec-style.html"> </head> <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink= "#840084" alink="#0000FF"> <div class="NAVHEADER"> <table width="100%" border="0" bgcolor="#ffffff" cellpadding= "1" cellspacing="0"> <tr> <th colspan="4" align="center"> <font color="#000000" size="2">GTK+ / Gnome Application Development</font> </th> </tr> <tr> <td width="25%" bgcolor="#ffffff" align="left"> <a href="z132.html"><font color="#0000ff" size="2"><b> <<< Previous</b></font></a> </td> <td width="25%" colspan="2" bgcolor="#ffffff" align= "center"> <font color="#0000ff" size="2"><b><a href="ggad.html"> <font color="#0000ff" size="2"><b> Home</b></font></a></b></font> </td> <td width="25%" bgcolor="#ffffff" align="right"> <a href="sec-style.html"><font color="#0000ff" size= "2"><b>Next >>></b></font></a> </td> </tr> </table> </div> <div class="SECT1"> <h1 class="SECT1"> <a name="SEC-GDKRESOURCEMGMT">GDK Resource Management</a> </h1> <p> GDK objects have either reference counting or destruction, but not both. Pixmaps, fonts, graphics contexts, and colormaps are purely reference counted. (<tt class= "FUNCTION">gdk_gc_destroy()</tt> exists but is deprecated --- it's just a wrapper for <tt class="FUNCTION"> gdk_gc_unref()</tt>.) In general, reference counting is analagous to <span class="STRUCTNAME">GtkObject</span> reference counting. That is, objects start with a reference count of one; when the reference count reaches 0 then the object is destroyed. </p> <p> Cursors and images are not reference counted; they simply have a destroy function. Some types represent static objects that are never destroyed; <span class="STRUCTNAME"> GdkVisual</span> is the main example. </p> <p> <span class="STRUCTNAME">GdkWindow</span> is the strange case; it's reference counted, but <span class="STRUCTNAME"> gdk_window_destroy()</span><i class="EMPHASIS">must</i> be called at some point. The reference counting applies to the client-side <span class="STRUCTNAME">GdkWindow</span> handle; <span class="STRUCTNAME"> gdk_window_destroy()</span> applies to the actual server-side object. See <a href="sec-gdkwindow.html">the section called <i><span class="STRUCTNAME"> GdkWindow</span></i></a> for an explanation of the distinction. <span class="STRUCTNAME"> gdk_window_destroy()</span> unreferences the client-side handle after it destroys the server-side object. It's safe to call any of the <span class="STRUCTNAME"> GdkWindow</span> functions on a destroyed window that still has a reference count greater than zero; they will all return immediately without taking any action. </p> <p> In practice this means that one section of code should "own" the <span class="STRUCTNAME">GdkWindow</span>; it will create the window, and hold the initial reference (remember that objects are created with a reference count of one). It will also call <tt class="FUNCTION"> gdk_window_destroy()</tt> eventually, destroying the server-side object and removing the initial reference count. If no other code increases the count, the client-side handle will be freed. If some other code has increased the reference count with <tt class="FUNCTION"> gdk_window_ref()</tt>, the client-side handle will remain safe to use but attempts to use it will have no effect. When the reference count is eventually decremented to zero, the client-side handle will be freed. </p> <p> In GTK+, windows are generally created and destroyed by the same widget; if other widgets want to draw on the window, they increase the window's reference count. </p> </div> <div class="NAVFOOTER"> <br> <br> <table width="100%" border="0" bgcolor="#ffffff" cellpadding= "1" cellspacing="0"> <tr> <td width="25%" bgcolor="#ffffff" align="left"> <a href="z132.html"><font color="#0000ff" size="2"><b> <<< Previous</b></font></a> </td> <td width="25%" colspan="2" bgcolor="#ffffff" align= "center"> <font color="#0000ff" size="2"><b><a href="ggad.html"> <font color="#0000ff" size="2"><b> Home</b></font></a></b></font> </td> <td width="25%" bgcolor="#ffffff" align="right"> <a href="sec-style.html"><font color="#0000ff" size= "2"><b>Next >>></b></font></a> </td> </tr> <tr> <td colspan="2" align="left"> <font color="#000000" size="2"><b>Drawing</b></font> </td> <td colspan="2" align="right"> <font color="#000000" size="2"><b><span class= "STRUCTNAME">GtkStyle</span> and Themes</b></font> </td> </tr> </table> </div> </body></html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -