kpanelapplet.h
/*****************************************************************
Copyright (c) 2000 Matthias Elter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#ifndef __kpanelapplet_h__
#define __kpanelapplet_h__
class KConfig;
class QPopupMenu;
#include <qframe.h>
#include <kconfig.h>
class KDEUI_EXPORT KPanelApplet : public QFrame
{
Q_OBJECT
public:
enum Type { Normal = 0, Stretch };
// KDE4: Merge these with KPanelExtension's enums
enum Action { About = 1, Help = 2, Preferences = 4, ReportBug = 8 };
enum Position { pLeft = 0, pRight, pTop, pBottom };
enum Alignment { LeftTop = 0, Center, RightBottom };
enum Direction { Up = 0, Down, Left, Right };
KPanelApplet(const QString& configFile, Type t = Normal,
int actions = 0, QWidget *parent = 0, const char *name = 0,
WFlags f = 0);
~KPanelApplet();
virtual int widthForHeight(int height) const { return height; }
virtual int heightForWidth(int width) const { return width; }
KConfig* config() const { return _config; }
KSharedConfig::Ptr sharedConfig() const;
Type type() const { return _type; }
int actions() const { return _actions; }
virtual void action( Action a );
const QPopupMenu* customMenu() const;
void setPosition( Position p );
void setAlignment( Alignment a );
signals:
void updateLayout();
void requestFocus();
void requestFocus(bool focus);
protected:
virtual void about() {}
virtual void help() {}
virtual void preferences() {}
virtual void reportBug() {}
Orientation orientation() const;
Position position() const { return _position; }
Alignment alignment() const { return _alignment; }
virtual void positionChange( Position p );
virtual void alignmentChange( Alignment /*a*/ ) {}
void setCustomMenu(const QPopupMenu*);
void watchForFocus(QWidget* widget, bool watch = true);
void needsFocus(bool focus);
// FIXME: Remove for KDE 4
virtual KDE_DEPRECATED void orientationChange( Orientation /* orientation*/) {}
Direction popupDirection();
// FIXME: Remove for KDE 4
virtual KDE_DEPRECATED void popupDirectionChange( Direction /*direction*/ ) {}
bool eventFilter(QObject *, QEvent *);
private:
Type _type;
Position _position;
Alignment _alignment;
KConfig* _config;
int _actions;
protected:
virtual void virtual_hook( int id, void* data );
class KPanelAppletPrivate;
KPanelAppletPrivate *d;
};
#endif
KPanelApplet::help
virtual void help()
Is called when the user selects "Help" from the applet's RMB menu.
Definition: kpanelapplet.h:281
KPanelApplet::config
KConfig * config() const
Always use this KConfig object to save/load your applet's configuration.
Definition: kpanelapplet.h:187
KPanelApplet::orientationChange
virtual KDE_DEPRECATED void orientationChange(Orientation)
The orientation changed to orientation.
Definition: kpanelapplet.h:364
KPanelApplet::position
Position position() const
Definition: kpanelapplet.h:309
KPanelApplet::about
virtual void about()
Is called when the user selects "About" from the applet's RMB menu.
Definition: kpanelapplet.h:272
KPanelApplet::widthForHeight
virtual int widthForHeight(int height) const
Returns a suggested width for a given height.
Definition: kpanelapplet.h:155
KPanelApplet
KDE Panel Applet class
Definition: kpanelapplet.h:97
KPanelApplet::alignmentChange
virtual void alignmentChange(Alignment)
The panel on which this applet resides has changed its alignment.
Definition: kpanelapplet.h:327
KPanelApplet::Type
Type
This enum describes the type of the applet.
Definition: kpanelapplet.h:106
KPanelApplet::actions
int actions() const
Definition: kpanelapplet.h:200
KPanelApplet::Action
Action
This enum holds flags which can be ORed together to describe which items the context menu over the ap...
Definition: kpanelapplet.h:112
KPanelApplet::preferences
virtual void preferences()
Is called when the user selects "Preferences" from the applet's RMB menu.
Definition: kpanelapplet.h:290
KPanelApplet::type
Type type() const
Definition: kpanelapplet.h:194
KPanelApplet::reportBug
virtual void reportBug()
Is called when the user selects "Report bug" from the applet's RMB menu.
Definition: kpanelapplet.h:300
KConfig
KPanelApplet::popupDirectionChange
virtual KDE_DEPRECATED void popupDirectionChange(Direction)
The popup direction changed to direction.
Definition: kpanelapplet.h:379
KPanelApplet::heightForWidth
virtual int heightForWidth(int width) const
Definition: kpanelapplet.h:176
KPanelApplet::alignment
Alignment alignment() const
Definition: kpanelapplet.h:313

KDE Home | KDE Accessibility Home | Description of Access Keys