/* * Copyright (c) 2021, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "DoubleClickArrowWidget.h" #include #include #include class MouseCursorModel final : public GUI::Model { public: static NonnullRefPtr create() { return adopt_ref(*new MouseCursorModel); } virtual ~MouseCursorModel() override { } enum Column { Bitmap, Name, __Count, }; virtual int row_count(const GUI::ModelIndex&) const override { return m_cursors.size(); } virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } virtual String column_name(int column_index) const override; virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override; virtual void invalidate() override; void change_theme(String const& name) { m_theme_name = name; invalidate(); } private: MouseCursorModel() { } struct Cursor { RefPtr bitmap; String path; String name; Gfx::CursorParams params; }; Vector m_cursors; String m_theme_name; }; class ThemeModel final : public GUI::Model { public: static NonnullRefPtr create() { return adopt_ref(*new ThemeModel); } virtual int row_count(const GUI::ModelIndex&) const override { return m_themes.size(); } virtual int column_count(const GUI::ModelIndex&) const override { return 1; } virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override; virtual void invalidate() override; private: Vector m_themes; }; class ThemeWidget final : public GUI::SettingsWindow::Tab { C_OBJECT(ThemeWidget) public: virtual ~ThemeWidget() override; virtual void apply_settings() override; virtual void reset_default_values() override; private: ThemeWidget(); RefPtr m_cursors_tableview; RefPtr m_theme_name_box; String m_theme_name; };