From e278b2452efbf1b653f2d7d6b6d8090128d02ff3 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 12 Jan 2021 05:18:05 -0500 Subject: More UIContext api --- ui/uicontext.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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 m_contexts; UIActionHandler m_globalActions; - static std::vector m_notifications; + static std::list m_notifications; static QPointer 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 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); -- cgit v1.3.1