summaryrefslogtreecommitdiffstats
path: root/kdcop/kdcoplistview.h
blob: b104e95cfa88210206be602bd0ca822f678ffcce (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
128
129
130
131
132
133
/*
 * Copyright (C) 2000 by Ian Reinhart Geiser <geiseri@kde.org>
 *
 * Licensed under the Artistic License.
 */

#ifndef __KDCOPLISTVIEW_H__
#define __KDCOPLISTVIEW_H__


#include <klistview.h>
class TQDragObject;

class KDCOPListView : public KListView
{
  Q_OBJECT

  public:
  	KDCOPListView ( TQWidget * parent = 0, const char * name = 0 );
	virtual ~KDCOPListView();
  	TQDragObject *dragObject();
	void setMode(const TQString &mode);
	TQString getCurrentCode() const;

  private:
  	TQString encode(TQListViewItem *code);
	TQString mode;

};

class DCOPBrowserItem : public QListViewItem
{
  public:

    enum Type { Application, Interface, Function };

    DCOPBrowserItem(TQListView * parent, Type type);
    DCOPBrowserItem(TQListViewItem * parent, Type type);

    virtual ~DCOPBrowserItem() {}

    Type type() const;

  private:

    Type type_;
};

class DCOPBrowserApplicationItem : public TQObject, public DCOPBrowserItem
{
 Q_OBJECT
  public:

    DCOPBrowserApplicationItem(TQListView * parent, const TQCString & app);
    virtual ~DCOPBrowserApplicationItem() {}

    TQCString app() const { return app_; }

    virtual void setOpen(bool o);

  protected:

    virtual void populate();

  private:

    TQCString app_;
  private slots:
  /**
   * Theses two slots are used to get the icon of the application
   */
    void retreiveIcon(int callId, const TQCString& replyType, const TQByteArray &replyData);
	void slotGotWindowName(int callId, const TQCString& replyType, const TQByteArray &replyData);
};

class DCOPBrowserInterfaceItem : public TQObject, public DCOPBrowserItem
{
  public:

    DCOPBrowserInterfaceItem
    (
     DCOPBrowserApplicationItem * parent,
     const TQCString & app,
     const TQCString & object,
     bool def
    );

    virtual ~DCOPBrowserInterfaceItem() {}

    TQCString app() const { return app_; }
    TQCString object() const { return object_; }

    virtual void setOpen(bool o);

  protected:

    virtual void populate();

  private:

    TQCString app_;
    TQCString object_;
};


class DCOPBrowserFunctionItem : public DCOPBrowserItem
{
  public:

    DCOPBrowserFunctionItem
    (
     DCOPBrowserInterfaceItem * parent,
     const TQCString & app,
     const TQCString & object,
     const TQCString & function
    );

    virtual ~DCOPBrowserFunctionItem() {}

    TQCString app() const { return app_; }
    TQCString object() const { return object_; }
    TQCString function() const { return function_; }

    virtual void setOpen(bool o);

  private:

    TQCString app_;
    TQCString object_;
    TQCString function_;
};

#endif