summaryrefslogtreecommitdiff
path: root/binaryview.cpp
diff options
context:
space:
mode:
authorJosh F <josh@vector35.com>2022-07-06 13:40:52 -0400
committerJosh F <josh@vector35.com>2022-07-18 16:13:50 -0400
commit11458f3160e9c82d3e0f48b7013d952b729ec38b (patch)
tree4c2165c208fa9542a2c744b7a3f94be52877315e /binaryview.cpp
parentc3362d1ffb2c581c0647a1e9f480b98e7976fe25 (diff)
Memory map sidebar widget + segment/section notifications
Diffstat (limited to 'binaryview.cpp')
-rw-r--r--binaryview.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/binaryview.cpp b/binaryview.cpp
index 330a1412..db45cc88 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -240,6 +240,66 @@ void BinaryDataNotification::TypeFieldReferenceChangedCallback(
}
+void BinaryDataNotification::SegmentAddedCallback(void* ctxt, BNBinaryView* data, BNSegment* segment)
+{
+ BinaryDataNotification* notify = (BinaryDataNotification*)ctxt;
+ Ref<BinaryView> view = new BinaryView(BNNewViewReference(data));
+ Ref<Segment> segmentObj = new Segment(BNNewSegmentReference(segment));
+
+ notify->OnSegmentAdded(view, segmentObj);
+}
+
+
+void BinaryDataNotification::SegmentUpdatedCallback(void* ctxt, BNBinaryView* data, BNSegment* segment)
+{
+ BinaryDataNotification* notify = (BinaryDataNotification*)ctxt;
+ Ref<BinaryView> view = new BinaryView(BNNewViewReference(data));
+ Ref<Segment> segmentObj = new Segment(BNNewSegmentReference(segment));
+
+ notify->OnSegmentUpdated(view, segmentObj);
+}
+
+
+void BinaryDataNotification::SegmentRemovedCallback(void* ctxt, BNBinaryView* data, BNSegment* segment)
+{
+ BinaryDataNotification* notify = (BinaryDataNotification*)ctxt;
+ Ref<BinaryView> view = new BinaryView(BNNewViewReference(data));
+ Ref<Segment> segmentObj = new Segment(BNNewSegmentReference(segment));
+
+ notify->OnSegmentRemoved(view, segmentObj);
+}
+
+
+void BinaryDataNotification::SectionAddedCallback(void* ctxt, BNBinaryView* data, BNSection* section)
+{
+ BinaryDataNotification* notify = (BinaryDataNotification*)ctxt;
+ Ref<BinaryView> view = new BinaryView(BNNewViewReference(data));
+ Ref<Section> sectionObj = new Section(BNNewSectionReference(section));
+
+ notify->OnSectionAdded(view, sectionObj);
+}
+
+
+void BinaryDataNotification::SectionUpdatedCallback(void* ctxt, BNBinaryView* data, BNSection* section)
+{
+ BinaryDataNotification* notify = (BinaryDataNotification*)ctxt;
+ Ref<BinaryView> view = new BinaryView(BNNewViewReference(data));
+ Ref<Section> sectionObj = new Section(BNNewSectionReference(section));
+
+ notify->OnSectionUpdated(view, sectionObj);
+}
+
+
+void BinaryDataNotification::SectionRemovedCallback(void* ctxt, BNBinaryView* data, BNSection* section)
+{
+ BinaryDataNotification* notify = (BinaryDataNotification*)ctxt;
+ Ref<BinaryView> view = new BinaryView(BNNewViewReference(data));
+ Ref<Section> sectionObj = new Section(BNNewSectionReference(section));
+
+ notify->OnSectionRemoved(view, sectionObj);
+}
+
+
BinaryDataNotification::BinaryDataNotification()
{
m_callbacks.context = this;
@@ -267,6 +327,12 @@ BinaryDataNotification::BinaryDataNotification()
m_callbacks.typeUndefined = TypeUndefinedCallback;
m_callbacks.typeReferenceChanged = TypeReferenceChangedCallback;
m_callbacks.typeFieldReferenceChanged = TypeFieldReferenceChangedCallback;
+ m_callbacks.segmentAdded = SegmentAddedCallback;
+ m_callbacks.segmentUpdated = SegmentUpdatedCallback;
+ m_callbacks.segmentRemoved = SegmentRemovedCallback;
+ m_callbacks.sectionAdded = SectionAddedCallback;
+ m_callbacks.sectionUpdated = SectionUpdatedCallback;
+ m_callbacks.sectionRemoved = SectionRemovedCallback;
}