ctkVTKTextPropertyWidget.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 __ctkVTKTextPropertyWidget_h
  15. #define __ctkVTKTextPropertyWidget_h
  16. // Qt includes
  17. #include <QWidget>
  18. // CTK includes
  19. #include "ctkPimpl.h"
  20. #include "ctkVTKObject.h"
  21. #include "ctkVisualizationVTKWidgetsExport.h"
  22. class ctkVTKTextPropertyWidgetPrivate;
  23. class vtkTextProperty;
  24. /// \ingroup Visualization_VTK_Widgets
  25. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKTextPropertyWidget : public QWidget
  26. {
  27. Q_OBJECT;
  28. QVTK_OBJECT;
  29. Q_PROPERTY(bool showText READ isTextVisible WRITE setTextVisible);
  30. Q_PROPERTY(QString text READ text WRITE setText);
  31. Q_PROPERTY(QString textLabel READ textLabel WRITE setTextLabel);
  32. Q_PROPERTY(bool showSize READ isSizeVisible WRITE setSizeVisible);
  33. public:
  34. /// Constructors
  35. ctkVTKTextPropertyWidget(QWidget* parentWidget);
  36. ctkVTKTextPropertyWidget(vtkTextProperty* textProperty, QWidget* parentWidget);
  37. virtual ~ctkVTKTextPropertyWidget();
  38. vtkTextProperty* textProperty()const;
  39. void setTextVisible(bool visible);
  40. bool isTextVisible()const;
  41. void setSizeVisible(bool visible);
  42. bool isSizeVisible()const;
  43. QString text()const;
  44. QString textLabel()const;
  45. /// Color of vtkTextProperty
  46. QColor color()const;
  47. /// Opacity of vtkTextProperty
  48. double opacity()const;
  49. /// Font of vtkTextProperty
  50. QString font()const;
  51. /// Is the text bold
  52. bool isBold()const;
  53. /// Is the text italic
  54. bool isItalic()const;
  55. /// Has the text shadows
  56. bool hasShadow()const;
  57. /// Size of vtkTextProperty
  58. double size()const;
  59. public Q_SLOTS:
  60. void setTextProperty(vtkTextProperty* textProperty);
  61. void setText(const QString& text);
  62. void setTextLabel(const QString& label);
  63. void setColor(const QColor& color);
  64. void setOpacity(double opacity);
  65. void setFont(const QString& font);
  66. void setBold(bool enable);
  67. void setItalic(bool enable);
  68. void setShadow(bool enable);
  69. void setSize(double size);
  70. Q_SIGNALS:
  71. void textChanged(const QString& text);
  72. void colorChanged(const QColor& color);
  73. void opacityChanged(double opacity);
  74. void fontFamilyChanged(const QString &font);
  75. void boldChanged(bool enable);
  76. void italicChanged(bool enable);
  77. void shadowChanged(bool enable);
  78. void sizeChanged(double size);
  79. protected Q_SLOTS:
  80. void updateFromTextProperty();
  81. protected:
  82. QScopedPointer<ctkVTKTextPropertyWidgetPrivate> d_ptr;
  83. private:
  84. Q_DECLARE_PRIVATE(ctkVTKTextPropertyWidget);
  85. Q_DISABLE_COPY(ctkVTKTextPropertyWidget);
  86. };
  87. #endif