⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtk-changes-1-2.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<p>Note that <code class="function">gtk_entry_adjust_scroll()</code> is no longer needed     as <span class="structname">GtkEntry</span> should automatically keep the scroll     adjusted properly.</p></li><li><p>Additionally, all <code class="function">gtk_*_interp()</code> functions were removed.  <code class="function">gtk_*_full()</code> versions were provided as of GTK+ 1.0 and   should be used instead.</p></li><li><p><span class="structname">GtkButton</span> has been changed to derive from <span class="structname">GtkBin</span>.  To access a button's child, use <code class="literal">GTK_BIN (button)-&gt;child</code>,  instead of the old <code class="literal">GTK_BUTTON (button)-&gt;child</code>.</p></li><li><p>The selection API has been slightly modified: <code class="function">gtk_selection_add_handler()</code> and  <code class="function">gtk_selection_add_handler_full()</code>  have been removed. To supply the selection, one now registers the targets one is interested in with:</p><pre class="programlisting">  void gtk_selection_add_target (GtkWidget           *widget, 	  	                 GdkAtom              selection,			         GdkAtom              target,			         guint                info);</pre><p> or:  </p><pre class="programlisting">  void gtk_selection_add_targets (GtkWidget           *widget, 	  			  GdkAtom              selection,				  GtkTargetEntry      *targets,				  guint                ntargets);</pre><p> When a request for a selection is received, the new "selection_get" signal will be called:</p><pre class="programlisting">   void  "selection_get"           (GtkWidget          *widget,				    GtkSelectionData   *selection_data,				    guint               info,				    guint               time);</pre><p> A "time" parameter has also been added to the "selection_received" signal.</p><pre class="programlisting">  void  "selection_received"       (GtkWidget          *widget,				    GtkSelectionData   *selection_data,				    guint               time);</pre><p></p></li><li><p>The old drag and drop API has been completely removed and replaced.  See the reference documentation for details on the new API.</p></li><li><p>Support for Themes has been added. In general, this does  not affect application code, however, a few new rules should  be observed:  </p><div class="itemizedlist"><ul type="circle"><li><p>To set a shape for a window, you must use      <code class="function">gtk_widget_shape_combine_mask()</code> instead of      <code class="function">gdk_window_shape_combine_mask()</code>, or the shape will be     reset when switching themes.  </p></li><li><p>It is no longer permissable to draw directly on an arbitrary     widget, or to set an arbitrary widget's background pixmap.     If you need to do that, use a <span class="structname">GtkDrawingArea</span> or      (for a toplevel) a <span class="structname">GtkWindow</span> where      <code class="function">gtk_widget_set_app_paintable()</code>     has been called.  </p></li></ul></div><p></p></li><li><p>The <span class="structname">GtkScrolledWindow</span> widget no longer creates a   <span class="structname">GtkViewport</span> automatically. Instead, it has been   generalized to accept any "self-scrolling" widget.</p><p>  The self-scrolling widgets in the GTK+ core are   <span class="structname">GtkViewport</span>,  <span class="structname">GtkCList</span>, <span class="structname">GtkCTree</span>,   <span class="structname">GtkText</span>, and <span class="structname">GtkLayout</span>.   All of these widgets can be added to a scrolled window as normal children with  <code class="function">gtk_container_add()</code> and scrollbars will be set up   automatically.</p><p>  To add scrollbars to a non self-scrolling widget, (such as a   <span class="structname">GtkList</span>),  first add it to a viewport, then add the viewport to a scrolled window.  The scrolled window code provides a convenience function to do this:</p><pre class="programlisting">  void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrollwin,					      GtkWidget         *child);</pre><p>  This does exactly what it says - it creates a viewport, adds the child  widget to it, then adds the viewport to the scrolled window.</p><p>  The scrollbars have been removed from the <span class="structname">GtkCList</span>  and <span class="structname">GtkCTree</span>, because they are now scrolled by simply  adding them to a scrolled window. The scrollbar policy is set on the scrolled  window with <code class="function">gtk_scrolled_window_set_policy()</code> and not on   the child widgets (e.g. <span class="structname">GtkCList</span>'s   <code class="function">gtk_clist_set_policy()</code> was removed).</p></li><li><p>The "main loop" of GTK+ has been moved to GLib. This should not  affect existing programs, since compatibility functions have  been provided. However, you may want to consider migrating  your code to use the GLib main loop directly.</p></li><li><p>the <code class="literal">GTK_BASIC</code> flag was removed, and with it the corresponding  macro and function <code class="function">GTK_WIDGET_BASIC()</code> and   <code class="function">gtk_widget_basic()</code>.</p></li><li><p>All freeze/thaw methods are now recursive - that is, if you  freeze a widget n times, you must also thaw it n times.  Therefore, if you have code like:</p><div class="informalexample"><pre class="programlisting">  gboolean frozen;  frozen = GTK_CLIST_FROZEN (clist);  gtk_clist_freeze (clist);  [...]  if (!frozen)    gtk_clist_thaw (clist);</pre></div><p>  it will not work anymore. It must be, simply:</p><div class="informalexample"><pre class="programlisting">  gtk_clist_freeze (clist);  [...]  gtk_clist_thaw (clist);</pre></div><p></p></li><li><p>The thread safety in GTK+ 1.2 is slightly different than  that which appeared in early versions in the 1.1  development track. The main difference is that it relies on   the thread primitives in GLib, and on the thread-safe   GLib main loop.</p><p>  This means:</p><div class="itemizedlist"><ul type="circle"><li><p>You must call <code class="function">g_thread_init()</code> before        executing any other GTK+ or GDK functions in a threaded GTK+ program.     </p></li><li><p>Idles, timeouts, and input functions are executed outside        of the main GTK+ lock. So, if you need to call GTK+        inside of such a callback, you must surround the callback       with a <code class="function">gdk_threads_enter()</code>/<code class="function">gdk_threads_leave()</code>        pair.     </p><p>However, signals are still executed within the main       GTK+ lock.     </p><p>In particular, this means, if you are writing widgets       that might be used in threaded programs, you <span class="emphasis"><em>must</em></span>       surround timeouts and idle functions in this matter.     </p><p>As always, you must also surround any calls to GTK+       not made within a signal handler with a        <code class="function">gdk_threads_enter()</code>/<code class="function">gdk_threads_leave()</code>        pair.     </p></li><li><p>There is no longer a special <code class="option">--with-threads</code>        <span class="command"><strong>configure</strong></span> option for GTK+. To use threads in a GTK+        program, you must:       </p><div class="orderedlist"><ol type="1"><li><p>If you want to use the native thread implementation,              make sure GLib found this in configuration, otherwise,              call you must provide a thread implementation to	      <code class="function">g_thread_init()</code>.           </p></li><li><p>Link with the libraries returned by             <span class="command"><strong>gtk-config --libs gthread</strong></span>             and use the cflags from             <span class="command"><strong>gtk-config --cflags gthread</strong></span>.             You can get these <code class="envar">CFLAGS</code> and <code class="envar">LIBS</code> by              passing <code class="literal">gthread</code> as the fourth parameter to the              <code class="literal">AM_PATH_GTK</code> <span class="application">automake</span>             macro.           </p></li></ol></div><p>     </p></li></ul></div><p></p></li><li><p>Prior to GTK+ 1.2, there were two conflicting interpretations  of <code class="literal">widget-&gt;requisition</code>. It was either taken to be  the size that the widget requested, or that size modified by calls to   <code class="function">gtk_widget_set_usize()</code>. In GTK+ 1.2,  it is always interpreted the first way.</p><p>  Container widgets are affected in two ways by this:  </p><div class="orderedlist"><ol type="1"><li><p>Container widgets should not pass         <code class="literal">widget-&gt;requisition</code> as the second parameter to         <code class="function">gtk_widget_size_request()</code>.        Instead they should call it like:        </p><pre class="programlisting">          GtkRequisition child_requisition;          gtk_widget_size_request (widget, &amp;child_requisition);        </pre><p>      </p></li><li><p>Container widgets should not access         <code class="literal">child-&gt;requisition</code> directly. Either they should use         the values returned by <code class="function">gtk_widget_size_request()</code>,         or they should call the new function:        </p><pre class="programlisting">    void gtk_widget_get_child_requisition (GtkWidget      *widget,					   GtkRequisition *requisition);        </pre><p>        which returns the requisition of the given widget, modified        by calls to <code class="function">gtk_widget_set_usize()</code>.      </p></li></ol></div><p></p></li></ul></div></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -