Mantid
Loading...
Searching...
No Matches
SetDefaultWhenProperty.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2021 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidKernel/DllConfig.h"
11#include <functional>
12#include <string>
13
14namespace Mantid {
15namespace Kernel {
16
17// Forward declarations
18class IPropertyManager;
19class Property;
20
21class MANTID_KERNEL_DLL SetDefaultWhenProperty : public IPropertySettings {
22public:
26 const std::string &watchedPropName,
27 const std::function<bool(const Mantid::Kernel::IPropertyManager *, Property *, Property *)> &changeCriterion)
28 : IPropertySettings(), m_watchedPropName{watchedPropName}, m_changeCriterion{changeCriterion} {}
29
31 bool isConditionChanged(const IPropertyManager *algo, const std::string &changedPropName) const override;
32
35 bool applyChanges(const Mantid::Kernel::IPropertyManager *algo, const std::string &currentPropName) override;
36
38 std::vector<std::string> dependsOn(const std::string &thisProp) const override;
39
41 IPropertySettings *clone() const override;
42
43private:
45 std::string m_watchedPropName;
46
51};
52
53} // namespace Kernel
54} // namespace Mantid
Interface to PropertyManager.
Interface for modifiers to Property's that specify if they should be enabled or visible in a GUI.
Base class for properties.
Definition Property.h:94
std::function< bool(const Mantid::Kernel::IPropertyManager *, Property *, Property *)> m_changeCriterion
Criterion to determine if a new dynamic-default value should be set: in which case this function shou...
SetDefaultWhenProperty(const std::string &watchedPropName, const std::function< bool(const Mantid::Kernel::IPropertyManager *, Property *, Property *)> &changeCriterion)
Constructs an SetDefaultWhenProperty instance which sets the dynamic-default value of a property when...
std::string m_watchedPropName
Name of the watched property.
Helper class which provides the Collimation Length for SANS instruments.