File: gtk-migrating-tooltips.html

package info (click to toggle)
gtk%2B2.0 2.24.33-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie, trixie-proposed-updates, trixie-updates
  • size: 124,860 kB
  • sloc: ansic: 574,091; makefile: 5,171; sh: 4,618; xml: 1,193; python: 1,117; perl: 749; awk: 49; cpp: 34
file content (123 lines) | stat: -rw-r--r-- 6,610 bytes parent folder | download | duplicates (3)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Migrating from GtkTooltips to GtkTooltip: GTK+ 2 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 2 Reference Manual">
<link rel="up" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
<link rel="prev" href="gtk-migrating-GtkBuilder.html" title="Migrating from libglade to GtkBuilder">
<link rel="next" href="gtk-migrating-entry-icons.html" title="Migrating from SexyIconEntry to GtkEntry">
<meta name="generator" content="GTK-Doc V1.33.0 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="migrating.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gtk-migrating-GtkBuilder.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtk-migrating-entry-icons.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="gtk-migrating-tooltips"></a>Migrating from GtkTooltips to GtkTooltip</h2></div></div></div>
<p>
    GTK+ 2.12 brings a completely new tooltip implementation which
    allows many things that were not possible with the old 
    <a class="link" href="GtkTooltips.html" title="GtkTooltips"><span class="type">GtkTooltips</span></a> interface. The new possibilities are explained
    in more detail in the section about <a class="link" href="GtkTooltip.html" title="GtkTooltip"><span class="type">GtkTooltip</span></a>. 
  </p>
<p>
    A number of complications of the old API have been removed:
    </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>
        Tooltips can not be grouped anymore. The old tooltips
        API allowed this by using multiple <a class="link" href="GtkTooltips.html" title="GtkTooltips"><span class="type">GtkTooltips</span></a> objects.
        We believe that the timeout behaviour of the new tooltips 
        implementation is better and makes it unnecessary to use 
        grouping as a way to overcome shortcomings of the 
        fast-tooltips mode.
      </p></li>
<li class="listitem"><p>
        Timeouts can not be set individually anymore. Instead
        there are settings <a class="link" href="GtkSettings.html#GtkSettings--gtk-tooltip-timeout" title="The “gtk-tooltip-timeout” property"><span class="type">“gtk-tooltip-timeout”</span></a>, 
        <a class="link" href="GtkSettings.html#GtkSettings--gtk-tooltip-browse-timeout" title="The “gtk-tooltip-browse-timeout” property"><span class="type">“gtk-tooltip-browse-timeout”</span></a> and
        <a class="link" href="GtkSettings.html#GtkSettings--gtk-tooltip-browse-mode-timeout" title="The “gtk-tooltip-browse-mode-timeout” property"><span class="type">“gtk-tooltip-browse-mode-timeout”</span></a> to influence
        the behaviour of tooltips globally.
      </p></li>
</ul></div>
<p>
  </p>
<p>
    Here is an example of setting a tooltip on a widget with the old API:
    </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="n">GtkTooltips</span> <span class="o">*</span><span class="n">tooltips</span> <span class="o">=</span> <span class="n">gtk_tooltips_new</span> <span class="p">();</span>     
<span class="n">gtk_tooltips_set_tip</span> <span class="p">(</span><span class="n">tooltips</span><span class="p">,</span> <span class="n">widget</span><span class="p">,</span> <span class="s">&quot;Some tips&quot;</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
  </p>
<p>
    Using the new tooltips API, it is no longer necessary to create 
    an object:
    </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="n">gtk_widget_set_tooltip_text</span> <span class="p">(</span><span class="n">widget</span><span class="p">,</span> <span class="s">&quot;Some tips&quot;</span><span class="p">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
  </p>
<p>
    Similarly, setting a tooltip on a <a class="link" href="GtkToolItem.html" title="GtkToolItem"><span class="type">GtkToolItem</span></a> gets
    simplified from
    </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="n">gtk_tool_item_set_tooltip</span> <span class="p">(</span><span class="n">toolitem</span><span class="p">,</span> <span class="n">toolbar</span><span class="o">-&gt;</span><span class="n">tooltips</span><span class="p">,</span> <span class="s">&quot;tool tip&quot;</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
    to
    </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="n">gtk_tool_item_set_tooltip_text</span> <span class="p">(</span><span class="n">toolitem</span><span class="p">,</span> <span class="n">text</span><span class="p">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
  </p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.0</div>
</body>
</html>