tdegraphics
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.

kptemppixmap.h 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. // TODO: maybe merge with kpSelection?
  24. #ifndef __kp_temp_pixmap_h__
  25. #define __kp_temp_pixmap_h__
  26. #include <tqpoint.h>
  27. #include <tqpixmap.h>
  28. class kpViewManager;
  29. class kpTempPixmap
  30. {
  31. public:
  32. enum RenderMode
  33. {
  34. SetPixmap,
  35. PaintPixmap,
  36. PaintMaskTransparentWithBrush
  37. };
  38. /*
  39. * <isBrush> Specifies that its visibility is dependent on whether or
  40. * not the mouse cursor is inside a view. If false, the
  41. * pixmap is always displayed.
  42. */
  43. kpTempPixmap (bool isBrush, RenderMode renderMode, const TQPoint &topLeft, const TQPixmap &pixmap);
  44. kpTempPixmap (const kpTempPixmap &rhs);
  45. kpTempPixmap &operator= (const kpTempPixmap &rhs);
  46. ~kpTempPixmap ();
  47. bool isBrush () const;
  48. RenderMode renderMode () const;
  49. TQPoint topLeft () const;
  50. TQPixmap pixmap () const;
  51. bool isVisible (const kpViewManager *vm) const;
  52. TQRect rect () const;
  53. int width () const;
  54. int height () const;
  55. // Returns whether a call to paint() may change <*destPixmap>'s mask
  56. bool mayChangeDocumentMask () const;
  57. /*
  58. * Draws itself onto <*destPixmap>, given that <*destPixmap> represents
  59. * the unzoomed <docRect> of the kpDocument. You should check for
  60. * visibility before calling this function.
  61. */
  62. void paint (TQPixmap *destPixmap, const TQRect &docRect) const;
  63. private:
  64. bool m_isBrush;
  65. RenderMode m_renderMode;
  66. TQPoint m_topLeft;
  67. TQPixmap m_pixmap;
  68. };
  69. #endif // __kp_temp_pixmap_h__