Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkPropertyObserver.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkPropertyObserver_h
14 #define mitkPropertyObserver_h
15 
16 #include <MitkCoreExports.h>
17 #include <mitkCommon.h>
18 #include <itkEventObject.h>
19 
20 namespace mitk
21 {
33  class BaseProperty;
34 
46  {
47  public:
50 
52  virtual ~PropertyObserver();
53 
55  virtual void PropertyChanged() = 0;
56 
58  virtual void PropertyRemoved() = 0;
59 
60  protected:
67 
70 
71  unsigned long m_ModifiedTag;
72  unsigned long m_DeleteTag;
73 
74  bool m_SelfCall;
75  };
76 
87  {
88  public:
94  PropertyView(const mitk::BaseProperty *property);
95 
97  ~PropertyView() override;
98 
103  void OnModified(const itk::EventObject &e);
104 
109  void OnDelete(const itk::EventObject &e);
110 
111  protected:
113  };
114 
125  {
126  public:
133 
135  ~PropertyEditor() override;
136 
141  void OnModified(const itk::EventObject &e);
142 
147  void OnDelete(const itk::EventObject &e);
148 
149  protected:
151  };
152 }
153 
154 #endif
#define MITKCORE_EXPORT
Abstract base class for properties.
Read-write observer for a mitk::BaseProperty.
mitk::BaseProperty * m_Property
The observed property (read-write).
void OnDelete(const itk::EventObject &e)
Callback for itk::DeleteEvent on the observed property.
~PropertyEditor() override
Destructor. Removes the ITK observer from the property.
PropertyEditor(mitk::BaseProperty *property)
Constructor. Begins observing the given property.
void OnModified(const itk::EventObject &e)
Callback for itk::ModifiedEvent on the observed property.
Base class for property observers providing callbacks for property changes and deletion.
virtual void PropertyChanged()=0
Called when the observed property value has changed.
void BeginModifyProperty()
Marks the beginning of a self-initiated property modification.
bool m_SelfCall
Guard flag to prevent re-entrant notification.
virtual ~PropertyObserver()
Virtual destructor.
unsigned long m_DeleteTag
ITK observer tag for the DeleteEvent.
virtual void PropertyRemoved()=0
Called when the observed property is about to be deleted.
PropertyObserver()
Constructor.
void EndModifyProperty()
Marks the end of a self-initiated property modification.
unsigned long m_ModifiedTag
ITK observer tag for the ModifiedEvent.
Read-only observer for a mitk::BaseProperty.
PropertyView(const mitk::BaseProperty *property)
Constructor. Begins observing the given property.
const mitk::BaseProperty * m_Property
The observed property (read-only).
~PropertyView() override
Destructor. Removes the ITK observer from the property.
void OnDelete(const itk::EventObject &e)
Callback for itk::DeleteEvent on the observed property.
void OnModified(const itk::EventObject &e)
Callback for itk::ModifiedEvent on the observed property.
Find image slices visible on a given plane.