source: trunk/src/gui/styles/qcdestyle.cpp@ 944

Last change on this file since 944 was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 10.5 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
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.
23**
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.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "qcdestyle.h"
43
44#if !defined(QT_NO_STYLE_CDE) || defined(QT_PLUGIN)
45
46#include "qmenu.h"
47#include "qapplication.h"
48#include "qpainter.h"
49#include "qdrawutil.h"
50#include "qpixmap.h"
51#include "qpalette.h"
52#include "qwidget.h"
53#include "qpushbutton.h"
54#include "qscrollbar.h"
55#include "qtabbar.h"
56#include "qtabwidget.h"
57#include "qlistview.h"
58#include "qsplitter.h"
59#include "qslider.h"
60#include "qcombobox.h"
61#include "qlineedit.h"
62#include "qprogressbar.h"
63#include "qimage.h"
64#include "qfocusframe.h"
65#include "qpainterpath.h"
66#include "qdebug.h"
67#include <limits.h>
68
69QT_BEGIN_NAMESPACE
70
71/*!
72 \class QCDEStyle
73 \brief The QCDEStyle class provides a CDE look and feel.
74
75 \ingroup appearance
76
77 This style provides a slightly improved Motif look similar to some
78 versions of the Common Desktop Environment (CDE). The main
79 differences are thinner frames and more modern radio buttons and
80 checkboxes. Together with a dark background and a bright
81 text/foreground color, the style looks quite attractive (at least
82 for Motif fans).
83
84 Note that most of the functions provided by QCDEStyle are
85 reimplementations of QStyle functions; see QStyle for their
86 documentation. QCDEStyle provides overloads for drawControl() and
87 drawPrimitive() which are documented here.
88
89 \img qcdestyle.png
90 \sa QWindowsXPStyle, QMacStyle, QWindowsStyle, QPlastiqueStyle, QMotifStyle
91*/
92
93/*!
94 Constructs a QCDEStyle.
95
96 If \a useHighlightCols is false (the default), then the style will
97 polish the application's color palette to emulate the Motif way of
98 highlighting, which is a simple inversion between the base and the
99 text color.
100*/
101QCDEStyle::QCDEStyle(bool useHighlightCols)
102 : QMotifStyle(useHighlightCols)
103{
104}
105
106/*!
107 Destroys the style.
108*/
109QCDEStyle::~QCDEStyle()
110{
111}
112
113
114/*!\reimp
115*/
116int QCDEStyle::pixelMetric(PixelMetric metric, const QStyleOption *option,
117 const QWidget *widget) const
118/*
119int QCDEStyle::pixelMetric(PixelMetric metric, const QStyleOption *option,
120 const QWidget *widget) const
121 */
122{
123 int ret = 0;
124
125 switch(metric) {
126 case PM_MenuBarPanelWidth:
127 case PM_DefaultFrameWidth:
128 case PM_FocusFrameVMargin:
129 case PM_FocusFrameHMargin:
130 case PM_MenuPanelWidth:
131 case PM_SpinBoxFrameWidth:
132 case PM_MenuBarVMargin:
133 case PM_MenuBarHMargin:
134 case PM_DockWidgetFrameWidth:
135 ret = 1;
136 break;