Skip to content
Snippets Groups Projects
VisibleWhenProperty.h 2.52 KiB
Newer Older
#ifndef MANTID_KERNEL_VISIBLEWHENPROPERTY_H_
#define MANTID_KERNEL_VISIBLEWHENPROPERTY_H_
#include "MantidKernel/System.h"
#include "MantidKernel/EnabledWhenProperty.h"

namespace Mantid {
namespace Kernel {

/** Same as EnabledWhenProperty, but returns the value for the
 * isVisible() property intead of the isEnabled() property.

  @author Janik Zikovsky
  @date 2011-08-26

  Copyright © 2011 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
 National Laboratory & European Spallation Source

  This file is part of Mantid.

  Mantid is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.

  Mantid is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  File change history is stored at: <https://github.com/mantidproject/mantid>
  Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport VisibleWhenProperty : public EnabledWhenProperty {
public:
  //--------------------------------------------------------------------------------------------
  /** Constructor
   * @param otherPropName :: Name of the OTHER property that we will check.
   * @param when :: Criterion to evaluate
   * @param value :: For the IS_EQUAL_TO or IS_NOT_EQUAL_TO condition, the value
   * (as string) to check for
   */
  VisibleWhenProperty(std::string otherPropName, ePropertyCriterion when,
                      std::string value = "");

  //--------------------------------------------------------------------------------------------
  /// Return true always
  bool isEnabled(const IPropertyManager *) const override;

  //--------------------------------------------------------------------------------------------
  /// Return true/false based on whether the other property satisfies the
  /// criterion
  bool isVisible(const IPropertyManager *algo) const override;

  //--------------------------------------------------------------------------------------------
  /// Make a copy of the present type of validator
  IPropertySettings *clone() override;

} // namespace Kernel
} // namespace Mantid

#endif /* MANTID_KERNEL_VISIBLEWHENPROPERTY_H_ */