summaryrefslogtreecommitdiffstats
path: root/PerlTQt/examples/richedit/richedit.pl
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-01 18:29:30 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-01 18:29:30 -0600
commitb2af005db21bd8fd068cb79b2ae700953128af2c (patch)
treeabd0ed633726bf0bbecb57d30e92836c31e02695 /PerlTQt/examples/richedit/richedit.pl
parentc1b9383f2032d82db5eb8918dca885e37a901dde (diff)
downloadlibtqt-perl-b2af005db21bd8fd068cb79b2ae700953128af2c.tar.gz
libtqt-perl-b2af005db21bd8fd068cb79b2ae700953128af2c.zip
Move PerlQt
Diffstat (limited to 'PerlTQt/examples/richedit/richedit.pl')
-rw-r--r--PerlTQt/examples/richedit/richedit.pl376
1 files changed, 376 insertions, 0 deletions
diff --git a/PerlTQt/examples/richedit/richedit.pl b/PerlTQt/examples/richedit/richedit.pl
new file mode 100644
index 0000000..d2dee84
--- /dev/null
+++ b/PerlTQt/examples/richedit/richedit.pl
@@ -0,0 +1,376 @@
+# 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("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("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, TQT_SIGNAL "activated()", this, TQT_SLOT "fileNew()");
+ TQt::Object::connect(fileOpenAction, TQT_SIGNAL "activated()", this, TQT_SLOT "fileOpen()");
+ TQt::Object::connect(fileSaveAction, TQT_SIGNAL "activated()", this, TQT_SLOT "fileSave()");
+ TQt::Object::connect(fileSaveAsAction, TQT_SIGNAL "activated()", this, TQT_SLOT "fileSaveAs()");
+ TQt::Object::connect(fileExitAction, TQT_SIGNAL "activated()", this, TQT_SLOT "fileExit()");
+ TQt::Object::connect(helpIndexAction, TQT_SIGNAL "activated()", this, TQT_SLOT "helpIndex()");
+ TQt::Object::connect(helpContentsAction, TQT_SIGNAL "activated()", this, TQT_SLOT "helpContents()");
+ TQt::Object::connect(helpAboutAction, TQT_SIGNAL "activated()", this, TQT_SLOT "helpAbout()");
+ TQt::Object::connect(SpinBox2, TQT_SIGNAL "valueChanged(int)", textEdit, TQT_SLOT "setPointSize(int)");
+ TQt::Object::connect(editCutAction, TQT_SIGNAL "activated()", textEdit, TQT_SLOT "cut()");
+ TQt::Object::connect(editPasteAction, TQT_SIGNAL "activated()", textEdit, TQT_SLOT "paste()");
+ TQt::Object::connect(editCopyAction, TQT_SIGNAL "activated()", textEdit, TQT_SLOT "copy()");
+ TQt::Object::connect(editRedoAction, TQT_SIGNAL "activated()", textEdit, TQT_SLOT "redo()");
+ TQt::Object::connect(editUndoAction, TQT_SIGNAL "activated()", textEdit, TQT_SLOT "undo()");
+ TQt::Object::connect(alignActionGroup, TQT_SIGNAL "selected(TQAction*)", this, TQT_SLOT "changeAlignment(TQAction*)");
+ TQt::Object::connect(underlineAction, TQT_SIGNAL "toggled(bool)", textEdit, TQT_SLOT "setUnderline(bool)");
+ TQt::Object::connect(italicAction, TQT_SIGNAL "toggled(bool)", textEdit, TQT_SLOT "setItalic(bool)");
+ TQt::Object::connect(boldAction, TQT_SIGNAL "toggled(bool)", textEdit, TQT_SLOT "setBold(bool)");
+ TQt::Object::connect(fontComboBox, TQT_SIGNAL "activated(const TQString&)", textEdit, TQT_SLOT "setFamily(const TQString&)");
+ TQt::Object::connect(fontComboBox, TQT_SIGNAL "activated(const TQString&)", textEdit, TQT_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, TQT_SIGNAL("lastWindowClosed()"), $a, TQT_SLOT("quit()"));
+my $w = EditorForm;
+$a->setMainWidget($w);
+$w->show;
+exit $a->exec;
+
+