// ************************************************************************************************ // // BornAgain: simulate and fit reflection and scattering // //! @file GUI/View/SampleDesigner/LayerEditorUtils.h //! @brief Defines class LayerEditorUtils //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) //! @copyright Forschungszentrum Jülich GmbH 2021 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) // // ************************************************************************************************ #ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H #include "GUI/Model/CatSample/FormFactorItemCatalog.h" #include "GUI/Model/CatSample/ItemWithParticlesCatalog.h" #include "GUI/Model/Descriptor/DoubleProperty.h" #include <QColor> #include <QList> #include <functional> class DoubleSpinBox; class FormFactorItem; class ItemWithParticles; class LayerBasicRoughnessItem; class Profile1DItem; class Profile2DItem; class QGridLayout; class QLabel; class QPushButton; class QString; class QWidget; class RotationItem; class SampleEditorController; class VectorProperty; //! Utility functions to support layer oriented sample editor namespace LayerEditorUtils { void updateLabelUnit(QLabel* label); void updateLabelUnit(QLabel* label, DoubleSpinBox* editor); //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to //! SampleEditorController::setDouble() void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol, const DoublePropertyRefs& valueDescriptors, SampleEditorController* ec, bool vertically, bool addSpacer); //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to the given setNewValue() void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol, const DoublePropertyRefs& valueDescriptors, std::function<void(double, DoubleProperty&)> setNewValue, bool vertically, bool addSpacer); void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol, const DoublePropertyRefs& valueDescriptors, SampleEditorController* ec, bool addSpacer); //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to //! SampleEditorController::setDouble() void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, SampleEditorController* ec, bool vertically, bool addSpacer); //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to the given setNewValue() void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v, std::function<void(double, DoubleProperty&)> setNewValue, bool vertically, bool addSpacer); QLabel* createBoldLabel(const QString& text); DoublePropertyRefs doubleDescriptorsOfItem(LayerBasicRoughnessItem* item); DoublePropertyRefs doubleDescriptorsOfItem(FormFactorItem* item); DoublePropertyRefs doubleDescriptorsOfItem(Profile1DItem* item); DoublePropertyRefs doubleDescriptorsOfItem(Profile2DItem* item); DoublePropertyRefs doubleDescriptorsOfItem(RotationItem* item); QWidget* createWidgetForItemWithParticles(QWidget* parentWidget, ItemWithParticles* itemWithParticles, bool allowAbundance, SampleEditorController* ec, bool allowRemove = true); QPushButton* createAddParticleButton(QWidget* parentWidget, std::function<void(FormFactorItemCatalog::Type t)> slotAddFormFactor, std::function<void(ItemWithParticlesCatalog::Type t)> slotAddParticle); QList<QColor> predefinedLayerColors(); } // namespace LayerEditorUtils #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H