TDE graphics utilities
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.

kptoolairspray.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. Copyright (c) 2003,2004,2005 Clarence Dang <dang@kde.org>
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. 1. Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. 2. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  13. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  14. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  16. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  17. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  18. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  19. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  20. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  21. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. */
  23. #ifndef __kptoolairspray_h__
  24. #define __kptoolairspray_h__
  25. #include <kpcommandhistory.h>
  26. #include <kpcolor.h>
  27. #include <kptool.h>
  28. class TQPixmap;
  29. class TQPoint;
  30. class TQRect;
  31. class TQString;
  32. class TQTimer;
  33. class kpMainWindow;
  34. class kpToolAirSprayCommand;
  35. class kpToolWidgetSpraycanSize;
  36. class kpViewManager;
  37. class kpToolAirSpray : public kpTool
  38. {
  39. Q_OBJECT
  40. public:
  41. kpToolAirSpray (kpMainWindow *);
  42. virtual ~kpToolAirSpray ();
  43. private:
  44. TQString haventBegunDrawUserMessage () const;
  45. public:
  46. virtual void begin ();
  47. virtual void end ();
  48. private slots:
  49. void slotSpraycanSizeChanged (int size);
  50. public:
  51. virtual void beginDraw ();
  52. virtual void draw (const TQPoint &thisPoint, const TQPoint &, const TQRect &);
  53. virtual void cancelShape ();
  54. virtual void releasedAllButtons ();
  55. virtual void endDraw (const TQPoint &, const TQRect &);
  56. public slots:
  57. void actuallyDraw ();
  58. private:
  59. kpToolWidgetSpraycanSize *m_toolWidgetSpraycanSize;
  60. kpToolAirSprayCommand *m_currentCommand;
  61. TQTimer *m_timer;
  62. int m_size;
  63. };
  64. class kpToolAirSprayCommand : public kpCommand
  65. {
  66. public:
  67. kpToolAirSprayCommand (const kpColor &color, int size,
  68. kpMainWindow *mainWindow);
  69. virtual ~kpToolAirSprayCommand ();
  70. virtual TQString name () const;
  71. virtual int size () const;
  72. virtual void execute ();
  73. virtual void unexecute ();
  74. // interface for TDEToolAirSpray
  75. void addPoints (const TQPointArray &points);
  76. void finalize ();
  77. void cancel ();
  78. private:
  79. kpColor m_color;
  80. int m_size;
  81. TQPixmap *m_newPixmapPtr;
  82. TQPixmap m_oldPixmap;
  83. TQRect m_boundingRect;
  84. };
  85. #endif // __kptoolairspray_h__