2021-04-06 23:10:57 +08:00
|
|
|
#ifndef EDITORLIST_H
|
|
|
|
#define EDITORLIST_H
|
|
|
|
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QSplitter>
|
|
|
|
#include <QWidget>
|
2021-04-07 21:13:15 +08:00
|
|
|
#include "utils.h"
|
2021-04-06 23:10:57 +08:00
|
|
|
|
2021-04-07 21:13:15 +08:00
|
|
|
class Editor;
|
|
|
|
class EditorList
|
2021-04-06 23:10:57 +08:00
|
|
|
{
|
|
|
|
public:
|
2021-04-11 12:39:22 +08:00
|
|
|
enum class ShowType{
|
2021-04-06 23:10:57 +08:00
|
|
|
lstNone,
|
|
|
|
lstLeft,
|
|
|
|
lstRight,
|
|
|
|
lstBoth
|
|
|
|
};
|
|
|
|
|
2021-04-07 21:13:15 +08:00
|
|
|
explicit EditorList(QTabWidget* leftPageWidget,
|
|
|
|
QTabWidget* rightPageWidget,
|
|
|
|
QSplitter* splitter,
|
|
|
|
QWidget* panel);
|
2021-04-06 23:10:57 +08:00
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
Editor* newEditor(const QString& filename, const QByteArray& encoding,
|
2021-04-07 21:13:15 +08:00
|
|
|
bool inProject, bool newFile,
|
|
|
|
QTabWidget* page=NULL);
|
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
Editor* getEditor(int index=-1, QTabWidget* tabsWidget=NULL) const;
|
2021-04-07 22:44:08 +08:00
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
bool closeEditor(Editor* editor, bool transferFocus=true, bool force=false);
|
2021-04-07 22:44:08 +08:00
|
|
|
|
2021-04-09 10:08:05 +08:00
|
|
|
bool closeAll(bool force = false);
|
|
|
|
|
2021-04-29 20:54:44 +08:00
|
|
|
Editor* getOpenedEditorByFilename(const QString& filename);
|
|
|
|
|
|
|
|
Editor* getEditorByFilename(const QString& filename);
|
2021-04-11 21:33:08 +08:00
|
|
|
|
2021-04-09 10:08:05 +08:00
|
|
|
void beginUpdate();
|
|
|
|
void endUpdate();
|
|
|
|
|
2021-04-07 21:13:15 +08:00
|
|
|
private:
|
2021-04-09 10:08:05 +08:00
|
|
|
QTabWidget* getNewEditorPageControl() const;
|
|
|
|
QTabWidget* getFocusedPageControl() const;
|
2021-04-06 23:10:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
ShowType mLayout;
|
|
|
|
QTabWidget *mLeftPageWidget;
|
|
|
|
QTabWidget *mRightPageWidget;
|
|
|
|
QSplitter *mSplitter;
|
|
|
|
QWidget *mPanel;
|
|
|
|
int mUpdateCount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITORLIST_H
|