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 |
29 | * \inmodule KWidgetsAddons |
30 | * |
31 | * \brief A KActionMenu is an action that provides a sub-menu of other actions. |
32 | * |
33 | * Plugged in a popupmenu, it will create a submenu. |
34 | * |
35 | * Plugged in a toolbar, it will create a button with a popup menu. |
36 | * |
37 | * This is the action used by the XMLGUI since it holds other actions. |
38 | * |
39 | * If you want a submenu for selecting one tool among many (without icons), see KSelectAction. |
40 | */ |
41 | class KWIDGETSADDONS_EXPORT : public QWidgetAction |
42 | { |
43 | Q_OBJECT |
44 | |
45 | /*! |
46 | * \property KActionMenu::popupMode |
47 | */ |
48 | Q_PROPERTY(QToolButton::ToolButtonPopupMode popupMode READ popupMode WRITE setPopupMode) |
49 | |
50 | public: |
51 | /*! |
52 | * |
53 | */ |
54 | explicit (QObject *parent); |
55 | |
56 | /*! |
57 | * |
58 | */ |
59 | (const QString &text, QObject *parent); |
60 | |
61 | /*! |
62 | * |
63 | */ |
64 | (const QIcon &icon, const QString &text, QObject *parent); |
65 | |
66 | () override; |
67 | |
68 | /*! |
69 | * Adds \a action to this KActionMenu. |
70 | * The KActionMenu does not take ownership of \a action. |
71 | */ |
72 | void (QAction *action); |
73 | |
74 | /*! |
75 | * |
76 | */ |
77 | QAction *(); |
78 | |
79 | /*! |
80 | * |
81 | */ |
82 | void (QAction *before, QAction *action); |
83 | |
84 | /*! |
85 | * |
86 | */ |
87 | QAction *(QAction *before); |
88 | |
89 | /*! |
90 | * |
91 | */ |
92 | void (QAction *action); |
93 | |
94 | /*! |
95 | * The currently used popup mode when plugged in a KToolBar. |
96 | * |
97 | * \sa setPopupMode() |
98 | * |
99 | * \since 5.77 |
100 | */ |
101 | QToolButton::ToolButtonPopupMode () const; |
102 | |
103 | /*! |
104 | * Determines the popup mode when plugged in a KToolBar. |
105 | * |
106 | * Options are: |
107 | * \list |
108 | * \li QToolButton::InstantPopup |
109 | * Clicking anywhere on the toolbar button opens the popup menu. |
110 | * \li QToolButton::DelayedPopup (Default) |
111 | * Clicking anywhere on the toolbar button triggers the default action. |
112 | * Clicking and holding the toolbar button opens the popup menu instead. |
113 | * \li QToolButton::MenuButtonPopup |
114 | * The toolbar button is split in a main button (triggers default action) |
115 | * and an arrow button (opens the popup menu). |
116 | * \endlist |
117 | * |
118 | * \sa QToolButton |
119 | * |
120 | * \since 5.77 |
121 | */ |
122 | void (QToolButton::ToolButtonPopupMode ); |
123 | |
124 | QWidget *(QWidget *parent) override; |
125 | |
126 | private: |
127 | std::unique_ptr<class KActionMenuPrivate> const ; |
128 | }; |
129 | |
130 | #endif |
131 | |