]> cloud.milkyroute.net Git - dolphin.git/blob - src/selectionmode/topbar.h
Merge remote-tracking branch 'fork/work/zakharafoniam/useful-groups'
[dolphin.git] / src / selectionmode / topbar.h
1 /*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2022 Felix Ernst <felixernst@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7
8 #ifndef SELECTIONMODETOPBAR_H
9 #define SELECTIONMODETOPBAR_H
10
11 #include "animatedheightwidget.h"
12
13 class KContextualHelpButton;
14 class QLabel;
15 class QPushButton;
16 class QResizeEvent;
17
18 namespace SelectionMode
19 {
20
21 /**
22 * @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.
23 */
24 class TopBar : public AnimatedHeightWidget
25 {
26 Q_OBJECT
27
28 public:
29 TopBar(QWidget *parent);
30
31 Q_SIGNALS:
32 void selectionModeLeavingRequested();
33
34 protected:
35 /** Calls updateLabelString() */
36 void resizeEvent(QResizeEvent *resizeEvent) override;
37
38 private:
39 /** Decides whether the m_fullLabelString or m_shortLabelString should be used based on available width. */
40 void updateLabelString();
41
42 /** @see AnimatedHeightWidget::preferredHeight() */
43 inline int preferredHeight() const override
44 {
45 return m_preferredHeight;
46 };
47
48 private:
49 QLabel *m_label;
50 KContextualHelpButton *m_contextualHelpButton;
51 QPushButton *m_closeButton;
52
53 /** @see updateLabelString() */
54 QString m_fullLabelString;
55 /** @see updateLabelString() */
56 QString m_shortLabelString;
57
58 int m_preferredHeight;
59 };
60
61 }
62
63 #endif // SELECTIONMODETOPBAR_H