1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
#ifndef EDITORS_H
#define EDITORS_H
#include "mostQtHeaders.h"
class TxsTabWidget;
class LatexEditorView;
class EditorChangeProxy;
class Editors : public QWidget
{
Q_OBJECT
public:
explicit Editors(QWidget *parent = 0);
void addTabWidget(TxsTabWidget *w);
void addEditor(LatexEditorView *edView, bool asCurrent = true);
void insertEditor(LatexEditorView *edView, int index, bool asCurrent = true);
enum Position {AbsoluteFront, AbsoluteEnd, GroupFront, GroupEnd};
void moveEditor(LatexEditorView *edView, Position pos);
public slots:
void requestCloseEditor(LatexEditorView *edView);
void removeEditor(LatexEditorView *edView);
protected:
void insertEditor(LatexEditorView *edView, TxsTabWidget *tabWidget=0 /*current*/, int pos=-1 /*append*/, bool asCurrent = true);
void removeEditor(LatexEditorView *edView, TxsTabWidget *tabWidget);
public:
bool containsEditor(LatexEditorView *edView) const;
TxsTabWidget * currentTabWidget() const;
LatexEditorView * currentEditor() const;
void setCurrentEditor(LatexEditorView *edView);
QList<LatexEditorView *> editors();
signals:
void currentEditorChanged();
void editorAboutToChangeByTabClick(LatexEditorView *from, LatexEditorView *to);
void closeCurrentEditorRequested();
void listOfEditorsChanged();
void editorsReordered();
public slots:
void setCurrentEditorFromAction();
void setCurrentEditorFromSender();
bool activateNextEditor();
bool activatePreviousEditor();
protected slots:
void setCurrentGroup(int index);
bool activateTabWidgetFromSender();
void tabBarContextMenu(const QPoint &point);
void onEditorChangeByTabClick(LatexEditorView *from, LatexEditorView *to);
void moveToOtherTabGroup();
void moveToTabGroup(LatexEditorView *edView, TxsTabWidget *target, int targetIndex);
void changeSplitOrientation();
protected:
int tabGroupIndexFromEditor(LatexEditorView *edView) const;
TxsTabWidget *tabWidgetFromEditor(LatexEditorView *edView) const;
private:
QSplitter *splitter;
QList<TxsTabWidget *> tabGroups;
int currentGroupIndex;
EditorChangeProxy *changes;
};
class EditorChangeProxy : public QObject
{
Q_OBJECT
public:
EditorChangeProxy(Editors *e);
bool block();
void release();
signals:
void currentEditorChanged();
void listOfEditorsChanged();
public slots:
void currentEditorChange();
void listOfEditorsChange();
private:
Editors *editors;
LatexEditorView *currentEditorAtBlock;
QList<LatexEditorView *> listOfEditorsAtBlock;
bool blocked;
};
#endif // EDITORS_H
|