#include <kdialog.h>
#include <tdelocale.h>

/****************************************************************************
** Form implementation generated from reading ui file 'qconstanteditor.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "qconstanteditor.h"

#include <ntqvariant.h>
#include <tdelistview.h>
#include <ntqpushbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "qconstanteditor.ui.h"

/*
 *  Constructs a QConstantEditor as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
QConstantEditor::QConstantEditor( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "QConstantEditor" );
    QConstantEditorLayout = new TQGridLayout( this, 1, 1, 11, 6, "QConstantEditorLayout"); 

    cmdDelete = new TQPushButton( this, "cmdDelete" );
    cmdDelete->setEnabled( false );

    QConstantEditorLayout->addWidget( cmdDelete, 2, 1 );

    cmdEdit = new TQPushButton( this, "cmdEdit" );
    cmdEdit->setEnabled( false );

    QConstantEditorLayout->addWidget( cmdEdit, 1, 1 );

    cmdDuplicate = new TQPushButton( this, "cmdDuplicate" );
    cmdDuplicate->setEnabled( false );

    QConstantEditorLayout->addWidget( cmdDuplicate, 3, 1 );

    cmdNew = new TQPushButton( this, "cmdNew" );

    QConstantEditorLayout->addWidget( cmdNew, 0, 1 );

    varlist = new TDEListView( this, "varlist" );
    varlist->addColumn( tr2i18n( "Variable" ) );
    varlist->addColumn( tr2i18n( "Value" ) );
    varlist->setShowSortIndicator( true );
    varlist->setItemsMovable( false );

    QConstantEditorLayout->addMultiCellWidget( varlist, 0, 4, 0, 0 );
    spacer2 = new TQSpacerItem( 20, 147, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    QConstantEditorLayout->addItem( spacer2, 4, 1 );
    languageChange();
    resize( TQSize(388, 341).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( cmdNew, TQ_SIGNAL( clicked() ), this, TQ_SLOT( cmdNew_clicked() ) );
    connect( cmdEdit, TQ_SIGNAL( clicked() ), this, TQ_SLOT( cmdEdit_clicked() ) );
    connect( cmdDelete, TQ_SIGNAL( clicked() ), this, TQ_SLOT( cmdDelete_clicked() ) );
    connect( varlist, TQ_SIGNAL( clicked(TQListViewItem*) ), this, TQ_SLOT( varlist_clicked(TQListViewItem*) ) );
    connect( cmdDuplicate, TQ_SIGNAL( clicked() ), this, TQ_SLOT( cmdDuplicate_clicked() ) );
    connect( varlist, TQ_SIGNAL( doubleClicked(TQListViewItem*) ), this, TQ_SLOT( varlist_doubleClicked(TQListViewItem*) ) );
}

/*
 *  Destroys the object and frees any allocated resources
 */
