1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship 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 *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _DesktopView_h_
21 #define _DesktopView_h_
25 * @brief Preview of the screens on the desktop.
26 * @author James Hogan <james@albanarts.com>
29 #include <QGraphicsView>
32 /** Screens preview widget.
33 * @todo Ensure works well with out of range screen id in multiselect mode
35 class DesktopView
: public QGraphicsView
41 * Constructors + destructor
44 /// Primary constructor.
45 DesktopView(QWidget
* parent
);
54 Q_PROPERTY(int selectedScreen READ selectedScreen WRITE setSelectedScreen
)
60 /// Find whether a screen is selected.
61 bool isScreenSelected(int screen
) const;
63 /// Find which single screen is selected.
64 int selectedScreen() const;
72 /// Set the selected screen.
73 void setSelectedScreen(int selectedScreen
);
81 /// A screen selection has changed.
82 void screenSelected(int screen
, bool selected
);
84 /// Current single select screen has changed.
85 void screenChanged(int screen
);
87 /// Status message has changed.
88 void statusChanged(QString status
);
96 void resizeEvent(QResizeEvent
*);
98 void mousePressEvent(QMouseEvent
* event
);
106 /// Indicates that a screen has been resized.
107 void resizeScreen(int screen
);
115 /// Desktop rectangle size.
116 QRectF m_desktopRect
;
118 /// Whether to allow multiple screens to be selected.
121 /// Whether to allow no screen to be selected.
124 /// Which screen is selected when in singleselect.
125 int m_selectedScreen
;
127 /// Which screens are selected when in multiselect.
128 QVector
<bool> m_selectedScreens
;
134 /// Setup the display.
137 /// Change selection of a screen.
138 void selectScreen(int screen
, bool newSelected
);
140 /// Update a single selection status.
141 void singleSelectRestatus();
144 #endif // _DesktopView_h_