1 /****************************************************************************
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the demonstration applications of the Qt Toolkit.
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
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.
40 ****************************************************************************/
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
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
;
71 QAction
*bottomAction
;
73 QAction
*changeSizeHintsAction
;
79 QAction
*windowModifiedAction
;
82 ColorSwatch(const QString
&colorName
, QWidget
*parent
= 0, Qt::WindowFlags flags
= 0);
85 void setCustomSizeHint(const QSize
&size
);
88 virtual void contextMenuEvent(QContextMenuEvent
*event
);
89 virtual void resizeEvent(QResizeEvent
*e
);
92 void allow(Qt::DockWidgetArea area
, bool allow
);
93 void place(Qt::DockWidgetArea area
, bool place
);
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
121 BlueTitleBar(QWidget
*parent
= 0);
123 QSize
sizeHint() const { return minimumSizeHint(); }
124 QSize
minimumSizeHint() const;
126 void paintEvent(QPaintEvent
*event
);
127 void mousePressEvent(QMouseEvent
*event
);
132 QPixmap leftPm
, centerPm
, rightPm
;