• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

  • kdeui
kseparator.cpp
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  */
19 
20 #include <tqstyle.h>
21 
22 #include <kdebug.h>
23 #include <kapplication.h>
24 
25 #include "kseparator.moc"
26 
27 
28 KSeparator::KSeparator(TQWidget* parent, const char* name, WFlags f)
29  : TQFrame(parent, name, f)
30 {
31  setLineWidth(1);
32  setMidLineWidth(0);
33  setOrientation( HLine );
34 }
35 
36 
37 
38 KSeparator::KSeparator(int orientation, TQWidget* parent, const char* name, WFlags f)
39  : TQFrame(parent, name, f)
40 {
41  setLineWidth(1);
42  setMidLineWidth(0);
43  setOrientation( orientation );
44 }
45 
46 
47 
48 void KSeparator::setOrientation(int orientation)
49 {
50  switch(orientation)
51  {
52  case Qt::Vertical:
53  case VLine:
54  setFrameStyle( TQFrame::VLine | TQFrame::Sunken );
55  setMinimumSize(2, 0);
56  break;
57 
58  default:
59  kdWarning() << "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" << endl;
60 
61  case Qt::Horizontal:
62  case HLine:
63  setFrameStyle( TQFrame::HLine | TQFrame::Sunken );
64  setMinimumSize(0, 2);
65  break;
66  }
67 }
68 
69 
70 
71 int KSeparator::orientation() const
72 {
73  if ( frameStyle() & VLine )
74  return VLine;
75 
76  if ( frameStyle() & HLine )
77  return HLine;
78 
79  return 0;
80 }
81 
82 void KSeparator::drawFrame(TQPainter *p)
83 {
84  QPoint p1, p2;
85  QRect r = frameRect();
86  const TQColorGroup & g = colorGroup();
87 
88  if ( frameStyle() & HLine ) {
89  p1 = TQPoint( r.x(), r.height()/2 );
90  p2 = TQPoint( r.x()+r.width(), p1.y() );
91  }
92  else {
93  p1 = TQPoint( r.x()+r.width()/2, 0 );
94  p2 = TQPoint( p1.x(), r.height() );
95  }
96 
97  TQStyleOption opt( lineWidth(), midLineWidth() );
98  style().tqdrawPrimitive( TQStyle::PE_Separator, p, TQRect( p1, p2 ), g,
99  TQStyle::Style_Sunken, opt );
100 }
101 
102 
103 TQSize KSeparator::sizeHint() const
104 {
105  if ( frameStyle() & VLine )
106  return TQSize(2, 0);
107 
108  if ( frameStyle() & HLine )
109  return TQSize(0, 2);
110 
111  return TQSize(-1, -1);
112 }
113 
114 void KSeparator::virtual_hook( int, void* )
115 { /*BASE::virtual_hook( id, data );*/ }
116 
kdWarning
kdbgstream kdWarning(int area=0)
KSeparator::KSeparator
KSeparator(TQWidget *parent=0, const char *name=0, WFlags f=0)
Constructor.
Definition: kseparator.cpp:28
KSeparator::drawFrame
virtual void drawFrame(TQPainter *p)
Definition: kseparator.cpp:82
KSeparator::sizeHint
virtual TQSize sizeHint() const
The recommended height (width) for a horizontal (vertical) separator.
Definition: kseparator.cpp:103
KSeparator::orientation
int orientation() const
Returns the orientation of the separator.
endl
kndbgstream & endl(kndbgstream &s)
KSeparator::setOrientation
void setOrientation(int orient)
Set the orientation of the separator to orient.
Definition: kseparator.cpp:48

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |