| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kpanelextension.cpp

    00001 /*****************************************************************
    00002
    00003 Copyright (c) 2000 Matthias Elter
    00004
    00005 Permission is hereby granted, free of charge, to any person obtaining a copy
    00006 of this software and associated documentation files (the "Software"), to deal
    00007 in the Software without restriction, including without limitation the rights
    00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00009 copies of the Software, and to permit persons to whom the Software is
    00010 furnished to do so, subject to the following conditions:
    00011
    00012 The above copyright notice and this permission notice shall be included in
    00013 all copies or substantial portions of the Software.
    00014
    00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    00018 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    00019 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    00020 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00021
    00022 ******************************************************************/
    00023
    00024 #include <kconfig.h>
    00025
    00026 #include "kpanelextension.h"
    00027 #include "kpanelextension.moc"
    00028
    00029 class KPanelExtensionPrivate
    00030 {
    00031 public:
    00032     KPanelExtensionPrivate()
    00033       : _size(KPanelExtension::SizeNormal),
    00034         _customSize(58)
    00035     {}
    00036
    00037     KPanelExtension::Size _size;
    00038     int _customSize;
    00039 };
    00040
    00041 KPanelExtension::KPanelExtension(const QString& configFile, Type type,
    00042                                  int actions, QWidget *parent, const char *name)
    00043   : QFrame(parent, name)
    00044   , _type(type)
    00045   , _position( Top )
    00046   , _alignment( LeftTop )
    00047   , _config(0)
    00048   , _actions(actions)
    00049 {
    00050     d = new KPanelExtensionPrivate;
    00051     setFrameStyle(NoFrame);
    00052     _config = new KConfig(configFile);
    00053 }
    00054
    00055 KPanelExtension::~KPanelExtension()
    00056 {
    00057     delete _config;
    00058     delete d;
    00059 }
    00060
    00061 void KPanelExtension::setPosition( Position p )
    00062 {
    00063   if( _position == p ) return;
    00064   _position = p;
    00065   positionChange( p );
    00066 }
    00067
    00068 void KPanelExtension::setAlignment( Alignment a )
    00069 {
    00070   if( _alignment == a ) return;
    00071   _alignment = a;
    00072   alignmentChange( a );
    00073 }
    00074
    00075 void KPanelExtension::setSize( Size size, int customSize )
    00076 {
    00077   if ( d->_size == size && d->_customSize == customSize ) return;
    00078   d->_size = size;
    00079   d->_customSize = customSize;
    00080   emit updateLayout();
    00081 }
    00082
    00083 void KPanelExtension::action( Action a )
    00084 {
    00085   if ( (a & About) != 0 )
    00086     about();
    00087   if ( (a & Help) != 0 )
    00088     help();
    00089   if ( (a & Preferences) != 0 )
    00090     preferences();
    00091   if ( (a & ReportBug) != 0 )
    00092     reportBug();
    00093 }
    00094
    00095 Qt::Orientation KPanelExtension::orientation()
    00096 {
    00097     if (_position == Left || _position == Right)
    00098         return Vertical;
    00099     else
    00100         return Horizontal;
    00101 }
    00102
    00103 KPanelExtension::Size KPanelExtension::sizeSetting() const
    00104 {
    00105     return d->_size;
    00106 }
    00107
    00108 int KPanelExtension::customSize() const
    00109 {
    00110     return d->_customSize;
    00111 }
    00112
    00113 int KPanelExtension::sizeInPixels() const
    00114 {
    00115   if (d->_size == SizeTiny)
    00116   {
    00117     return 24;
    00118   }
    00119   else if (d->_size == SizeSmall)
    00120   {
    00121     return 30;
    00122   }
    00123   else if (d->_size == SizeNormal)
    00124   {
    00125     return 46;
    00126   }
    00127   else if (d->_size == SizeLarge)
    00128   {
    00129     return 58;
    00130   }
    00131
    00132   return d->_customSize;
    00133 }
    00134
    00135 void KPanelExtension::virtual_hook( int, void* )
    00136 { /*BASE::virtual_hook( id, data );*/ }
    00137

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:57:28 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001