1
//=============================================================================
3
// File : KvsObject_mainWindow.cpp
4
// Creation date : Mon Feb 28 14:21:48 CEST 2005
5
// by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor)
7
// This file is part of the KVIrc irc client distribution
8
// Copyright (C) 2005-2008 Alessandro Carbone (elfonol at gmail dot com)
10
// This program is FREE software. You can redistribute it and/or
11
// modify it under the terms of the GNU General Public License
12
// as published by the Free Software Foundation; either version 2
13
// of the License, or (at your opinion) any later version.
15
// This program is distributed in the HOPE that it will be USEFUL,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
// See the GNU General Public License for more details.
20
// You should have received a copy of the GNU General Public License
21
// along with this program. If not, write to the Free Software Foundation,
22
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24
//=============================================================================
26
#include "KviTalMainWindow.h"
27
#include "KvsObject_mainWindow.h"
29
#include "kvi_debug.h"
30
#include "KviLocale.h"
31
#include "KviIconManager.h"
37
mainwindow object class,
43
Provides a mainwindow.
48
The mainwindow class provides a main application window, with menubar, toolbars.
50
!fn: $setCentralWidget(<widget:object>)
51
Sets the central widget for the main window to <wid>.
54
KVSO_BEGIN_REGISTERCLASS(KvsObject_mainWindow,"mainwindow","widget")
55
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_mainWindow,setCentralWidget)
57
KVSO_END_REGISTERCLASS(KvsObject_mainWindow)
59
KVSO_BEGIN_CONSTRUCTOR(KvsObject_mainWindow,KvsObject_widget)
61
KVSO_END_CONSTRUCTOR(KvsObject_mainWindow)
64
KVSO_BEGIN_DESTRUCTOR(KvsObject_mainWindow)
66
KVSO_END_CONSTRUCTOR(KvsObject_mainWindow)
68
bool KvsObject_mainWindow::init(KviKvsRunTimeContext *,KviKvsVariantList *)
70
setObject(new KviTalMainWindow(parentScriptWidget(), getName().toUtf8().data()), true);
74
KVSO_CLASS_FUNCTION(mainWindow,setCentralWidget)
76
CHECK_INTERNAL_POINTER(widget())
77
KviKvsObject * pObject;
78
kvs_hobject_t hObject;
79
KVSO_PARAMETERS_BEGIN(c)
80
KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
81
KVSO_PARAMETERS_END(c)
82
pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
85
c->warning(__tr2qs_ctx("Widget parameter is not an object","objects"));
88
if (!pObject->object())
90
c->warning(__tr2qs_ctx("Widget parameter is not a valid object","objects"));
93
if(!pObject->inheritsClass("widget"))
95
c->warning(__tr2qs_ctx("Widget object required","objects"));
98
((KviTalMainWindow *)widget())->setCentralWidget(((QWidget *)(pObject->object())));