Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryGuiTkIControlListener.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 
19 namespace berry {
20 
21 namespace GuiTk {
22 
24 {
25 }
26 
27 void
28 IControlListener::Events
29 ::AddListener(IControlListener::Pointer l)
30 {
31  if (l.IsNull()) return;
32 
33  Types types = l->GetEventTypes();
34 
35  if (types & MOVED)
36  movedEvent += Delegate(l.GetPointer(), &IControlListener::ControlMoved);
37  if (types & RESIZED)
38  resizedEvent += Delegate(l.GetPointer(), &IControlListener::ControlResized);
39  if (types & ACTIVATED)
40  activatedEvent += Delegate(l.GetPointer(), &IControlListener::ControlActivated);
41  if (types & DESTROYED)
42  destroyedEvent += Delegate(l.GetPointer(), &IControlListener::ControlDestroyed);
43 }
44 
45 void
46 IControlListener::Events
47 ::RemoveListener(IControlListener::Pointer l)
48 {
49  if (l.IsNull()) return;
50 
51  movedEvent -= Delegate(l.GetPointer(), &IControlListener::ControlMoved);
52  resizedEvent -= Delegate(l.GetPointer(), &IControlListener::ControlResized);
53  activatedEvent -= Delegate(l.GetPointer(), &IControlListener::ControlActivated);
54  destroyedEvent -= Delegate(l.GetPointer(), &IControlListener::ControlDestroyed);
55 }
56 
57 }
58 
59 }
virtual void ControlDestroyed(ControlEvent::Pointer)
virtual void ControlMoved(ControlEvent::Pointer)
virtual void ControlActivated(ControlEvent::Pointer)
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:88
virtual void ControlResized(ControlEvent::Pointer)
ObjectType * GetPointer() const