ctkWidgetsPythonQtDecorators.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 __ctkWidgetsPythonQtDecorators_h
  15. #define __ctkWidgetsPythonQtDecorators_h
  16. // PythonQt includes
  17. #include <PythonQt.h>
  18. // CTK includes
  19. #include <ctkWorkflowWidgetStep.h>
  20. // NOTE:
  21. //
  22. // For decorators it is assumed that the methods will never be called
  23. // with the self argument as NULL. The self argument is the first argument
  24. // for non-static methods.
  25. //
  26. /// \ingroup Widgets
  27. class ctkWidgetsPythonQtDecorators : public QObject
  28. {
  29. Q_OBJECT
  30. public:
  31. ctkWidgetsPythonQtDecorators()
  32. {
  33. PythonQt::self()->addParentClass("ctkWorkflowWidgetStep", "ctkWorkflowStep",
  34. PythonQtUpcastingOffset<ctkWorkflowWidgetStep,ctkWorkflowStep>());
  35. }
  36. public Q_SLOTS:
  37. bool hasCreateUserInterfaceCommand(ctkWorkflowWidgetStep* step)const
  38. {
  39. return step->hasCreateUserInterfaceCommand();
  40. }
  41. void setHasCreateUserInterfaceCommand(
  42. ctkWorkflowWidgetStep* step, bool newHasCreateUserInterfaceCommand)
  43. {
  44. step->setHasCreateUserInterfaceCommand(newHasCreateUserInterfaceCommand);
  45. }
  46. bool hasShowUserInterfaceCommand(ctkWorkflowWidgetStep* step)const
  47. {
  48. return step->hasShowUserInterfaceCommand();
  49. }
  50. void setHasShowUserInterfaceCommand(
  51. ctkWorkflowWidgetStep* step, bool newHasShowUserInterfaceCommand)
  52. {
  53. step->setHasShowUserInterfaceCommand(newHasShowUserInterfaceCommand);
  54. }
  55. };
  56. //-----------------------------------------------------------------------------
  57. /// \ingroup Widgets
  58. void initCTKWidgetsPythonQtDecorators()
  59. {
  60. PythonQt::self()->addDecorators(new ctkWidgetsPythonQtDecorators);
  61. }
  62. #endif