ctkCorePythonQtDecorators.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkCorePythonQtDecorators_h
  15. #define __ctkCorePythonQtDecorators_h
  16. // Qt includes
  17. #include <QObject>
  18. // PythonQt includes
  19. #include <PythonQt.h>
  20. // CTK includes
  21. #include <ctkWorkflowStep.h>
  22. #include <ctkWorkflowTransitions.h>
  23. #include "ctkCoreExport.h"
  24. // NOTE:
  25. //
  26. // For decorators it is assumed that the methods will never be called
  27. // with the self argument as NULL. The self argument is the first argument
  28. // for non-static methods.
  29. //
  30. /// \ingroup Core
  31. class CTK_CORE_EXPORT ctkCorePythonQtDecorators : public QObject
  32. {
  33. Q_OBJECT
  34. public:
  35. ctkCorePythonQtDecorators()
  36. {
  37. PythonQt::self()->registerCPPClass("ctkWorkflowStep", 0, "CTKCore");
  38. PythonQt::self()->registerClass(&ctkWorkflowInterstepTransition::staticMetaObject, "CTKCore");
  39. }
  40. public slots:
  41. //
  42. // ctkWorkflowStep
  43. //
  44. ctkWorkflowStep* new_ctkWorkflowStep()
  45. {
  46. return new ctkWorkflowStep();
  47. }
  48. ctkWorkflowStep* new_ctkWorkflowStep(ctkWorkflow* newWorkflow, const QString& newId = QString())
  49. {
  50. return new ctkWorkflowStep(newWorkflow, newId);
  51. }
  52. void delete_ctkWorkflowStep(ctkWorkflowStep * step)
  53. {
  54. delete step;
  55. }
  56. ctkWorkflow* workflow(ctkWorkflowStep* step)const
  57. {
  58. return step->workflow();
  59. }
  60. QString id(ctkWorkflowStep* step)const
  61. {
  62. return step->id();
  63. }
  64. void setId(ctkWorkflowStep* step, const QString& newId)const
  65. {
  66. step->setId(newId);
  67. }
  68. QString name(ctkWorkflowStep* step)const
  69. {
  70. return step->name();
  71. }
  72. void setName(ctkWorkflowStep* step, const QString& newName)
  73. {
  74. step->setName(newName);
  75. }
  76. QString description(ctkWorkflowStep* step)const
  77. {
  78. return step->description();
  79. }
  80. void setDescription(ctkWorkflowStep* step, const QString& newDescription)
  81. {
  82. step->setDescription(newDescription);
  83. }
  84. QString statusText(ctkWorkflowStep* step)const
  85. {
  86. return step->statusText();
  87. }
  88. bool hasValidateCommand(ctkWorkflowStep* step)const
  89. {
  90. return step->hasValidateCommand();
  91. }
  92. void setHasValidateCommand(ctkWorkflowStep* step, bool newHasValidateCommand)
  93. {
  94. step->setHasValidateCommand(newHasValidateCommand);
  95. }
  96. bool hasOnEntryCommand(ctkWorkflowStep* step)const
  97. {
  98. return step->hasOnEntryCommand();
  99. }
  100. void setHasOnEntryCommand(ctkWorkflowStep* step, bool newHasOnEntryCommand)
  101. {
  102. step->setHasOnEntryCommand(newHasOnEntryCommand);
  103. }
  104. bool hasOnExitCommand(ctkWorkflowStep* step)const
  105. {
  106. return step->hasOnExitCommand();
  107. }
  108. void setHasOnExitCommand(ctkWorkflowStep* step, bool newHasOnExitCommand)
  109. {
  110. step->setHasOnExitCommand(newHasOnExitCommand);
  111. }
  112. QObject* ctkWorkflowStepQObject(ctkWorkflowStep* step)
  113. {
  114. return step->ctkWorkflowStepQObject();
  115. }
  116. //
  117. // ctkWorkflowInterstepTransition
  118. //
  119. ctkWorkflowInterstepTransition* new_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition::InterstepTransitionType newTransitionType)
  120. {
  121. return new ctkWorkflowInterstepTransition(newTransitionType);
  122. }
  123. ctkWorkflowInterstepTransition* new_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition::InterstepTransitionType newTransitionType, const QString& newId)
  124. {
  125. return new ctkWorkflowInterstepTransition(newTransitionType, newId);
  126. }
  127. void delete_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition * transition)
  128. {
  129. delete transition;
  130. }
  131. };
  132. #endif