HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Cell.hpp
1// Copyright 2020 Pokitec
2// All rights reserved.
3
4#pragma once
5
6#include "TTauri/GUI/Window_forward.hpp"
7#include "TTauri/Foundation/aarect.hpp"
8
9namespace tt {
10class DrawContext;
11
12class Cell {
13protected:
16 mutable bool modified;
17
18public:
19 Cell() : modified(true) {}
20 virtual ~Cell() = default;
21 Cell(Cell const &) noexcept = delete;
22 Cell(Cell &&) noexcept = delete;
23 Cell &operator=(Cell const &) noexcept = delete;
24 Cell &operator=(Cell &&) noexcept = delete;
25
28 [[nodiscard]] virtual vec preferredExtent() const noexcept { return {}; }
29
32 [[nodiscard]] virtual float heightForWidth(float width) const noexcept { return 0.0f; }
33
41 virtual void draw(
42 DrawContext const &drawContext,
43 aarect rectangle,
44 Alignment alignment,
46 ) const noexcept = 0;
47};
48
49}
Definition Cell.hpp:12
virtual vec preferredExtent() const noexcept
Return the extent that this cell wants to be drawn as.
Definition Cell.hpp:28
virtual float heightForWidth(float width) const noexcept
Get the height to draw this cell for the given width.
Definition Cell.hpp:32
virtual void draw(DrawContext const &drawContext, aarect rectangle, Alignment alignment, float middle=std::numeric_limits< float >::max()) const noexcept=0
Draw the cell.
Class which represents an axis-aligned rectangle.
Definition aarect.hpp:13
A 4D vector.
Definition vec.hpp:37
Draw context for drawing using the TTauri shaders.
Definition DrawContext.hpp:30