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