Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / ModuleBase / ModuleBase_PropPanelOperation.h
1 /*
2  * ModuleBase_PropPanelOperation.h
3  *
4  *  Created on: Apr 2, 2014
5  *      Author: sbh
6  */
7
8 #ifndef MODULEBASE_PROPPANELOPERATION_H
9 #define MODULEBASE_PROPPANELOPERATION_H
10
11 #include <ModuleBase.h>
12 #include <ModuleBase_Operation.h>
13
14 #include <QObject>
15 #include <QString>
16
17 #include <memory>
18
19 /*!
20  * \class ModuleBase_PropPanelOperation
21  *
22  */
23 class MODULEBASE_EXPORT ModuleBase_PropPanelOperation: public ModuleBase_Operation
24 {
25
26   Q_OBJECT
27
28 public:
29   ModuleBase_PropPanelOperation(const QString& theId = "", QObject* parent = 0);
30   virtual ~ModuleBase_PropPanelOperation();
31
32   /*!
33    * \brief Replied whether the operation should be commited after the start, or the operation itself
34    *  do that. The default realization provides the check by the operation having the xml prepresentation 
35    *  @return the boolean value
36    */
37   virtual bool isPerformedImmediately() const
38   {
39     return xmlRepresentation().isEmpty();
40   }
41   /*!
42    *  \brief Returns XML representation of the operation's widget.
43    *  \return XML QString
44    *
45    *  Returns XML representation of the operation's widget.
46    */
47   const QString& xmlRepresentation() const
48   {
49     return myXmlRepr;
50   }
51
52   /*!
53    *  \brief Sets XML representation of the operation's widget.
54    *  \param xmlRepr - XML QString
55    *
56    *  Sets XML representation of the operation's widget.
57    */
58   void setXmlRepresentation(const QString& xmlRepr)
59   {
60     this->myXmlRepr = xmlRepr;
61   }
62
63
64   /*
65    *  Returns a short description of operation (will be
66    *  inserted in title of property panel)
67    */
68   const QString& description() const
69   {
70     return myDescription;
71   }
72
73   /*
74    *  Sets a short description of operation (will be
75    *  inserted in title of property panel)
76    */
77   void setDescription(const QString& theDescription)
78   {
79     this->myDescription = theDescription;
80   }
81
82 private:
83   //!< Next fields could be extracted into a subclass;
84   QString myXmlRepr;
85   QString myDescription;
86 };
87
88 #endif //MODULEBASE_PROPPANELOPERATION_H