| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
|---|---|
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef TEXTEDITTABBAR_H |
| 6 | #define TEXTEDITTABBAR_H |
| 7 | |
| 8 | #include <QTabBar> |
| 9 | |
| 10 | class TextEditTabBarPrivate; |
| 11 | class TextEditTabBar : public QWidget |
| 12 | { |
| 13 | Q_OBJECT |
| 14 | friend class TextEditTabBarPrivate; |
| 15 | TextEditTabBarPrivate *const d; |
| 16 | public: |
| 17 | explicit TextEditTabBar(QWidget *parent = nullptr); |
| 18 | virtual ~TextEditTabBar(); |
| 19 | int fileIndex(const QString &file) const; |
| 20 | QString indexFile(int index) const; |
| 21 | void setFile(const QString &file); |
| 22 | void switchFile(const QString &file); |
| 23 | void removeTab(const QString &file); |
| 24 | int count() const; |
| 25 | int currentIndex() const; |
| 26 | QString currentFile() const; |
| 27 | void setCurrentIndex(int idx); |
| 28 | void setCloseButtonVisible(bool flag); |
| 29 | void setSplitButtonVisible(bool flag); |
| 30 | |
| 31 | signals: |
| 32 | void fileClosed(const QString &file); |
| 33 | void fileSwitched(const QString &file); |
| 34 | void saveFile(const QString &file); |
| 35 | void splitClicked(Qt::Orientation ori); |
| 36 | void closeClicked(); |
| 37 | |
| 38 | public slots: |
| 39 | void tabCloseRequested(int idx); |
| 40 | void doFileChanged(const QString &file); |
| 41 | void doFileSaved(const QString &file); |
| 42 | }; |
| 43 | |
| 44 | #endif // TEXTEDITTABBAR_H |
| 45 |