2024-04-03 01:24:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
|
2024-04-28 14:07:23 +00:00
|
|
|
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
2024-07-26 10:38:26 +00:00
|
|
|
* Copyright (c) 2024, Sam Atkins <sam@ladybird.org>
|
2024-04-03 01:24:17 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-07-26 10:38:26 +00:00
|
|
|
#include <QProxyStyle>
|
2024-04-03 01:24:17 +00:00
|
|
|
#include <QPushButton>
|
2024-04-03 01:38:01 +00:00
|
|
|
#include <QTabBar>
|
|
|
|
#include <QTabWidget>
|
2024-04-03 01:24:17 +00:00
|
|
|
|
2024-04-28 14:07:23 +00:00
|
|
|
class QContextMenuEvent;
|
2024-04-03 01:24:17 +00:00
|
|
|
class QEvent;
|
|
|
|
class QIcon;
|
|
|
|
class QWidget;
|
|
|
|
|
|
|
|
namespace Ladybird {
|
|
|
|
|
2024-04-03 01:38:01 +00:00
|
|
|
class TabBar : public QTabBar {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2024-04-28 14:07:23 +00:00
|
|
|
explicit TabBar(QWidget* parent = nullptr);
|
|
|
|
|
2024-04-03 01:38:01 +00:00
|
|
|
virtual QSize tabSizeHint(int index) const override;
|
2024-04-28 14:07:23 +00:00
|
|
|
virtual void contextMenuEvent(QContextMenuEvent* event) override;
|
2024-04-03 01:38:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TabWidget : public QTabWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit TabWidget(QWidget* parent = nullptr);
|
2024-07-26 13:39:26 +00:00
|
|
|
|
|
|
|
virtual void paintEvent(QPaintEvent*) override;
|
2024-04-03 01:38:01 +00:00
|
|
|
};
|
|
|
|
|
2024-04-03 01:24:17 +00:00
|
|
|
class TabBarButton : public QPushButton {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit TabBarButton(QIcon const& icon, QWidget* parent = nullptr);
|
|
|
|
|
|
|
|
protected:
|
2024-07-14 16:29:33 +00:00
|
|
|
virtual bool event(QEvent* event) override;
|
2024-04-03 01:24:17 +00:00
|
|
|
};
|
|
|
|
|
2024-07-26 10:38:26 +00:00
|
|
|
class TabStyle : public QProxyStyle {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit TabStyle(QObject* parent = nullptr);
|
|
|
|
|
|
|
|
virtual QRect subElementRect(QStyle::SubElement, QStyleOption const*, QWidget const*) const override;
|
|
|
|
};
|
|
|
|
|
2024-04-03 01:24:17 +00:00
|
|
|
}
|