From e931fbb18ed367745411592e3c408c1a04155a57 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Sat, 21 Feb 2015 20:15:09 -0500 Subject: Handle sizing and complete event for disassembly view --- binaryninjaapi.h | 7 +++---- functiongraph.cpp | 29 +++++++++++++---------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 21d46554..ce400e38 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -722,13 +722,12 @@ namespace BinaryNinja void StartLayout(); bool IsLayoutComplete(); void OnComplete(const std::function& func); + void ClearOnComplete(); std::vector> GetBlocks() const; - int GetLeftExtent() const; - int GetTopExtent() const; - int GetRightExtent() const; - int GetBottomExtent() const; + int GetWidth() const; + int GetHeight() const; std::vector> GetBlocksInRegion(int left, int top, int right, int bottom); }; } diff --git a/functiongraph.cpp b/functiongraph.cpp index 476c2fe2..405046ea 100644 --- a/functiongraph.cpp +++ b/functiongraph.cpp @@ -65,6 +65,15 @@ void FunctionGraph::OnComplete(const std::function& func) } +void FunctionGraph::ClearOnComplete() +{ + // Must clear the callback with the core before clearing our own function object, as until it + // is cleared in the core it can be called at any time from a different thread. + BNClearFunctionGraphCompleteCallback(m_graph); + m_completeFunc = []() {}; +} + + vector> FunctionGraph::GetBlocks() const { size_t count; @@ -79,27 +88,15 @@ vector> FunctionGraph::GetBlocks() const } -int FunctionGraph::GetLeftExtent() const -{ - return BNGetFunctionGraphLeftExtent(m_graph); -} - - -int FunctionGraph::GetTopExtent() const -{ - return BNGetFunctionGraphTopExtent(m_graph); -} - - -int FunctionGraph::GetRightExtent() const +int FunctionGraph::GetWidth() const { - return BNGetFunctionGraphRightExtent(m_graph); + return BNGetFunctionGraphWidth(m_graph); } -int FunctionGraph::GetBottomExtent() const +int FunctionGraph::GetHeight() const { - return BNGetFunctionGraphBottomExtent(m_graph); + return BNGetFunctionGraphHeight(m_graph); } -- cgit v1.3.1