# Form implementation generated from reading ui file 'richedit.ui'
#
# Created: jeu jun 13 20:02:56 2002
#      by: The PerlTQt User Interface Compiler (puic)
#


use strict;

# the below is a manual addition... 
# maybe puic should do that.
# Allows to run a modular application from anywhere
use FindBin;
use lib "$FindBin::Bin";                                 

package EditorForm;
use TQt;
use TQt::isa qw(TQt::MainWindow);
use TQt::slots
    init => [],
    fileExit => [],
    fileNew => [],
    fileOpen => [],
    fileSave => [],
    fileSaveAs => [],
    helpAbout => [],
    helpContents => [],
    helpIndex => [],
    changeAlignment => ['TQAction*'],
    saveAndContinue => ['const TQString&'];
use TQt::attributes qw(
    textEdit
    fontComboBox
    SpinBox2
    menubar
    fileMenu
    editMenu
    PopupMenu_2
    helpMenu
    toolBar
    Toolbar
    fileNewAction
    fileOpenAction
    fileSaveAction
    fileSaveAsAction
    fileExitAction
    editUndoAction
    editRedoAction
    editCutAction
    editCopyAction
    editPasteAction
    helpContentsAction
    helpIndexAction
    helpAboutAction
    boldAction
    italicAction
    underlineAction
    alignActionGroup
    leftAlignAction
    rightAlignAction
    centerAlignAction
);


sub uic_load_pixmap_EditorForm
{
    my $pix = TQt::Pixmap();
    my $m = TQt::MimeSourceFactory::defaultFactory()->data(shift);

    if($m)
    {
        TQt::ImageDrag::decode($m, $pix);
    }

    return $pix;
}


