texteditor.h
branchvendor
changeset 28 512536ce7773
child 2 608f976aa7bb
child 106 4083860dd82e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/texteditor.h	Sun Jan 30 12:59:03 2005 +0000
     1.3 @@ -0,0 +1,123 @@
     1.4 +#ifndef TEXTEDITOR_H 
     1.5 +#define TEXTEDITOR_H
     1.6 +
     1.7 +#include <qmainwindow.h>
     1.8 +#include <qtextedit.h>
     1.9 +#include <qaction.h>
    1.10 +#include <qfontdatabase.h>
    1.11 +#include <qcombobox.h>
    1.12 +
    1.13 +
    1.14 +enum EditorState {inactiveEditor,emptyEditor,filledEditor};
    1.15 +
    1.16 +class TextEditor : public QMainWindow {
    1.17 +    Q_OBJECT
    1.18 +public:
    1.19 +    TextEditor();
    1.20 +    ~TextEditor();
    1.21 +
    1.22 +	bool isEmpty();
    1.23 +	void setShowWithMain (bool);
    1.24 +	bool showWithMain ();
    1.25 +	void setFontHint(const QString&);
    1.26 +	QString getFontHint();
    1.27 +	QString getFontHintDefault();
    1.28 +	void setFilename (const QString&);
    1.29 +	QString getFilename ();
    1.30 +	bool findText(const QString &, const bool &); // find Text 
    1.31 +
    1.32 +protected:
    1.33 +	void setupFileActions();
    1.34 +	void setupEditActions();
    1.35 +	void setupFormatActions();
    1.36 +	void setupSettingsActions();
    1.37 +    void closeEvent( QCloseEvent* );
    1.38 +	
    1.39 +
    1.40 +public:
    1.41 +	QString getText();
    1.42 +
    1.43 +public slots:
    1.44 +	void editorChanged();	// received when text() changed
    1.45 +	void setText(QString);	// set Text (by MapEditor)
    1.46 +	void setInactive();		// Nothing can be entered
    1.47 +	void editCopyAll();
    1.48 +
    1.49 +signals:
    1.50 +	void textHasChanged();
    1.51 +	void fontFamilyHasChanged();
    1.52 +	void fontSizeHasChanged();
    1.53 +	
    1.54 +private slots:
    1.55 +    void textLoad();
    1.56 +    void textSaveAs();
    1.57 +    void textSave();
    1.58 +	void textConvertPar();
    1.59 +	void textJoinLines();
    1.60 +	QString textConvertToASCII(const QString &);
    1.61 +	void textExportAsASCII();
    1.62 +    void textPrint();
    1.63 +	void textEditUndo();
    1.64 +    void toggleFonthint();
    1.65 +    void setFixedFont();
    1.66 +    void setVarFont();
    1.67 +    void textBold();
    1.68 +    void textUnderline();
    1.69 +    void textItalic();
    1.70 +    void textFamily( const QString &f );
    1.71 +    void textSize( const QString &p );
    1.72 +	void textColor();
    1.73 +	void textAlign(QAction*);
    1.74 +    void fontChanged( const QFont &f );
    1.75 +    void colorChanged( const QColor &c );
    1.76 +    void alignmentChanged( int a );
    1.77 +	void enableActions();
    1.78 +	void disableActions();
    1.79 +
    1.80 +private:
    1.81 +    QPrinter *printer;
    1.82 +    QTextEdit *e;
    1.83 +	QPoint lastPos;			// save last position of window
    1.84 +    QString filename;
    1.85 +
    1.86 +	QBrush emptyPaper;		// setting the background color
    1.87 +	QBrush filledPaper;		// depending on the state
    1.88 +	QBrush inactivePaper;	// depending on the state
    1.89 +	EditorState state;
    1.90 +	bool showwithmain;		// same visibility as mainwindow?
    1.91 +
    1.92 +	QFont varFont;
    1.93 +	QFont fixedFont;
    1.94 +    QComboBox
    1.95 +	*comboFont,
    1.96 +	*comboSize;
    1.97 +	
    1.98 +	QAction *actionFileLoad,
    1.99 +	*actionFileSave,
   1.100 +	*actionFileSaveAs,
   1.101 +	*actionFilePrint,
   1.102 +	*actionEditUndo,
   1.103 +	*actionEditRedo,
   1.104 +	*actionEditCopy,
   1.105 +	*actionEditCut,
   1.106 +	*actionEditPaste,
   1.107 +	*actionEditDeleteAll,
   1.108 +	*actionEditConvertPar,
   1.109 +	*actionEditJoinLines,
   1.110 +	*actionFormatUseFixedFont,
   1.111 +	*actionSettingsVarFont,
   1.112 +	*actionSettingsFixedFont,
   1.113 +	*actionSettingsFonthintDefault,
   1.114 +    *actionTextBold,
   1.115 +	*actionTextUnderline,
   1.116 +	*actionTextItalic,
   1.117 +	*actionTextColor,
   1.118 +	*actionAlignLeft,
   1.119 +	*actionAlignCenter,
   1.120 +	*actionAlignRight,
   1.121 +	*actionAlignJustify;
   1.122 +
   1.123 +
   1.124 +};
   1.125 +
   1.126 +#endif