ctkCorePythonQtDecorators.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*=auto=========================================================================
  2. Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH)
  3. All Rights Reserved.
  4. See Doc/copyright/copyright.txt
  5. or http://www.slicer.org/copyright/copyright.txt for details.
  6. Program: 3D Slicer
  7. =========================================================================auto=*/
  8. #ifndef __ctkCorePythonQtDecorators_h
  9. #define __ctkCorePythonQtDecorators_h
  10. // Qt includes
  11. #include <QObject>
  12. // PythonQt includes
  13. #include <PythonQt.h>
  14. // CTK includes
  15. #include <ctkWorkflowStep.h>
  16. #include <ctkWorkflowTransitions.h>
  17. #include "ctkCoreExport.h"
  18. // NOTE:
  19. //
  20. // For decorators it is assumed that the methods will never be called
  21. // with the self argument as NULL. The self argument is the first argument
  22. // for non-static methods.
  23. //
  24. /// \ingroup Core
  25. class CTK_CORE_EXPORT ctkCorePythonQtDecorators : public QObject
  26. {
  27. Q_OBJECT
  28. public:
  29. ctkCorePythonQtDecorators()
  30. {
  31. PythonQt::self()->registerCPPClass("ctkWorkflowStep", 0, "CTKCore");
  32. PythonQt::self()->registerClass(&ctkWorkflowInterstepTransition::staticMetaObject, "CTKCore");
  33. }
  34. public slots:
  35. //
  36. // ctkWorkflowStep
  37. //
  38. ctkWorkflowStep* new_ctkWorkflowStep()
  39. {
  40. return new ctkWorkflowStep();
  41. }
  42. ctkWorkflowStep* new_ctkWorkflowStep(ctkWorkflow* newWorkflow, const QString& newId = QString())
  43. {
  44. return new ctkWorkflowStep(newWorkflow, newId);
  45. }
  46. void delete_ctkWorkflowStep(ctkWorkflowStep * step)
  47. {
  48. delete step;
  49. }
  50. ctkWorkflow* workflow(ctkWorkflowStep* step)const
  51. {
  52. return step->workflow();
  53. }
  54. QString id(ctkWorkflowStep* step)const
  55. {
  56. return step->id();
  57. }
  58. void setId(ctkWorkflowStep* step, const QString& newId)const
  59. {
  60. step->setId(newId);
  61. }
  62. QString name(ctkWorkflowStep* step)const
  63. {
  64. return step->name();
  65. }
  66. void setName(ctkWorkflowStep* step, const QString& newName)
  67. {
  68. step->setName(newName);
  69. }
  70. QString description(ctkWorkflowStep* step)const
  71. {
  72. return step->description();
  73. }
  74. void setDescription(ctkWorkflowStep* step, const QString& newDescription)
  75. {
  76. step->setDescription(newDescription);
  77. }
  78. QString statusText(ctkWorkflowStep* step)const
  79. {
  80. return step->statusText();
  81. }
  82. bool hasValidateCommand(ctkWorkflowStep* step)const
  83. {
  84. return step->hasValidateCommand();
  85. }
  86. void setHasValidateCommand(ctkWorkflowStep* step, bool newHasValidateCommand)
  87. {
  88. step->setHasValidateCommand(newHasValidateCommand);
  89. }
  90. bool hasOnEntryCommand(ctkWorkflowStep* step)const
  91. {
  92. return step->hasOnEntryCommand();
  93. }
  94. void setHasOnEntryCommand(ctkWorkflowStep* step, bool newHasOnEntryCommand)
  95. {
  96. step->setHasOnEntryCommand(newHasOnEntryCommand);
  97. }
  98. bool hasOnExitCommand(ctkWorkflowStep* step)const
  99. {
  100. return step->hasOnExitCommand();
  101. }
  102. void setHasOnExitCommand(ctkWorkflowStep* step, bool newHasOnExitCommand)
  103. {
  104. step->setHasOnExitCommand(newHasOnExitCommand);
  105. }
  106. QObject* ctkWorkflowStepQObject(ctkWorkflowStep* step)
  107. {
  108. return step->ctkWorkflowStepQObject();
  109. }
  110. //
  111. // ctkWorkflowInterstepTransition
  112. //
  113. ctkWorkflowInterstepTransition* new_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition::InterstepTransitionType newTransitionType)
  114. {
  115. return new ctkWorkflowInterstepTransition(newTransitionType);
  116. }
  117. ctkWorkflowInterstepTransition* new_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition::InterstepTransitionType newTransitionType, const QString& newId)
  118. {
  119. return new ctkWorkflowInterstepTransition(newTransitionType, newId);
  120. }
  121. void delete_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition * transition)
  122. {
  123. delete transition;
  124. }
  125. };
  126. #endif