Diffstat (limited to 'microkde/kdeui/kseparator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/kseparator.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/microkde/kdeui/kseparator.cpp b/microkde/kdeui/kseparator.cpp index d028420..66000f0 100644 --- a/microkde/kdeui/kseparator.cpp +++ b/microkde/kdeui/kseparator.cpp | |||
@@ -1,121 +1,123 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1997 Michael Roth <mroth@wirlweb.de> | 2 | * Copyright (C) 1997 Michael Roth <mroth@wirlweb.de> |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU Library General Public License as published by | 5 | * it under the terms of the GNU Library General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU Library General Public License for more details. | 12 | * GNU Library General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU Library General Public License | 14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qstyle.h> | 20 | #include <qstyle.h> |
21 | //Added by qt3to4: | ||
22 | #include <Q3Frame> | ||
21 | 23 | ||
22 | #include <kdebug.h> | 24 | #include <kdebug.h> |
23 | //US #include <kapplication.h> | 25 | //US #include <kapplication.h> |
24 | 26 | ||
25 | //US #include "kseparator.moc" | 27 | //US #include "kseparator.moc" |
26 | 28 | ||
27 | #include "kseparator.h" | 29 | #include "kseparator.h" |
28 | 30 | ||
29 | KSeparator::KSeparator(QWidget* parent, const char* name, WFlags f) | 31 | KSeparator::KSeparator(QWidget* parent, const char* name, Qt::WFlags f) |
30 | : QFrame(parent, name, f) | 32 | : Q3Frame(parent, name, f) |
31 | { | 33 | { |
32 | setLineWidth(1); | 34 | setLineWidth(1); |
33 | setMidLineWidth(0); | 35 | setMidLineWidth(0); |
34 | setOrientation( HLine ); | 36 | setOrientation( HLine ); |
35 | } | 37 | } |
36 | 38 | ||
37 | 39 | ||
38 | 40 | ||
39 | KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, WFlags f) | 41 | KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, Qt::WFlags f) |
40 | : QFrame(parent, name, f) | 42 | : Q3Frame(parent, name, f) |
41 | { | 43 | { |
42 | setLineWidth(1); | 44 | setLineWidth(1); |
43 | setMidLineWidth(0); | 45 | setMidLineWidth(0); |
44 | setOrientation( orientation ); | 46 | setOrientation( orientation ); |
45 | } | 47 | } |
46 | 48 | ||
47 | 49 | ||
48 | 50 | ||
49 | void KSeparator::setOrientation(int orientation) | 51 | void KSeparator::setOrientation(int orientation) |
50 | { | 52 | { |
51 | switch(orientation) | 53 | switch(orientation) |
52 | { | 54 | { |
53 | case Vertical: | 55 | case Qt::Vertical: |
54 | case VLine: | 56 | case VLine: |
55 | setFrameStyle( QFrame::VLine | QFrame::Sunken ); | 57 | setFrameStyle( Q3Frame::VLine | Q3Frame::Sunken ); |
56 | setMinimumSize(2, 0); | 58 | setMinimumSize(2, 0); |
57 | break; | 59 | break; |
58 | 60 | ||
59 | default: | 61 | default: |
60 | kdWarning() << "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" << endl; | 62 | kdWarning() << "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" << endl; |
61 | 63 | ||
62 | case Horizontal: | 64 | case Qt::Horizontal: |
63 | case HLine: | 65 | case HLine: |
64 | setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 66 | setFrameStyle( Q3Frame::HLine | Q3Frame::Sunken ); |
65 | setMinimumSize(0, 2); | 67 | setMinimumSize(0, 2); |
66 | break; | 68 | break; |
67 | } | 69 | } |
68 | } | 70 | } |
69 | 71 | ||
70 | 72 | ||
71 | 73 | ||
72 | int KSeparator::orientation() const | 74 | int KSeparator::orientation() const |
73 | { | 75 | { |
74 | if ( frameStyle() & VLine ) | 76 | if ( frameStyle() & VLine ) |
75 | return VLine; | 77 | return VLine; |
76 | 78 | ||
77 | if ( frameStyle() & HLine ) | 79 | if ( frameStyle() & HLine ) |
78 | return HLine; | 80 | return HLine; |
79 | 81 | ||
80 | return 0; | 82 | return 0; |
81 | } | 83 | } |
82 | 84 | ||
83 | void KSeparator::drawFrame(QPainter *p) | 85 | void KSeparator::drawFrame(QPainter *p) |
84 | { | 86 | { |
85 | QPointp1, p2; | 87 | QPointp1, p2; |
86 | QRectr = frameRect(); | 88 | QRectr = frameRect(); |
87 | const QColorGroup & g = colorGroup(); | 89 | const QColorGroup & g = colorGroup(); |
88 | 90 | ||
89 | if ( frameStyle() & HLine ) { | 91 | if ( frameStyle() & HLine ) { |
90 | p1 = QPoint( r.x(), r.height()/2 ); | 92 | p1 = QPoint( r.x(), r.height()/2 ); |
91 | p2 = QPoint( r.x()+r.width(), p1.y() ); | 93 | p2 = QPoint( r.x()+r.width(), p1.y() ); |
92 | } | 94 | } |
93 | else { | 95 | else { |
94 | p1 = QPoint( r.x()+r.width()/2, 0 ); | 96 | p1 = QPoint( r.x()+r.width()/2, 0 ); |
95 | p2 = QPoint( p1.x(), r.height() ); | 97 | p2 = QPoint( p1.x(), r.height() ); |
96 | } | 98 | } |
97 | 99 | ||
98 | /*US | 100 | /*US |
99 | QStyleOption opt( lineWidth(), midLineWidth() ); | 101 | QStyleOption opt( lineWidth(), midLineWidth() ); |
100 | style().drawPrimitive( QStyle::PE_Separator, p, QRect( p1, p2 ), g, | 102 | style().drawPrimitive( QStyle::PE_Separator, p, QRect( p1, p2 ), g, |
101 | QStyle::Style_Sunken, opt ); | 103 | QStyle::Style_Sunken, opt ); |
102 | */ | 104 | */ |
103 | //LRstyle().drawSeparator( p, p1.x(), p1.y(), p2.x(), p2.y(), g, true, lineWidth(), midLineWidth()); | 105 | //LRstyle().drawSeparator( p, p1.x(), p1.y(), p2.x(), p2.y(), g, true, lineWidth(), midLineWidth()); |
104 | 106 | ||
105 | } | 107 | } |
106 | 108 | ||
107 | 109 | ||
108 | QSize KSeparator::sizeHint() const | 110 | QSize KSeparator::sizeHint() const |
109 | { | 111 | { |
110 | if ( frameStyle() & VLine ) | 112 | if ( frameStyle() & VLine ) |
111 | return QSize(2, 0); | 113 | return QSize(2, 0); |
112 | 114 | ||
113 | if ( frameStyle() & HLine ) | 115 | if ( frameStyle() & HLine ) |
114 | return QSize(0, 2); | 116 | return QSize(0, 2); |
115 | 117 | ||
116 | return QSize(-1, -1); | 118 | return QSize(-1, -1); |
117 | } | 119 | } |
118 | 120 | ||
119 | void KSeparator::virtual_hook( int, void* ) | 121 | void KSeparator::virtual_hook( int, void* ) |
120 | { /*BASE::virtual_hook( id, data );*/ } | 122 | { /*BASE::virtual_hook( id, data );*/ } |
121 | 123 | ||