diff options
| author | Josh Ferrell <josh@vector35.com> | 2024-01-22 16:11:19 -0500 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2024-01-22 16:11:19 -0500 |
| commit | 3dd22f40996fc128ffce6026e8e747ca66bcc21d (patch) | |
| tree | a5e7fc57dc620fc4d4a408ffdbf114bb66dcf91d /ui/uicontext.h | |
| parent | 96053ffc711aa27fcaeeb6cbfa89df0c253361f8 (diff) | |
Project support
Diffstat (limited to 'ui/uicontext.h')
| -rw-r--r-- | ui/uicontext.h | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/ui/uicontext.h b/ui/uicontext.h index 99abb84e..df4ff0a2 100644 --- a/ui/uicontext.h +++ b/ui/uicontext.h @@ -7,6 +7,7 @@ #include "binaryninjaapi.h" #include "action.h" #include "preview.h" +#include "uitypes.h" #define PREVIEW_HOVER_TIME 500 @@ -79,6 +80,41 @@ class BINARYNINJAUIAPI UIContextNotification return true; } /*! + Callback after a project is opened + \param context Context which opened the project + \param project Project that was opened + \param frame ViewFrame constructed to display the project + */ + virtual void OnAfterOpenProject(UIContext* context, ProjectRef project) + { + (void)context; + (void)project; + } + /*! + Callback before a project file is opened + \param context Context opening the project file + \param projectFile Project file that is being opened + \return True if the project file should be opened + */ + virtual bool OnBeforeOpenProjectFile(UIContext* context, ProjectFileRef projectFile) + { + (void)context; + (void)projectFile; + return true; + } + /*! + Callback after a project file is opened + \param context Context which opened the project file + \param projectFile Project file that was opened + \param frame ViewFrame constructed to display the project file + */ + virtual void OnAfterOpenProjectFile(UIContext* context, ProjectFileRef projectFile, ViewFrame* frame) + { + (void)context; + (void)projectFile; + (void)frame; + } + /*! Callback before a file (raw or database) is opened (after OnAfterOpenDatabase if opening a database) \param context Context opening the file \param file Context with the file and ui views @@ -264,6 +300,9 @@ class BINARYNINJAUIAPI UIContext bool NotifyOnBeforeOpenDatabase(FileMetadataRef metadata); bool NotifyOnAfterOpenDatabase(FileMetadataRef metadata, BinaryViewRef data); + void NotifyOnAfterOpenProject(ProjectRef project); + bool NotifyOnBeforeOpenProjectFile(ProjectFileRef projectFile); + void NotifyOnAfterOpenProjectFile(ProjectFileRef projectFile, ViewFrame* frame); bool NotifyOnBeforeOpenFile(FileContext* file); void NotifyOnAfterOpenFile(FileContext* file, ViewFrame* frame); bool NotifyOnBeforeSaveFile(FileContext* file, ViewFrame* frame); @@ -326,8 +365,9 @@ public: Open a tab containing the given widget with the given name \param name Name for tab \param widget Widget to display in the tab (optionally a ViewFrame) + \return Index of created tab */ - virtual void createTabForWidget(const QString& name, QWidget* widget) = 0; + virtual int createTabForWidget(const QString& name, QWidget* widget) = 0; /*! * Open a new window with the same file context and Navigate to a given location @@ -409,8 +449,12 @@ public: */ virtual std::vector<ViewFrame*> getAllViewFramesForTab(QWidget* tab) const = 0; + virtual ProjectRef getProject(); + virtual bool openFilename(const QString& path, bool openOptions = false); + virtual ProjectRef openProject(const QString& path); virtual ViewFrame* openFileContext(FileContext* file, const QString& forcedView = "", bool addTab = true); + virtual bool openProjectFile(ProjectFileRef file, ExternalLocationRef loc = nullptr, bool openWithOptions = false); virtual void recreateViewFrames(FileContext* file) = 0; UIActionHandler* globalActions() { return &m_globalActions; } |
