KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kis_tool_gradient.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * kis_tool_line.h - part of Krayon
  3. *
  4. * Copyright (c) 2000 John Califf <jcaliff@comuzone.net>
  5. * Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
  6. * Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
  7. * Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  22. */
  23. #ifndef KIS_TOOL_GRADIENT_H_
  24. #define KIS_TOOL_GRADIENT_H_
  25. #include "kis_tool_paint.h"
  26. #include "kis_global.h"
  27. #include "kis_types.h"
  28. #include "kis_gradient_painter.h"
  29. #include "kis_tool_factory.h"
  30. class KIntNumInput;
  31. class KDoubleNumInput;
  32. class KisCmbComposite;
  33. class KisPainter;
  34. class TQLabel;
  35. class TQPoint;
  36. class TQWidget;
  37. class TQCheckBox;
  38. class KisToolGradient : public KisToolPaint {
  39. Q_OBJECT
  40. TQ_OBJECT
  41. typedef KisToolPaint super;
  42. public:
  43. KisToolGradient();
  44. virtual ~KisToolGradient();
  45. virtual void setup(KActionCollection *collection);
  46. virtual enumToolType toolType() { return TOOL_FILL; }
  47. virtual TQ_UINT32 priority() { return 1; }
  48. virtual void update(KisCanvasSubject *subject);
  49. virtual void buttonPress(KisButtonPressEvent *event);
  50. virtual void move(KisMoveEvent *event);
  51. virtual void buttonRelease(KisButtonReleaseEvent *event);
  52. virtual void paint(KisCanvasPainter& gc);
  53. virtual void paint(KisCanvasPainter& gc, const TQRect& rc);
  54. TQWidget* createOptionWidget(TQWidget* parent);
  55. public slots:
  56. void slotSetShape(int);
  57. void slotSetRepeat(int);
  58. void slotSetReverse(bool);
  59. void slotSetAntiAliasThreshold(double);
  60. private:
  61. void paintLine();
  62. void paintLine(KisCanvasPainter& gc);
  63. KisPoint straightLine(KisPoint point);
  64. bool m_dragging;
  65. KisPoint m_startPos;
  66. KisPoint m_endPos;
  67. KisCanvasSubject *m_subject;
  68. KisGradientPainter::enumGradientShape m_shape;
  69. KisGradientPainter::enumGradientRepeat m_repeat;
  70. bool m_reverse;
  71. double m_antiAliasThreshold;
  72. TQLabel *m_lbShape;
  73. TQLabel *m_lbRepeat;
  74. TQCheckBox *m_ckReverse;
  75. TQComboBox *m_cmbShape;
  76. TQComboBox *m_cmbRepeat;
  77. TQLabel *m_lbAntiAliasThreshold;
  78. KDoubleNumInput *m_slAntiAliasThreshold;
  79. };
  80. class KisToolGradientFactory : public KisToolFactory {
  81. typedef KisToolFactory super;
  82. public:
  83. KisToolGradientFactory() : super() {};
  84. virtual ~KisToolGradientFactory(){};
  85. virtual KisTool * createTool(KActionCollection * ac) {
  86. KisTool * t = new KisToolGradient();
  87. Q_CHECK_PTR(t);
  88. t->setup(ac);
  89. return t;
  90. }
  91. virtual KisID id() { return KisID("gradient", i18n("Gradient Tool")); }
  92. };
  93. #endif //KIS_TOOL_GRADIENT_H_