/* * Copyright (c) 2020, Itamar S. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "Debugger.h" #include #include #include #include namespace HackStudio { class VariablesModel final : public GUI::Model { public: static RefPtr create(const PtraceRegisters& regs); void set_variable_value(const GUI::ModelIndex&, const StringView&, GUI::Window*); virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override; virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override; private: explicit VariablesModel(NonnullOwnPtrVector&& variables, const PtraceRegisters& regs) : m_variables(move(variables)) , m_regs(regs) { m_variable_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png")); } NonnullOwnPtrVector m_variables; PtraceRegisters m_regs; GUI::Icon m_variable_icon; }; }