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

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

#include "replacedialog.h"

#include <ntqvariant.h>
#include <tqlineedit.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <ntqcombobox.h>
#include <ntqbuttongroup.h>
#include <ntqcheckbox.h>
#include <ntqradiobutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "../interfaces/editorinterface.h"
#include "replacedialog.ui.h"

/*
 *  Constructs a ReplaceDialog as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The qdialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal qdialog.
 */
ReplaceDialog::ReplaceDialog( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "ReplaceDialog" );
    ReplaceDialogLayout = new TQGridLayout( this, 1, 1, 11, 6, "ReplaceDialogLayout"); 

    Layout3 = new TQGridLayout( 0, 1, 1, 0, 6, "Layout3"); 

    TextLabel2 = new TQLabel( this, "TextLabel2" );

    Layout3->addWidget( TextLabel2, 1, 0 );

    TextLabel1 = new TQLabel( this, "TextLabel1" );

    Layout3->addWidget( TextLabel1, 0, 0 );

    comboFind = new TQComboBox( false, this, "comboFind" );
    comboFind->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 0, 0, comboFind->sizePolicy().hasHeightForWidth() ) );
    comboFind->setEditable( true );

    Layout3->addWidget( comboFind, 0, 1 );

    comboReplace = new TQComboBox( false, this, "comboReplace" );
    comboReplace->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 0, 0, comboReplace->sizePolicy().hasHeightForWidth() ) );
    comboReplace->setEditable( true );

    Layout3->addWidget( comboReplace, 1, 1 );

    ReplaceDialogLayout->addMultiCellLayout( Layout3, 0, 0, 0, 1 );

    Layout5 = new TQHBoxLayout( 0, 0, 6, "Layout5"); 
    Spacer1 = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    Layout5->addItem( Spacer1 );

    buttonReplace = new TQPushButton( this, "buttonReplace" );
    buttonReplace->setDefault( true );
    Layout5->addWidget( buttonReplace );

    buttonReplaceAll = new TQPushButton( this, "buttonReplaceAll" );
    Layout5->addWidget( buttonReplaceAll );

    PushButton2 = new TQPushButton( this, "PushButton2" );
    Layout5->addWidget( PushButton2 );

    ReplaceDialogLayout->addMultiCellLayout( Layout5, 2, 2, 0, 1 );

    ButtonGroup1 = new TQButtonGroup( this, "ButtonGroup1" );
    ButtonGroup1->setColumnLayout(0, TQt::Vertical );
    ButtonGroup1->layout()->setSpacing( 6 );
    ButtonGroup1->layout()->setMargin( 11 );
    ButtonGroup1Layout = new TQVBoxLayout( ButtonGroup1->layout() );
    ButtonGroup1Layout->setAlignment( TQt::AlignTop );

    checkWords = new TQCheckBox( ButtonGroup1, "checkWords" );
    ButtonGroup1Layout->addWidget( checkWords );

    checkCase = new TQCheckBox( ButtonGroup1, "checkCase" );
    ButtonGroup1Layout->addWidget( checkCase );

    checkBegin = new TQCheckBox( ButtonGroup1, "checkBegin" );
    ButtonGroup1Layout->addWidget( checkBegin );

    ReplaceDialogLayout->addWidget( ButtonGroup1, 1, 0 );

    ButtonGroup2 = new TQButtonGroup( this, "ButtonGroup2" );
    ButtonGroup2->setColumnLayout(0, TQt::Vertical );
    ButtonGroup2->layout()->setSpacing( 6 );
    ButtonGroup2->layout()->setMargin( 11 );
    ButtonGroup2Layout = new TQVBoxLayout( ButtonGroup2->layout() );
    ButtonGroup2Layout->setAlignment( TQt::AlignTop );

    radioForward = new TQRadioButton( ButtonGroup2, "radioForward" );
    radioForward->setChecked( true );
    ButtonGroup2Layout->addWidget( radioForward );

    radioBackward = new TQRadioButton( ButtonGroup2, "radioBackward" );
    ButtonGroup2Layout->addWidget( radioBackward );

    ReplaceDialogLayout->addWidget( ButtonGroup2, 1, 1 );
    languageChange();
    resize( TQSize(286, 217).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( buttonReplace, TQ_SIGNAL( clicked() ), this, TQ_SLOT( doReplace() ) );
    connect( buttonReplaceAll, TQ_SIGNAL( clicked() ), this, TQ_SLOT( doReplaceAll() ) );
    connect( PushButton2, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );

    // tab order
    setTabOrder( comboFind, comboReplace );
    setTabOrder( comboReplace, checkWords );
    setTabOrder( checkWords, checkCase );
    setTabOrder( checkCase, checkBegin );
    setTabOrder( checkBegin, radioForward );
    setTabOrder( radioForward, radioBackward );
    setTabOrder( radioBackward, buttonReplace );
    setTabOrder( buttonReplace, buttonReplaceAll );
    setTabOrder( buttonReplaceAll, PushButton2 );

    // buddies
    TextLabel2->setBuddy( comboReplace );
    TextLabel1->setBuddy( comboFind );
    init();
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void ReplaceDialog::languageChange()
{
    setCaption( tr2i18n( "Replace Text" ) );
    TextLabel2->setText( tr2i18n( "R&eplace:" ) );
    TextLabel1->setText( tr2i18n( "&Find:" ) );
    buttonReplace->setText( tr2i18n( "&Replace" ) );
    buttonReplaceAll->setText( tr2i18n( "Replace &All" ) );
    PushButton2->setText( tr2i18n( "&Close" ) );
    ButtonGroup1->setTitle( tr2i18n( "Options" ) );
    checkWords->setText( tr2i18n( "&Whole words only" ) );
    checkCase->setText( tr2i18n( "Case &sensitive" ) );
    checkBegin->setText( tr2i18n( "Start at &beginning" ) );
    ButtonGroup2->setTitle( tr2i18n( "Direction" ) );
    radioForward->setText( tr2i18n( "Forwar&d" ) );
    radioBackward->setText( tr2i18n( "Bac&kward" ) );
}

/****************************************************************************
** ReplaceDialog meta object code from reading C++ file 'replacedialog.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 "replacedialog.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 *ReplaceDialog::className() const
{
    return "ReplaceDialog";
}

TQMetaObject *ReplaceDialog::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_ReplaceDialog( "ReplaceDialog", &ReplaceDialog::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* ReplaceDialog::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 = TQDialog::staticMetaObject();
    static const TQUMethod slot_0 = {"init", 0, 0 };
    static const TQUMethod slot_1 = {"destroy", 0, 0 };
    static const TQUMethod slot_2 = {"doReplace", 0, 0 };
    static const TQUMethod slot_3 = {"doReplaceAll", 0, 0 };
    static const TQUParameter param_slot_4[] = {
	{ "e", &static_QUType_ptr, "EditorInterface", TQUParameter::In },
	{ "fw", &static_QUType_ptr, "TQObject", TQUParameter::In }
    };
    static const TQUMethod slot_4 = {"setEditor", 2, param_slot_4 };
    static const TQUMethod slot_5 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "init()", &slot_0, TQMetaData::Public },
	{ "destroy()", &slot_1, TQMetaData::Public },
	{ "doReplace()", &slot_2, TQMetaData::Public },
	{ "doReplaceAll()", &slot_3, TQMetaData::Public },
	{ "setEditor(EditorInterface*,TQObject*)", &slot_4, TQMetaData::Public },
	{ "languageChange()", &slot_5, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"ReplaceDialog", parentObject,
	slot_tbl, 6,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_ReplaceDialog.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool ReplaceDialog::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: init(); break;
    case 1: destroy(); break;
    case 2: doReplace(); break;
    case 3: doReplaceAll(); break;
    case 4: setEditor((EditorInterface*)static_QUType_ptr.get(_o+1),(TQObject*)static_QUType_ptr.get(_o+2)); break;
    case 5: languageChange(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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