summaryrefslogtreecommitdiffstats
path: root/kicker/applets/swallow/swallow.h
blob: 8bacc79f3d430fd4d8dcd6794db7cdefc3d4a482 (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
/*
 *  Copyright (c) 2000 Matthias Hölzer-Klüpfel <hoelzer@kde.org>
                  2000 Carsten Pfeiffer <pfeiffer@kde.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 */

#ifndef __swallow_h__
#define __swallow_h__


#include <tqevent.h>
#include <tqptrlist.h>
#include <qxembed.h>

#include <kpanelapplet.h>

class TQBoxLayout;
class TDEConfig;
class TDEProcess;
class KWinModule;

class SwallowApp;

typedef struct _SwallowCommand {
    TQString cmdline;
    TQString title;
} SwallowCommand;

typedef TQPtrList<SwallowCommand> SwallowCommandList;
typedef TQPtrListIterator<SwallowCommand> SwallowCommandListIterator;
typedef TQPtrList<SwallowApp> SwallowAppList;

class SwallowApplet : public KPanelApplet
{
    TQ_OBJECT

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

    // returns 0L if we don't have a SwallowApplet object yet,
    // but who cares
    static KWinModule * winModule() { return wModule; }
    static void removeApplet( SwallowApp * );

public: // for KPanelApplet
    int widthForHeight( int w );
    int heightForWidth( int h );

    void windowAdded(WId win);
    void processExited(TDEProcess *proc);

public slots:
    virtual void preferences();

private slots:
    void embedded( SwallowApp * );

private:
    void layoutApps();
    SwallowCommandList* readConfig();
    void createApps( SwallowCommandList * );


    static SwallowApplet *self;
    static SwallowAppList *appList;
    static SwallowAppList *embeddedList;
    static KWinModule *wModule;

    SwallowCommandList * m_swcList;
    TQBoxLayout *m_layout;

};


class SwallowApp : public QXEmbed
{
    TQ_OBJECT
	
public:
    SwallowApp( const SwallowCommand * swc, TQWidget* parent = 0,
		const char* name = 0);
    ~SwallowApp();

    float sizeRatio() const { return wh_ratio; }

signals:
    void embedded( SwallowApp * );

protected slots:
    void windowAdded(WId win);
    void processExited(TDEProcess *proc);

private:
    TDEProcess   	*process;
    TQString  	winTitle;
    float 	wh_ratio;

};

#endif // __swallow_h__