1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 1999 Reginald Stadlbauer <reggie@kde.org>
4 SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org>
5 SPDX-FileCopyrightText: 2000 Nicolas Hadacek <haadcek@kde.org>
6 SPDX-FileCopyrightText: 2000 Kurt Granroth <granroth@kde.org>
7 SPDX-FileCopyrightText: 2000 Michael Koch <koch@kde.org>
8 SPDX-FileCopyrightText: 2001 Holger Freyther <freyther@kde.org>
9 SPDX-FileCopyrightText: 2002 Ellis Whitehead <ellis@kde.org>
10 SPDX-FileCopyrightText: 2003 Andras Mantia <amantia@kde.org>
11 SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <rodda@kde.org>
12
13 SPDX-License-Identifier: LGPL-2.0-only
14*/
15
16#ifndef KTOGGLETOOLBARACTION_H
17#define KTOGGLETOOLBARACTION_H
18
19#include <KToggleAction>
20#include <kxmlgui_export.h>
21#include <memory>
22
23class KToolBar;
24
25/**
26 * @class KToggleToolBarAction ktoggletoolbaraction.h KToggleToolBarAction
27 *
28 * An action that takes care of everything associated with
29 * showing or hiding a toolbar by a menu action. It will
30 * show or hide the toolbar with the given name when
31 * activated, and check or uncheck itself if the toolbar
32 * is manually shown or hidden.
33 *
34 * If you need to perform some additional action when the
35 * toolbar is shown or hidden, connect to the toggled(bool)
36 * signal. It will be emitted after the toolbar's
37 * visibility has changed, whenever it changes.
38 */
39class KXMLGUI_EXPORT KToggleToolBarAction : public KToggleAction
40{
41 Q_OBJECT
42
43public:
44 /**
45 * Create a KToggleToolBarAction that manages the @p toolBar.
46 *
47 * @param toolBar the toolbar to be managed
48 * @param parent the action's parent object.
49 */
50 KToggleToolBarAction(KToolBar *toolBar, const QString &text, QObject *parent);
51
52 /**
53 * Destroys toggle toolbar action.
54 */
55 ~KToggleToolBarAction() override;
56
57 /**
58 * Returns a pointer to the tool bar it manages.
59 */
60 KToolBar *toolBar();
61
62 /**
63 * Reimplemented from QObject.
64 */
65 bool eventFilter(QObject *watched, QEvent *event) override;
66
67private Q_SLOTS:
68 void slotToggled(bool checked) override;
69
70private:
71 std::unique_ptr<class KToggleToolBarActionPrivate> const d;
72};
73
74#endif
75

source code of kxmlgui/src/ktoggletoolbaraction.h