ctkVTKTextPropertyWidget.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. public:
  33. /// Constructors
  34. ctkVTKTextPropertyWidget(QWidget* parentWidget);
  35. ctkVTKTextPropertyWidget(vtkTextProperty* textProperty, QWidget* parentWidget);
  36. virtual ~ctkVTKTextPropertyWidget();
  37. vtkTextProperty* textProperty()const;
  38. void setTextVisible(bool visible);
  39. bool isTextVisible()const;
  40. QString text()const;
  41. QString textLabel()const;
  42. /// Color of vtkTextProperty
  43. QColor color()const;
  44. /// Opacity of vtkTextProperty
  45. double opacity()const;
  46. /// Font of vtkTextProperty
  47. QString font()const;
  48. /// Is the text bold
  49. bool isBold()const;
  50. /// Is the text italic
  51. bool isItalic()const;
  52. /// Has the text shadows
  53. bool hasShadow()const;
  54. public Q_SLOTS:
  55. void setTextProperty(vtkTextProperty* textProperty);
  56. void setText(const QString& text);
  57. void setTextLabel(const QString& label);
  58. void setColor(const QColor& color);
  59. void setOpacity(double opacity);
  60. void setFont(const QString& font);
  61. void setBold(bool enable);
  62. void setItalic(bool enable);
  63. void setShadow(bool enable);
  64. Q_SIGNALS:
  65. void textChanged(const QString& text);
  66. void colorChanged(const QColor& color);
  67. void opacityChanged(double opacity);
  68. void fontFamilyChanged(const QString &font);
  69. void boldChanged(bool enable);
  70. void italicChanged(bool enable);
  71. void shadowChanged(bool enable);
  72. protected Q_SLOTS:
  73. void updateFromTextProperty();
  74. protected:
  75. QScopedPointer<ctkVTKTextPropertyWidgetPrivate> d_ptr;
  76. private:
  77. Q_DECLARE_PRIVATE(ctkVTKTextPropertyWidget);
  78. Q_DISABLE_COPY(ctkVTKTextPropertyWidget);
  79. };
  80. #endif