1
//=============================================================================
3
// File : kvi_scriptbutton.cpp
4
// Creation date : Wed Nov 14 15:43:41 2001 GMT by Szymon Stefanek
6
// This file is part of the KVirc irc client distribution
7
// Copyright (C) 2001-2008 Szymon Stefanek (pragma at kvirc dot net)
9
// This program is FREE software. You can redistribute it and/or
10
// modify it under the terms of the GNU General Public License
11
// as published by the Free Software Foundation; either version 2
12
// of the License, or (at your opinion) any later version.
14
// This program is distributed in the HOPE that it will be USEFUL,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
// See the GNU General Public License for more details.
19
// You should have received a copy of the GNU General Public License
20
// along with this program. If not, write to the Free Software Foundation,
21
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
//=============================================================================
25
#include "kvi_scriptbutton.h"
26
#include "kvi_irctoolbar.h"
27
#include "kvi_window.h"
28
#include "kvi_console.h"
30
#include "kvi_parameterlist.h"
31
#include "kvi_kvs_variantlist.h"
32
#include "kvi_kvs_script.h"
35
KviScriptUserButton::KviScriptUserButton(QWidget * par,const char * name)
40
// setAutoRaise(true);
41
connect(this,SIGNAL(clicked()),this,SLOT(btnClicked()));
45
KviScriptUserButton::~KviScriptUserButton()
47
if(m_pScript)delete m_pScript;
50
KviWindow * KviScriptUserButton::window()
52
return g_pActiveWindow;
55
void KviScriptUserButton::setButtonCode(KviKvsScript * pScript)
57
if(m_pScript)delete m_pScript;
62
void KviScriptUserButton::btnClicked()
64
KviWindow * pWnd = window();
65
if(!pWnd)return; // ops...
66
QPoint pos = mapToGlobal(QPoint(0,height()));
68
KviKvsVariantList vList;
69
vList.append((kvs_int_t)pos.x());
70
vList.append((kvs_int_t)pos.y());
71
m_pScript->run(pWnd,&vList,0,KviKvsScript::PreserveParams);
75
KviWindowScriptButton::KviWindowScriptButton(QWidget * p,KviWindow * wnd,const char * name)
76
: KviScriptUserButton(p,name)
81
KviWindowScriptButton::~KviWindowScriptButton()
85
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
86
#include "kvi_scriptbutton.moc"
87
#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES