TDE base libraries and programs
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.

112 lines
3.1 KiB

  1. /* vi: ts=8 sts=4 sw=4
  2. kate: space-indent on; indent-width 4; indent-mode cstyle;
  3. This file is part of the KDE project, module kcmbackground.
  4. Copyright (C) 2002 Laurent Montel <montell@club-internet.fr>
  5. Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
  6. Copyright (C) 2005 David Saxton <david@bluehaze.org>
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. version 2 as published by the Free Software Foundation.
  10. This library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public License
  15. along with this library; see the file COPYING.LIB. If not, write to
  16. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. Boston, MA 02110-1301, USA.
  18. */
  19. #ifndef _BGMONITOR_H_
  20. #define _BGMONITOR_H_
  21. #include <tqlabel.h>
  22. #include <tqvaluevector.h>
  23. #include <tqwidget.h>
  24. class BGMonitor;
  25. class BGMonitorLabel;
  26. class KPixmap;
  27. /**
  28. * This class arranges and resizes a set of monitor images according to the
  29. * monitor geometries.
  30. */
  31. class BGMonitorArrangement : public TQWidget
  32. {
  33. Q_OBJECT
  34. public:
  35. BGMonitorArrangement(TQWidget *parent, const char *name=0L);
  36. /**
  37. * Splits up the pixmap according to monitor geometries and sets each
  38. * BGMonitor pixmap accordingly.
  39. */
  40. void setPixmap( const KPixmap & pm );
  41. TQSize combinedPreviewSize() const { return m_combinedPreviewSize; }
  42. TQSize maxPreviewSize() const { return m_maxPreviewSize; }
  43. unsigned numMonitors() const { return m_pBGMonitor.size(); }
  44. BGMonitor * monitor( unsigned screen ) const;
  45. void updateArrangement();
  46. signals:
  47. void imageDropped(const TQString &);
  48. protected:
  49. virtual void resizeEvent( TQResizeEvent * );
  50. TQRect expandToPreview( TQRect r ) const;
  51. TQSize expandToPreview( TQSize s ) const;
  52. TQPoint expandToPreview( TQPoint p ) const;
  53. TQValueVector<BGMonitorLabel*> m_pBGMonitor;
  54. TQSize m_combinedPreviewSize;
  55. TQSize m_maxPreviewSize;
  56. };
  57. /**
  58. * Contains a BGMonitor.
  59. */
  60. class BGMonitorLabel : public TQLabel
  61. {
  62. public:
  63. BGMonitorLabel(TQWidget *parent, const char *name=0L);
  64. BGMonitor * monitor() const { return m_pBGMonitor; }
  65. void updateMonitorGeometry();
  66. void setPreviewPosition( TQRect r ) { m_previewPosition = r; }
  67. TQRect previewPosition() const { return m_previewPosition; }
  68. protected:
  69. virtual void resizeEvent( TQResizeEvent * );
  70. BGMonitor * m_pBGMonitor;
  71. TQRect m_previewPosition;
  72. };
  73. /**
  74. * This class handles drops on the preview monitor.
  75. */
  76. class BGMonitor : public TQLabel
  77. {
  78. Q_OBJECT
  79. public:
  80. BGMonitor(TQWidget *parent, const char *name=0L);
  81. signals:
  82. void imageDropped(const TQString &);
  83. protected:
  84. virtual void dropEvent(TQDropEvent *);
  85. virtual void dragEnterEvent(TQDragEnterEvent *);
  86. };
  87. #endif