From 369a7032b434efb8254a2fac5481b9a9045b6d90 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Mon, 8 Aug 2016 21:47:45 +0300 Subject: [PATCH] App::Property: add methods to get/set read-onlyness --- src/App/Property.cpp | 9 +++++++++ src/App/Property.h | 17 +++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/App/Property.cpp b/src/App/Property.cpp index 35590a20a..a53e4c95c 100644 --- a/src/App/Property.cpp +++ b/src/App/Property.cpp @@ -32,6 +32,7 @@ #include "ObjectIdentifier.h" #include "PropertyContainer.h" #include +#include "Application.h" using namespace App; @@ -110,6 +111,14 @@ void Property::touch() StatusBits.set(0); } +void Property::setReadOnly(bool readOnly) +{ + unsigned long status = this->getStatus(); + this->setStatus(App::Property::ReadOnly, readOnly); + if (status != this->getStatus()) + App::GetApplication().signalChangePropertyEditor(*this); +} + void Property::hasSetValue(void) { if (father) diff --git a/src/App/Property.h b/src/App/Property.h index 79a1e21f7..43a1bbe91 100644 --- a/src/App/Property.h +++ b/src/App/Property.h @@ -27,11 +27,11 @@ // Std. configurations #include -#ifndef BOOST_105400 -#include -#else -#include -#endif +#ifndef BOOST_105400 +#include +#else +#include +#endif #include #include @@ -138,6 +138,11 @@ public: inline void setStatus(Status pos, bool on) { StatusBits.set(static_cast(pos), on); } + ///Sets property editable/grayed out in property editor + void setReadOnly(bool readOnly); + inline bool isReadOnly() const { + return testStatus(App::Property::ReadOnly); + } //@} /// Returns a new copy of the property (mainly for Undo/Redo and transactions) @@ -248,4 +253,4 @@ private: } // namespace App -#endif // APP_PROPERTY_H +#endif // APP_PROPERTY_H