This file is indexed.

/usr/share/gtk-doc/html/goocanvas/goocanvas-model-view-canvas.html is in libgoocanvas-dev 1.0.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Model/View Canvas Example</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GooCanvas Reference Manual">
<link rel="up" href="ch01.html" title="Introduction">
<link rel="prev" href="goocanvas-simple-canvas.html" title="Simple Canvas Example">
<link rel="next" href="goocanvas-architecture.html" title="Underlying Architecture">
<meta name="generator" content="GTK-Doc V1.14 (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="2"><tr valign="middle">
<td><a accesskey="p" href="goocanvas-simple-canvas.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GooCanvas Reference Manual</th>
<td><a accesskey="n" href="goocanvas-architecture.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry" title="Model/View Canvas Example">
<a name="goocanvas-model-view-canvas"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">Model/View Canvas Example</span></h2>
<p>Model/View Canvas Example — how to create a model/view canvas.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1" title="Model View Canvas Example">
<a name="model-view-overview"></a><h2>Model View Canvas Example</h2>
<p>
    Here's a complete example application that creates a model-view <a class="link" href="GooCanvas.html" title="GooCanvas"><span class="type">GooCanvas</span></a>
    with a rectangle and a text item in it.
    </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
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</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;stdlib.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;goocanvas.h&gt;</span>


<span class="keyword">static</span><span class="normal"> gboolean </span><span class="function">on_rect_button_press</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GooCanvasItem.html">GooCanvasItem</a>  </span><span class="symbol">*</span><span class="normal">view</span><span class="symbol">,</span>
<span class="normal">                                      <a href="GooCanvasItem.html">GooCanvasItem</a>  </span><span class="symbol">*</span><span class="normal">target</span><span class="symbol">,</span>
<span class="normal">                                      GdkEventButton </span><span class="symbol">*</span><span class="normal">event</span><span class="symbol">,</span>
<span class="normal">                                      gpointer        data</span><span class="symbol">);</span>

<span class="keyword">static</span><span class="normal"> gboolean </span><span class="function">on_delete_event</span><span class="normal">      </span><span class="symbol">(</span><span class="normal">GtkWidget      </span><span class="symbol">*</span><span class="normal">window</span><span class="symbol">,</span>
<span class="normal">                                      GdkEvent       </span><span class="symbol">*</span><span class="normal">event</span><span class="symbol">,</span>
<span class="normal">                                      gpointer        unused_data</span><span class="symbol">);</span>


<span class="type">int</span>
<span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">argv</span><span class="symbol">[])</span>
<span class="cbracket">{</span>
<span class="normal">  GtkWidget </span><span class="symbol">*</span><span class="normal">window</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">scrolled_win</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">canvas</span><span class="symbol">;</span>
<span class="normal">  <a href="GooCanvasItemModel.html">GooCanvasItemModel</a> </span><span class="symbol">*</span><span class="normal">root</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">rect_model</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">text_model</span><span class="symbol">;</span>
<span class="normal">  <a href="GooCanvasItem.html">GooCanvasItem</a> </span><span class="symbol">*</span><span class="normal">rect_item</span><span class="symbol">;</span>

<span class="normal">  </span><span class="comment">/* Initialize GTK+. */</span>
<span class="normal">  gtk_set_locale </span><span class="symbol">();</span>
<span class="normal">  </span><span class="function">gtk_init</span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">argc</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">argv</span><span class="symbol">);</span>

<span class="normal">  </span><span class="comment">/* Create the window and widgets. */</span>
<span class="normal">  window </span><span class="symbol">=</span><span class="normal"> </span><span class="function">gtk_window_new</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">GTK_WINDOW_TOPLEVEL</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">gtk_window_set_default_size</span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_WINDOW</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">window</span><span class="symbol">),</span><span class="normal"> </span><span class="number">640</span><span class="symbol">,</span><span class="normal"> </span><span class="number">600</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">gtk_widget_show</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">window</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">g_signal_connect</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">window</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"delete_event"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">GtkSignalFunc</span><span class="symbol">)</span><span class="normal"> on_delete_event</span><span class="symbol">,</span>
<span class="normal">                    NULL</span><span class="symbol">);</span>

<span class="normal">  scrolled_win </span><span class="symbol">=</span><span class="normal"> </span><span class="function">gtk_scrolled_window_new</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">NULL</span><span class="symbol">,</span><span class="normal"> NULL</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">gtk_scrolled_window_set_shadow_type</span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_SCROLLED_WINDOW</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">scrolled_win</span><span class="symbol">),</span>
<span class="normal">                                       GTK_SHADOW_IN</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">gtk_widget_show</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">scrolled_win</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">gtk_container_add</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">window</span><span class="symbol">),</span><span class="normal"> scrolled_win</span><span class="symbol">);</span>

<span class="normal">  canvas </span><span class="symbol">=</span><span class="normal"> goo_canvas_new </span><span class="symbol">();</span>
<span class="normal">  </span><span class="function">gtk_widget_set_size_request</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">canvas</span><span class="symbol">,</span><span class="normal"> </span><span class="number">600</span><span class="symbol">,</span><span class="normal"> </span><span class="number">450</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GooCanvas.html#goo-canvas-set-bounds">goo_canvas_set_bounds</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GOO_CANVAS</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">canvas</span><span class="symbol">),</span><span class="normal"> </span><span class="number">0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1000</span><span class="symbol">,</span><span class="normal"> </span><span class="number">1000</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">gtk_widget_show</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">canvas</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">gtk_container_add</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">scrolled_win</span><span class="symbol">),</span><span class="normal"> canvas</span><span class="symbol">);</span>

<span class="normal">  root </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GooCanvasGroupModel.html#goo-canvas-group-model-new">goo_canvas_group_model_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">NULL</span><span class="symbol">,</span><span class="normal"> NULL</span><span class="symbol">);</span>

<span class="normal">  </span><span class="comment">/* Add a few simple items. */</span>
<span class="normal">  rect_model </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GooCanvasRectModel.html#goo-canvas-rect-model-new">goo_canvas_rect_model_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">root</span><span class="symbol">,</span><span class="normal"> </span><span class="number">100</span><span class="symbol">,</span><span class="normal"> </span><span class="number">100</span><span class="symbol">,</span><span class="normal"> </span><span class="number">400</span><span class="symbol">,</span><span class="normal"> </span><span class="number">400</span><span class="symbol">,</span>
<span class="normal">                                          </span><span class="string">"line-width"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">10.0</span><span class="symbol">,</span>
<span class="normal">                                          </span><span class="string">"radius-x"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">20.0</span><span class="symbol">,</span>
<span class="normal">                                          </span><span class="string">"radius-y"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">10.0</span><span class="symbol">,</span>
<span class="normal">                                          </span><span class="string">"stroke-color"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"yellow"</span><span class="symbol">,</span>
<span class="normal">                                          </span><span class="string">"fill-color"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"red"</span><span class="symbol">,</span>
<span class="normal">                                          NULL</span><span class="symbol">);</span>

<span class="normal">  text_model </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GooCanvasTextModel.html#goo-canvas-text-model-new">goo_canvas_text_model_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">root</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Hello World"</span><span class="symbol">,</span><span class="normal"> </span><span class="number">300</span><span class="symbol">,</span><span class="normal"> </span><span class="number">300</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">,</span>
<span class="normal">                                          GTK_ANCHOR_CENTER</span><span class="symbol">,</span>
<span class="normal">                                          </span><span class="string">"font"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Sans 24"</span><span class="symbol">,</span>
<span class="normal">                                          NULL</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GooCanvasItemModel.html#goo-canvas-item-model-rotate">goo_canvas_item_model_rotate</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">text_model</span><span class="symbol">,</span><span class="normal"> </span><span class="number">45</span><span class="symbol">,</span><span class="normal"> </span><span class="number">300</span><span class="symbol">,</span><span class="normal"> </span><span class="number">300</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="GooCanvas.html#goo-canvas-set-root-item-model">goo_canvas_set_root_item_model</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GOO_CANVAS</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">canvas</span><span class="symbol">),</span><span class="normal"> root</span><span class="symbol">);</span>

<span class="normal">  </span><span class="comment">/* Connect a signal handler for the rectangle item. */</span>
<span class="normal">  rect_item </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GooCanvas.html#goo-canvas-get-item">goo_canvas_get_item</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GOO_CANVAS</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">canvas</span><span class="symbol">),</span><span class="normal"> rect_model</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">g_signal_connect</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rect_item</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="symbol">(</span><span class="normal">GtkSignalFunc</span><span class="symbol">)</span><span class="normal"> on_rect_button_press</span><span class="symbol">,</span><span class="normal"> NULL</span><span class="symbol">);</span>

<span class="normal">  </span><span class="comment">/* Pass control to the GTK+ main event loop. */</span>
<span class="normal">  gtk_main </span><span class="symbol">();</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
<span class="cbracket">}</span>


<span class="comment">/* This handles button presses in item views. We simply output a message to</span>
<span class="comment">   the console. */</span>
<span class="keyword">static</span><span class="normal"> gboolean</span>
<span class="function">on_rect_button_press</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GooCanvasItem.html">GooCanvasItem</a>  </span><span class="symbol">*</span><span class="normal">item</span><span class="symbol">,</span>
<span class="normal">                      <a href="GooCanvasItem.html">GooCanvasItem</a>  </span><span class="symbol">*</span><span class="normal">target</span><span class="symbol">,</span>
<span class="normal">                      GdkEventButton </span><span class="symbol">*</span><span class="normal">event</span><span class="symbol">,</span>
<span class="normal">                      gpointer        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">"rect item received button press event</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
<span class="normal">  </span><span class="keyword">return</span><span class="normal"> TRUE</span><span class="symbol">;</span>
<span class="cbracket">}</span>


<span class="comment">/* This is our handler for the "delete-event" signal of the window, which</span>
<span class="comment">   is emitted when the 'x' close button is clicked. We just exit here. */</span>
<span class="keyword">static</span><span class="normal"> gboolean</span>
<span class="function">on_delete_event</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">GtkWidget </span><span class="symbol">*</span><span class="normal">window</span><span class="symbol">,</span>
<span class="normal">                 GdkEvent  </span><span class="symbol">*</span><span class="normal">event</span><span class="symbol">,</span>
<span class="normal">                 gpointer   unused_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">0</span><span class="symbol">);</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

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