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.
31 #include <QDragEnterEvent>
39 * This class arranges and resizes a set of monitor images according to the
42 class BGMonitorArrangement
: public QWidget
46 BGMonitorArrangement(QWidget
*parent
);
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();
61 void imageDropped(const QString
&);
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
;
75 * Contains a BGMonitor.
77 class BGMonitorLabel
: public QLabel
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
; }
89 virtual void resizeEvent( QResizeEvent
* );
90 BGMonitor
* m_pBGMonitor
;
91 QRect m_previewPosition
;
95 * This class handles drops on the preview monitor.
97 class BGMonitor
: public QLabel
102 explicit BGMonitor(QWidget
*parent
, const char *name
=0L);
105 void imageDropped(const QString
&);
108 virtual void dropEvent(QDropEvent
*);
109 virtual void dragEnterEvent(QDragEnterEvent
*);