BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ItemWithParticlesCatalog.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatSample/ItemWithParticlesCatalog.h
6 //! @brief Defines class ItemWithParticlesCatalog
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_MODEL_CATSAMPLE_ITEMWITHPARTICLESCATALOG_H
16 #define BORNAGAIN_GUI_MODEL_CATSAMPLE_ITEMWITHPARTICLESCATALOG_H
17 
18 #include <QString>
19 #include <QVector>
20 
21 class ItemWithParticles;
22 class MaterialItems;
23 
25 public:
27 
28  // Do not change the numbering! It is serialized!
29  enum class Type : uint8_t { Particle = 1, Composition = 2, CoreShell = 3, MesoCrystal = 4 };
30 
31  struct UiInfo {
32  QString menuEntry;
33  QString description;
34  QString iconPath;
35  };
36 
37  //! Creates the item of the given type.
38  //!
39  //! If type is "None", a nullptr is returned.
40  static ItemWithParticles* create(Type type, const MaterialItems* materials);
41 
42  //! Available types of items, sorted as expected in the UI (e.g. in combo box)
43  static QVector<Type> types();
44 
45  //! Available types of assembly items, sorted as expected in the UI (e.g. in combo box)
46  static QVector<Type> assemblyTypes();
47 
48  //! UiInfo on the given type.
49  static UiInfo uiInfo(Type t);
50 
51  //! Returns the enum type of the given item.
52  static Type type(const ItemWithParticles* item);
53 };
54 
55 #endif // BORNAGAIN_GUI_MODEL_CATSAMPLE_ITEMWITHPARTICLESCATALOG_H
static QVector< Type > types()
Available types of items, sorted as expected in the UI (e.g. in combo box)
static Type type(const ItemWithParticles *item)
Returns the enum type of the given item.
static QVector< Type > assemblyTypes()
Available types of assembly items, sorted as expected in the UI (e.g. in combo box)
static ItemWithParticles * create(Type type, const MaterialItems *materials)
Creates the item of the given type.
static UiInfo uiInfo(Type t)
UiInfo on the given type.