~ubuntu-branches/ubuntu/warty/kdebase/warty

« back to all changes in this revision

Viewing changes to kicker/core/container_applet.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-09-16 04:51:45 UTC
  • Revision ID: james.westby@ubuntu.com-20040916045145-9vr63kith3k1cpza
Tags: upstream-3.2.2
ImportĀ upstreamĀ versionĀ 3.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************
 
2
 
 
3
Copyright (c) 1996-2000 the kicker authors. See file AUTHORS.
 
4
 
 
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:
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
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.
 
21
 
 
22
******************************************************************/
 
23
 
 
24
#ifndef __container_applet_h__
 
25
#define __container_applet_h__
 
26
 
 
27
#include <kpanelapplet.h>
 
28
#include <dcopobject.h>
 
29
 
 
30
#include "appletinfo.h"
 
31
#include "container_base.h"
 
32
 
 
33
class QHBox;
 
34
class QXEmbed;
 
35
class QBoxLayout;
 
36
class KConfig;
 
37
 
 
38
class AppletHandle;
 
39
 
 
40
class AppletContainer : public BaseContainer
 
41
{
 
42
    Q_OBJECT
 
43
 
 
44
public:
 
45
    AppletContainer(const AppletInfo& info, QPopupMenu* opMenu, QWidget* parent = 0);
 
46
 
 
47
    KPanelApplet::Type type() const { return _type; }
 
48
    const AppletInfo& info() const { return _info; }
 
49
 
 
50
    bool isStretch() const { return type() ==  KPanelApplet::Stretch; }
 
51
 
 
52
    void resetLayout();
 
53
 
 
54
    virtual void configure();
 
55
    virtual const QPopupMenu* appletsOwnMenu() const { return 0; }
 
56
 
 
57
    void setWidthForHeightHint(int w) { _widthForHeightHint = w; }
 
58
    void setHeightForWidthHint(int h) { _heightForWidthHint = h; }
 
59
 
 
60
signals:
 
61
    void updateLayout();
 
62
 
 
63
public slots:
 
64
    virtual void slotRemoved();
 
65
    virtual void slotSetPopupDirection(Direction d);
 
66
    virtual void slotSetOrientation(Orientation o);
 
67
    void moveApplet( const QPoint& moveOffset );
 
68
    void removeApplet();
 
69
    void showAppletMenu();
 
70
    void slotReconfigure();
 
71
    void activateWindow() { setActiveWindow(); }
 
72
 
 
73
protected:
 
74
    virtual void doLoadConfiguration( KConfigGroup& );
 
75
    virtual void doSaveConfiguration( KConfigGroup&, bool layoutOnly ) const;
 
76
 
 
77
    virtual QPopupMenu* createOpMenu() const;
 
78
 
 
79
    AppletHandle      *_handle;
 
80
    AppletInfo         _info;
 
81
    QHBox             *_appletframe;
 
82
    QBoxLayout        *_layout;
 
83
    KPanelApplet::Type _type;
 
84
    int                _widthForHeightHint, _heightForWidthHint;
 
85
    QString            _deskFile, _configFile;
 
86
    bool               _firstuse;
 
87
};
 
88
 
 
89
class InternalAppletContainer : public AppletContainer
 
90
{
 
91
    Q_OBJECT
 
92
 
 
93
public:
 
94
    InternalAppletContainer(const AppletInfo& info, QPopupMenu* opMenu, QWidget *parent);
 
95
    ~InternalAppletContainer();
 
96
 
 
97
    int widthForHeight(int height) const;
 
98
    int heightForWidth(int width)  const;
 
99
 
 
100
    virtual bool isValid() { return _valid; }
 
101
 
 
102
    void about();
 
103
    void help();
 
104
    void preferences();
 
105
    void reportBug();
 
106
 
 
107
    QString appletType() const { return "Applet"; }
 
108
    const QPopupMenu* appletsOwnMenu() const;
 
109
 
 
110
    void setBackground();
 
111
 
 
112
public slots:
 
113
    void slotSetPopupDirection(Direction d);
 
114
 
 
115
private slots:
 
116
    void slotAlignmentChange( Alignment a );
 
117
    void slotDelayedDestruct();
 
118
 
 
119
private:
 
120
    QCString      _id;
 
121
    KPanelApplet *_applet;
 
122
    bool          _valid;
 
123
};
 
124
 
 
125
 
 
126
class ExternalAppletContainer : public AppletContainer, DCOPObject
 
127
{
 
128
    Q_OBJECT
 
129
 
 
130
public:
 
131
    ExternalAppletContainer(const AppletInfo& info, QPopupMenu* opMenu, QWidget *parent);
 
132
    ~ExternalAppletContainer();
 
133
 
 
134
    int widthForHeight(int height) const;
 
135
    int heightForWidth(int width)  const;
 
136
 
 
137
    void about();
 
138
    void help();
 
139
    void preferences();
 
140
    void reportBug();
 
141
 
 
142
    void setBackground(); 
 
143
 
 
144
    QString appletType() const { return "Applet"; }
 
145
 
 
146
    bool process(const QCString &fun, const QByteArray &data,
 
147
                 QCString& replyType, QByteArray &replyData);
 
148
public slots:
 
149
    void slotSetPopupDirection(Direction d);
 
150
 
 
151
signals:
 
152
    void embeddedWindowDestroyed();
 
153
    void docked(ExternalAppletContainer*);
 
154
 
 
155
protected:
 
156
    void dockRequest(QCString app, int actions, int type);
 
157
 
 
158
private slots:
 
159
    void slotAlignmentChange( Alignment a );
 
160
 
 
161
private:
 
162
    QXEmbed  *_embed;
 
163
    QCString  _app;
 
164
    bool      _isdocked;
 
165
};
 
166
 
 
167
 
 
168
#endif
 
169