The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
notifiee.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2016 by Mark de Wever <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #ifndef GUI_WIDGETS_AUXILIARY_NOTIFIEE_HPP_INCLUDED
16 #define GUI_WIDGETS_AUXILIARY_NOTIFIEE_HPP_INCLUDED
17 
18 #include <cstdlib>
19 
20 namespace gui2
21 {
22 
23 template <class T>
24 class tnotifier;
25 
26 /**
27  * Helper class to implement callbacks with lifetime management.
28  *
29  * This part manages the lifetime off the callback.
30  */
31 template <class FUNCTOR>
32 class tnotifiee
33 {
34 public:
35  typedef FUNCTOR tfunctor;
36  friend class tnotifier<tfunctor>;
37 
38  tnotifiee() : notifier_(nullptr)
39  {
40  }
41 
43  {
44  if(notifier_) {
46  }
47  }
48 
49 private:
50  /** Pointer the the tnotifier that's linked to us. */
52 };
53 
54 } // namespace gui2
55 
56 #endif
void disconnect_notifiee(tnotifiee< tfunctor > &notifiee)
Disconnects a callback.
Definition: notifier.hpp:77
Helper class to implement callbacks with lifetime management.
Definition: notifiee.hpp:32
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
Helper class to implement callbacks with lifetime management.
Definition: notifiee.hpp:24
FUNCTOR tfunctor
Definition: notifiee.hpp:35
tnotifier< tfunctor > * notifier_
Pointer the the tnotifier that's linked to us.
Definition: notifiee.hpp:51