QConstantEditor::~QConstantEditor()
{
    // no need to delete child widgets, TQt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void QConstantEditor::languageChange()
{
    setCaption( tr2i18n( "Constant Editor" ) );
    cmdDelete->setText( tr2i18n( "&Delete" ) );
    TQToolTip::add( cmdDelete, tr2i18n( "delete selected constant" ) );
    TQWhatsThis::add( cmdDelete, tr2i18n( "Click here to delete the selected constant; it can only be removed if it is not currently used by a plot." ) );
    cmdEdit->setText( tr2i18n( "&Change Value..." ) );
    TQToolTip::add( cmdEdit, tr2i18n( "Change the value of a user-defined constant" ) );
    TQWhatsThis::add( cmdEdit, tr2i18n( "Click here to edit the value of the selected constant. Its name cannot be changed." ) );
    cmdDuplicate->setText( tr2i18n( "D&uplicate" ) );
    TQToolTip::add( cmdDuplicate, tr2i18n( "Duplicate the selected constant" ) );
    TQWhatsThis::add( cmdDuplicate, tr2i18n( "Click here to Copy the selected constant to another constant. You can choose the new name from a list." ) );
    cmdNew->setText( tr2i18n( "&New..." ) );
    TQToolTip::add( cmdNew, tr2i18n( "Add a new constant" ) );
    TQWhatsThis::add( cmdNew, tr2i18n( "Click this button to add a new constant." ) );
    varlist->header()->setLabel( 0, tr2i18n( "Variable" ) );
    varlist->header()->setLabel( 1, tr2i18n( "Value" ) );
    TQToolTip::add( varlist, tr2i18n( "List of user-defined constants" ) );
    TQWhatsThis::add( varlist, tr2i18n( "Select a constant to change its value, remove it or duplicate it." ) );
}

/****************************************************************************
** QConstantEditor meta object code from reading C++ file 'qconstanteditor.h'
**
** Created by: The TQt Meta Object Compiler version 26 (TQt 3.5.0)
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#undef TQT_NO_COMPAT
#include "qconstanteditor.h"
#include <ntqmetaobject.h>
#include <ntqapplication.h>

#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.5.0. It"
#error "cannot be used with the include files from this version of TQt."
#error "(The moc has changed too much.)"
#endif

const char *QConstantEditor::className() const
{
    return "QConstantEditor";
}

TQMetaObject *QConstantEditor::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_QConstantEditor( "QConstantEditor", &QConstantEditor::staticMetaObject );

#ifndef TQT_NO_TRANSLATION
TQString QConstantEditor::tr( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "QConstantEditor", s, c, TQApplication::DefaultCodec );
    else
	return TQString::fromLatin1( s );
}
#ifndef TQT_NO_TRANSLATION_UTF8
TQString QConstantEditor::trUtf8( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "QConstantEditor", s, c, TQApplication::UnicodeUTF8 );
    else
	return TQString::fromUtf8( s );
}
#endif // TQT_NO_TRANSLATION_UTF8

#endif // TQT_NO_TRANSLATION

TQMetaObject* QConstantEditor::staticMetaObject()
{
    if ( metaObj ) {
	return metaObj;
}
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();
    if ( metaObj ) {
	if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
	return metaObj;
    }
#endif // TQT_THREAD_SUPPORT
    TQMetaObject* parentObject = TQWidget::staticMetaObject();
    static const TQUMethod slot_0 = {"cmdCancel_clicked", 0, 0 };
    static const TQUMethod slot_1 = {"cmdNew_clicked", 0, 0 };
    static const TQUMethod slot_2 = {"cmdEdit_clicked", 0, 0 };
    static const TQUMethod slot_3 = {"cmdDelete_clicked", 0, 0 };
    static const TQUParameter param_slot_4[] = {
	{ "item", &static_QUType_ptr, "TQListViewItem", TQUParameter::In }
    };
    static const TQUMethod slot_4 = {"varlist_clicked", 1, param_slot_4 };
    static const TQUMethod slot_5 = {"cmdDuplicate_clicked", 0, 0 };
    static const TQUMethod slot_6 = {"newNewConstantSlot", 0, 0 };
    static const TQUParameter param_slot_7[] = {
	{ 0, &static_QUType_ptr, "TQListViewItem", TQUParameter::In }
    };
    static const TQUMethod slot_7 = {"varlist_doubleClicked", 1, param_slot_7 };
    static const TQUMethod slot_8 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "cmdCancel_clicked()", &slot_0, TQMetaData::Public },
	{ "cmdNew_clicked()", &slot_1, TQMetaData::Public },
	{ "cmdEdit_clicked()", &slot_2, TQMetaData::Public },
	{ "cmdDelete_clicked()", &slot_3, TQMetaData::Public },
	{ "varlist_clicked(TQListViewItem*)", &slot_4, TQMetaData::Public },
	{ "cmdDuplicate_clicked()", &slot_5, TQMetaData::Public },
	{ "newNewConstantSlot()", &slot_6, TQMetaData::Public },
	{ "varlist_doubleClicked(TQListViewItem*)", &slot_7, TQMetaData::Public },
	{ "languageChange()", &slot_8, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"QConstantEditor", parentObject,
	slot_tbl, 9,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_QConstantEditor.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

void* QConstantEditor::tqt_cast( const char* clname )
{
    if ( !qstrcmp( clname, "QConstantEditor" ) )
	return this;
    return TQWidget::tqt_cast( clname );
}

bool QConstantEditor::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: cmdCancel_clicked(); break;
    case 1: cmdNew_clicked(); break;
    case 2: cmdEdit_clicked(); break;
    case 3: cmdDelete_clicked(); break;
    case 4: varlist_clicked((TQListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 5: cmdDuplicate_clicked(); break;
    case 6: newNewConstantSlot(); break;
    case 7: varlist_doubleClicked((TQListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 8: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool QConstantEditor::tqt_emit( int _id, TQUObject* _o )
{
    return TQWidget::tqt_emit(_id,_o);
}
#ifndef TQT_NO_PROPERTIES

bool QConstantEditor::tqt_property( int id, int f, TQVariant* v)
{
    return TQWidget::tqt_property( id, f, v);
}

bool QConstantEditor::tqt_static_property( TQObject* , int , int , TQVariant* ){ return false; }
#endif // TQT_NO_PROPERTIES
