kdeui Library API Documentation

kpanelapplet.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 __kpanelapplet_h__
00025 #define __kpanelapplet_h__
00026 
00027 class KConfig;
00028 class QPopupMenu;
00029 
00030 #include <qframe.h>
00031 #include <kconfig.h>
00032 
00097 class KDEUI_EXPORT KPanelApplet : public QFrame
00098 {
00099     Q_OBJECT
00100 
00101 public:
00102 
00106     enum Type { Normal = 0, Stretch };
00111     // KDE4: Merge these with KPanelExtension's enums
00112     enum Action { About = 1, Help = 2, Preferences = 4, ReportBug = 8 };
00113     enum Position { pLeft = 0, pRight, pTop, pBottom };
00114     enum Alignment { LeftTop = 0, Center, RightBottom };
00115     enum Direction { Up = 0, Down, Left, Right };
00116 
00127     KPanelApplet(const QString& configFile, Type t = Normal,
00128                  int actions = 0, QWidget *parent = 0, const char *name = 0,
00129                  WFlags f = 0);
00130 
00134     ~KPanelApplet();
00135 
00155     virtual int widthForHeight(int height) const { return height; }
00156 
00176     virtual int heightForWidth(int width) const { return width; }
00177 
00187     KConfig* config() const { return _config; }
00188     KSharedConfig::Ptr sharedConfig() const;
00189 
00194     Type type() const { return _type; }
00195 
00200     int actions() const { return _actions; }
00201 
00212     virtual void action( Action a );
00213 
00218     const QPopupMenu* customMenu() const;
00219 
00223     void setPosition( Position p );
00227     void setAlignment( Alignment a );
00228 
00229 signals:
00244     void updateLayout();
00245 
00250     void requestFocus();
00251 
00252 
00253 protected:
00254 
00262     virtual void about() {}
00263 
00271     virtual void help() {}
00272 
00280     virtual void preferences() {}
00281 
00290    virtual void reportBug() {}
00291 
00295     Orientation orientation() const;
00299     Position position() const { return _position; }
00303     Alignment alignment() const { return _alignment; }
00304 
00310     virtual void positionChange( Position p );
00311 
00317     virtual void alignmentChange( Alignment /*a*/ ) {};
00318 
00328     void setCustomMenu(const QPopupMenu*);
00329 
00330 
00337     // FIXME: Remove for KDE 4
00338     virtual KDE_DEPRECATED void orientationChange( Orientation /* orientation*/) {}
00339 
00344     Direction popupDirection();
00345 
00352     // FIXME: Remove for KDE 4
00353     virtual KDE_DEPRECATED void popupDirectionChange( Direction /*direction*/ ) {}
00354 
00355 
00356 private:
00357     Type         _type;
00358     Position     _position;
00359     Alignment    _alignment;
00360     KConfig*     _config;
00361     int          _actions;
00362 protected:
00363     virtual void virtual_hook( int id, void* data );
00364     class KPanelAppletPrivate;
00365     KPanelAppletPrivate *d;
00366 };
00367 
00368 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:12:01 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003