1
//MountManager - the program for easy mounting of storage devices in Linux
2
//Copyright (C) 2007-2008 Tikhonov Sergey
4
//This file is part of MountManager Gui
6
//This program is free software; you can redistribute it and/or
7
//modify it under the terms of the GNU General Public License
8
//as published by the Free Software Foundation; either version 2
9
//of the License, or (at your option) any later version.
11
//This program is distributed in the hope that it will be useful,
12
//but WITHOUT ANY WARRANTY; without even the implied warranty of
13
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
//GNU General Public License for more details.
16
//You should have received a copy of the GNU General Public License
17
//along with this program; if not, write to the Free Software
18
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#include <QWidgetAction>
21
#include <QHBoxLayout>
28
Menu::Menu(bool useSpecialHeader) {
31
headerActionFrame = 0;
34
// Create header action if useSpecialHeader == true
35
if (useSpecialHeader) {
36
headerAction = new QWidgetAction(this);
37
headerAction->setEnabled(false);
39
headerActionFrame = new QFrame;
40
headerActionFrame->setFrameShape(QFrame::Box);
42
headerAction->setDefaultWidget(headerActionFrame);
44
QHBoxLayout *headerActionFrameLayout = new QHBoxLayout();
45
headerActionFrameLayout->setMargin(3);
46
headerActionFrameLayout->setSpacing(3);
47
headerActionFrame->setLayout(headerActionFrameLayout);
49
iconLabel = new QLabel;
50
headerLabel = new QLabel;
52
iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
53
headerActionFrameLayout->insertWidget(-1,iconLabel,0);
54
headerActionFrameLayout->insertWidget(-1,headerLabel,20);
55
QFont font = headerLabel->font();
57
headerLabel->setFont(font);
60
addAction(headerAction);
65
if (headerAction != 0) {
68
delete headerActionFrame;
73
void Menu::setHeaderText(const QString &headerText) {
75
headerLabel->setText(headerText);
78
void Menu::setHeaderIcon(const QIcon &icon) {
80
iconLabel->setPixmap(icon.pixmap(iconSize,iconSize));
b'\\ No newline at end of file'