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