sub NEW
{
    shift->SUPER::NEW(@_[0..2]);
    this->statusBar();

    if( this->name() eq "unnamed" )
    {
        this->setName("EditorForm");
    }
    this->resize(646,436);
    this->setCaption(this->trUtf8("Rich Edit"));

    this->setCentralWidget(TQt::Widget(this, "qt_central_widget"));
    my $EditorFormLayout = TQt::HBoxLayout(this->centralWidget(), 11, 6, '$EditorFormLayout');

    textEdit = TQt::TextEdit(this->centralWidget(), "textEdit");
    textEdit->setSizePolicy(TQt::SizePolicy(7, 7, 0, 0, textEdit->sizePolicy()->hasHeightForWidth()));
    textEdit->setTextFormat(&TQt::TextEdit::RichText);
    $EditorFormLayout->addWidget(textEdit);

    fileNewAction= TQt::Action(this,"fileNewAction");
    fileNewAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("filenew")));
    fileNewAction->setText(this->trUtf8("New"));
    fileNewAction->setMenuText(this->trUtf8("&New"));
    fileNewAction->setAccel(TQt::KeySequence(int(4194382)));
    fileOpenAction= TQt::Action(this,"fileOpenAction");
    fileOpenAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("fileopen")));
    fileOpenAction->setText(this->trUtf8("Open"));
    fileOpenAction->setMenuText(this->trUtf8("&Open..."));
    fileOpenAction->setAccel(TQt::KeySequence(int(4194383)));
    fileSaveAction= TQt::Action(this,"fileSaveAction");
    fileSaveAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("filesave")));
    fileSaveAction->setText(this->trUtf8("Save"));
    fileSaveAction->setMenuText(this->trUtf8("&Save"));
    fileSaveAction->setAccel(TQt::KeySequence(int(4194387)));
    fileSaveAsAction= TQt::Action(this,"fileSaveAsAction");
    fileSaveAsAction->setText(this->trUtf8("Save As"));
    fileSaveAsAction->setMenuText(this->trUtf8("Save &As..."));
    fileSaveAsAction->setAccel(TQt::KeySequence(int(0)));
    fileExitAction= TQt::Action(this,"fileExitAction");
    fileExitAction->setText(this->trUtf8("Exit"));
    fileExitAction->setMenuText(this->trUtf8("E&xit"));
    fileExitAction->setAccel(TQt::KeySequence(int(0)));
    editUndoAction= TQt::Action(this,"editUndoAction");
    editUndoAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("edit-undo")));
    editUndoAction->setText(this->trUtf8("Undo"));
    editUndoAction->setMenuText(this->trUtf8("&Undo"));
    editUndoAction->setAccel(TQt::KeySequence(int(4194394)));
    editRedoAction= TQt::Action(this,"editRedoAction");
    editRedoAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("edit-redo")));
    editRedoAction->setText(this->trUtf8("Redo"));
    editRedoAction->setMenuText(this->trUtf8("&Redo"));
    editRedoAction->setAccel(TQt::KeySequence(int(4194393)));
    editCutAction= TQt::Action(this,"editCutAction");
    editCutAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("editcut")));
    editCutAction->setText(this->trUtf8("Cut"));
    editCutAction->setMenuText(this->trUtf8("&Cut"));
    editCutAction->setAccel(TQt::KeySequence(int(4194392)));
    editCopyAction= TQt::Action(this,"editCopyAction");
    editCopyAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("editcopy")));
    editCopyAction->setText(this->trUtf8("Copy"));
    editCopyAction->setMenuText(this->trUtf8("C&opy"));
    editCopyAction->setAccel(TQt::KeySequence(int(4194371)));
    editPasteAction= TQt::Action(this,"editPasteAction");
    editPasteAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("editpaste")));
    editPasteAction->setText(this->trUtf8("Paste"));
    editPasteAction->setMenuText(this->trUtf8("&Paste"));
    editPasteAction->setAccel(TQt::KeySequence(int(4194390)));
    helpContentsAction= TQt::Action(this,"helpContentsAction");
    helpContentsAction->setText(this->trUtf8("Contents"));
    helpContentsAction->setMenuText(this->trUtf8("&Contents..."));
    helpContentsAction->setAccel(TQt::KeySequence(int(0)));
    helpIndexAction= TQt::Action(this,"helpIndexAction");
    helpIndexAction->setText(this->trUtf8("Index"));
    helpIndexAction->setMenuText(this->trUtf8("&Index..."));
    helpIndexAction->setAccel(TQt::KeySequence(int(0)));
    helpAboutAction= TQt::Action(this,"helpAboutAction");
    helpAboutAction->setText(this->trUtf8("About"));
    helpAboutAction->setMenuText(this->trUtf8("&About..."));
    helpAboutAction->setAccel(TQt::KeySequence(int(0)));
    boldAction= TQt::Action(this,"boldAction");
    boldAction->setToggleAction(1);
    boldAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("textbold")));
    boldAction->setText(this->trUtf8("bold"));
    boldAction->setMenuText(this->trUtf8("&Bold"));
    boldAction->setAccel(TQt::KeySequence(int(272629826)));
    italicAction= TQt::Action(this,"italicAction");
    italicAction->setToggleAction(1);
    italicAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("textitalic")));
    italicAction->setText(this->trUtf8("italic"));
    italicAction->setMenuText(this->trUtf8("&Italic"));
    italicAction->setAccel(TQt::KeySequence(int(272629833)));
    underlineAction= TQt::Action(this,"underlineAction");
    underlineAction->setToggleAction(1);
    underlineAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("textunder")));
    underlineAction->setText(this->trUtf8("underline"));
    underlineAction->setMenuText(this->trUtf8("&Underline"));
    underlineAction->setAccel(TQt::KeySequence(int(272629845)));
    alignActionGroup= TQt::ActionGroup(this,"alignActionGroup");
    alignActionGroup->setText(this->trUtf8("align"));
    alignActionGroup->setUsesDropDown(0);
    leftAlignAction= TQt::Action(alignActionGroup,"leftAlignAction");
    leftAlignAction->setToggleAction(1);
    leftAlignAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("textleft")));
    leftAlignAction->setText(this->trUtf8("left"));
    leftAlignAction->setMenuText(this->trUtf8("&Left"));
    leftAlignAction->setAccel(TQt::KeySequence(int(272629836)));
    rightAlignAction= TQt::Action(alignActionGroup,"rightAlignAction");
    rightAlignAction->setToggleAction(1);
    rightAlignAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("textright")));
    rightAlignAction->setText(this->trUtf8("right"));
    rightAlignAction->setMenuText(this->trUtf8("&Right"));
    rightAlignAction->setAccel(TQt::KeySequence(int(272629842)));
    centerAlignAction= TQt::Action(alignActionGroup,"centerAlignAction");
    centerAlignAction->setToggleAction(1);
    centerAlignAction->setIconSet(TQt::IconSet(uic_load_pixmap_EditorForm("textcenter")));
    centerAlignAction->setText(this->trUtf8("center"));
    centerAlignAction->setMenuText(this->trUtf8("&Center"));


    toolBar = TQt::ToolBar("", this, &DockTop);

    toolBar->setLabel(this->trUtf8("Tools"));
    fileNewAction->addTo(toolBar);
    fileOpenAction->addTo(toolBar);
    fileSaveAction->addTo(toolBar);
    toolBar->addSeparator;
    editUndoAction->addTo(toolBar);
    editRedoAction->addTo(toolBar);
    editCutAction->addTo(toolBar);
    editCopyAction->addTo(toolBar);
    editPasteAction->addTo(toolBar);
    Toolbar = TQt::ToolBar("", this, &DockTop);

    Toolbar->setLabel(this->trUtf8("Toolbar"));
    leftAlignAction->addTo(Toolbar);
    centerAlignAction->addTo(Toolbar);
    rightAlignAction->addTo(Toolbar);
    Toolbar->addSeparator;
    boldAction->addTo(Toolbar);
    italicAction->addTo(Toolbar);
    underlineAction->addTo(Toolbar);
    Toolbar->addSeparator;

    fontComboBox = TQt::ComboBox(0, Toolbar, "fontComboBox");

    SpinBox2 = TQt::SpinBox(Toolbar, "SpinBox2");
    SpinBox2->setMinValue(int(6));
    SpinBox2->setValue(int(10));


    menubar= TQt::MenuBar( this, "menubar");

    fileMenu= TQt::PopupMenu(this);
    fileNewAction->addTo(fileMenu);
    fileOpenAction->addTo(fileMenu);
    fileSaveAction->addTo(fileMenu);
    fileSaveAsAction->addTo(fileMenu);
    fileMenu->insertSeparator;
    fileExitAction->addTo(fileMenu);
    menubar->insertItem(this->trUtf8("&File"), fileMenu);

    editMenu= TQt::PopupMenu(this);
    editUndoAction->addTo(editMenu);
    editRedoAction->addTo(editMenu);
    editMenu->insertSeparator;
    editCutAction->addTo(editMenu);
    editCopyAction->addTo(editMenu);
    editPasteAction->addTo(editMenu);
    menubar->insertItem(this->trUtf8("&Edit"), editMenu);

    PopupMenu_2= TQt::PopupMenu(this);
    leftAlignAction->addTo(PopupMenu_2);
    rightAlignAction->addTo(PopupMenu_2);
    centerAlignAction->addTo(PopupMenu_2);
    PopupMenu_2->insertSeparator;
    boldAction->addTo(PopupMenu_2);
    italicAction->addTo(PopupMenu_2);
    underlineAction->addTo(PopupMenu_2);
    menubar->insertItem(this->trUtf8("F&ormat"), PopupMenu_2);

    helpMenu= TQt::PopupMenu(this);
    helpContentsAction->addTo(helpMenu);
    helpIndexAction->addTo(helpMenu);
    helpMenu->insertSeparator;
    helpAboutAction->addTo(helpMenu);
    menubar->insertItem(this->trUtf8("&Help"), helpMenu);



    TQt::Object::connect(fileNewAction, TQ_SIGNAL "activated()", this, TQ_SLOT "fileNew()");
    TQt::Object::connect(fileOpenAction, TQ_SIGNAL "activated()", this, TQ_SLOT "fileOpen()");
    TQt::Object::connect(fileSaveAction, TQ_SIGNAL "activated()", this, TQ_SLOT "fileSave()");
    TQt::Object::connect(fileSaveAsAction, TQ_SIGNAL "activated()", this, TQ_SLOT "fileSaveAs()");
    TQt::Object::connect(fileExitAction, TQ_SIGNAL "activated()", this, TQ_SLOT "fileExit()");
    TQt::Object::connect(helpIndexAction, TQ_SIGNAL "activated()", this, TQ_SLOT "helpIndex()");
    TQt::Object::connect(helpContentsAction, TQ_SIGNAL "activated()", this, TQ_SLOT "helpContents()");
    TQt::Object::connect(helpAboutAction, TQ_SIGNAL "activated()", this, TQ_SLOT "helpAbout()");
    TQt::Object::connect(SpinBox2, TQ_SIGNAL "valueChanged(int)", textEdit, TQ_SLOT "setPointSize(int)");
    TQt::Object::connect(editCutAction, TQ_SIGNAL "activated()", textEdit, TQ_SLOT "cut()");
    TQt::Object::connect(editPasteAction, TQ_SIGNAL "activated()", textEdit, TQ_SLOT "paste()");
    TQt::Object::connect(editCopyAction, TQ_SIGNAL "activated()", textEdit, TQ_SLOT "copy()");
    TQt::Object::connect(editRedoAction, TQ_SIGNAL "activated()", textEdit, TQ_SLOT "redo()");
    TQt::Object::connect(editUndoAction, TQ_SIGNAL "activated()", textEdit, TQ_SLOT "undo()");
    TQt::Object::connect(alignActionGroup, TQ_SIGNAL "selected(TQAction*)", this, TQ_SLOT "changeAlignment(TQAction*)");
    TQt::Object::connect(underlineAction, TQ_SIGNAL "toggled(bool)", textEdit, TQ_SLOT "setUnderline(bool)");
    TQt::Object::connect(italicAction, TQ_SIGNAL "toggled(bool)", textEdit, TQ_SLOT "setItalic(bool)");
    TQt::Object::connect(boldAction, TQ_SIGNAL "toggled(bool)", textEdit, TQ_SLOT "setBold(bool)");
    TQt::Object::connect(fontComboBox, TQ_SIGNAL "activated(const TQString&)", textEdit, TQ_SLOT "setFamily(const TQString&)");
    TQt::Object::connect(fontComboBox, TQ_SIGNAL "activated(const TQString&)", textEdit, TQ_SLOT "setFocus()");

    init();
}


