FTXUI 7.0.3
C++ functional terminal UI.
Loading...
Searching...
No Matches
surface.hpp
Go to the documentation of this file.
1// Copyright 2024 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#ifndef FTXUI_SCREEN_SURFACE_HPP
5#define FTXUI_SCREEN_SURFACE_HPP
6
7#include <string> // for string, basic_string, allocator
8#include <vector> // for vector
9
10#include "ftxui/screen/box.hpp" // for Box
11#include "ftxui/screen/cell.hpp" // for Cell
12#include "ftxui/util/export.hpp" // for FTXUI_EXPORT
13
14namespace ftxui {
15
16/// @brief Cellの長方形グリッド。
17///
18/// @note このクラスは以前はImageという名前でした。
19///
20/// @ingroup screen
21class FTXUI_EXPORT(SCREEN) Surface {
22 public:
23 // コンストラクタ:
24 Surface() = delete;
25 Surface(int dimx, int dimy);
26
27 // デストラクタ:
28 virtual ~Surface() = default;
29
30 // コピー:
31 Surface(const Surface&) = default;
32 Surface& operator=(const Surface&) = default;
33
34 // グリッド内の指定位置にある文字にアクセスします。
35 std::string& at(int x, int y);
36 const std::string& at(int x, int y) const;
37
38 // グリッド内の指定位置にあるセル(Cell)にアクセスします。
39 Cell& CellAt(int x, int y);
40 const Cell& CellAt(int x, int y) const;
41
42 // [非推奨] CellAtのエイリアス。
43 Cell& PixelAt(int x, int y) { return CellAt(x, y); }
44 const Cell& PixelAt(int x, int y) const { return CellAt(x, y); }
45
46 // 画面の寸法を取得します。
47 int dimx() const { return dimx_; }
48 int dimy() const { return dimy_; }
49
50 // サーフェスをスペースとデフォルトスタイルで埋めます。
51 void Clear();
52
53 // ABI予約:
54 virtual void Reserved1();
55 virtual void Reserved2();
56 virtual void Reserved3();
57 virtual void Reserved4();
58 virtual void Reserved5();
59 virtual void Reserved6();
60 virtual void Reserved7();
61 virtual void Reserved8();
62
63 Box stencil;
64
65 protected:
66 Cell& FastCellAt(int x, int y);
67 const Cell& FastCellAt(int x, int y) const;
68
69 int dimx_;
70 int dimy_;
71 std::vector<Cell> cells_;
72};
73
74} // namespace ftxui
75
76#endif // FTXUI_SCREEN_SURFACE_HPP
FTXUI ftxui::名前空間
Definition animation.hpp:11