Skip to content

Commit

Permalink
App::Property: add methods to get/set read-onlyness
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepSOIC committed Aug 8, 2016
1 parent 50af9ef commit 369a703
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
9 changes: 9 additions & 0 deletions src/App/Property.cpp
Expand Up @@ -32,6 +32,7 @@
#include "ObjectIdentifier.h"
#include "PropertyContainer.h"
#include <Base/Exception.h>
#include "Application.h"

using namespace App;

Expand Down Expand Up @@ -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)
Expand Down
17 changes: 11 additions & 6 deletions src/App/Property.h
Expand Up @@ -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>

Expand Down Expand Up @@ -138,6 +138,11 @@ class AppExport Property : public Base::Persistence
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)
Expand Down Expand Up @@ -248,4 +253,4 @@ template<class P> class AtomicPropertyChangeInterface {

} // namespace App

#endif // APP_PROPERTY_H
#endif // APP_PROPERTY_H

0 comments on commit 369a703

Please sign in to comment.