texteditor.h
branchqt4-port
changeset 2 608f976aa7bb
parent 0 7a96bd401351
child 5 5cfbba1dc2f8
     1.1 --- a/texteditor.h	Sun Jan 30 12:58:47 2005 +0000
     1.2 +++ b/texteditor.h	Tue Jun 06 14:58:11 2006 +0000
     1.3 @@ -1,16 +1,21 @@
     1.4 +/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
     1.5  #ifndef TEXTEDITOR_H 
     1.6  #define TEXTEDITOR_H
     1.7  
     1.8 -#include <qmainwindow.h>
     1.9 -#include <qtextedit.h>
    1.10 +#include <q3mainwindow.h>
    1.11 +#include <q3textedit.h>
    1.12  #include <qaction.h>
    1.13  #include <qfontdatabase.h>
    1.14  #include <qcombobox.h>
    1.15 +//Added by qt3to4:
    1.16 +#include <QCloseEvent>
    1.17  
    1.18  
    1.19  enum EditorState {inactiveEditor,emptyEditor,filledEditor};
    1.20  
    1.21 -class TextEditor : public QMainWindow {
    1.22 +class MyTextEdit;
    1.23 +
    1.24 +class TextEditor : public Q3MainWindow {
    1.25      Q_OBJECT
    1.26  public:
    1.27      TextEditor();
    1.28 @@ -24,6 +29,8 @@
    1.29  	QString getFontHintDefault();
    1.30  	void setFilename (const QString&);
    1.31  	QString getFilename ();
    1.32 +	void setFilenameHint (const QString&);
    1.33 +	QString getFilenameHint ();
    1.34  	bool findText(const QString &, const bool &); // find Text 
    1.35  
    1.36  protected:
    1.37 @@ -54,7 +61,6 @@
    1.38      void textSave();
    1.39  	void textConvertPar();
    1.40  	void textJoinLines();
    1.41 -	QString textConvertToASCII(const QString &);
    1.42  	void textExportAsASCII();
    1.43      void textPrint();
    1.44  	void textEditUndo();
    1.45 @@ -68,17 +74,20 @@
    1.46      void textSize( const QString &p );
    1.47  	void textColor();
    1.48  	void textAlign(QAction*);
    1.49 +	void textVAlign();
    1.50      void fontChanged( const QFont &f );
    1.51      void colorChanged( const QColor &c );
    1.52      void alignmentChanged( int a );
    1.53 +    void verticalAlignmentChanged(int a);
    1.54  	void enableActions();
    1.55  	void disableActions();
    1.56  
    1.57  private:
    1.58      QPrinter *printer;
    1.59 -    QTextEdit *e;
    1.60 +    MyTextEdit *e;
    1.61  	QPoint lastPos;			// save last position of window
    1.62      QString filename;
    1.63 +    QString filenameHint;
    1.64  
    1.65  	QBrush emptyPaper;		// setting the background color
    1.66  	QBrush filledPaper;		// depending on the state
    1.67 @@ -115,9 +124,39 @@
    1.68  	*actionAlignLeft,
    1.69  	*actionAlignCenter,
    1.70  	*actionAlignRight,
    1.71 -	*actionAlignJustify;
    1.72 +	*actionAlignJustify,
    1.73 +	*actionAlignSubScript,
    1.74 +	*actionAlignSuperScript;
    1.75 +};
    1.76  
    1.77 -
    1.78 +/* Wraps currentVerticalAlignmentChanged(VerticalAlignment)
    1.79 + * to currentVerticalAlignmentChanged(int) 
    1.80 + * this way the signal can be used without use of the internal 
    1.81 + * VerticalAlignment enum of QTextEdit 
    1.82 + * If VerticalAlignment has been a global like the normal alignment there
    1.83 + * have been no problems!
    1.84 + */
    1.85 + 
    1.86 +class MyTextEdit : public Q3TextEdit 
    1.87 +{
    1.88 +    Q_OBJECT;
    1.89 + public:
    1.90 +    MyTextEdit(QWidget *parent, const char *name) : Q3TextEdit(parent, name) {
    1.91 +	connect(this, 
    1.92 +		SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)),
    1.93 +		this, 
    1.94 +		SLOT(verticalAlignmentChanged(VerticalAlignment)));
    1.95 +    }
    1.96 +    int verticalAlignment() const { return m_verticalAlignment; } 
    1.97 + signals:
    1.98 +    void currentVerticalAlignmentChanged(int a);
    1.99 + public slots:
   1.100 +    void verticalAlignmentChanged(VerticalAlignment a) {
   1.101 +     m_verticalAlignment = a;
   1.102 +	emit currentVerticalAlignmentChanged((int)a);
   1.103 +    }
   1.104 + private: 
   1.105 + int m_verticalAlignment;
   1.106  };
   1.107  
   1.108  #endif