ctkCorePythonQtDecorators.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. class CTK_CORE_EXPORT ctkCorePythonQtDecorators : public QObject
  25. {
  26. Q_OBJECT
  27. public:
  28. ctkCorePythonQtDecorators()
  29. {
  30. PythonQt::self()->registerCPPClass("ctkWorkflowStep", 0, "CTKCore");
  31. PythonQt::self()->registerClass(&ctkWorkflowInterstepTransition::staticMetaObject, "CTKCore");
  32. }
  33. public slots:
  34. //
  35. // ctkWorkflowStep
  36. //
  37. ctkWorkflowStep* new_ctkWorkflowStep()
  38. {
  39. return new ctkWorkflowStep();
  40. }
  41. ctkWorkflowStep* new_ctkWorkflowStep(ctkWorkflow* newWorkflow, const QString& newId = QString())
  42. {
  43. return new ctkWorkflowStep(newWorkflow, newId);
  44. }
  45. void delete_ctkWorkflowStep(ctkWorkflowStep * step)
  46. {
  47. delete step;
  48. }
  49. ctkWorkflow* workflow(ctkWorkflowStep* step)const
  50. {
  51. return step->workflow();
  52. }
  53. QString id(ctkWorkflowStep* step)const
  54. {
  55. return step->id();
  56. }
  57. void setId(ctkWorkflowStep* step, const QString& newId)const
  58. {
  59. step->setId(newId);
  60. }
  61. QString name(ctkWorkflowStep* step)const
  62. {
  63. return step->name();
  64. }
  65. void setName(ctkWorkflowStep* step, const QString& newName)
  66. {
  67. step->setName(newName);
  68. }
  69. QString description(ctkWorkflowStep* step)const
  70. {
  71. return step->description();
  72. }
  73. void setDescription(ctkWorkflowStep* step, const QString& newDescription)
  74. {
  75. step->setDescription(newDescription);
  76. }
  77. QString statusText(ctkWorkflowStep* step)const
  78. {
  79. return step->statusText();
  80. }
  81. bool hasValidateCommand(ctkWorkflowStep* step)const
  82. {
  83. return step->hasValidateCommand();
  84. }
  85. void setHasValidateCommand(ctkWorkflowStep* step, bool newHasValidateCommand)
  86. {
  87. step->setHasValidateCommand(newHasValidateCommand);
  88. }
  89. bool hasOnEntryCommand(ctkWorkflowStep* step)const
  90. {
  91. return step->hasOnEntryCommand();
  92. }
  93. void setHasOnEntryCommand(ctkWorkflowStep* step, bool newHasOnEntryCommand)
  94. {
  95. step->setHasOnEntryCommand(newHasOnEntryCommand);
  96. }
  97. bool hasOnExitCommand(ctkWorkflowStep* step)const
  98. {
  99. return step->hasOnExitCommand();
  100. }
  101. void setHasOnExitCommand(ctkWorkflowStep* step, bool newHasOnExitCommand)
  102. {
  103. step->setHasOnExitCommand(newHasOnExitCommand);
  104. }
  105. QObject* ctkWorkflowStepQObject(ctkWorkflowStep* step)
  106. {
  107. return step->ctkWorkflowStepQObject();
  108. }
  109. //
  110. // ctkWorkflowInterstepTransition
  111. //
  112. ctkWorkflowInterstepTransition* new_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition::InterstepTransitionType newTransitionType)
  113. {
  114. return new ctkWorkflowInterstepTransition(newTransitionType);
  115. }
  116. ctkWorkflowInterstepTransition* new_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition::InterstepTransitionType newTransitionType, const QString& newId)
  117. {
  118. return new ctkWorkflowInterstepTransition(newTransitionType, newId);
  119. }
  120. void delete_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition * transition)
  121. {
  122. delete transition;
  123. }
  124. };
  125. #endif