summaryrefslogtreecommitdiffstats
path: root/kicker/kicker/core/panelextension.h
blob: 61e6c229ce3a97286dc9d1dc61d0398fb2527aa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*****************************************************************

Copyright (c) 2000 Matthias Elter
              2004 Aaron J. Seigo <aseigo@kde.org>

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 _panelextension_h_
#define _panelextension_h_

#include <kpanelextension.h>
#include <dcopobject.h>

#include "appletinfo.h"

class AppletContainer;
class ContainerArea;
class TQPopupMenu;
class TQGridLayout;

// This is the KPanelExtension responsible for the main kicker panel
// Prior to KDE 3.4 it was the ChildPanelExtension

class PanelExtension : public KPanelExtension, virtual public  DCOPObject
{
    Q_OBJECT
    K_DCOP

public:
    PanelExtension(const TQString& configFile, TQWidget *parent = 0, const char *name = 0);
    virtual ~PanelExtension();

    TQPopupMenu* opMenu();

k_dcop:
    int panelSize() { return sizeInPixels(); }
    int panelOrientation() { return static_cast<int>(orientation()); }
    int panelPosition() { return static_cast<int>(position()); }

    void setPanelSize(int size);
    void addKMenuButton();
    void addDesktopButton();
    void addWindowListButton();
    void addURLButton(const TQString &url);
    void addBrowserButton(const TQString &startDir);
    void addServiceButton(const TQString &desktopEntry);
    void addServiceMenuButton(const TQString &name, const TQString& relPath);
    void addNonKDEAppButton(const TQString &filePath, const TQString &icon,
                            const TQString &cmdLine, bool inTerm);
    void addNonKDEAppButton(const TQString &title, const TQString &description,
                            const TQString &filePath, const TQString &icon,
                            const TQString &cmdLine, bool inTerm);

    void addApplet(const TQString &desktopFile);
    void addAppletContainer(const TQString &desktopFile); // KDE4: remove, useless

    bool insertApplet(const TQString& desktopFile, int index);
    bool insertImmutableApplet(const TQString& desktopFile, int index);
    TQStringList listApplets();
    bool removeApplet(int index);

    void restart(); // KDE4: remove, moved to Kicker
    void configure(); // KDE4: remove, moved to Kikcker

public:
    TQSize tqsizeHint(Position, TQSize maxSize) const;
    Position preferedPosition() const { return Bottom; }
    bool eventFilter( TQObject *, TQEvent * );

protected:
    void positionChange(Position);

    ContainerArea    *_containerArea;

protected slots:
    void configurationChanged();
    void immutabilityChanged(bool);
    void slotBuildOpMenu();
    void showConfig();
    void showProcessManager();
    virtual void populateContainerArea();

private:
    TQPopupMenu* _opMnu;
    TQPopupMenu* m_panelAddMenu;
    TQPopupMenu* m_removeMnu;
    TQPopupMenu* m_addExtensionMenu;
    TQPopupMenu* m_removeExtensionMenu;
    TQString _configFile;
    bool m_opMenuBuilt;
};

class MenubarExtension : public PanelExtension
{
    Q_OBJECT

    public:
        MenubarExtension(const AppletInfo& info);
        virtual ~MenubarExtension();

    protected slots:
        virtual void populateContainerArea();

    private:
        MenubarExtension();

        AppletContainer* m_menubar;
};

#endif