#ifndef JUCI_AUTOCOMPLETE_H_ #define JUCI_AUTOCOMPLETE_H_ #include "dispatcher.h" #include "tooltips.h" #include #include class Autocomplete { Gtk::TextView *view; bool &interactive_completion; /// Some libraries/utilities, like libclang, require that autocomplete is started at the beginning of a word bool strip_word; Dispatcher dispatcher; public: enum class State { IDLE, STARTING, RESTARTING, CANCELED }; std::string prefix; std::mutex prefix_mutex; std::vector> rows; Tooltips tooltips; std::atomic state; std::thread thread; std::function is_processing = [] { return true; }; std::function reparse = [] {}; std::function cancel_reparse = [] {}; std::function>()> get_parse_lock = [] { return nullptr; }; std::function stop_parse = [] {}; std::function is_continue_key = [](guint) { return false; }; std::function is_restart_key = [](guint) { return false; }; std::function run_check = [] { return false; }; std::function before_add_rows = [] {}; std::function after_add_rows = [] {}; std::function on_add_rows_error = [] {}; /// The handler is not run in the main loop. std::function add_rows = [](std::string &, int, int) {}; std::function setup_dialog = [] {}; Autocomplete(Gtk::TextView *view, bool &interactive_completion, guint &last_keyval, bool strip_word); void run(); void stop(); private: void setup_initial_dialog(); }; #endif // JUCI_AUTOCOMPLETE_H_