sub init
{

    textEdit->setFocus;
    my $fonts = TQt::FontDatabase;
    fontComboBox->insertStringList($fonts->families);
    my $font = lc textEdit->family;
    for(my $i = 0; $i < fontComboBox->count; $i++) {
        if($font eq fontComboBox->text($i)) {
            fontComboBox->setCurrentItem($i);
            last;
        }
    }

}

sub fileExit
{
    print "EditorForm->fileExit(): Not implemented yet.\n";
}

sub fileNew
{
    print "EditorForm->fileNew(): Not implemented yet.\n";
}

sub fileOpen
{
    print "EditorForm->fileOpen(): Not implemented yet.\n";
}

sub fileSave
{
    print "EditorForm->fileSave(): Not implemented yet.\n";
}

sub fileSaveAs
{
    print "EditorForm->fileSaveAs(): Not implemented yet.\n";
}

sub helpAbout
{
    print "EditorForm->helpAbout(): Not implemented yet.\n";
}

sub helpContents
{
    print "EditorForm->helpContents(): Not implemented yet.\n";
}

sub helpIndex
{
    print "EditorForm->helpIndex(): Not implemented yet.\n";
}

sub changeAlignment
{
    print "EditorForm->changeAlignment(TQAction*): Not implemented yet.\n";
}

sub saveAndContinue
{
    print "EditorForm->saveAndContinue(const TQString&): Not implemented yet.\n";
}

1;


package main;

use TQt;
use EditorForm;
use imageCollection;

my $a = TQt::Application(\@ARGV);
TQt::Object::connect($a, TQ_SIGNAL("lastWindowClosed()"), $a, TQ_SLOT("quit()"));
my $w = EditorForm;
$a->setMainWidget($w);
$w->show;
exit $a->exec;


