forked from N1coc4colA/DA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdaddonbutton.h
78 lines (68 loc) · 2.01 KB
/
daddonbutton.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef DADDONICONBUTTON_H
#define DADDONICONBUTTON_H
#include "libda_global.h"
#include <QMenu>
#include <DIconButton>
LDA_BEGIN_NAMESPACE
/**
* @brief The DAddonIconButton class, special kit for menu popups
*/
class LIBDA_SHARED_EXPORT DAddonIconButton : public Dtk::Widget::DIconButton
{
Q_OBJECT
public:
Q_INVOKABLE explicit DAddonIconButton(QWidget *parent = nullptr, Qt::AnchorPoint xa = Qt::AnchorLeft, Qt::AnchorPoint ya = Qt::AnchorBottom);
Q_INVOKABLE ~DAddonIconButton();
/**
* @brief processAnchor, XY to use depending of the anchor (relative to this button). Not all are handled!
* @param a
* @return int
*/
Q_INVOKABLE int processAnchor(Qt::AnchorPoint a);
/**
* @brief anchorX, X anchor used to set pos when popuping the menu
* @return Qt::AnchorPoint
*/
Q_INVOKABLE Qt::AnchorPoint anchorX() const;
/**
* @brief anchorY, Y anchor used to set pos when popuping the menu
* @return Qt::AnchorPoint
*/
Q_INVOKABLE Qt::AnchorPoint anchorY() const;
Q_SIGNALS:
/**
* @brief clicked
*/
void clicked();
/**
* @brief requestMenu, emitted when clicked, if you need to use a QMenu
*/
void requestMenu();
public Q_SLOTS:
/**
* @brief setMenuXAnchor set the X menu's anchor when it'll be displayed
* @param a
*/
void setMenuXAnchor(Qt::AnchorPoint a);
/**
* @brief setMenuYAnchor, set the Y menu's anchor when it'll be displayed
* @param a
*/
void setMenuYAnchor(Qt::AnchorPoint a);
/**
* @brief setMenuAnchors, set the X & Y menu's anchors when it'll be displayed
* @param x
* @param y
*/
void setMenuAnchors(Qt::AnchorPoint x, Qt::AnchorPoint y);
/**
* @brief handleMenuRequest, calling this shows the menu, call it in response to @requestMenu()
* @param menu
*/
void handleMenuRequest(QMenu *menu);
private:
Qt::AnchorPoint anchor_x;
Qt::AnchorPoint anchor_y;
};
LDA_END_NAMESPACE
#endif // DADDONICONBUTTON_H