Add (and install) svg for the new krunner interface.
[kdebase/uwolfer.git] / workspace / kcontrol / kdm / background / bgmonitor.h
blobaf35007393487bcd28f34bd1eb63f0e92e8c11d6
1 /* vi: ts=8 sts=4 sw=4
2 kate: space-indent on; indent-width 4; indent-mode cstyle;
4 This file is part of the KDE project, module kcmbackground.
6 Copyright (C) 2002 Laurent Montel <montell@club-internet.fr>
7 Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
8 Copyright (C) 2005 David Saxton <david@bluehaze.org>
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12 version 2 as published by the Free Software Foundation.
14 This library 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 GNU
17 Library General Public License for more details.
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
25 #ifndef _BGMONITOR_H_
26 #define _BGMONITOR_H_
28 #include <QWidget>
29 #include <QLabel>
30 //Added by qt3to4:
31 #include <QDragEnterEvent>
32 #include <QDropEvent>
34 class BGMonitor;
35 class BGMonitorLabel;
36 class QPixmap;
38 /**
39 * This class arranges and resizes a set of monitor images according to the
40 * monitor geometries.
42 class BGMonitorArrangement : public QWidget
44 Q_OBJECT
45 public:
46 BGMonitorArrangement(QWidget *parent);
48 /**
49 * Splits up the pixmap according to monitor geometries and sets each
50 * BGMonitor pixmap accordingly.
52 void setPixmap( const QPixmap & pm );
53 QSize combinedPreviewSize() const { return m_combinedPreviewSize; }
54 QSize maxPreviewSize() const { return m_maxPreviewSize; }
55 unsigned numMonitors() const { return m_pBGMonitor.size(); }
57 BGMonitor * monitor( unsigned screen ) const;
58 void updateArrangement();
60 signals:
61 void imageDropped(const QString &);
63 protected:
64 virtual void resizeEvent( QResizeEvent * );
65 QRect expandToPreview( const QRect &r ) const;
66 QSize expandToPreview( const QSize &s ) const;
67 QPoint expandToPreview( const QPoint &p ) const;
69 QVector<BGMonitorLabel*> m_pBGMonitor;
70 QSize m_combinedPreviewSize;
71 QSize m_maxPreviewSize;
74 /**
75 * Contains a BGMonitor.
77 class BGMonitorLabel : public QLabel
79 public:
80 explicit BGMonitorLabel(QWidget *parent, const char *name=0L);
82 BGMonitor * monitor() const { return m_pBGMonitor; }
83 void updateMonitorGeometry();
85 void setPreviewPosition( const QRect &r ) { m_previewPosition = r; }
86 QRect previewPosition() const { return m_previewPosition; }
88 protected:
89 virtual void resizeEvent( QResizeEvent * );
90 BGMonitor * m_pBGMonitor;
91 QRect m_previewPosition;
94 /**
95 * This class handles drops on the preview monitor.
97 class BGMonitor : public QLabel
99 Q_OBJECT
100 public:
102 explicit BGMonitor(QWidget *parent, const char *name=0L);
104 Q_SIGNALS:
105 void imageDropped(const QString &);
107 protected:
108 virtual void dropEvent(QDropEvent *);
109 virtual void dragEnterEvent(QDragEnterEvent *);
113 #endif