2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@kde.org>
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8 #ifndef SELECTIONMODETOPBAR_H
9 #define SELECTIONMODETOPBAR_H
14 #include <QPropertyAnimation>
23 namespace SelectionMode
27 * @brief A bar appearing at the top of the view when in selection mode to make users aware of the selection mode state of the application.
29 class TopBar
: public QWidget
34 TopBar(QWidget
*parent
);
37 * Plays a show or hide animation while changing visibility.
38 * Therefore, if this method is used to hide this widget, the actual hiding will be postponed until the animation finished.
39 * @see QWidget::setVisible()
41 void setVisible(bool visible
, Animated animated
);
44 void selectionModeLeavingRequested();
47 /** Calls updateLabelString() */
48 void resizeEvent(QResizeEvent
*resizeEvent
) override
;
51 using QWidget::setVisible
; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget so we can still use it privately.
53 /** Decides whether the m_fullLabelString or m_shortLabelString should be used based on available width. */
54 void updateLabelString();
58 QPushButton
*m_closeButton
;
60 /** @see updateLabelString() */
61 QString m_fullLabelString
;
62 /** @see updateLabelString() */
63 QString m_shortLabelString
;
65 int m_preferredHeight
;
67 QPointer
<QPropertyAnimation
> m_heightAnimation
;
72 #endif // SELECTIONMODETOPBAR_H