File indexing completed on 2024-05-05 05:57:02

0001 /*
0002   SPDX-FileCopyrightText: 2008-2014 Eike Hein <hein@kde.org>
0003   SPDX-FileCopyrightText: 2020 Ryan McCoskrie <work@ryanmccoskrie.me>
0004 
0005   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #ifndef TITLEBAR_H
0009 #define TITLEBAR_H
0010 
0011 #include <QMouseEvent>
0012 #include <QWidget>
0013 
0014 class MainWindow;
0015 class Skin;
0016 
0017 class QPushButton;
0018 
0019 class TitleBar : public QWidget
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit TitleBar(MainWindow *mainWindow);
0025     ~TitleBar();
0026 
0027     void setVisible(bool visible) override;
0028     void applySkin();
0029     void updateMask();
0030     void updateMenu();
0031 
0032     QString title();
0033 
0034     void setFocusButtonState(bool checked);
0035 
0036 public Q_SLOTS:
0037     void setTitle(const QString &title);
0038 
0039 protected:
0040     void resizeEvent(QResizeEvent *) override;
0041     void paintEvent(QPaintEvent *) override;
0042     void mouseMoveEvent(QMouseEvent *) override;
0043 
0044 private:
0045     void moveButtons();
0046 
0047     MainWindow *m_mainWindow;
0048     Skin *m_skin;
0049     bool m_visible = false;
0050 
0051     QPushButton *m_focusButton;
0052     QPushButton *m_menuButton;
0053     QPushButton *m_quitButton;
0054 
0055     QString m_title;
0056 };
0057 
0058 #endif