1 | /* -*- C++ -*- |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 1997 Tim D. Gilman <tdgilman@best.org> |
4 | SPDX-FileCopyrightText: 1998-2001 Mirko Boehm <mirko@kde.org> |
5 | SPDX-FileCopyrightText: 2007 John Layt <john@layt.net> |
6 | |
7 | SPDX-License-Identifier: LGPL-2.0-or-later |
8 | */ |
9 | |
10 | #ifndef KPOPUPFRAME_H |
11 | #define |
12 | |
13 | #include <kwidgetsaddons_export.h> |
14 | |
15 | #include <QFrame> |
16 | #include <memory> |
17 | |
18 | /*! |
19 | * \class KPopupFrame |
20 | * \inmodule KWidgetsAddons |
21 | * |
22 | * \brief Frame with popup menu behavior. |
23 | */ |
24 | class KWIDGETSADDONS_EXPORT : public QFrame |
25 | { |
26 | Q_OBJECT |
27 | protected: |
28 | void (QKeyEvent *e) override; |
29 | |
30 | void (QHideEvent *e) override; |
31 | |
32 | public Q_SLOTS: |
33 | /*! |
34 | * Close the popup window. This is called from the main widget, usually. |
35 | * |
36 | * \a r is the result returned from exec() |
37 | */ |
38 | void (int r); |
39 | |
40 | public: |
41 | /*! |
42 | * The constructor. Creates a dialog without buttons. |
43 | */ |
44 | (QWidget *parent = nullptr); |
45 | |
46 | () override; |
47 | |
48 | /*! |
49 | * Set the main widget. You cannot set the main widget from the constructor, |
50 | * since it must be a child of the frame itself. |
51 | * Be careful: the size is set to the main widgets size. It is up to you to |
52 | * set the main widgets correct size before setting it as the main |
53 | * widget. |
54 | */ |
55 | void setMainWidget(QWidget *m); |
56 | |
57 | /*! |
58 | * The resize event. Simply resizes the main widget to the whole |
59 | * widgets client size. |
60 | */ |
61 | void (QResizeEvent *resize) override; |
62 | |
63 | /*! |
64 | * Open the popup window at position pos. |
65 | */ |
66 | void (const QPoint &pos); |
67 | |
68 | /*! |
69 | * Execute the popup window. |
70 | */ |
71 | int (const QPoint &p); |
72 | |
73 | /*! |
74 | * Execute the popup window. |
75 | */ |
76 | int (int x, int y); |
77 | |
78 | Q_SIGNALS: |
79 | /*! |
80 | * |
81 | */ |
82 | void (); |
83 | |
84 | private: |
85 | friend class ; |
86 | std::unique_ptr<class KPopupFramePrivate> const ; |
87 | |
88 | Q_DISABLE_COPY() |
89 | }; |
90 | |
91 | #endif // KPOPUPFRAME_H |
92 | |