# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kpanelapplet.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 <kapp.h>
    00025 #include <kconfig.h>
    00026
    00027 #include "kpanelapplet.h"
    00028 #include "kpanelapplet.moc"
    00029
    00030 KPanelApplet::KPanelApplet(const QString& configFile, Type type,
    00031                            int actions, QWidget *parent, const char *name, WFlags f)
    00032   : QFrame(parent, name, f)
    00033   , _type(type)
    00034   , _position( pBottom )
    00035   , _alignment( LeftTop )
    00036   , _config(0)
    00037   , _actions(actions)
    00038 {
    00039   setFrameStyle(NoFrame);
    00040   QPalette pal(palette());
    00041   if(pal.active().mid() != pal.inactive().mid()){
    00042     pal.setInactive(pal.active());
    00043     setPalette(pal);
    00044   }
    00045
    00046   _config = new KConfig(configFile, kapp && kapp->config()->isImmutable());
    00047 }
    00048
    00049 KPanelApplet::~KPanelApplet()
    00050 {
    00051   delete _config;
    00052 }
    00053
    00054 void KPanelApplet::setPosition( Position p )
    00055 {
    00056   if( _position == p ) return;
    00057   _position = p;
    00058   positionChange( p );
    00059 }
    00060
    00061 void KPanelApplet::setAlignment( Alignment a )
    00062 {
    00063   if( _alignment == a ) return;
    00064   _alignment = a;
    00065   alignmentChange( a );
    00066 }
    00067
    00068 // FIXME: Remove implementation for KDE 4
    00069 void KPanelApplet::positionChange( Position )
    00070 {
    00071   orientationChange( orientation() );
    00072   QResizeEvent e( size(), size() );
    00073   resizeEvent( &e );
    00074   popupDirectionChange( popupDirection() );
    00075 }
    00076
    00077 Qt::Orientation KPanelApplet::orientation() const
    00078 {
    00079   if( _position == pTop || _position == pBottom ) {
    00080     return Horizontal;
    00081   } else {
    00082     return Vertical;
    00083   }
    00084 }
    00085
    00086 // FIXME: Remove for KDE 4
    00087 KPanelApplet::Direction KPanelApplet::popupDirection()
    00088 {
    00089     switch( _position ) {
    00090     case pTop:     return Down;
    00091     case pRight:   return Left;
    00092     case pLeft:    return Right;
    00093     default:
    00094     case pBottom:  return Up;
    00095     }
    00096 }
    00097
    00098 void KPanelApplet::action( Action a )
    00099 {
    00100     if ( (a & About) != 0 )
    00101         about();
    00102     if ( (a & Help) != 0 )
    00103         help();
    00104     if ( (a & Preferences) != 0 )
    00105         preferences();
    00106     if ( (a & ReportBug) != 0 )
    00107     reportBug();
    00108 }
    00109
    00110 void KPanelApplet::virtual_hook( int, void* )
    00111 { /*BASE::virtual_hook( id, data );*/ }
    00112

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:26 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001