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
@@ -253,25 +254,26 @@ int main()
253
254
</programlisting>
254
255
255
256
<para>Easy.</para>
256
-
</sect1>
257
+
</section>
257
258
258
-
<sect1id="sect-disconnecting">
259
-
<title>Disconnecting</title>
259
+
<sectionxml:id="sect-disconnecting">
260
+
<info><title>Disconnecting</title></info>
260
261
261
262
<para>If you decide you no longer want your code to be called whenever a signal is
262
263
emitted, you must remember the return value of <literalremap="tt">connect()</literal>, which we've been
263
264
ignoring until now.</para>
264
265
265
266
<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>
266
267
267
-
</sect1>
268
+
</section>
268
269
</chapter>
269
270
270
-
<chapterid="chapter-writing">
271
-
<title>Writing your own signals</title>
271
+
<chapterxml:id="chapter-writing">
272
+
<info><title>Writing your own signals</title></info>
273
+
274
+
<sectionxml:id="sect-quick-recap">
275
+
<info><title>Quick recap</title></info>
272
276
273
-
<sect1id="sect-quick-recap">
274
-
<title>Quick recap</title>
275
277
<para>If all you want to do is use gtkmm, and connect your functionality to its
276
278
signals, you can probably stop reading here.</para>
277
279
@@ -316,10 +318,11 @@ void AlienDetector::run()
316
318
// they landed in the carpark after all.
317
319
}
318
320
</programlisting>
319
-
</sect1>
321
+
</section>
322
+
323
+
<sectionxml:id="sect-return-values">
324
+
<info><title>What about return values?</title></info>
320
325
321
-
<sect1id="sect-return-values">
322
-
<title>What about return values?</title>
323
326
<para>If you only ever have one slot connected to a signal, or if you only care
324
327
about the return value of the last registered one, it's quite straightforward:</para>
325
328
@@ -329,14 +332,15 @@ int a_return_value;
329
332
330
333
a_return_value = somesignal.emit();
331
334
</programlisting>
332
-
</sect1>
335
+
</section>
333
336
</chapter>
334
337
335
-
<chapterid="chapter-advanced">
336
-
<title>Advanced topics</title>
338
+
<chapterxml:id="chapter-advanced">
339
+
<info><title>Advanced topics</title></info>
340
+
341
+
<sectionxml:id="sect-rebinding">
342
+
<info><title>Rebinding</title></info>
337
343
338
-
<sect1id="sect-rebinding">
339
-
<title>Rebinding</title>
340
344
<para>Suppose you already have a function that you want to be called when a
341
345
signal is emitted, but it takes the wrong argument types. For example, lets try
342
346
to attach the <literalremap="tt">warn_people(std::string)</literal> function to the detected signal
0 commit comments