New upstream version 3.23.2

This commit is contained in:
Andrea Azzarone
2018-08-09 13:46:53 +03:00
882 changed files with 323996 additions and 311120 deletions

View File

@ -3,12 +3,12 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkImage: GTK+ 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="DisplayWidgets.html" title="Display Widgets">
<link rel="prev" href="GtkLabel.html" title="GtkLabel">
<link rel="next" href="GtkSpinner.html" title="GtkSpinner">
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
<meta name="generator" content="GTK-Doc V1.28 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@ -395,7 +395,7 @@
<a name="GtkImage.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GtkImage implements
AtkImplementor and <a class="link" href="GtkBuildable.html" title="GtkBuildable">GtkBuildable</a>.</p>
AtkImplementorIface and <a class="link" href="GtkBuildable.html" title="GtkBuildable">GtkBuildable</a>.</p>
</div>
<div class="refsect1">
<a name="GtkImage.includes"></a><h2>Includes</h2>
@ -409,10 +409,19 @@ can be displayed as an image; most typically, you would load a
<span class="type">GdkPixbuf</span> ("pixel buffer") from a file, and then display that.
Theres a convenience function to do this, <a class="link" href="GtkImage.html#gtk-image-new-from-file" title="gtk_image_new_from_file ()"><code class="function">gtk_image_new_from_file()</code></a>,
used as follows:</p>
<div class="informalexample"><pre class="programlisting">
GtkWidget *image;
image = gtk_image_new_from_file ("myfile.png");
</pre></div>
<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="usertype">GtkWidget</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">image</span><span class="symbol">;</span>
<span class="normal">image </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkImage.html#gtk-image-new-from-file">gtk_image_new_from_file</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"myfile.png"</span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p>
If the file isnt loaded successfully, the image will contain a
“broken image” icon similar to that used in many web browsers.
@ -425,47 +434,87 @@ display an animation (<span class="type">GdkPixbufAnimation</span>) instead of a
<p><a class="link" href="GtkImage.html" title="GtkImage"><span class="type">GtkImage</span></a> is a subclass of <a class="link" href="GtkMisc.html" title="GtkMisc"><span class="type">GtkMisc</span></a>, which implies that you can
align it (center, left, right) and add padding to it, using
<a class="link" href="GtkMisc.html" title="GtkMisc"><span class="type">GtkMisc</span></a> methods.</p>
<p><a class="link" href="GtkImage.html" title="GtkImage"><span class="type">GtkImage</span></a> is a “no window” widget (has no <a href="../html/gdk3-Windows.html#GdkWindow-struct"><span class="type">GdkWindow</span></a> of its own),
<p><a class="link" href="GtkImage.html" title="GtkImage"><span class="type">GtkImage</span></a> is a “no window” widget (has no <span class="type">GdkWindow</span> of its own),
so by default does not receive events. If you want to receive events
on the image, such as button clicks, place the image inside a
<a class="link" href="GtkEventBox.html" title="GtkEventBox"><span class="type">GtkEventBox</span></a>, then connect to the event signals on the event box.</p>
<div class="refsect3">
<a name="id-1.3.8.3.9.8"></a><h4>Handling button press events on a <a class="link" href="GtkImage.html" title="GtkImage"><span class="type">GtkImage</span></a>.</h4>
<div class="informalexample"><pre class="programlisting">
static gboolean
button_press_callback (GtkWidget *event_box,
GdkEventButton *event,
gpointer data)
{
g_print ("Event box clicked at coordinates %f,%f\n",
event-&gt;x, event-&gt;y);
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>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</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> gboolean</span>
<span class="function">button_press_callback</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GtkWidget</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">event_box</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">GdkEventButton</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">event</span><span class="symbol">,</span>
<span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="function">g_print</span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Event box clicked at coordinates %f,%f</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span>
<span class="normal"> event</span><span class="symbol">-&gt;</span><span class="normal">x</span><span class="symbol">,</span><span class="normal"> event</span><span class="symbol">-&gt;</span><span class="normal">y</span><span class="symbol">);</span>
// Returning TRUE means we handled the event, so the signal
// emission should be stopped (dont call any further callbacks
// that may be connected). Return FALSE to continue invoking callbacks.
return TRUE;
}
<span class="normal"> </span><span class="comment">// Returning TRUE means we handled the event, so the signal</span>
<span class="normal"> </span><span class="comment">// emission should be stopped (dont call any further callbacks</span>
<span class="normal"> </span><span class="comment">// that may be connected). Return FALSE to continue invoking callbacks.</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> TRUE</span><span class="symbol">;</span>
<span class="cbracket">}</span>
static GtkWidget*
create_image (void)
{
GtkWidget *image;
GtkWidget *event_box;
<span class="keyword">static</span><span class="normal"> <a href="GtkWidget.html#GtkWidget-struct">GtkWidget</a></span><span class="symbol">*</span>
<span class="function">create_image</span><span class="normal"> </span><span class="symbol">(</span><span class="type">void</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GtkWidget</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">image</span><span class="symbol">;</span>
<span class="normal"> </span><span class="usertype">GtkWidget</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">event_box</span><span class="symbol">;</span>
image = gtk_image_new_from_file ("myfile.png");
<span class="normal"> image </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkImage.html#gtk-image-new-from-file">gtk_image_new_from_file</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"myfile.png"</span><span class="symbol">);</span>
event_box = gtk_event_box_new ();
<span class="normal"> event_box </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkEventBox.html#gtk-event-box-new">gtk_event_box_new</a></span><span class="normal"> </span><span class="symbol">();</span>
gtk_container_add (GTK_CONTAINER (event_box), image);
<span class="normal"> </span><span class="function"><a href="GtkContainer.html#gtk-container-add">gtk_container_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_CONTAINER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">event_box</span><span class="symbol">),</span><span class="normal"> image</span><span class="symbol">);</span>
g_signal_connect (G_OBJECT (event_box),
"button_press_event",
G_CALLBACK (button_press_callback),
image);
<span class="normal"> </span><span class="function">g_signal_connect</span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_OBJECT</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">event_box</span><span class="symbol">),</span>
<span class="normal"> </span><span class="string">"button_press_event"</span><span class="symbol">,</span>
<span class="normal"> </span><span class="function">G_CALLBACK</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">button_press_callback</span><span class="symbol">),</span>
<span class="normal"> image</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="normal"> image</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
return image;
}
</pre></div>
<p></p>
<p>When handling events on the event box, keep in mind that coordinates
in the image may be different from event box coordinates due to
@ -1718,6 +1767,6 @@ and <a class="link" href="GtkImage.html#GTK-IMAGE-GICON:CAPS"><code class="liter
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.27</div>
<hr>Generated by GTK-Doc V1.28</div>
</body>
</html>