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.

kpselectiondrag.h 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 __kp_selection_drag_h__
  24. #define __kp_selection_drag_h__
  25. #include <tqdragobject.h>
  26. #include <kppixmapfx.h>
  27. #include <kpselection.h>
  28. class kpSelectionDrag : public TQImageDrag
  29. {
  30. Q_OBJECT
  31. public:
  32. kpSelectionDrag (TQWidget *dragSource = 0, const char *name = 0);
  33. kpSelectionDrag (const TQImage &image, TQWidget *dragSource = 0, const char *name = 0);
  34. kpSelectionDrag (const kpSelection &sel, TQWidget *dragSource = 0, const char *name = 0);
  35. virtual ~kpSelectionDrag ();
  36. static const char * const selectionMimeType;
  37. void setSelection (const kpSelection &sel);
  38. protected:
  39. bool holdsSelection () const;
  40. public:
  41. virtual const char *format (int which = 0) const;
  42. virtual bool provides (const char *mimeType) const;
  43. virtual TQByteArray encodedData (const char *mimeType) const;
  44. static bool canDecode (const TQMimeSource *e);
  45. static bool decode (const TQMimeSource *e, TQImage &img);
  46. static bool decode (const TQMimeSource *e, kpSelection &sel,
  47. const kpPixmapFX::WarnAboutLossInfo &wali =
  48. kpPixmapFX::WarnAboutLossInfo ());
  49. protected:
  50. kpSelection m_selection;
  51. };
  52. #endif // __kp_selection_drag_h__