/* * Copyright (c) 2021, Matthew Olsson * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include class OutlineModel final : public GUI::Model { public: static NonnullRefPtr create(const NonnullRefPtr& outline); void set_index_open_state(const GUI::ModelIndex& index, bool is_open); virtual int row_count(const GUI::ModelIndex&) const override; virtual int column_count(const GUI::ModelIndex&) const override; 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, const GUI::ModelIndex&) const override; private: OutlineModel(const NonnullRefPtr& outline); GUI::Icon m_closed_item_icon; GUI::Icon m_open_item_icon; NonnullRefPtr m_outline; HashTable m_open_outline_items; };