ctkCorePythonQtDecorators.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. QString name(ctkWorkflowStep* step)const
  58. {
  59. return step->name();
  60. }
  61. void setName(ctkWorkflowStep* step, const QString& newName)
  62. {
  63. step->setName(newName);
  64. }
  65. QString description(ctkWorkflowStep* step)const
  66. {
  67. return step->description();
  68. }
  69. void setDescription(ctkWorkflowStep* step, const QString& newDescription)
  70. {
  71. step->setDescription(newDescription);
  72. }
  73. QString statusText(ctkWorkflowStep* step)const
  74. {
  75. return step->statusText();
  76. }
  77. bool hasValidateCommand(ctkWorkflowStep* step)const
  78. {
  79. return step->hasValidateCommand();
  80. }
  81. void setHasValidateCommand(ctkWorkflowStep* step, bool newHasValidateCommand)
  82. {
  83. step->setHasValidateCommand(newHasValidateCommand);
  84. }
  85. bool hasOnEntryCommand(ctkWorkflowStep* step)const
  86. {
  87. return step->hasOnEntryCommand();
  88. }
  89. void setHasOnEntryCommand(ctkWorkflowStep* step, bool newHasOnEntryCommand)
  90. {
  91. step->setHasOnEntryCommand(newHasOnEntryCommand);
  92. }
  93. bool hasOnExitCommand(ctkWorkflowStep* step)const
  94. {
  95. return step->hasOnExitCommand();
  96. }
  97. void setHasOnExitCommand(ctkWorkflowStep* step, bool newHasOnExitCommand)
  98. {
  99. step->setHasOnExitCommand(newHasOnExitCommand);
  100. }
  101. QObject* ctkWorkflowStepQObject(ctkWorkflowStep* step)
  102. {
  103. return step->ctkWorkflowStepQObject();
  104. }
  105. //
  106. // ctkWorkflowInterstepTransition
  107. //
  108. ctkWorkflowInterstepTransition* new_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition::InterstepTransitionType newTransitionType)
  109. {
  110. return new ctkWorkflowInterstepTransition(newTransitionType);
  111. }
  112. ctkWorkflowInterstepTransition* new_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition::InterstepTransitionType newTransitionType, const QString& newId)
  113. {
  114. return new ctkWorkflowInterstepTransition(newTransitionType, newId);
  115. }
  116. void delete_ctkWorkflowInterstepTransition(ctkWorkflowInterstepTransition * transition)
  117. {
  118. delete transition;
  119. }
  120. };
  121. #endif