RedPanda-CPP/RedPandaIDE/editorlist.h

66 lines
1.4 KiB
C
Raw Normal View History

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:
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
Editor* newEditor(const QString& filename, const QByteArray& encoding,
2021-04-07 21:13:15 +08:00
bool inProject, bool newFile,
QTabWidget* page=NULL);
Editor* getEditor(int index=-1, QTabWidget* tabsWidget=NULL) const;
2021-04-07 22:44:08 +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-06-07 11:02:03 +08:00
void applySettings();
2021-06-20 14:30:47 +08:00
void applyColorSchemes(const QString& name);
2021-06-23 22:38:02 +08:00
bool isFileOpened(const QString& name);
2021-07-26 00:22:08 +08:00
int pageCount();
Editor* operator[](int index);
2021-04-09 10:08:05 +08:00
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