kdeui Library API Documentation

kpanelextension.h

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 #ifndef __kpanelextension_h__
00025 #define __kpanelextension_h__
00026 
00027 class QPopupMenu;
00028 class KConfig;
00029 class KPanelExtensionPrivate;
00030 
00031 #include <qframe.h>
00032 
00033 #include <kdelibs_export.h>
00034 
00098 class KDEUI_EXPORT KPanelExtension : public QFrame
00099 {
00100     Q_OBJECT
00101 
00102 public:
00103 
00105     enum Type { Normal = 0, Stretch };
00106     // KDE4: Merge these with KPanelApplet's enums
00107     enum Action { About = 1, Help = 2, Preferences = 4, ReportBug = 8 };
00108     enum Position { Left = 0, Right, Top, Bottom, Floating };
00109     enum Alignment { LeftTop = 0, Center, RightBottom };
00111     enum Size { SizeTiny = 0, SizeSmall, SizeNormal, SizeLarge, SizeCustom };
00112 
00122     KPanelExtension(const QString& configFile, Type t = Normal,
00123          int actions = 0, QWidget *parent = 0, const char *name = 0);
00124 
00128     ~KPanelExtension();
00129 
00139     virtual QSize sizeHint(Position /*p*/, QSize maxsize) const { return maxsize; }
00140 
00150     KConfig* config() const { return _config; }
00151 
00156     Type type() const { return _type; }
00157 
00162     int actions() const { return _actions; }
00163 
00174     virtual void action( Action a );
00175 
00176 
00183     virtual Position preferedPosition() const { return Bottom; }
00184 
00188     void setPosition( Position p );
00192     void setAlignment( Alignment a );
00197     void setSize( Size size, int customSize );
00198 
00203     Size sizeSetting() const;
00204 
00209     int customSize() const;
00210 
00216     QPopupMenu* customMenu() const;
00217 
00224     bool reserveStrut() const;
00225 
00226 signals:
00232     void updateLayout();
00233 
00238     void maintainFocus(bool);
00239 
00240 protected:
00241 
00249     virtual void about() {}
00250 
00258     virtual void help() {}
00259 
00267     virtual void preferences() {}
00268 
00277     virtual void reportBug() {}
00278 
00282     Position position() const { return _position; }
00283 
00287     Alignment alignment() const { return _alignment; }
00288 
00292     Orientation orientation();
00293 
00298     int sizeInPixels() const;
00299 
00305     virtual void positionChange( Position ) {};
00306 
00312     virtual void alignmentChange( Alignment ) {};
00313 
00324     void setCustomMenu(QPopupMenu*);
00325 
00331     void setReserveStrut(bool shouldUseStrut);
00332 
00333 private:
00334     Type                _type;
00335     Position            _position;
00336     Alignment           _alignment;
00337     KConfig*            _config;
00338     int                 _actions;
00339 protected:
00340     virtual void virtual_hook( int id, void* data );
00341 private:
00342     KPanelExtensionPrivate     *d;
00343 };
00344 
00345 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Jul 20 12:32:00 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003