add more spacing
[personal-kdebase.git] / workspace / kwin / kcmkwin / kwincompositing / monitor.h
blobef7215fb45f0a9ec50cf0709bf0ecd77b57f7b10
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2008 Lubos Lunak <l.lunak@suse.cz>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
21 #ifndef CCSM_MONITOR_H
22 #define CCSM_MONITOR_H
24 #include <qactiongroup.h>
25 #include <qgraphicsitem.h>
26 #include <qlabel.h>
27 #include <qvector.h>
29 class QAction;
30 class QGraphicsView;
31 class QGraphicsScene;
32 class QMenu;
34 namespace KWin
37 class Monitor
38 : public QLabel
40 Q_OBJECT
41 public:
42 Monitor( QWidget* parent );
43 void setEdge( int edge, bool set );
44 bool edge( int edge ) const;
45 void clear();
46 void addEdgeItem( int edge, const QString& item );
47 void selectEdgeItem( int edge, int index );
48 int selectedEdgeItem( int edge ) const;
50 enum Edges
52 Left,
53 Right,
54 Top,
55 Bottom,
56 TopLeft,
57 TopRight,
58 BottomLeft,
59 BottomRight
61 signals:
62 void changed();
63 void edgeSelectionChanged( int edge, int index );
64 protected:
65 virtual void resizeEvent( QResizeEvent* e );
66 private:
67 class Corner;
68 void popup( Corner* c, QPoint pos );
69 void flip( Corner* c, QPoint pos );
70 void checkSize();
71 QGraphicsView* view;
72 QGraphicsScene* scene;
73 QGraphicsRectItem* items[ 8 ];
74 QMenu* popups[ 8 ];
75 QVector< QAction* > popup_actions[ 8 ];
76 QActionGroup* grp[ 8 ];
79 class Monitor::Corner
80 : public QGraphicsRectItem
82 public:
83 Corner( Monitor* m );
84 protected:
85 virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent* e );
86 virtual void mousePressEvent( QGraphicsSceneMouseEvent* e );
87 private:
88 Monitor* monitor;
91 } // namespace
93 #endif