| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef TABCONTENT_H |
| 4 | #define TABCONTENT_H |
| 5 | |
| 6 | #include <QWidget> |
| 7 | |
| 8 | class WebBrowser; |
| 9 | |
| 10 | // Base class for all widgets which are placed inside tabs of TabWidget |
| 11 | class TabContent : public QWidget { |
| 12 | Q_OBJECT |
| 13 | |
| 14 | public: |
| 15 | explicit TabContent(QWidget* parent = nullptr); |
| 16 | virtual ~TabContent(); |
| 17 | |
| 18 | // Gets/sets current index of this TabContent. |
| 19 | // NOTE: This is the index under which this object lies |
| 20 | // in parent tab widget. |
| 21 | virtual int index() const; |
| 22 | virtual void setIndex(int index); |
| 23 | |
| 24 | // Obtains instance contained in this TabContent or nullptr. |
| 25 | // This can be used for obtaining the menu from the instance and so on. |
| 26 | virtual WebBrowser* webBrowser() const = 0; |
| 27 | |
| 28 | protected: |
| 29 | int m_index; |
| 30 | }; |
| 31 | |
| 32 | inline int TabContent::index() const { |
| 33 | return m_index; |
| 34 | } |
| 35 | |
| 36 | inline void TabContent::setIndex(int index) { |
| 37 | m_index = index; |
| 38 | } |
| 39 | |
| 40 | #endif // TABCONTENT_H |