/* * Copyright (c) 2018-2020, Andreas Kling * Copyright (c) 2021, Mustafa Quraish * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "HexEditor.h" #include #include #include #include #include #include #include class HexEditor; class HexEditorWidget final : public GUI::Widget { C_OBJECT(HexEditorWidget) public: virtual ~HexEditorWidget() override; void open_file(int fd, String const& path); void initialize_menubar(GUI::Window&); bool request_close(); private: HexEditorWidget(); void set_path(StringView const&); void update_title(); void set_search_results_visible(bool visible); virtual void drop_event(GUI::DropEvent&) override; RefPtr m_editor; String m_path; String m_name; String m_extension; int m_goto_history { 0 }; String m_search_text; ByteBuffer m_search_buffer; int last_found_index() const { return m_last_found_index == -1 ? 0 : m_last_found_index; } int m_last_found_index { -1 }; RefPtr m_new_action; RefPtr m_open_action; RefPtr m_save_action; RefPtr m_save_as_action; RefPtr m_find_action; RefPtr m_goto_offset_action; RefPtr m_layout_toolbar_action; RefPtr m_layout_search_results_action; GUI::ActionGroup m_bytes_per_row_actions; RefPtr m_statusbar; RefPtr m_toolbar; RefPtr m_toolbar_container; RefPtr m_search_results; RefPtr m_search_results_container; bool m_document_dirty { false }; };