App::Property: add methods to get/set read-onlyness

This commit is contained in:
DeepSOIC 2016-08-08 21:47:45 +03:00
parent 50af9efa9f
commit 369a7032b4
2 changed files with 20 additions and 6 deletions

View File

@ -32,6 +32,7 @@
#include "ObjectIdentifier.h"
#include "PropertyContainer.h"
#include <Base/Exception.h>
#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)

View File

@ -27,11 +27,11 @@
// Std. configurations
#include <Base/Persistence.h>
#ifndef BOOST_105400
#include <boost/any.hpp>
#else
#include <boost_any_1_55.hpp>
#endif
#ifndef BOOST_105400
#include <boost/any.hpp>
#else
#include <boost_any_1_55.hpp>
#endif
#include <string>
#include <bitset>
@ -138,6 +138,11 @@ public:
inline void setStatus(Status pos, bool on) {
StatusBits.set(static_cast<size_t>(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