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 <kdemacros.h>
00032 #include <kconfig.h>
00033 
00099 class KPanelApplet : public QFrame
00100 {
00101     Q_OBJECT
00102 
00103 public:
00104 
00108     enum Type { Normal = 0, Stretch };
00113     enum Action { About = 1, Help = 2, Preferences = 4, ReportBug = 8 };
00114     // FIXME: Remove 'p' from element names for KDE 4.
00115     enum Position { pLeft = 0, pRight, pTop, pBottom };
00116     enum Alignment { LeftTop = 0, Center, RightBottom };
00117     // FIXME: Remove for KDE 4.
00118     enum Direction { Up = 0, Down, Left, Right };
00119 
00130     KPanelApplet(const QString& configFile, Type t = Normal,
00131                  int actions = 0, QWidget *parent = 0, const char *name = 0,
00132                  WFlags f = 0);
00133 
00137     ~KPanelApplet();
00138 
00158     virtual int widthForHeight(int height) const { return height; }
00159 
00179     virtual int heightForWidth(int width) const { return width; }
00180 
00190     KConfig* config() const { return _config; }
00191     KSharedConfig::Ptr sharedConfig() const;
00192 
00197     Type type() const { return _type; }
00198 
00203     int actions() const { return _actions; }
00204 
00215     virtual void action( Action a );
00216 
00221     const QPopupMenu* customMenu() const;
00222 
00226     void setPosition( Position p );
00230     void setAlignment( Alignment a );
00231 
00232 signals:
00247     void updateLayout();
00248 
00252     void requestFocus();
00253 
00254 protected:
00255 
00263     virtual void about() {}
00264 
00272     virtual void help() {}
00273 
00281     virtual void preferences() {}
00282 
00291    virtual void reportBug() {}
00292 
00296     Orientation orientation() const;
00300     Position position() const { return _position; }
00304     Alignment alignment() const { return _alignment; }
00305 
00311     virtual void positionChange( Position p );
00312 
00318     virtual void alignmentChange( Alignment /*a*/ ) {};
00319 
00329     void setCustomMenu(const QPopupMenu*);
00330 
00337     // FIXME: Remove for KDE 4
00338     virtual KDE_DEPRECATED void orientationChange( Orientation /* orientation*/) {}
00339 
00347     // FIXME: Remove for KDE 4
00348     Direction popupDirection() KDE_DEPRECATED;
00349 
00356     // FIXME: Remove for KDE 4
00357     virtual KDE_DEPRECATED void popupDirectionChange( Direction /*direction*/ ) {}
00358 
00359 private:
00360     Type         _type;
00361     Position     _position;
00362     Alignment    _alignment;
00363     KConfig*     _config;
00364     int          _actions;
00365 protected:
00366     virtual void virtual_hook( int id, void* data );
00367     class KPanelAppletPrivate;
00368     KPanelAppletPrivate *d;
00369 };
00370 
00371 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 22 14:23:28 2004 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2003