diff options
| author | Josh Ferrell <josh@vector35.com> | 2024-09-18 14:38:09 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2024-09-18 15:47:06 -0400 |
| commit | a4b2f1ed627c2cc7aa6c09dac8390ebce2147d7b (patch) | |
| tree | 75c70df5651ab30cb028caaae0ffc58e674f295c /binaryninjaapi.h | |
| parent | 5504262629597323782184311297513669076903 (diff) | |
Custom flow graph layout support
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 3c6bc72a..4126c8cd 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -11005,6 +11005,18 @@ namespace BinaryNinja { */ void SetBasicBlock(BasicBlock* block); + /*! Set flow graph block X position + + \param x Flow graph block X position + */ + void SetX(int x); + + /*! Set flow graph block Y position + + \param y Flow graph block Y position + */ + void SetY(int y); + /*! Flow graph block X position \return Flow graph block X position @@ -11079,6 +11091,8 @@ namespace BinaryNinja { void SetHighlight(const BNHighlightColor& color); bool IsValidForGraph(FlowGraph* graph) const; + + void SetVisibilityRegion(int x, int y, int w, int h); }; /*! @@ -11200,17 +11214,22 @@ namespace BinaryNinja { */ size_t AddNode(FlowGraphNode* node); + + /*! Flow graph width \return Flow graph width */ int GetWidth() const; + void SetWidth(int width); /*! Flow graph height \return Flow graph height */ int GetHeight() const; + void SetHeight(int height); + std::vector<Ref<FlowGraphNode>> GetNodesInRegion(int left, int top, int right, int bottom); /*! Whether this graph is representing IL. @@ -11298,6 +11317,34 @@ namespace BinaryNinja { virtual Ref<FlowGraph> Update() override; }; + class FlowGraphLayout : public StaticCoreRefCountObject<BNFlowGraphLayout> + { + protected: + FlowGraphLayout(BNFlowGraphLayout* layout); + + static bool LayoutCallback(void* ctxt, BNFlowGraph* graph, BNFlowGraphNode** nodes, size_t nodeCount); + + std::string m_nameForRegister; + + public: + FlowGraphLayout(const std::string& name); + + static void Register(FlowGraphLayout* layout); + static Ref<FlowGraphLayout> GetByName(const std::string& name); + static std::vector<Ref<FlowGraphLayout>> GetFlowGraphLayouts(); + + std::string GetName() const; + virtual bool Layout(Ref<FlowGraph> graph, std::vector<Ref<FlowGraphNode>>& nodes); + }; + + class CoreFlowGraphLayout : public FlowGraphLayout + { + public: + CoreFlowGraphLayout(BNFlowGraphLayout* layout); + + virtual bool Layout(Ref<FlowGraph> graph, std::vector<Ref<FlowGraphNode>>& nodes) override; + }; + /*! \ingroup lowlevelil */ |
