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 KACTIONMENU_H |
17 | #define |
18 | |
19 | #include <QToolButton> |
20 | #include <QWidgetAction> |
21 | #include <memory> |
22 | |
23 | #include <kwidgetsaddons_export.h> |
24 | |
25 | class ; |
26 | |
27 | /** |
28 | * @class KActionMenu kactionmenu.h KActionMenu |
29 | * |
30 | * A KActionMenu is an action that provides a sub-menu of other actions. |
31 | * |
32 | * Plugged in a popupmenu, it will create a submenu. |
33 | * Plugged in a toolbar, it will create a button with a popup menu. |
34 | * |
35 | * This is the action used by the XMLGUI since it holds other actions. |
36 | * If you want a submenu for selecting one tool among many (without icons), see KSelectAction. |
37 | */ |
38 | class KWIDGETSADDONS_EXPORT : public QWidgetAction |
39 | { |
40 | Q_OBJECT |
41 | Q_PROPERTY(QToolButton::ToolButtonPopupMode popupMode READ popupMode WRITE setPopupMode) |
42 | |
43 | public: |
44 | explicit (QObject *parent); |
45 | (const QString &text, QObject *parent); |
46 | (const QIcon &icon, const QString &text, QObject *parent); |
47 | () override; |
48 | |
49 | /** |
50 | * Adds @p action to this KActionMenu. |
51 | * The KActionMenu does not take ownership of @p action. |
52 | */ |
53 | void (QAction *action); |
54 | QAction *(); |
55 | void (QAction *before, QAction *action); |
56 | QAction *(QAction *before); |
57 | void (QAction *action); |
58 | |
59 | /** |
60 | * The currently used popup mode when plugged in a KToolBar. |
61 | * |
62 | * @see setPopupMode() |
63 | * |
64 | * @since 5.77 |
65 | */ |
66 | QToolButton::ToolButtonPopupMode () const; |
67 | |
68 | /** |
69 | * Determines the popup mode when plugged in a KToolBar. |
70 | * |
71 | * Options are: |
72 | * - QToolButton::InstantPopup |
73 | * Clicking anywhere on the toolbar button opens the popup menu. |
74 | * - QToolButton::DelayedPopup (Default) |
75 | * Clicking anywhere on the toolbar button triggers the default action. |
76 | * Clicking and holding the toolbar button opens the popup menu instead. |
77 | * - QToolButton::MenuButtonPopup |
78 | * The toolbar button is split in a main button (triggers default action) |
79 | * and an arrow button (opens the popup menu). |
80 | * |
81 | * @see QToolButton |
82 | * |
83 | * @since 5.77 |
84 | */ |
85 | void (QToolButton::ToolButtonPopupMode ); |
86 | |
87 | QWidget *(QWidget *parent) override; |
88 | |
89 | private: |
90 | std::unique_ptr<class KActionMenuPrivate> const ; |
91 | }; |
92 | |
93 | #endif |
94 | |