2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@zohomail.eu>
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>
24 namespace SelectionMode
28 * @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.
30 class TopBar
: public QWidget
35 TopBar(QWidget
*parent
);
38 * Plays a show or hide animation while changing visibility.
39 * Therefore, if this method is used to hide this widget, the actual hiding will be postponed until the animation finished.
40 * @see QWidget::setVisible()
42 void setVisible(bool visible
, Animated animated
);
45 void leaveSelectionModeRequested();
48 /** Calls updateLabelString() */
49 void resizeEvent(QResizeEvent
*resizeEvent
) override
;
52 using QWidget::setVisible
; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget so we can still use it privately.
54 /** Decides whether the m_fullLabelString or m_shortLabelString should be used based on available width. */
55 void updateLabelString();
59 QPushButton
*m_closeButton
;
61 /** @see updateLabelString() */
62 QString m_fullLabelString
;
63 /** @see updateLabelString() */
64 QString m_shortLabelString
;
66 int m_preferredHeight
;
68 QPointer
<QPropertyAnimation
> m_heightAnimation
;
73 #endif // SELECTIONMODETOPBAR_H