File: changes-gtkmm3.html

package info (click to toggle)
gtkmm-documentation 4.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,772 kB
  • sloc: cpp: 15,541; javascript: 1,208; makefile: 1,080; python: 401; xml: 106; perl: 67; sh: 8
file content (103 lines) | stat: -rw-r--r-- 8,527 bytes parent folder | download
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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="highlight.min.css">
<script src="highlight.min.js"></script><script>
      hljs.configure({languages: ['cpp']});
      hljs.highlightAll();
    </script><title>Chapter 4. Changes in gtkmm 3</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="Programming with gtkmm 4">
<link rel="up" href="index.html" title="Programming with gtkmm 4">
<link rel="prev" href="sec-helloworld.html" title="Hello World in gtkmm">
<link rel="next" href="changes-gtkmm4.html" title="Chapter 5. Changes in gtkmm-4.0 and glibmm-2.68">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Chapter 4. Changes in <span class="application">gtkmm</span> 3</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="sec-helloworld.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="changes-gtkmm4.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter">
<div class="titlepage"><div><div><h1 class="title">
<a name="changes-gtkmm3"></a>Chapter 4. Changes in <span class="application">gtkmm</span> 3</h1></div></div></div>


<p><span class="application">gtkmm</span>-3.0 is an old version of the <span class="application">gtkmm</span> API that installs in parallel with the still older <span class="application">gtkmm</span>-2.4 API and the new <span class="application">gtkmm</span>-4.0 API. The last version of the <span class="application">gtkmm</span>-2.4 API was <span class="application">gtkmm</span> 2.24. <span class="application">gtkmm</span> 3 has no major fundamental differences to <span class="application">gtkmm</span> 2 but does make several small changes that were not possible while maintaining binary compatibility. If you never used the <span class="application">gtkmm</span>-2.4 API then you can safely ignore this chapter.</p>

<p><span class="application">gtkmm</span> 3's library is called <code class="literal">libgtkmm-3.0</code> rather than <code class="literal">libgtkmm-2.4</code> and installs its headers in a similarly-versioned directory, so your pkg-config check should ask for <code class="literal">gtkmm-3.0</code>  rather than <code class="literal">gtkmm-2.4</code>.</p>

<p><span class="application">gtkmm</span> 3 added some new classes:</p>

<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<code class="classname">Gtk::AppChooser</code>, <code class="classname">Gtk::AppChooserButton</code>, <code class="classname">Gtk::AppChooserDialog</code> allow the user to select an installed application to open a particular type of content.</li>
<li class="listitem">
<code class="classname">Gtk::Grid</code> is a new container widget that will eventually replace <code class="classname">Gtk::Box</code> and <code class="classname">Gtk::Table</code>. It arranges its children according to properties of those children rather than its own layout details.</li>
<li class="listitem">
<code class="classname">Gtk::Switch</code> displays On/Off states more explicitly than <code class="classname">Gtk::CheckButton</code>. It may be useful, for instance, when allowing users to activate hardware.</li>
</ol></div>

<p><span class="application">gtkmm</span> 3 also made several small changes to the API, which you will probably encounter when porting code that used <span class="application">gtkmm</span>-2.4. Here is a short list:</p>

<p>
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<code class="classname">Gtk::CellLayout</code>, used by <code class="classname">Gtk::IconView</code>, <code class="classname">Gtk::TreeView::Column</code> and <code class="classname">Gtk::ComboBox</code>, now has a <code class="classname">Gtk::CellArea</code> which can be used to specify more details of how the <code class="classname">CellRenderer</code>s are arranged and aligned.</li>
<li class="listitem">Gtk::ComboBox now derives from CellLayout, allowing easier layout and alignment of its <code class="classname">Gtk::CellRenderer</code>s.</li>
<li class="listitem">
<code class="classname">Gtk::Adjustment</code> and <code class="classname">IconSet</code> and <code class="classname">Gdk::Cursor</code> are now used via <code class="classname">Glib::RefPtr</code>.</li>
<li class="listitem">
<code class="classname">Gtk::Box</code>, <code class="classname">Gtk::ButtonBox</code>, <code class="classname">Gtk::IconView</code>, <code class="classname">Gtk::Paned</code>, <code class="classname">Gtk::ProgressBar</code>, <code class="classname">Gtk::ScaleButton</code>, <code class="classname">Gtk::Scrollbar</code> and <code class="classname">Gtk::Separator</code> now derive from <code class="classname">Gtk::Orientable</code>, allowing their
orientation (vertical or horizontal) to be specified without requiring the use of a derived class such as <code class="classname">Gtk::HBox</code>.</li>
<li class="listitem">
<code class="classname">Gtk::IconView</code>, <code class="classname">Gtk::TextView</code>, <code class="classname">Gtk::TreeView</code> and other widgets derive from Scrollable instead of having their own methods such as <code class="methodname">get_vadjustment()</code> and instead of having their own set_scroll_adjustments signal.</li>
<li class="listitem">
<code class="classname">Gtk::Style</code> and <code class="classname">Gtk::Rc</code> were removed, replaced by <code class="classname">Gtk::StyleContext</code>, and <code class="classname">Gtk::StyleProvider</code>s, such as <code class="classname">Gtk::CssProvider</code>.</li>
<li class="listitem">Widget::on_expose_event() was replaced by Widget::on_draw(), which assumes that cairomm is used for drawing, via the provided <code class="classname">Cairo::Context</code> and does not require you to call <code class="methodname">Cairo::Context::clip()</code>.</li>
<li class="listitem">
<code class="classname">Gdk::RGBA</code> replaces <code class="classname">Color</code>, adding an alpha component for opacity. <code class="classname">Colormap</code> was removed, along with its awkward use to allocate colors.</li>
<li class="listitem">
<code class="classname">Gdk::Pixmap</code> and <code class="classname">Gdk::Bitmap</code> were removed in favor of <code class="classname">Gdk::Pixbuf</code>.</li>
<li class="listitem">
<code class="classname">Gdk::Drawable</code> was removed, with its methods moving into <code class="classname">Gdk::Window</code>.</li>
<li class="listitem">We now use std::vector in several methods instead of the intermediate *Handle types to make the API clearer.</li>
</ol></div>
<p>
</p>

<p>All deprecated API was removed in <span class="application">gtkmm</span> 3.0, though there have been new deprecations in later <span class="application">gtkmm</span> 3.x versions.</p>

<p>As a first step to porting your source code to <span class="application">gtkmm</span>-3.0 you should probably ensure that your application builds with the deprecated <span class="application">gtkmm</span>-2.4 API disabled, by defining macro such as GTKMM_DISABLE_DEPRECATED. There are some autotools macros that can help with this by defining them optionally at build time. See the <a class="ulink" href="https://wiki.gnome.org/Projects/gtkmm/PortingToGtkmm3" target="_top">gtkmm 3 porting wiki page</a> for more details.</p>

</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="sec-helloworld.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="changes-gtkmm4.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Hello World in <span class="application">gtkmm</span> </td>
<td width="20%" align="center"><a accesskey="h" href="index.html"><img src="icons/home.png" alt="Home"></a></td>
<td width="40%" align="right" valign="top"> Chapter 5. Changes in <span class="application">gtkmm</span>-4.0 and <span class="application">glibmm-2.68</span>
</td>
</tr>
</table>
</div>
</body>
</html>