summaryrefslogtreecommitdiff
path: root/ui/createarraydialog.h
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2024-04-22 15:43:09 +0800
committerXusheng <xusheng@vector35.com>2024-04-25 12:01:00 +0800
commit6ba7605eafb5419b82e2721026e9dc922de95347 (patch)
tree390eb535f6d8272d3ac9b18df22904a7d3ff99d0 /ui/createarraydialog.h
parent803ac2fca1f9bc4b30806615e3927fcd9b3edc69 (diff)
Automatically update the element count when the type is changed in the create array dialog. Fix https://github.com/Vector35/binaryninja-api/issues/5284
Diffstat (limited to 'ui/createarraydialog.h')
-rw-r--r--ui/createarraydialog.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/ui/createarraydialog.h b/ui/createarraydialog.h
index 1f1114d7..61c89624 100644
--- a/ui/createarraydialog.h
+++ b/ui/createarraydialog.h
@@ -12,8 +12,9 @@ class CreateArrayDialog : public QDialog
BinaryViewRef m_data;
uint64_t m_startAddress;
+ size_t m_size;
TypeRef m_elementType;
- uint64_t m_elementCount;
+ uint64_t m_elementCount{};
QLineEdit* m_startField;
QComboBox* m_typeDropdown;
@@ -22,15 +23,16 @@ class CreateArrayDialog : public QDialog
QPushButton* m_cancelButton;
QPushButton* m_createButton;
- void validate();
+ void update();
+ size_t guessElementCount(size_t elementWidth);
public:
- explicit CreateArrayDialog(BinaryViewRef data, QWidget* parent = nullptr);
+ explicit CreateArrayDialog(BinaryViewRef data, BNAddressRange selection, QWidget* parent = nullptr);
/// Set the initial start address, element type, and element count for
/// the dialog. The element type may be null if no default is desired; a
/// default will be chosen by the dialog.
- void setInitialState(uint64_t start, const TypeRef& elementType, uint64_t count);
+ void setInitialState();
/// Get the desired start address from the accepted dialog.
[[nodiscard]] uint64_t startAddress() const;