summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-09-26 23:12:20 -0400
committerGlenn Smith <glenn@vector35.com>2022-09-29 21:02:20 -0400
commit207925956bb8ca0174d40523fda70bfb5bc7bd38 (patch)
tree4d5c8cba9ee2ad2b061f1e420c681a793ad397b8 /binaryninjaapi.h
parent5c8aa2ad6c2c03b37cacad4021f81310be12f375 (diff)
Interaction::RunProgressDialog
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 964e0636..bf00f6f2 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -1063,6 +1063,17 @@ namespace BinaryNinja {
*/
bool OpenUrl(const std::string& url);
+ /*! Run a given task in a background thread, and show an updating progress bar which the user can cancel
+
+ \param title Dialog title
+ \param canCancel If the task can be cancelled
+ \param task Function to perform the task, taking as a parameter a function which should be called to report progress
+ updates and check for cancellation. If the progress function returns false, the user has requested
+ to cancel, and the task should handle this appropriately.
+ \return True if not cancelled
+ */
+ bool RunProgressDialog(const std::string& title, bool canCancel, std::function<void(std::function<bool(size_t, size_t)> progress)> task);
+
/*!
Split a single progress function into equally sized subparts.
This function takes the original progress function and returns a new function whose signature
@@ -11286,6 +11297,7 @@ namespace BinaryNinja {
virtual BNMessageBoxButtonResult ShowMessageBox(const std::string& title, const std::string& text,
BNMessageBoxButtonSet buttons = OKButtonSet, BNMessageBoxIcon icon = InformationIcon) = 0;
virtual bool OpenUrl(const std::string& url) = 0;
+ virtual bool RunProgressDialog(const std::string& title, bool canCancel, std::function<void(std::function<bool(size_t, size_t)> progress)> task) = 0;
};
typedef BNPluginOrigin PluginOrigin;