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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
//
// File : class_window.cpp
// Creation date : Tue Now 26 21:39:59 CEST 2002 by Szymon Stefanek
//
// This file is part of the KVirc irc client distribution
// Copyright (C) 2002 Szymon Stefanek (pragma at kvirc dot net)
//
// 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 opinion) 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 Foundation,
// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
#include "class_window.h"
#include "kvi_error.h"
#include "kvi_debug.h"
#include "kvi_locale.h"
#include "kvi_frame.h"
KviKvsScriptWindowWindow::KviKvsScriptWindowWindow(KviFrame * pParent,const TQString &szName)
: KviWindow(KVI_WINDOW_TYPE_SCRIPTOBJECT,pParent,szName)
{
m_pCentralWidget = 0;
#ifdef COMPILE_USE_QT4
setBackgroundMode(TQt::NoBackground);
#else
setBackgroundMode(TQWidget::NoBackground);
#endif
}
KviKvsScriptWindowWindow::~KviKvsScriptWindowWindow()
{
}
void KviKvsScriptWindowWindow::setCentralWidget(KviKvsObject_widget *o,TQWidget * w)
{
m_pCentralWidgetObject = o;
m_pCentralWidget = w;
}
void KviKvsScriptWindowWindow::resizeEvent(TQResizeEvent *e)
{
if(m_pCentralWidget)
m_pCentralWidget->setGeometry(0,0,width(),height());
}
void KviKvsScriptWindowWindow::centralWidgetObjectDestroyed()
{
m_pCentralWidget = 0;
m_pCentralWidgetObject = 0;
}
void KviKvsScriptWindowWindow::centralWidgetDestroyed()
{
m_pCentralWidget = 0;
m_pCentralWidgetObject = 0;
}
/*
@doc: window
@title:
window class
@type:
class
@short:
A MDI window object
@inherits:
[class]object[/class]
[class]widget[/class]
@description:
This class rappresents a MDI window in a KVIrc frame.
Regardless of the tqparent object passed, the window will be always
a "physical" child of the frame window: you can't embed a window object
inside a widget or another window. The tqparent object will just "own" this
window object and eventually destroy it when it dies.
This class can manage only a single central child widget that must
be set with $setCentralWidget().
The central widget MUST be set before you initially call show()
@functions:
*/
KVSO_BEGIN_REGISTERCLASS(KviKvsObject_window,"window","widget")
KVSO_REGISTER_HANDLER(KviKvsObject_window,"setCaption", functionsetCaption)
KVSO_REGISTER_HANDLER(KviKvsObject_window,"setCentralWidget", functionsetCentralWidget)
// KVSO_REGISTER_HANDLER(KviKvsObject_window,"setIcon", functionsetIcon)
KVSO_END_REGISTERCLASS(KviKvsObject_window)
KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_window,KviKvsObject_widget)
KVSO_END_CONSTRUCTOR(KviKvsObject_window)
KVSO_BEGIN_DESTRUCTOR(KviKvsObject_window)
KVSO_END_CONSTRUCTOR(KviKvsObject_window)
bool KviKvsObject_window::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams)
{
KviWindow * w = new KviKvsScriptWindowWindow(pContext->window()->frame(),name());
setObject(TQT_TQOBJECT(w));
pContext->window()->frame()->addWindow(w,false);
w->minimize(); // must be minimized before tqchildren are added, otherwise the focus handling goes nuts...
return true;
}
bool KviKvsObject_window::functionsetCaption(KviKvsObjectFunctionCall *c)
{
TQString szCaption;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("caption",KVS_PT_STRING,0,szCaption)
KVSO_PARAMETERS_END(c)
if(widget())
((KviKvsScriptWindowWindow *)widget())->setCaptionString(szCaption);
return true;
}
bool KviKvsObject_window::functionsetCentralWidget(KviKvsObjectFunctionCall *c)
{
KviKvsObject *ob;
kvs_hobject_t hObject;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
KVSO_PARAMETERS_END(c)
ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
if(!widget())return true;
if(!ob->object()->isWidgetType())
{
c->warning(__tr2qs("Can't add a non-widget object"));
return true;
}
if(!ob->inherits("KviKvsObject_widget"))
{
c->warning(__tr2qs("Can't add a non-widget object"));
return true;
}
((KviKvsScriptWindowWindow *)widget())->setCentralWidget((KviKvsObject_widget *)ob,((KviKvsObject_widget *)ob)->widget());
return true;
}
#include "m_class_window.moc"
|