kmail

snippetitem.h
1/***************************************************************************
2 * snippet feature from tdevelop/plugins/snippet/ *
3 * *
4 * Copyright (C) 2007 by Robert Gruber *
5 * rgruber@users.sourceforge.net *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 ***************************************************************************/
13
14#ifndef SNIPPETITEM_H
15#define SNIPPETITEM_H
16
17#include <tdelistview.h>
18#include <tdelocale.h>
19
20#include <tqobject.h>
21
22class TQString;
23class TDEAction;
24class SnippetGroup;
25
26
32class SnippetItem : public TQObject, public TQListViewItem {
33friend class SnippetGroup;
34
35 TQ_OBJECT
36
37public:
38 SnippetItem(TQListViewItem * parent, TQString name, TQString text);
39
41 TQString getName();
42 TQString getText();
43 using TQListViewItem::parent;
44 int getParent() { return iParent; }
45 void resetParent();
46 void setText(TQString text);
47 void setName(TQString name);
48 void setAction( TDEAction* );
49 TDEAction* getAction();
50 static SnippetItem * findItemByName(TQString name, TQPtrList<SnippetItem> &list);
51 static SnippetGroup * findGroupById(int id, TQPtrList<SnippetItem> &list);
52signals:
53 void execute( TQListViewItem * );
54public slots:
55 void slotExecute();
56
57private:
58 SnippetItem(TQListView * parent, TQString name, TQString text);
59 TQString strName;
60 TQString strText;
61 int iParent;
62 TDEAction *action;
63};
64
71class SnippetGroup : public SnippetItem {
72public:
73 SnippetGroup(TQListView * parent, TQString name, int id);
75
76 int getId() { return iId; }
77 static int getMaxId() { return iMaxId; }
78
79 void setId(int id);
80
81private:
82 static int iMaxId;
83 int iId;
84};
85
86#endif
This class represents one group in the listview.
Definition: snippetitem.h:71
This class represents one CodeSnippet-Item in the listview.
Definition: snippetitem.h:32