/*************************************************************************** * Copyright (c) 2023-2024 David Carter * * * * This file is part of FreeCAD. * * * * FreeCAD is free software: you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 2.1 of the * * License, or (at your option) any later version. * * * * FreeCAD 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 * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with FreeCAD. If not, see * * . * * * **************************************************************************/ #ifndef MATERIAL_PROPERTYMATERIAL_H #define MATERIAL_PROPERTYMATERIAL_H #include #include #include "Materials.h" namespace App { class Material; } namespace Materials { /** Material properties * This is the father of all properties handling colors. */ class MaterialsExport PropertyMaterial: public App::Property { TYPESYSTEM_HEADER_WITH_OVERRIDE(); public: /** * A constructor. * A more elaborate description of the constructor. */ PropertyMaterial(); /** * A destructor. * A more elaborate description of the destructor. */ ~PropertyMaterial() override; /** Sets the property */ void setValue(const Material& mat); /** Sets the appearance properties */ void setValue(const App::Material& mat); /** This method returns a string representation of the property */ const Material& getValue() const; PyObject* getPyObject() override; void setPyObject(PyObject*) override; void Save(Base::Writer& writer) const override; void Restore(Base::XMLReader& reader) override; const char* getEditorName() const override; Property* Copy() const override; void Paste(const Property& from) override; unsigned int getMemSize() const override { return sizeof(_material); } bool isSame(const Property& other) const override { if (&other == this) { return true; } return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } private: Material _material; }; } // namespace Materials #endif // MATERIAL_PROPERTYMATERIAL_H