blob: ed543afad7a572daf5404a8a2d61e6a7ebca9f4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#pragma once
#include "../Base.hpp"
#include "cru/platform/gui/UiApplication.hpp"
#include <chrono>
namespace cru::ui::host {
class LayoutPaintCycler {
public:
explicit LayoutPaintCycler(WindowHost* host);
CRU_DELETE_COPY(LayoutPaintCycler)
CRU_DELETE_MOVE(LayoutPaintCycler)
~LayoutPaintCycler();
public:
void InvalidateLayout();
void InvalidatePaint();
bool IsLayoutDirty() { return layout_dirty_; }
private:
void OnCycle();
private:
WindowHost* host_;
platform::gui::TimerAutoCanceler timer_canceler_;
bool layout_dirty_ = true;
bool paint_dirty_ = true;
std::chrono::steady_clock::time_point last_cycle_time_;
std::chrono::steady_clock::duration cycle_threshold_ =
std::chrono::milliseconds(1000) / 144;
};
} // namespace cru::ui::host
|