texteditor.h
author insilmaril
Fri, 08 Jul 2005 07:24:43 +0000
changeset 118 d18eb6939d17
parent 106 4083860dd82e
child 131 16b250a57c17
permissions -rw-r--r--
changes for 1.6.9
     1 #ifndef TEXTEDITOR_H 
     2 #define TEXTEDITOR_H
     3 
     4 #include <qmainwindow.h>
     5 #include <qtextedit.h>
     6 #include <qaction.h>
     7 #include <qfontdatabase.h>
     8 #include <qcombobox.h>
     9 
    10 
    11 enum EditorState {inactiveEditor,emptyEditor,filledEditor};
    12 
    13 class TextEditor : public QMainWindow {
    14     Q_OBJECT
    15 public:
    16     TextEditor();
    17     ~TextEditor();
    18 
    19 	bool isEmpty();
    20 	void setShowWithMain (bool);
    21 	bool showWithMain ();
    22 	void setFontHint(const QString&);
    23 	QString getFontHint();
    24 	QString getFontHintDefault();
    25 	void setFilename (const QString&);
    26 	QString getFilename ();
    27 	void setFilenameHint (const QString&);
    28 	QString getFilenameHint ();
    29 	bool findText(const QString &, const bool &); // find Text 
    30 
    31 protected:
    32 	void setupFileActions();
    33 	void setupEditActions();
    34 	void setupFormatActions();
    35 	void setupSettingsActions();
    36     void closeEvent( QCloseEvent* );
    37 	
    38 
    39 public:
    40 	QString getText();
    41 
    42 public slots:
    43 	void editorChanged();	// received when text() changed
    44 	void setText(QString);	// set Text (by MapEditor)
    45 	void setInactive();		// Nothing can be entered
    46 	void editCopyAll();
    47 
    48 signals:
    49 	void textHasChanged();
    50 	void fontFamilyHasChanged();
    51 	void fontSizeHasChanged();
    52 	
    53 private slots:
    54     void textLoad();
    55     void textSaveAs();
    56     void textSave();
    57 	void textConvertPar();
    58 	void textJoinLines();
    59 	QString textConvertToASCII(const QString &);
    60 	void textExportAsASCII();
    61     void textPrint();
    62 	void textEditUndo();
    63     void toggleFonthint();
    64     void setFixedFont();
    65     void setVarFont();
    66     void textBold();
    67     void textUnderline();
    68     void textItalic();
    69     void textFamily( const QString &f );
    70     void textSize( const QString &p );
    71 	void textColor();
    72 	void textAlign(QAction*);
    73     void fontChanged( const QFont &f );
    74     void colorChanged( const QColor &c );
    75     void alignmentChanged( int a );
    76 	void enableActions();
    77 	void disableActions();
    78 
    79 private:
    80     QPrinter *printer;
    81     QTextEdit *e;
    82 	QPoint lastPos;			// save last position of window
    83     QString filename;
    84     QString filenameHint;
    85 
    86 	QBrush emptyPaper;		// setting the background color
    87 	QBrush filledPaper;		// depending on the state
    88 	QBrush inactivePaper;	// depending on the state
    89 	EditorState state;
    90 	bool showwithmain;		// same visibility as mainwindow?
    91 
    92 	QFont varFont;
    93 	QFont fixedFont;
    94     QComboBox
    95 	*comboFont,
    96 	*comboSize;
    97 	
    98 	QAction *actionFileLoad,
    99 	*actionFileSave,
   100 	*actionFileSaveAs,
   101 	*actionFilePrint,
   102 	*actionEditUndo,
   103 	*actionEditRedo,
   104 	*actionEditCopy,
   105 	*actionEditCut,
   106 	*actionEditPaste,
   107 	*actionEditDeleteAll,
   108 	*actionEditConvertPar,
   109 	*actionEditJoinLines,
   110 	*actionFormatUseFixedFont,
   111 	*actionSettingsVarFont,
   112 	*actionSettingsFixedFont,
   113 	*actionSettingsFonthintDefault,
   114     *actionTextBold,
   115 	*actionTextUnderline,
   116 	*actionTextItalic,
   117 	*actionTextColor,
   118 	*actionAlignLeft,
   119 	*actionAlignCenter,
   120 	*actionAlignRight,
   121 	*actionAlignJustify;
   122 };
   123 
   124 #endif