digiKam
visibilitycontroller.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 : 2008-03-14
7  * Description : User interface for searches
8  *
9  * Copyright (C) 2008-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_VISIBILITY_CONTROLLER_H
25 #define DIGIKAM_VISIBILITY_CONTROLLER_H
26 
27 // Qt includes
28 
29 #include <QWidget>
30 #include <QList>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 
36 namespace Digikam
37 {
38 
39 class DIGIKAM_GUI_EXPORT VisibilityObject
40 {
41 public:
42 
43  VisibilityObject() = default;
44  virtual ~VisibilityObject() = default;
45  virtual void setVisible(bool visible) = 0;
46  virtual bool isVisible() = 0;
47 
48 private:
49 
50  Q_DISABLE_COPY(VisibilityObject)
51 };
52 
53 // -----------------------------------------------------------------------------------
54 
55 class DIGIKAM_GUI_EXPORT VisibilityController : public QObject
56 {
57  Q_OBJECT
58 
59 public:
60 
61  enum Status
62  {
67  Hiding
68  };
69 
70 public:
71 
72  explicit VisibilityController(QObject* const parent);
73  ~VisibilityController() override;
74 
78  void setContainerWidget(QWidget* const widget);
79 
83  void addWidget(QWidget* const widget);
84 
89  void addObject(VisibilityObject* const object);
90 
94  bool isVisible() const;
95 
96 public Q_SLOTS:
97 
99  void setVisible(bool visible);
100  void show();
101  void hide();
102 
104  void triggerVisibility();
105 
106 protected:
107 
108  void step();
109  void allSteps();
110 
111  virtual void beginStatusChange();
112 
113 private:
114 
115  class Private;
116  Private* const d;
117 };
118 
119 } // namespace Digikam
120 
121 #endif // DIGIKAM_VISIBILITY_CONTROLLER_H
Definition: visibilitycontroller.h:56
Status
Definition: visibilitycontroller.h:62
@ Shown
Definition: visibilitycontroller.h:66
@ Unknown
Definition: visibilitycontroller.h:63
@ Showing
Definition: visibilitycontroller.h:65
@ Hidden
Definition: visibilitycontroller.h:64
Definition: visibilitycontroller.h:40
virtual bool isVisible()=0
virtual ~VisibilityObject()=default
virtual void setVisible(bool visible)=0
Definition: datefolderview.cpp:43