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

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

#include "tdelisteditor.h"

#include <ntqvariant.h>
#include <ntqpushbutton.h>
#include <ntqgroupbox.h>
#include <ntqlineedit.h>
#include <ntqlistbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "tdelisteditor.ui.h"

/*
 *  Constructs a TDEListEditor as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
TDEListEditor::TDEListEditor( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "TDEListEditor" );
    setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) );
    TDEListEditorLayout = new TQHBoxLayout( this, 0, 0, "TDEListEditorLayout"); 

    _frame = new TQGroupBox( this, "_frame" );
    _frame->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 0, 0, _frame->sizePolicy().hasHeightForWidth() ) );
    _frame->setColumnLayout(0, TQt::Vertical );
    _frame->layout()->setSpacing( 6 );
    _frame->layout()->setMargin( 11 );
    _frameLayout = new TQHBoxLayout( _frame->layout() );
    _frameLayout->setAlignment( TQt::AlignTop );

    Layout3 = new TQVBoxLayout( 0, 0, 6, "Layout3"); 

    _edit = new TQLineEdit( _frame, "_edit" );
    Layout3->addWidget( _edit );

    Layout2 = new TQHBoxLayout( 0, 0, 6, "Layout2"); 

    _list = new TQListBox( _frame, "_list" );
    _list->setMinimumSize( TQSize( 200, 200 ) );
    Layout2->addWidget( _list );

    Layout5_2 = new TQVBoxLayout( 0, 0, 6, "Layout5_2"); 

    _addButton = new TQPushButton( _frame, "_addButton" );
    _addButton->setEnabled( false );
    Layout5_2->addWidget( _addButton );

    _removeButton = new TQPushButton( _frame, "_removeButton" );
    _removeButton->setEnabled( false );
    Layout5_2->addWidget( _removeButton );

    _upButton = new TQPushButton( _frame, "_upButton" );
    _upButton->setEnabled( false );
    Layout5_2->addWidget( _upButton );

    _downButton = new TQPushButton( _frame, "_downButton" );
    _downButton->setEnabled( false );
    Layout5_2->addWidget( _downButton );
    Spacer2_2 = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    Layout5_2->addItem( Spacer2_2 );
    Layout2->addLayout( Layout5_2 );
    Layout3->addLayout( Layout2 );
    _frameLayout->addLayout( Layout3 );
    TDEListEditorLayout->addWidget( _frame );
    languageChange();
    resize( TQSize(334, 274).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( _addButton, TQ_SIGNAL( pressed() ), this, TQ_SLOT( addToList() ) );
    connect( _removeButton, TQ_SIGNAL( pressed() ), this, TQ_SLOT( removeFromList() ) );
    connect( _upButton, TQ_SIGNAL( pressed() ), this, TQ_SLOT( upInList() ) );
    connect( _downButton, TQ_SIGNAL( pressed() ), this, TQ_SLOT( downInList() ) );
    connect( _edit, TQ_SIGNAL( returnPressed() ), this, TQ_SLOT( updateList() ) );
    connect( _edit, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( editChanged(const TQString&) ) );
    connect( _list, TQ_SIGNAL( highlighted(int) ), this, TQ_SLOT( updateButtons(int) ) );
    connect( _list, TQ_SIGNAL( highlighted(const TQString&) ), _edit, TQ_SLOT( setText(const TQString&) ) );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void TDEListEditor::languageChange()
{
    _frame->setTitle( TQString::null );
    _list->clear();
    _list->insertItem( tr2i18n( "New Item" ) );
    _addButton->setText( tr2i18n( "Add" ) );
    _removeButton->setText( tr2i18n( "Remove" ) );
    _upButton->setText( tr2i18n( "Up" ) );
    _downButton->setText( tr2i18n( "Down" ) );
}

/****************************************************************************
** TDEListEditor meta object code from reading C++ file 'tdelisteditor.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 "tdelisteditor.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

#include <ntqvariant.h>
const char *TDEListEditor::className() const
{
    return "TDEListEditor";
}

TQMetaObject *TDEListEditor::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_TDEListEditor( "TDEListEditor", &TDEListEditor::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* TDEListEditor::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 = {"addToList", 0, 0 };
    static const TQUMethod slot_1 = {"downInList", 0, 0 };
    static const TQUMethod slot_2 = {"removeFromList", 0, 0 };
    static const TQUMethod slot_3 = {"upInList", 0, 0 };
    static const TQUParameter param_slot_4[] = {
	{ "newIndex", &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_4 = {"updateButtons", 1, param_slot_4 };
    static const TQUMethod slot_5 = {"updateList", 0, 0 };
    static const TQUParameter param_slot_6[] = {
	{ "contents", &static_QUType_varptr, "\x04", TQUParameter::In }
    };
    static const TQUMethod slot_6 = {"setList", 1, param_slot_6 };
    static const TQUParameter param_slot_7[] = {
	{ "s", &static_QUType_TQString, 0, TQUParameter::In }
    };
    static const TQUMethod slot_7 = {"setTitle", 1, param_slot_7 };
    static const TQUParameter param_slot_8[] = {
	{ 0, &static_QUType_TQVariant, "\x04", TQUParameter::Out }
    };
    static const TQUMethod slot_8 = {"list", 1, param_slot_8 };
    static const TQUMethod slot_9 = {"languageChange", 0, 0 };
    static const TQUParameter param_slot_10[] = {
	{ "s", &static_QUType_TQString, 0, TQUParameter::In }
    };
    static const TQUMethod slot_10 = {"editChanged", 1, param_slot_10 };
    static const TQMetaData slot_tbl[] = {
	{ "addToList()", &slot_0, TQMetaData::Public },
	{ "downInList()", &slot_1, TQMetaData::Public },
	{ "removeFromList()", &slot_2, TQMetaData::Public },
	{ "upInList()", &slot_3, TQMetaData::Public },
	{ "updateButtons(int)", &slot_4, TQMetaData::Public },
	{ "updateList()", &slot_5, TQMetaData::Public },
	{ "setList(TQStringList)", &slot_6, TQMetaData::Public },
	{ "setTitle(const TQString&)", &slot_7, TQMetaData::Public },
	{ "list()", &slot_8, TQMetaData::Public },
	{ "languageChange()", &slot_9, TQMetaData::Protected },
	{ "editChanged(const TQString&)", &slot_10, TQMetaData::Protected }
    };
    static const TQUMethod signal_0 = {"itemsChanged", 0, 0 };
    static const TQMetaData signal_tbl[] = {
	{ "itemsChanged()", &signal_0, TQMetaData::Public }
    };
    metaObj = TQMetaObject::new_metaobject(
	"TDEListEditor", parentObject,
	slot_tbl, 11,
	signal_tbl, 1,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_TDEListEditor.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

// TQ_SIGNAL itemsChanged
void TDEListEditor::itemsChanged()
{
    activate_signal( staticMetaObject()->signalOffset() + 0 );
}

bool TDEListEditor::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: addToList(); break;
    case 1: downInList(); break;
    case 2: removeFromList(); break;
    case 3: upInList(); break;
    case 4: updateButtons((int)static_QUType_int.get(_o+1)); break;
    case 5: updateList(); break;
    case 6: setList((TQStringList)(*((TQStringList*)static_QUType_ptr.get(_o+1)))); break;
    case 7: setTitle((const TQString&)static_QUType_TQString.get(_o+1)); break;
    case 8: static_QUType_TQVariant.set(_o,TQVariant(list())); break;
    case 9: languageChange(); break;
    case 10: editChanged((const TQString&)static_QUType_TQString.get(_o+1)); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool TDEListEditor::tqt_emit( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: itemsChanged(); break;
    default:
	return TQWidget::tqt_emit(_id,_o);
    }
    return true;
}
#ifndef TQT_NO_PROPERTIES

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

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