1
/*****************************************************************
3
Copyright (c) 1996-2000 the kicker authors. See file AUTHORS.
5
Permission is hereby granted, free of charge, to any person obtaining a copy
6
of this software and associated documentation files (the "Software"), to deal
7
in the Software without restriction, including without limitation the rights
8
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
copies of the Software, and to permit persons to whom the Software is
10
furnished to do so, subject to the following conditions:
12
The above copyright notice and this permission notice shall be included in
13
all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
******************************************************************/
24
#ifndef __container_applet_h__
25
#define __container_applet_h__
27
#include <kpanelapplet.h>
28
#include <dcopobject.h>
30
#include "appletinfo.h"
31
#include "container_base.h"
40
class AppletContainer : public BaseContainer
45
AppletContainer(const AppletInfo& info, QPopupMenu* opMenu, QWidget* parent = 0);
47
KPanelApplet::Type type() const { return _type; }
48
const AppletInfo& info() const { return _info; }
50
bool isStretch() const { return type() == KPanelApplet::Stretch; }
54
virtual void configure();
55
virtual const QPopupMenu* appletsOwnMenu() const { return 0; }
57
void setWidthForHeightHint(int w) { _widthForHeightHint = w; }
58
void setHeightForWidthHint(int h) { _heightForWidthHint = h; }
64
virtual void slotRemoved();
65
virtual void slotSetPopupDirection(Direction d);
66
virtual void slotSetOrientation(Orientation o);
67
void moveApplet( const QPoint& moveOffset );
69
void showAppletMenu();
70
void slotReconfigure();
71
void activateWindow() { setActiveWindow(); }
74
virtual void doLoadConfiguration( KConfigGroup& );
75
virtual void doSaveConfiguration( KConfigGroup&, bool layoutOnly ) const;
77
virtual QPopupMenu* createOpMenu() const;
79
AppletHandle *_handle;
83
KPanelApplet::Type _type;
84
int _widthForHeightHint, _heightForWidthHint;
85
QString _deskFile, _configFile;
89
class InternalAppletContainer : public AppletContainer
94
InternalAppletContainer(const AppletInfo& info, QPopupMenu* opMenu, QWidget *parent);
95
~InternalAppletContainer();
97
int widthForHeight(int height) const;
98
int heightForWidth(int width) const;
100
virtual bool isValid() { return _valid; }
107
QString appletType() const { return "Applet"; }
108
const QPopupMenu* appletsOwnMenu() const;
110
void setBackground();
113
void slotSetPopupDirection(Direction d);
116
void slotAlignmentChange( Alignment a );
117
void slotDelayedDestruct();
121
KPanelApplet *_applet;
126
class ExternalAppletContainer : public AppletContainer, DCOPObject
131
ExternalAppletContainer(const AppletInfo& info, QPopupMenu* opMenu, QWidget *parent);
132
~ExternalAppletContainer();
134
int widthForHeight(int height) const;
135
int heightForWidth(int width) const;
142
void setBackground();
144
QString appletType() const { return "Applet"; }
146
bool process(const QCString &fun, const QByteArray &data,
147
QCString& replyType, QByteArray &replyData);
149
void slotSetPopupDirection(Direction d);
152
void embeddedWindowDestroyed();
153
void docked(ExternalAppletContainer*);
156
void dockRequest(QCString app, int actions, int type);
159
void slotAlignmentChange( Alignment a );