mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
75 lines
1.7 KiB
C++
75 lines
1.7 KiB
C++
/**
|
|
* @file tab.h
|
|
* @ingroup Tabs
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef TAB_H
|
|
#define TAB_H
|
|
|
|
#include <QMainWindow>
|
|
#include <libcockatrice/utility/card_ref.h>
|
|
|
|
class QMenu;
|
|
class TabSupervisor;
|
|
class CardInfoDisplayWidget;
|
|
|
|
class Tab : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
signals:
|
|
void userEvent(bool globalEvent = true);
|
|
void tabTextChanged(Tab *tab, const QString &newTabText);
|
|
|
|
protected:
|
|
TabSupervisor *tabSupervisor;
|
|
void addTabMenu(QMenu *menu)
|
|
{
|
|
tabMenus.append(menu);
|
|
}
|
|
protected slots:
|
|
void showCardInfoPopup(const QPoint &pos, const CardRef &cardRef);
|
|
void deleteCardInfoPopup(const QString &cardName);
|
|
|
|
private:
|
|
CardRef currentCard;
|
|
bool contentsChanged;
|
|
CardInfoDisplayWidget *infoPopup;
|
|
QList<QMenu *> tabMenus;
|
|
|
|
public:
|
|
explicit Tab(TabSupervisor *_tabSupervisor);
|
|
[[nodiscard]] const QList<QMenu *> &getTabMenus() const
|
|
{
|
|
return tabMenus;
|
|
}
|
|
[[nodiscard]] TabSupervisor *getTabSupervisor() const
|
|
{
|
|
return tabSupervisor;
|
|
}
|
|
[[nodiscard]] bool getContentsChanged() const
|
|
{
|
|
return contentsChanged;
|
|
}
|
|
void setContentsChanged(bool _contentsChanged)
|
|
{
|
|
contentsChanged = _contentsChanged;
|
|
}
|
|
[[nodiscard]] virtual QString getTabText() const = 0;
|
|
virtual void retranslateUi() = 0;
|
|
|
|
/**
|
|
* Nicely asks to close the tab.
|
|
* Override this method to do checks or ask for confirmation before closing the tab.
|
|
* If you need to force close the tab, just call close() instead.
|
|
*
|
|
* @return True if the tab is successfully closed.
|
|
*/
|
|
virtual bool closeRequest();
|
|
|
|
virtual void tabActivated()
|
|
{
|
|
}
|
|
};
|
|
|
|
#endif
|