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

📄 gtk-changes-2-0.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 4 页
字号:
There are <code class="function">ctree_set_expander_style()</code>-functions, to     randomly change look-and-feel for no good reason.</p></li><li><p>The split between <span class="structname">GtkProgress</span> and <span class="structname">GtkProgressBar</span> makes no sense to me whatsoever.</p></li></ul></div><p>  This was a big wart on GTK+ and made people waste lots of time,  both learning and using the interface.  So, we have added what we feel is the correct API, and marked all the  rest deprecated. However, the changes are 100% backward-compatible and  should break no existing code.  The following 5 functions are the new programming interface and you   should consider changing your code to use them:</p><pre class="programlisting">  void       gtk_progress_bar_pulse                (GtkProgressBar *pbar);  void       gtk_progress_bar_set_text             (GtkProgressBar *pbar,                                                    const gchar    *text);  void       gtk_progress_bar_set_fraction         (GtkProgressBar *pbar,                                                    gfloat          fraction);  void       gtk_progress_bar_set_pulse_step       (GtkProgressBar *pbar,                                                    gfloat          fraction);  void       gtk_progress_bar_set_orientation      (GtkProgressBar *pbar,						    GtkProgressBarOrientation orientation);</pre><p></p></li><li><p>The <span class="structname">GtkNotebookPage</span> structure has been removed from   the public header files;  this was never meant to be a public structure, and all functionality that  could be done by accessing the struct fields of this structure should be   accessible otherwise.</p></li><li><p>Negative values of the <em class="parameter"><code>position</code></em> parameter to  <code class="function">gtk_notebook_reorder_child()</code> now cause the page to be appended, not  inserted at the beginning. (This gives consistency with  <code class="function">gtk_box_reorder_child()</code>, <code class="function">gtk_menu_reorder_child()</code>.)</p></li><li><p><code class="function">GtkMenuPositionFunc</code> has a new parameter   <code class="literal">push_in</code> which controls how menus placed outside the   screen is handled. If this is set to <code class="literal">TRUE</code> and  part of the menu is outside the screen then GTK+ pushes it into the visible  area. Otherwise the menu is cut of at the end of the visible screen area.</p><p>  Regardless of what happens to the size of the menu, the result is always  that the items are placed in the same place as if the menu was placed  outside the screen, using menu scrolling if necessary.</p></li><li><p>The "draw" signal and virtual method on <span class="structname">GtkWidget</span>   has been removed.  All drawing should now occur by invalidating a region of the widget  (call <code class="function">gdk_window_invalidate_rect()</code> or   <code class="function">gtk_widget_queue_draw()</code> for example to invalidate   a region). GTK+ merges all invalid regions, and sends expose events to   the widget in an idle handler for the invalid regions.   <code class="function">gtk_widget_draw()</code> is deprecated but still works; it  adds the passed-in area to the invalid region and immediately sends  expose events for the current invalid region.   Most widgets will work fine if you just delete their "draw"  implementation, since they will already have working expose_event  implementations. The draw method was rarely called in practice  anyway.</p></li><li><p>The <span class="structname">GdkExposeEvent</span> has a new <em class="structfield"><code>region</code></em>  field. This can be used instead of the <em class="structfield"><code>area</code></em> field if you   want a more exact representation of the area to update.</p></li><li><p>Sending synthetic exposes using <code class="function">gtk_widget_event()</code> is no   longer allowed. If you just need an expose call you should use   <code class="function">gdk_window_invalidate_rect()</code> or   <code class="function">gdk_window_invalidate_region()</code> instead. For the case   of container widgets that need to propagate expose events to   <code class="literal">NO_WINDOW</code> children you can either use   <code class="function">gtk_container_propagate_expose()</code>, or chain to the  default container expose handler.</p></li><li><p>The draw_default and draw_focus methods/signals on   <span class="structname">GtkWidget</span> are gone; simply draw things in your   expose handler. <code class="function">gtk_widget_draw_focus()</code> and   <code class="function">gtk_widget_draw_default()</code> wrapper  functions are also gone; just queue a draw on the widget,    or the part affected by the focus/default anyway.  Also, <span class="structname">GtkWidget</span> now has default implementations for   focus_in_event and focus_out_event. These set/unset   <code class="literal">GTK_HAS_FOCUS</code>, and queue a draw. So if your focus in/out   handler just does that, you can delete it.</p></li><li><p><span class="structname">GtkText</span> and <span class="structname">GtkTree</span> are   buggy and broken. We don't recommend using them, and changing old code to   avoid them is a good idea. The recommended alternatives are   <span class="structname">GtkTextView</span> and <span class="structname">GtkTreeView</span>.  The broken widgets are not declared in the headers by default; to use  them, define the symbol <code class="literal">GTK_ENABLE_BROKEN</code> during   compilation. In some future release, these widgets will be removed from GTK+.</p></li><li><p><span class="structname">GdkColorContext</span> is gone; you probably weren't using   it anyway.  Use <span class="structname">GdkColormap</span> and the   <code class="function">gdk_rgb_*</code> functions instead.</p></li><li><p><span class="structname">GtkMenuBar</span> now draws the <em class="structfield"><code>GtkContainer::border_width</code></em>   space outside the frame, not inside the frame.</p></li><li><p>In GTK+ 1.2, if an event handler returned <code class="literal">TRUE</code> it prevented  propagation of that event to parent widgets. That is, the   event signal would not be emitted on parent widgets. In   GTK+ 2.0, if an event handler returns <code class="literal">TRUE</code>, the current   signal emission on the current widget is immediately stopped. That is,  other callbacks connected to the signal will not be invoked.</p></li><li><p><code class="function">gtk_toolbar_new()</code> no longer has arguments. This function   was broken because the default <code class="literal">GtkToolbarStyle</code> (icons,   text, both) is now a user preference, which is overridden when you call  <code class="function">gtk_toolbar_set_style()</code>. The constructor forced everyone  to override the preference, which was undesirable. So to port  your app, decide if you want to force the toolbar style   or conform to the user's global defaults; if you want to force  it, call <code class="function">gtk_toolbar_set_style()</code>.</p><p>  The orientation arg was removed from <code class="function">gtk_toolbar_new()</code>   as well, just because it wasn't very useful and we were breaking the function  anyway so had an opportunity to lose it. Call  <code class="function">gtk_toolbar_set_orientation()</code> to set toolbar orientation.</p></li><li><p><span class="structname">GtkRange</span>/<span class="structname">GtkScrollbar</span>/<span class="structname">GtkScale</span> were rewritten; this means that most  theme engines won't draw them properly, and any custom subclasses of  these widgets will need a rewrite (though if you could figure out  how to subclass the old version of <span class="structname">GtkRange</span>, you   have our respect). Also, <code class="literal">GtkTroughType</code> is gone.</p><p> Here are some notable changes: </p><div class="itemizedlist"><ul type="circle"><li><p>       <code class="literal">stepper_size</code> style property is the height for        vertical ranges, width for horizontal; the other dimension matches        the trough size.     </p></li><li><p>       Added the ability to do NeXT-style steppers (and several other styles       that don't make any sense).     </p></li><li><p>       Added <code class="literal">min_slider_length</code>,        <code class="literal">fixed_slider_length</code> properties to       <span class="structname">GtkScrollbar</span>.     </p></li><li><p>       Cleaned some private (or at least useless) functions out of       <code class="filename">gtkscale.h</code>, e.g.        <code class="function">gtk_scale_value_width</code>.     </p></li><li><p>       Moved bindings from subclasses to <span class="structname">GtkScale</span>,        even arrow keys, since blind users don't know scale orientation.     </p></li><li><p>       Changed <code class="literal">move_slider</code> action signal to use new        <span class="structname">GtkScrollType</span>, remove         <span class="structname">GtkTroughType</span> argument.     </p></li><li><p>       Digits rounds the values a range will input to the given       number of decimals, but will not try to force adjustment       values set by other controllers. That is, we no longer       modify <code class="literal">adjustment-&gt;value</code> inside a        <code class="literal">value_changed</code> handler.     </p></li><li><p>       Added getters for <span class="structname">GtkScale</span> setters.     </p></li><li><p>       Middle-click begins a slider drag.     </p></li></ul></div><p></p></li><li><p>The GtkContainer::focus signal/virtual function and  <code class="function">gtk_container_focus()</code> call were replaced by   GtkWidget::focus and <code class="function">gtk_widget_child_focus()</code>.   The semantics are the same, so you should be able to just   replace <code class="literal">container_class-&gt;focus = mywidget_focus</code> with   <code class="literal">widget_class-&gt;focus = mywidget_focus</code> and replace   <code class="function">gtk_container_focus()</code> calls with   <code class="function">gtk_widget_child_focus()</code> calls.</p><p>  The purpose of this change was to allow non-containers to have   focusable elements.</p></li><li><p><code class="function">gtk_rc_set_image_loader()</code> and <code class="function">gtk_rc_load_image()</code> have been removed, now   that GTK+ includes decent image loading capabilities itself.</p></li><li><p>An extra <span class="structname">GtkSettings</span> argument has been added to  <code class="function">gtk_rc_find_pixmap_in_path()</code>. This function is only   actually useful from a theme engine during parsing, at which point the   <span class="structname">GtkSettings</span> is provided.</p></li><li><p>The child argument facility in <code class="filename">gtkcontainer.c</code> has been   converted to a child property facility using   <span class="structname">GParamSpec</span> and other facilities  for <span class="structname">GObject</span>.   </p></li><li><p>The <code class="function">set_child_arg()</code> and <code class="function">get_child_arg()</code>      virtual methods have been replaced with <code class="function">set_child_property()</code>/<code class="function">get_child_property()</code>, which     work similar to GObject-&gt;set_property/get_property.</p></li><li><p>Other removed <span class="structname">GtkContainer</span> functions with the replacements:</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th>Old function</th><th>Replacement</th></tr></thead><tbody><tr><td><code class="function">gtk_container_add_child_arg_type</code></td><td><code class="function">gtk_container_class_install_child_property</code></td></tr><tr><td><code class="function">gtk_container_query_child_args</code></td><td><code class="function">gtk_container_class_list_child_properties</code></td></tr><tr><td><code class="function">gtk_container_child_getv</code></td><td><code class="function">gtk_container_child_set_property</code></td></tr><tr><td><code class="function">gtk_container_child_setv</code></td><td><code class="function">gtk_container_child_get_property</code></td></tr><tr><td><code class="function">gtk_container_add_with_args</code></td><td><code class="function">gtk_container_add_with_properties</code></td></tr><tr><td><code class="function">gtk_container_addv</code></td><td><code class="function">gtk_container_add</code>/<code class="function">gtk_container_child_set_property</code></td></tr></tbody></table></div><p></p></li><li><p><code class="function">gdk_image_get()</code> (or rather its replacement,  <code class="function">gdk_drawable_get_image()</code>) now handles errors properly   by returning <code class="literal">NULL</code>, previously it would crash. Also, a   window being offscreen is no longer considered an error; instead, the area   contains undefined contents for the offscreen areas. In most cases, code  using <code class="function">gdk_image_get()</code> should really be ported to

⌨️ 快捷键说明

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