digiKam
thumbbardock.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-15-08
7  * Description : A floatable/dockable widget for thumbnail bars (ThumbBarView
8  * and its descendants), providing i drag handle similar to the
9  * one on toolbars and a standard Action to show/hide the
10  * thumbnail bar. It inherits QDockWidget and can be used in
11  * the dock area's of a QMainWindow.
12  *
13  * Copyright (C) 2009 by Pieter Edelman <p dot edelman at gmx dot net>
14  *
15  * This program is free software; you can redistribute it
16  * and/or modify it under the terms of the GNU General
17  * Public License as published by the Free Software Foundation;
18  * either version 2, or (at your option)
19  * any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * ============================================================ */
27 
28 #ifndef DIGIKAM_THUMB_BAR_DOCK_H
29 #define DIGIKAM_THUMB_BAR_DOCK_H
30 
31 // Qt includes
32 
33 #include <QDockWidget>
34 #include <QPainter>
35 #include <QString>
36 #include <QStyle>
37 #include <QStyleOptionToolBar>
38 #include <QMainWindow>
39 #include <QAction>
40 
41 // Local includes
42 
43 #include "digikam_export.h"
44 
45 namespace Digikam
46 {
47 
51 class DragHandle : public QWidget
52 {
53  Q_OBJECT
54 
55 public:
56 
57  explicit DragHandle(QDockWidget* const);
58  ~DragHandle() override;
59 
60  QSize sizeHint() const override;
61  QSize minimumSizeHint() const override;
62 
63 protected:
64 
65  void paintEvent(QPaintEvent*) override;
66 
67 private Q_SLOTS:
68 
69  void dockLocationChanged(Qt::DockWidgetArea);
70 
71 private:
72 
73  class Private;
74  Private* const d;
75 };
76 
77 // --------------------------------------------------------------------------------
78 
83 class DIGIKAM_EXPORT ThumbBarDock : public QDockWidget
84 {
85  Q_OBJECT
86 
87 public:
88 
90  {
94  SHOULD_BE_SHOWN
95  };
96 
97 public:
98 
99  explicit ThumbBarDock(QWidget* const parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
100  ~ThumbBarDock() override;
101 
108  void reInitialize();
109 
113  QAction* getToggleAction(QObject* const parent,
114  const QString& caption = QString()) const;
115 
126  bool shouldBeVisible() const;
127  void setShouldBeVisible(bool);
128  void restoreVisibility();
129 
130  static QPixmap generateFuzzyRect(const QSize& size, const QColor& color, int radius, const QColor& fillColor = Qt::transparent);
131  static QPixmap generateFuzzyRectForGroup(const QSize& size, const QColor& color, int radius);
132 
133 public Q_SLOTS:
134 
135  void showThumbBar(bool);
136 
137 private:
138 
139  Visibility m_visible;
140 };
141 
142 } // namespace Digikam
143 
144 #endif // DIGIKAM_THUMB_BAR_DOCK_H
Definition: thumbbardock.h:52
void paintEvent(QPaintEvent *) override
Definition: thumbbardock.cpp:76
QSize minimumSizeHint() const override
Definition: thumbbardock.cpp:148
QSize sizeHint() const override
Definition: thumbbardock.cpp:129
DragHandle(QDockWidget *const)
Definition: thumbbardock.cpp:56
~DragHandle() override
Definition: thumbbardock.cpp:71
Definition: thumbbardock.h:84
Visibility
Definition: thumbbardock.h:90
@ WAS_SHOWN
Definition: thumbbardock.h:92
@ SHOULD_BE_HIDDEN
Definition: thumbbardock.h:93
@ WAS_HIDDEN
Definition: thumbbardock.h:91
Definition: datefolderview.cpp:43