summaryrefslogtreecommitdiff
path: root/ui/uicontext.h
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2021-01-12 05:18:05 -0500
committerGlenn Smith <glenn@vector35.com>2021-05-26 16:48:25 -0400
commite278b2452efbf1b653f2d7d6b6d8090128d02ff3 (patch)
tree516181de1ae0e4cc87ecaa15881d035ae27e6d48 /ui/uicontext.h
parentae2688710f9101f620d5af770c7b67937b2a93b7 (diff)
More UIContext api
Diffstat (limited to 'ui/uicontext.h')
-rw-r--r--ui/uicontext.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/ui/uicontext.h b/ui/uicontext.h
index ffc5b325..25a5fac5 100644
--- a/ui/uicontext.h
+++ b/ui/uicontext.h
@@ -36,6 +36,9 @@ public:
virtual void OnViewChange(UIContext* context, ViewFrame* frame, const QString& type) { (void)context; (void)frame; (void)type; }
virtual void OnAddressChange(UIContext* context, ViewFrame* frame, View* view, const ViewLocation& location) { (void)context; (void)frame; (void)view; (void)location; };
+
+ virtual bool GetNameForFile(UIContext* context, FileContext* file, QString& name) { (void)context; (void)file; (void)name; return false; }
+ virtual bool GetNameForPath(UIContext* context, const QString& path, QString& name) { (void)context; (void)path; (void)name; return false; }
};
class BINARYNINJAUIAPI UIContextHandler
@@ -52,7 +55,7 @@ class BINARYNINJAUIAPI UIContext
static UIContextHandler* m_handler;
static std::set<UIContext*> m_contexts;
UIActionHandler m_globalActions;
- static std::vector<UIContextNotification*> m_notifications;
+ static std::list<UIContextNotification*> m_notifications;
static QPointer<PreviewWidget> m_currentPreview;
@@ -66,7 +69,23 @@ public:
virtual QMainWindow* mainWindow() = 0;
virtual void viewChanged(ViewFrame* frame, const QString& type);
virtual bool navigateForBinaryView(BinaryViewRef view, uint64_t addr);
+
+ virtual View* getCurrentView() = 0;
+ virtual ViewFrame* getCurrentViewFrame() = 0;
+ virtual UIActionHandler* getCurrentActionHandler() = 0;
+
virtual void createTabForWidget(const QString& name, QWidget* widget) = 0;
+ virtual QList<QWidget*> getTabs() = 0;
+ virtual QWidget* getTabForName(const QString& name) = 0;
+ virtual QWidget* getTabForFile(FileContext* file) = 0;
+ virtual QString getNameForTab(QWidget* tab) = 0;
+ virtual void activateTab(QWidget* tab) = 0;
+ virtual void closeTab(QWidget* tab) = 0;
+ virtual QWidget* getCurrentTab() = 0;
+
+ virtual View* getViewForTab(QWidget* tab) = 0;
+ virtual ViewFrame* getViewFrameForTab(QWidget* tab) = 0;
+
virtual bool openFilename(const QString& path, bool openOptions = false);
virtual ViewFrame* openFileContext(FileContext* file, const QString& forcedView = "", bool addTab = true);
@@ -91,6 +110,9 @@ public:
void NotifyOnViewChange(ViewFrame* frame, const QString& type);
void NotifyOnAddressChange(ViewFrame* frame, View* view, const ViewLocation& location);
+ QString GetNameForFile(FileContext* file);
+ QString GetNameForPath(const QString& path);
+
static void setHandler(UIContextHandler* handler);
static QSize getScaledWindowSize(int x, int y);