Serenity Operating System
at master 46 lines 1.2 kB view raw
1/* 2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include "CodeDocument.h" 10#include <AK/ByteBuffer.h> 11#include <AK/DeprecatedString.h> 12#include <AK/NonnullRefPtr.h> 13#include <AK/RefCounted.h> 14 15namespace HackStudio { 16 17class ProjectFile : public RefCounted<ProjectFile> { 18public: 19 static NonnullRefPtr<ProjectFile> construct_with_name(DeprecatedString const& name) 20 { 21 return adopt_ref(*new ProjectFile(name)); 22 } 23 24 DeprecatedString const& name() const { return m_name; } 25 bool could_render_text() const { return m_could_render_text; } 26 27 GUI::TextDocument& document() const; 28 CodeDocument& code_document() const; 29 30 int vertical_scroll_value() const; 31 void vertical_scroll_value(int); 32 int horizontal_scroll_value() const; 33 void horizontal_scroll_value(int); 34 35private: 36 explicit ProjectFile(DeprecatedString const& name); 37 void create_document_if_needed() const; 38 39 DeprecatedString m_name; 40 mutable RefPtr<CodeDocument> m_document; 41 mutable bool m_could_render_text { false }; 42 int m_vertical_scroll_value { 0 }; 43 int m_horizontal_scroll_value { 0 }; 44}; 45 46}