• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kate

dockviewbase.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #include "dockviewbase.h"
00020 #include "dockviewbase.moc"
00021 
00022 #include <qlabel.h>
00023 #include <qlayout.h>
00024 
00025 //#include <kdebug.h>
00026 
00027 namespace Kate {
00028 
00029 // data storage
00030 class DockViewBasePrivate {
00031   public:
00032   QWidget *header;
00033   QLabel *lTitle;
00034   QLabel *lPrefix;
00035 };
00036 
00037 }
00038 
00039 Kate::DockViewBase::DockViewBase( QWidget* parent, const char* name )
00040   : QVBox( parent, name ),
00041     d ( new Kate::DockViewBasePrivate )
00042 {
00043   init( QString::null, QString::null );
00044 }
00045 
00046 Kate::DockViewBase::DockViewBase( const QString &prefix, const QString &title, QWidget* parent, const char* name )
00047   : QVBox( parent, name ),
00048     d ( new Kate::DockViewBasePrivate )
00049 {
00050   init( prefix, title );
00051 }
00052 
00053 Kate::DockViewBase::~DockViewBase()
00054 {
00055   delete d;
00056 }
00057 
00058 void Kate::DockViewBase::setTitlePrefix( const QString &prefix )
00059 {
00060     d->lPrefix->setText( prefix );
00061     d->lPrefix->show();
00062 }
00063 
00064 QString Kate::DockViewBase::titlePrefix() const
00065 {
00066   return d->lPrefix->text();
00067 }
00068 
00069 void Kate::DockViewBase::setTitle( const QString &title )
00070 {
00071   d->lTitle->setText( title );
00072   d->lTitle->show();
00073 }
00074 
00075 QString Kate::DockViewBase::title() const
00076 {
00077   return d->lTitle->text();
00078 }
00079 
00080 void Kate::DockViewBase::setTitle( const QString &prefix, const QString &title )
00081 {
00082   setTitlePrefix( prefix );
00083   setTitle( title );
00084 }
00085 
00086 void Kate::DockViewBase::init( const QString &prefix, const QString &title )
00087 {
00088   setSpacing( 4 );
00089   d->header = new QWidget( this );
00090   d->header->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed, true ) );
00091   QHBoxLayout *lo = new QHBoxLayout( d->header );
00092   lo->setSpacing( 6 );
00093   lo->insertSpacing( 0, 6 ); 
00094   d->lPrefix = new QLabel( title, d->header );
00095   lo->addWidget( d->lPrefix );
00096   d->lTitle = new QLabel( title, d->header );
00097   lo->addWidget( d->lTitle );
00098   lo->setStretchFactor( d->lTitle, 1 );
00099   lo->insertSpacing( -1, 6 );
00100   if ( prefix.isEmpty() ) d->lPrefix->hide();
00101   if ( title.isEmpty() ) d->lTitle->hide();
00102 }

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kate
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal