You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<para>For the other side of the fence, libsigc++ provides <literalremap="tt">signal</literal>s, to which the
70
70
client can attach <literalremap="tt">slot</literal>s. When the <literalremap="tt">signal</literal> is emitted, all the connected
71
71
<literalremap="tt">slot</literal>s are called.</para>
72
-
</sect1>
72
+
</section>
73
73
</chapter>
74
74
75
-
<chapterid="chapter-connecting">
76
-
<title>Connecting your code to signals</title>
75
+
<chapterxml:id="chapter-connecting">
76
+
<info><title>Connecting your code to signals</title></info>
77
+
78
+
<sectionxml:id="sect-simple-ex">
79
+
<info><title>A simple example</title></info>
77
80
78
-
<sect1id="sect-simple-ex">
79
-
<title>A simple example</title>
80
81
<para>So to get some experience, lets look at a simple example...</para>
81
82
82
83
<para>Lets say you and I are writing an application which informs the user when
@@ -138,10 +139,10 @@ int main()
138
139
<programlisting>./example1</programlisting>
139
140
<para>(Try not to panic when the aliens land!)</para>
140
141
141
-
</sect1>
142
+
</section>
142
143
143
-
<sect1id="sect-using-mem-func">
144
-
<title>Using a member function</title>
144
+
<sectionxml:id="sect-using-mem-func">
145
+
<info><title>Using a member function</title></info>
145
146
146
147
<para>Suppose you found a more sophisticated alien alerter class on the web,
147
148
such as this:</para>
@@ -187,10 +188,10 @@ int main()
187
188
With a lambda expression you would lose the automatic disconnection that the
188
189
combination of <literalremap="tt">sigc::trackable</literal> and sigc::mem_fun()
189
190
offers.</para>
190
-
</sect1>
191
+
</section>
191
192
192
-
<sect1id="sect-signals-with-pars">
193
-
<title>Signals with parameters</title>
193
+
<sectionxml:id="sect-signals-with-pars">
194
+
<info><title>Signals with parameters</title></info>
194
195
195
196
<para>Functions taking no parameters and returning void are quite useful,
196
197
especially when they're members of classes that can store unlimited amounts of
@@ -252,25 +253,26 @@ int main()
252
253
</programlisting>
253
254
254
255
<para>Easy.</para>
255
-
</sect1>
256
+
</section>
256
257
257
-
<sect1id="sect-disconnecting">
258
-
<title>Disconnecting</title>
258
+
<sectionxml:id="sect-disconnecting">
259
+
<info><title>Disconnecting</title></info>
259
260
260
261
<para>If you decide you no longer want your code to be called whenever a signal is
261
262
emitted, you must remember the return value of <literalremap="tt">connect()</literal>, which we've been
262
263
ignoring until now.</para>
263
264
264
265
<para><literalremap="tt">connect()</literal> returns a <literalremap="tt">sigc::connection</literal> object, which has a <literalremap="tt">disconnect()</literal> member method. This does just what you think it does.</para>
265
266
266
-
</sect1>
267
+
</section>
267
268
</chapter>
268
269
269
-
<chapterid="chapter-writing">
270
-
<title>Writing your own signals</title>
270
+
<chapterxml:id="chapter-writing">
271
+
<info><title>Writing your own signals</title></info>
272
+
273
+
<sectionxml:id="sect-quick-recap">
274
+
<info><title>Quick recap</title></info>
271
275
272
-
<sect1id="sect-quick-recap">
273
-
<title>Quick recap</title>
274
276
<para>If all you want to do is use gtkmm, and connect your functionality to its
275
277
signals, you can probably stop reading here.</para>
276
278
@@ -315,10 +317,11 @@ void AlienDetector::run()
315
317
// they landed in the carpark after all.
316
318
}
317
319
</programlisting>
318
-
</sect1>
320
+
</section>
321
+
322
+
<sectionxml:id="sect-return-values">
323
+
<info><title>What about return values?</title></info>
319
324
320
-
<sect1id="sect-return-values">
321
-
<title>What about return values?</title>
322
325
<para>If you only ever have one slot connected to a signal, or if you only care
323
326
about the return value of the last registered one, it's quite straightforward:</para>
324
327
@@ -328,14 +331,15 @@ int a_return_value;
328
331
329
332
a_return_value = somesignal.emit();
330
333
</programlisting>
331
-
</sect1>
334
+
</section>
332
335
</chapter>
333
336
334
-
<chapterid="chapter-advanced">
335
-
<title>Advanced topics</title>
337
+
<chapterxml:id="chapter-advanced">
338
+
<info><title>Advanced topics</title></info>
339
+
340
+
<sectionxml:id="sect-rebinding">
341
+
<info><title>Rebinding</title></info>
336
342
337
-
<sect1id="sect-rebinding">
338
-
<title>Rebinding</title>
339
343
<para>Suppose you already have a function that you want to be called when a
340
344
signal is emitted, but it takes the wrong argument types. For example, lets try
341
345
to attach the <literalremap="tt">warn_people(std::string)</literal> function to the detected signal
0 commit comments