| 1 |
/* This file is part of the KDE project |
| 2 |
SPDX-FileCopyrightText: 2007 Marijn Kruisselbrink <[email protected]> |
| 3 |
|
| 4 |
SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 |
*/ |
| 6 |
#ifndef KODOCKWIDGETTITLEBAR_H_ |
| 7 |
#define KODOCKWIDGETTITLEBAR_H_ |
| 8 |
|
| 9 |
#include "kowidgets_export.h" |
| 10 |
#include <QDockWidget> |
| 11 |
|
| 12 |
/** |
| 13 |
* @short A custom title bar for dock widgets. |
| 14 |
* |
| 15 |
* Allow customization such as collapsable, or hiding text. |
| 16 |
* |
| 17 |
* @see KoDockWidgetTitleBarButton |
| 18 |
*/ |
| 19 |
class KOWIDGETS_EXPORT KoDockWidgetTitleBar : public QWidget |
| 20 |
{ |
| 21 |
Q_OBJECT |
| 22 |
public: |
| 23 |
explicit KoDockWidgetTitleBar(QDockWidget *dockWidget); |
| 24 |
~KoDockWidgetTitleBar() override; |
| 25 |
|
| 26 |
QSize minimumSizeHint() const override; ///< reimplemented from QWidget |
| 27 |
QSize sizeHint() const override; ///< reimplemented from QWidget |
| 28 |
|
| 29 |
enum TextVisibilityMode {TextCanBeInvisible, FullTextAlwaysVisible}; |
| 30 |
/// Define whether the minimal width should ensure that the full text is visible. |
| 31 |
/// textVisibilityMode is FullTextAlwaysVisible by default |
| 32 |
void setTextVisibilityMode(TextVisibilityMode textVisibilityMode); |
| 33 |
|
| 34 |
void updateIcons(); |
| 35 |
|
| 36 |
public Q_SLOTS: |
| 37 |
void setCollapsed(bool collapsed); |
| 38 |
void setLocked(bool locked); |
| 39 |
void setCollapsable(bool collapsable); |
| 40 |
|
| 41 |
protected: |
| 42 |
void paintEvent(QPaintEvent* event) override; ///< reimplemented from QWidget |
| 43 |
void resizeEvent(QResizeEvent* event) override; ///< reimplemented from QWidget |
| 44 |
private: |
| 45 |
Q_PRIVATE_SLOT(d, void toggleFloating()) |
| 46 |
Q_PRIVATE_SLOT(d, void toggleCollapsed()) |
| 47 |
Q_PRIVATE_SLOT(d, void topLevelChanged(bool topLevel)) |
| 48 |
Q_PRIVATE_SLOT(d, void featuresChanged(QDockWidget::DockWidgetFeatures)) |
| 49 |
|
| 50 |
class Private; |
| 51 |
Private * const d; |
| 52 |
}; |
| 53 |
|
| 54 |
#endif // KODOCKWIDGETTITLEBAR_H_ |