summaryrefslogtreecommitdiff
path: root/ui/menus.h
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2021-01-22 20:54:32 -0500
committerGlenn Smith <glenn@vector35.com>2021-04-02 16:16:47 -0400
commit62135f163f19d3362d0c95b5acd63837dab89a39 (patch)
tree4eaf32135412409c1a2ddb7fa30e010f31a87cfa /ui/menus.h
parent5080deaf69b1a3b3c3a09b63e82f3310ce02cb5c (diff)
Make status bar buttons full height + adjustable color
Diffstat (limited to 'ui/menus.h')
-rw-r--r--ui/menus.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/ui/menus.h b/ui/menus.h
index 4b0cc3a5..50b92785 100644
--- a/ui/menus.h
+++ b/ui/menus.h
@@ -12,8 +12,10 @@
#include "action.h"
#include "viewframe.h"
-class BINARYNINJAUIAPI ContextMenuManager
+class BINARYNINJAUIAPI ContextMenuManager: public QObject
{
+ Q_OBJECT
+
QWidget* m_parent;
QPointer<QMenu> m_menu;
MenuInstance* m_instance;
@@ -24,8 +26,14 @@ public:
~ContextMenuManager();
QMenu* create();
MenuInstance* show(View* view);
+ MenuInstance* show(QPoint pos, View* view);
MenuInstance* show(Menu* source, UIActionHandler* handler);
+ MenuInstance* show(QPoint pos, Menu* source, UIActionHandler* handler);
bool isActive() { return !m_menu.isNull(); }
+
+Q_SIGNALS:
+ void onOpen();
+ void onClose();
};
@@ -34,22 +42,30 @@ class BINARYNINJAUIAPI MenuHelper: public QLabel
Q_OBJECT
QPalette::ColorRole m_backgroundRole;
+ QPalette::ColorRole m_activeBackgroundRole;
+ QPalette::ColorRole m_pressedBackgroundRole;
QPalette::ColorRole m_foregroundRole;
QPalette::ColorRole m_activeForegroundRole;
+ QPalette::ColorRole m_pressedForegroundRole;
protected:
Menu m_menu;
- ContextMenuManager m_contextMenuManager;
+ ContextMenuManager* m_contextMenuManager;
QTimer* m_timer;
bool m_activeOnHover = true;
+ bool m_active;
+ bool m_pressed;
public:
MenuHelper() { }
MenuHelper(QWidget* parent, bool activeOnHover = true);
- void setBackgroundColorRole(QPalette::ColorRole role = QPalette::Highlight);
- void setForegroundColorRole(QPalette::ColorRole role = QPalette::WindowText);
- void setActiveForegroundColorRole(QPalette::ColorRole role = QPalette::HighlightedText);
+ void setBackgroundColorRole(QPalette::ColorRole role);
+ void setActiveBackgroundColorRole(QPalette::ColorRole role);
+ void setPressedBackgroundColorRole(QPalette::ColorRole role);
+ void setForegroundColorRole(QPalette::ColorRole role);
+ void setActiveForegroundColorRole(QPalette::ColorRole role);
+ void setPressedForegroundColorRole(QPalette::ColorRole role);
Q_SIGNALS:
void clicked();
@@ -67,5 +83,8 @@ protected:
void enterEvent(QEnterEvent* event) override;
#endif
void leaveEvent(QEvent* event) override;
+ void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
+
+ void updateColors();
};