kpanelapplet.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
00261 void requestFocus(bool focus);
00262
00263 protected:
00264
00272 virtual void about() {}
00273
00281 virtual void help() {}
00282
00290 virtual void preferences() {}
00291
00300 virtual void reportBug() {}
00301
00305 Orientation orientation() const;
00309 Position position() const { return _position; }
00313 Alignment alignment() const { return _alignment; }
00314
00320 virtual void positionChange( Position p );
00321
00327 virtual void alignmentChange( Alignment ) {};
00328
00338 void setCustomMenu(const QPopupMenu*);
00339
00347 void watchForFocus(QWidget* widget, bool watch = true);
00348
00355 void needsFocus(bool focus);
00356
00363
00364 virtual KDE_DEPRECATED void orientationChange( Orientation ) {}
00365
00370 Direction popupDirection();
00371
00378
00379 virtual KDE_DEPRECATED void popupDirectionChange( Direction ) {}
00380
00381 bool eventFilter(QObject *, QEvent *);
00382
00383 private:
00384 Type _type;
00385 Position _position;
00386 Alignment _alignment;
00387 KConfig* _config;
00388 int _actions;
00389 protected:
00390 virtual void virtual_hook( int id, void* data );
00391 class KPanelAppletPrivate;
00392 KPanelAppletPrivate *d;
00393 };
00394
00395 #endif
|