kpanelextension.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 __kpanelextension_h__
#define __kpanelextension_h__
class QPopupMenu;
class KConfig;
class KPanelExtensionPrivate;
#include <qframe.h>
#include <kdelibs_export.h>
class KDEUI_EXPORT KPanelExtension : public QFrame
{
Q_OBJECT
public:
enum Type { Normal = 0, Stretch };
// KDE4: Merge these with KPanelApplet's enums
enum Action { About = 1, Help = 2, Preferences = 4, ReportBug = 8 };
enum Position { Left = 0, Right, Top, Bottom, Floating };
enum Alignment { LeftTop = 0, Center, RightBottom };
enum Size { SizeTiny = 0, SizeSmall, SizeNormal, SizeLarge, SizeCustom };
KPanelExtension(const QString& configFile, Type t = Normal,
int actions = 0, QWidget *parent = 0, const char *name = 0);
~KPanelExtension();
virtual QSize sizeHint(Position /*p*/, QSize maxsize) const { return maxsize; }
KConfig* config() const { return _config; }
Type type() const { return _type; }
int actions() const { return _actions; }
virtual void action( Action a );
virtual Position preferedPosition() const { return Bottom; }
void setPosition( Position p );
void setAlignment( Alignment a );
void setSize( Size size, int customSize );
Size sizeSetting() const;
int customSize() const;
QPopupMenu* customMenu() const;
bool reserveStrut() const;
signals:
void updateLayout();
void maintainFocus(bool);
protected:
virtual void about() {}
virtual void help() {}
virtual void preferences() {}
virtual void reportBug() {}
Position position() const { return _position; }
Alignment alignment() const { return _alignment; }
Orientation orientation();
int sizeInPixels() const;
virtual void positionChange( Position ) {}
virtual void alignmentChange( Alignment ) {}
void setCustomMenu(QPopupMenu*);
void setReserveStrut(bool shouldUseStrut);
private:
Type _type;
Position _position;
Alignment _alignment;
KConfig* _config;
int _actions;
protected:
virtual void virtual_hook( int id, void* data );
private:
KPanelExtensionPrivate *d;
};
#endif
KPanelExtension::config
KConfig * config() const
Always use this KConfig object to save/load your extensions configuration.
Definition: kpanelextension.h:151
KPanelExtension::Type
Type
The type of the extension (TODO)
Definition: kpanelextension.h:105
KPanelExtension::preferences
virtual void preferences()
Is called when the user selects "Preferences" from the extensions RMB menu.
Definition: kpanelextension.h:268
KPanelExtension::reportBug
virtual void reportBug()
Is called when the user selects "Report bug" from the applet's RMB menu.
Definition: kpanelextension.h:278
KPanelExtension
KDE Panel Extension class
Definition: kpanelextension.h:98
KPanelExtension::Action
Action
An action to be taken sometime.
Definition: kpanelextension.h:108
KPanelExtension::preferedPosition
virtual Position preferedPosition() const
Reimplement this function to set a preferred dock position for your extension.
Definition: kpanelextension.h:184
KPanelExtension::about
virtual void about()
Is called when the user selects "About" from the extensions RMB menu.
Definition: kpanelextension.h:250
KPanelExtension::positionChange
virtual void positionChange(Position)
This extension has changed its position.
Definition: kpanelextension.h:306
KPanelExtension::type
Type type() const
Definition: kpanelextension.h:157
KPanelExtension::sizeHint
virtual QSize sizeHint(Position, QSize maxsize) const
Returns the preferred size for a given Position.
Definition: kpanelextension.h:140
KConfig
KPanelExtension::Size
Size
Definition: kpanelextension.h:112
KPanelExtension::position
Position position() const
Definition: kpanelextension.h:283
KPanelExtension::alignmentChange
virtual void alignmentChange(Alignment)
This extension has changed its alignment.
Definition: kpanelextension.h:313
KPanelExtension::actions
int actions() const
Definition: kpanelextension.h:163
KPanelExtension::alignment
Alignment alignment() const
Definition: kpanelextension.h:288
KPanelExtension::help
virtual void help()
Is called when the user selects "Help" from the extensions RMB menu.
Definition: kpanelextension.h:259

KDE Home | KDE Accessibility Home | Description of Access Keys