summaryrefslogtreecommitdiff
path: root/ui/typecompletioncombobox.h
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2026-04-06 19:10:03 -0400
committerRusty Wagner <rusty.wagner@gmail.com>2026-05-22 17:52:21 -0400
commit8f2e99d1b6e814fcf7b9142889b7f2dfab5dd94e (patch)
treee11e1633c257b6973406b47f18a53ce9a41ba3d2 /ui/typecompletioncombobox.h
parentf905a0133585fc7385c6e8ef0270bc6e0704cc2a (diff)
Function signature table in edit function dialog
Diffstat (limited to 'ui/typecompletioncombobox.h')
-rw-r--r--ui/typecompletioncombobox.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/ui/typecompletioncombobox.h b/ui/typecompletioncombobox.h
new file mode 100644
index 00000000..e512836a
--- /dev/null
+++ b/ui/typecompletioncombobox.h
@@ -0,0 +1,70 @@
+#pragma once
+
+#include <QtCore/QStringListModel>
+#ifndef BINARYNINJAUI_BINDINGS
+ #include <QtCore/QThread>
+#endif
+#include <optional>
+#include "completioncombobox.h"
+#include "binaryninjaapi.h"
+#include "uitypes.h"
+
+
+#ifdef BINARYNINJAUI_BINDINGS
+// QThread has issues working in the bindings on some platforms
+class GetTypesListThread;
+#else
+
+/*!
+
+ \ingroup typedialog
+*/
+class BINARYNINJAUIAPI GetTypesListThread : public QThread
+{
+ Q_OBJECT
+
+ QStringList m_allTypes;
+ std::function<void()> m_completeFunc;
+ std::mutex m_mutex;
+ bool m_done;
+ BinaryNinja::TypeContainer m_typeContainer;
+
+protected:
+ virtual void run() override;
+
+public:
+ GetTypesListThread(BinaryNinja::TypeContainer typeContainer, const std::function<void()>& completeFunc);
+ void cancel();
+
+ const QStringList& getTypes() const { return m_allTypes; }
+};
+#endif
+
+//! A CompletionComboBox pre-configured for type name autocompletion.
+//!
+//! Fetches type names from a TypeContainer in a background thread and populates
+//! the completer model. Respects the ui.types.substring and
+//! ui.types.maxAutoFeaturesCount settings.
+//!
+//! Optionally manages a persistent input history stored in QSettings.
+class BINARYNINJAUIAPI TypeCompletionComboBox : public CompletionComboBox
+{
+ Q_OBJECT
+
+ QStringListModel* m_model;
+ GetTypesListThread* m_updateThread = nullptr;
+ QStringList m_historyEntries;
+ int m_historySize;
+
+ void customEvent(QEvent* event) override;
+
+public:
+ TypeCompletionComboBox(std::optional<BinaryNinja::TypeContainer> typeContainer, QWidget* parent = nullptr,
+ QString existing = QString());
+ ~TypeCompletionComboBox();
+
+ //! Commit the current text to the persistent input history.
+ void commitHistory();
+
+ QStringListModel* completionModel() const { return m_model; }
+};