/****************************************************************************
   **
   ** Copyright (c) 2009-2016 TopLinker Co.,Ltd. (http://www.toplinker.net)
   **           ALL RIGHTS RESERVED
   **
   **  The entire contents of this file is protected by copyright law and
   **  international treaties. Unauthorized reproduction, reverse-engineering
   **  and distribution of all or any portion of the code contained in this
   **  file is strictly prohibited and may result in severe civil and
   **  criminal penalties and will be prosecuted to the maximum extent
   **  possible under the law.
   **
   **  RESTRICTIONS
   **
   **  THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
   **  FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
   **  COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
   **  AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
   **  AND PERMISSION FROM DEVELOPER MACHINES
   **
   **  CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
   **  ADDITIONAL RESTRICTIONS.
   **
   ****************************************************************************/
#include "twidgetecmaplugin.h"
#include <QDebug>
#include <QMessageBox>
#include <QScriptEngine>
#include <tbaseutil/tecmahelper.h>
#include <twidget/tuiloader.h>
#include <twidget/tuiloaderdialog.h>
#include <twidget/ttableview.h>
#include <twidget/ttreeviewdialog.h>
#include <twidget/tcombobox.h>
#include <twidget/tdateedit.h>
#include <twidget/tdatetimeedit.h>
#include <twidget/tlineedit.h>
#include <twidget/tlabel.h>
#include <twidget/tradiobox.h>
#include <twidget/tplaintextedit.h>
#include <twidget/ttextedit.h>
#include <twidget/tpushbutton.h>
#include <twidget/tsearchentry.h>
#include <twidget/ttreeview.h>
#include <twidget/tcheckbox.h>
#include <twidget/ttableviewdialog.h>
#include <twidget/ttablechooserdialog.h>
#include "tmessagebox_ecmabinding.h"
#include "tfiledialog_ecmabinding.h"
#include "ttableviewdialog_ecmabinding.h"

QScriptValue qtscript_create_QMessageBox_class(QScriptEngine *engine);

QStringList TWidgetEcmaPlugin::keys() const
{
    return QStringList() << "ikm" << "ikm.widgets";
}

void TWidgetEcmaPlugin::initialize(const QString &key, QScriptEngine *engine)
{
    if (key == "ikm.widgets") {
        TMessageBox_EcmaBinding::initBinding(engine);
        TFileDialog_EcmaBinding::initBinding(engine);
        TTableViewDialog_EcmaBinding::initBinding(engine);
        TEcmaHelper::registerQWidget<TUiLoader>("TUiloader", engine);
        TEcmaHelper::registerQWidget<TUiloaderDialog>("TUiloaderDialog", engine);
        TEcmaHelper::registerQWidget<TTableView>("TTableView", engine);
        TEcmaHelper::registerQWidget<TComboBox>("TComboBox", engine);
        TEcmaHelper::registerQWidget<TDateEdit>("TDateEdit", engine);
        TEcmaHelper::registerQWidget<TDateTimeEdit>("TDateTimeEdit", engine);
        TEcmaHelper::registerQWidget<TLineEdit>("TLineEdit", engine);
        TEcmaHelper::registerQWidget<TLabel>("TLabel", engine);
        TEcmaHelper::registerQWidget<TRadioBox>("TRadioBox", engine);
        TEcmaHelper::registerQWidget<TPlainTextEdit>("TPlainTextEdit", engine);
        TEcmaHelper::registerQWidget<TPushButton>("TPushButton", engine);
        TEcmaHelper::registerQWidget<TSearchEntry>("TSearchEntry", engine);
        TEcmaHelper::registerQWidget<TTreeView>("TTreeView", engine);
        TEcmaHelper::registerQWidget<TCheckBox>("TCheckBox", engine);
        TEcmaHelper::registerQWidget<TTableChooserDialog>("TTableChooserDialog", engine);
        TEcmaHelper::registerQWidget<TTreeViewDialog>("TTreeViewDialog", engine);
    }
}