Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
[qt-netbsd.git] / demos / mainwindow / colorswatch.h
blob90036a707bdb554031be5ff28519fbe0cf1b9053
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the demonstration applications of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
40 ****************************************************************************/
42 #ifndef COLORSWATCH_H
43 #define COLORSWATCH_H
45 #include <QDockWidget>
47 QT_FORWARD_DECLARE_CLASS(QAction)
48 QT_FORWARD_DECLARE_CLASS(QActionGroup)
49 QT_FORWARD_DECLARE_CLASS(QMenu)
51 class ColorSwatch : public QDockWidget
53 Q_OBJECT
55 QAction *closableAction;
56 QAction *movableAction;
57 QAction *floatableAction;
58 QAction *floatingAction;
59 QAction *verticalTitleBarAction;
61 QActionGroup *allowedAreasActions;
62 QAction *allowLeftAction;
63 QAction *allowRightAction;
64 QAction *allowTopAction;
65 QAction *allowBottomAction;
67 QActionGroup *areaActions;
68 QAction *leftAction;
69 QAction *rightAction;
70 QAction *topAction;
71 QAction *bottomAction;
73 QAction *changeSizeHintsAction;
75 QMenu *tabMenu;
76 QMenu *splitHMenu;
77 QMenu *splitVMenu;
79 QAction *windowModifiedAction;
81 public:
82 ColorSwatch(const QString &colorName, QWidget *parent = 0, Qt::WindowFlags flags = 0);
84 QMenu *menu;
85 void setCustomSizeHint(const QSize &size);
87 protected:
88 virtual void contextMenuEvent(QContextMenuEvent *event);
89 virtual void resizeEvent(QResizeEvent *e);
91 private:
92 void allow(Qt::DockWidgetArea area, bool allow);
93 void place(Qt::DockWidgetArea area, bool place);
95 private slots:
96 void changeClosable(bool on);
97 void changeMovable(bool on);
98 void changeFloatable(bool on);
99 void changeFloating(bool on);
100 void changeVerticalTitleBar(bool on);
101 void updateContextMenu();
103 void allowLeft(bool a);
104 void allowRight(bool a);
105 void allowTop(bool a);
106 void allowBottom(bool a);
108 void placeLeft(bool p);
109 void placeRight(bool p);
110 void placeTop(bool p);
111 void placeBottom(bool p);
113 void splitInto(QAction *action);
114 void tabInto(QAction *action);
117 class BlueTitleBar : public QWidget
119 Q_OBJECT
120 public:
121 BlueTitleBar(QWidget *parent = 0);
123 QSize sizeHint() const { return minimumSizeHint(); }
124 QSize minimumSizeHint() const;
125 protected:
126 void paintEvent(QPaintEvent *event);
127 void mousePressEvent(QMouseEvent *event);
128 public slots:
129 void updateMask();
131 private:
132 QPixmap leftPm, centerPm, rightPm;
136 #endif