1 #ifndef _KVI_KVS_TREENODE_SPECIALCOMMANDDEFPOPUP_H_
2 #define _KVI_KVS_TREENODE_SPECIALCOMMANDDEFPOPUP_H_
3 //=============================================================================
4 //
5 //   File : KviKvsTreeNodeSpecialCommandDefpopup.h
6 //   Creation date : Fri 02 Jan 2004 13:54:00 by Szymon Stefanek
7 //
8 //   This file is part of the KVIrc IRC client distribution
9 //   Copyright (C) 2004-2010 Szymon Stefanek <pragma at kvirc dot net>
10 //
11 //   This program is FREE software. You can redistribute it and/or
12 //   modify it under the terms of the GNU General Public License
13 //   as published by the Free Software Foundation; either version 2
14 //   of the License, or (at your option) any later version.
15 //
16 //   This program is distributed in the HOPE that it will be USEFUL,
17 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 //   See the GNU General Public License for more details.
20 //
21 //   You should have received a copy of the GNU General Public License
22 //   along with this program. If not, write to the Free Software Foundation,
23 //   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "kvi_settings.h"
28 #include "KviQString.h"
29 #include "KviKvsTreeNode.h"
30 #include "KviKvsTreeNodeSpecialCommand.h"
31 
32 class KviKvsTreeNodeExpression;
33 class KviKvsTreeNodeInstruction;
34 class KviKvsRunTimeContext;
35 class KviKvsVariant;
36 class KviKvsPopupMenu;
37 
38 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupLabel : public KviKvsTreeNode
39 {
40 public:
41 	QString m_szItemName;
42 
43 public:
KviKvsTreeNodeSpecialCommandDefpopupLabel(const QChar * pLocation,const QString & szItemName)44 	KviKvsTreeNodeSpecialCommandDefpopupLabel(const QChar * pLocation, const QString & szItemName)
45 	    : KviKvsTreeNode(pLocation), m_szItemName(szItemName){};
~KviKvsTreeNodeSpecialCommandDefpopupLabel()46 	~KviKvsTreeNodeSpecialCommandDefpopupLabel(){};
47 
48 public:
setItemName(const QString & szItemName)49 	void setItemName(const QString & szItemName) { m_szItemName = szItemName; };
50 	virtual bool execute(KviKvsRunTimeContext * c, KviKvsPopupMenu * p) = 0;
51 };
52 
53 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel : public KviKvsTreeNodeSpecialCommandDefpopupLabel
54 {
55 protected:
56 	QString m_szCondition; // may be null!
57 public:
KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel(const QChar * pLocation,const QString & szCondition,const QString & szItemName)58 	KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel(const QChar * pLocation, const QString & szCondition, const QString & szItemName)
59 	    : KviKvsTreeNodeSpecialCommandDefpopupLabel(pLocation, szItemName), m_szCondition(szCondition){};
~KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel()60 	~KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel(){};
61 
62 public:
setCondition(const QString & szCondition)63 	void setCondition(const QString & szCondition) { m_szCondition = szCondition; };
64 };
65 
66 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupLabelSeparator : public KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel
67 {
68 public:
KviKvsTreeNodeSpecialCommandDefpopupLabelSeparator(const QChar * pLocation,const QString & szCondition,const QString & szItemName)69 	KviKvsTreeNodeSpecialCommandDefpopupLabelSeparator(const QChar * pLocation, const QString & szCondition, const QString & szItemName)
70 	    : KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel(pLocation, szCondition, szItemName){};
~KviKvsTreeNodeSpecialCommandDefpopupLabelSeparator()71 	~KviKvsTreeNodeSpecialCommandDefpopupLabelSeparator(){};
72 
73 public:
74 	virtual void contextDescription(QString & szBuffer);
75 	virtual void dump(const char * prefix);
76 	virtual bool execute(KviKvsRunTimeContext * c, KviKvsPopupMenu * p);
77 };
78 
79 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon : public KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel
80 {
81 protected:
82 	QString m_szText;
83 	QString m_szIcon;
84 
85 public:
KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon(const QChar * pLocation,const QString & szCondition,const QString & szText,const QString & szIcon,const QString & szItemName)86 	KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon(const QChar * pLocation, const QString & szCondition, const QString & szText, const QString & szIcon, const QString & szItemName)
87 	    : KviKvsTreeNodeSpecialCommandDefpopupConditionalLabel(pLocation, szCondition, szItemName), m_szText(szText), m_szIcon(szIcon){};
~KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon()88 	~KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon(){};
89 
90 public:
setText(const QString & szText)91 	void setText(const QString & szText) { m_szText = szText; };
setIcon(const QString & szIcon)92 	void setIcon(const QString & szIcon) { m_szIcon = szIcon; };
93 };
94 
95 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupLabelExtpopup : public KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon
96 {
97 protected:
98 	QString m_szName;
99 
100 public:
KviKvsTreeNodeSpecialCommandDefpopupLabelExtpopup(const QChar * pLocation,const QString & szCondition,const QString & szText,const QString & szIcon,const QString & szName,const QString & szItemName)101 	KviKvsTreeNodeSpecialCommandDefpopupLabelExtpopup(const QChar * pLocation, const QString & szCondition, const QString & szText, const QString & szIcon, const QString & szName, const QString & szItemName)
102 	    : KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon(pLocation, szCondition, szText, szIcon, szItemName), m_szName(szName){};
~KviKvsTreeNodeSpecialCommandDefpopupLabelExtpopup()103 	~KviKvsTreeNodeSpecialCommandDefpopupLabelExtpopup(){};
104 
105 public:
106 	virtual void contextDescription(QString & szBuffer);
107 	virtual void dump(const char * prefix);
108 	virtual bool execute(KviKvsRunTimeContext * c, KviKvsPopupMenu * p);
109 };
110 
111 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupLabelItem : public KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon
112 {
113 protected:
114 	QString m_szInstruction;
115 
116 public:
KviKvsTreeNodeSpecialCommandDefpopupLabelItem(const QChar * pLocation,const QString & szCondition,const QString & szText,const QString & szIcon,const QString & szInstruction,const QString & szItemName)117 	KviKvsTreeNodeSpecialCommandDefpopupLabelItem(const QChar * pLocation, const QString & szCondition, const QString & szText, const QString & szIcon, const QString & szInstruction, const QString & szItemName)
118 	    : KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon(pLocation, szCondition, szText, szIcon, szItemName), m_szInstruction(szInstruction){};
~KviKvsTreeNodeSpecialCommandDefpopupLabelItem()119 	~KviKvsTreeNodeSpecialCommandDefpopupLabelItem(){};
120 
121 public:
122 	virtual void contextDescription(QString & szBuffer);
123 	virtual void dump(const char * prefix);
124 	virtual bool execute(KviKvsRunTimeContext * c, KviKvsPopupMenu * p);
125 };
126 
127 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupLabelLabel : public KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon
128 {
129 public:
KviKvsTreeNodeSpecialCommandDefpopupLabelLabel(const QChar * pLocation,const QString & szCondition,const QString & szText,const QString & szIcon,const QString & szItemName)130 	KviKvsTreeNodeSpecialCommandDefpopupLabelLabel(const QChar * pLocation, const QString & szCondition, const QString & szText, const QString & szIcon, const QString & szItemName)
131 	    : KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon(pLocation, szCondition, szText, szIcon, szItemName){};
~KviKvsTreeNodeSpecialCommandDefpopupLabelLabel()132 	~KviKvsTreeNodeSpecialCommandDefpopupLabelLabel(){};
133 
134 public:
135 	virtual void contextDescription(QString & szBuffer);
136 	virtual void dump(const char * prefix);
137 	virtual bool execute(KviKvsRunTimeContext * c, KviKvsPopupMenu * p);
138 };
139 
140 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupLabelPrologue : public KviKvsTreeNodeSpecialCommandDefpopupLabel
141 {
142 protected:
143 	QString m_szInstruction;
144 
145 public:
KviKvsTreeNodeSpecialCommandDefpopupLabelPrologue(const QChar * pLocation,const QString & szInstruction,const QString & szItemName)146 	KviKvsTreeNodeSpecialCommandDefpopupLabelPrologue(const QChar * pLocation, const QString & szInstruction, const QString & szItemName)
147 	    : KviKvsTreeNodeSpecialCommandDefpopupLabel(pLocation, szItemName), m_szInstruction(szInstruction){};
~KviKvsTreeNodeSpecialCommandDefpopupLabelPrologue()148 	~KviKvsTreeNodeSpecialCommandDefpopupLabelPrologue(){};
149 
150 public:
151 	virtual void contextDescription(QString & szBuffer);
152 	virtual void dump(const char * prefix);
153 	virtual bool execute(KviKvsRunTimeContext * c, KviKvsPopupMenu * p);
154 };
155 
156 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupLabelEpilogue : public KviKvsTreeNodeSpecialCommandDefpopupLabel
157 {
158 protected:
159 	QString m_szInstruction;
160 
161 public:
KviKvsTreeNodeSpecialCommandDefpopupLabelEpilogue(const QChar * pLocation,const QString & szInstruction,const QString & szItemName)162 	KviKvsTreeNodeSpecialCommandDefpopupLabelEpilogue(const QChar * pLocation, const QString & szInstruction, const QString & szItemName)
163 	    : KviKvsTreeNodeSpecialCommandDefpopupLabel(pLocation, szItemName), m_szInstruction(szInstruction){};
~KviKvsTreeNodeSpecialCommandDefpopupLabelEpilogue()164 	~KviKvsTreeNodeSpecialCommandDefpopupLabelEpilogue(){};
165 
166 public:
167 	virtual void contextDescription(QString & szBuffer);
168 	virtual void dump(const char * prefix);
169 	virtual bool execute(KviKvsRunTimeContext * c, KviKvsPopupMenu * p);
170 };
171 
172 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopupLabelPopup : public KviKvsTreeNodeSpecialCommandDefpopupConditionalLabelWithTextAndIcon
173 {
174 public:
175 	KviKvsTreeNodeSpecialCommandDefpopupLabelPopup(const QChar * pLocation);
176 	~KviKvsTreeNodeSpecialCommandDefpopupLabelPopup();
177 
178 protected:
179 	KviPointerList<KviKvsTreeNodeSpecialCommandDefpopupLabel> * m_pLabels;
180 
181 public:
isEmpty()182 	bool isEmpty() { return m_pLabels->isEmpty(); };
183 	void addLabel(KviKvsTreeNodeSpecialCommandDefpopupLabel * pLabel);
184 	virtual void contextDescription(QString & szBuffer);
185 	virtual void dump(const char * prefix);
186 	virtual bool execute(KviKvsRunTimeContext * c, KviKvsPopupMenu * p);
187 	bool fill(KviKvsRunTimeContext * c, KviKvsPopupMenu * p);
188 };
189 
190 class KVIRC_API KviKvsTreeNodeSpecialCommandDefpopup : public KviKvsTreeNodeSpecialCommand
191 {
192 public:
193 	KviKvsTreeNodeSpecialCommandDefpopup(const QChar * pLocation, KviKvsTreeNodeData * pPopupName, KviKvsTreeNodeSpecialCommandDefpopupLabelPopup * pMainPopup);
194 	~KviKvsTreeNodeSpecialCommandDefpopup();
195 
196 private:
197 	KviKvsTreeNodeData * m_pPopupName; // can't be zero
198 	KviKvsTreeNodeSpecialCommandDefpopupLabelPopup * m_pMainPopup;
199 
200 public:
201 	virtual void contextDescription(QString & szBuffer);
202 	virtual void dump(const char * prefix);
203 	virtual bool execute(KviKvsRunTimeContext * c);
204 };
205 
206 #endif //!_KVI_KVS_TREENODE_SPECIALCOMMANDDEFPOPUP_H_
207