aboutsummaryrefslogtreecommitdiff
path: root/src/ui/ui_manager.hpp
blob: 107b536ce72c182efc0a7736665e777d66b367d8 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include "pre.hpp"

#include "base.hpp"

struct ID2D1Brush;
struct IDWriteTextFormat;
namespace cru::graph {
class GraphManager;
}

namespace cru::ui {
struct CaretInfo {
  std::chrono::milliseconds caret_blink_duration;
  float half_caret_width;
};

class PredefineResources : public Object {
 public:
  PredefineResources();
  PredefineResources(const PredefineResources& other) = delete;
  PredefineResources(PredefineResources&& other) = delete;
  PredefineResources& operator=(const PredefineResources& other) = delete;
  PredefineResources& operator=(PredefineResources&& other) = delete;
  ~PredefineResources() override;

  // region Button
  ID2D1Brush* button_normal_border_brush = nullptr;

  // region TextBlock
  ID2D1Brush* text_block_selection_brush = nullptr;
  ID2D1Brush* text_block_text_brush = nullptr;
  IDWriteTextFormat* text_block_text_format = nullptr;
};

class UiManager : public Object {
 public:
  static UiManager* GetInstance();

 private:
  UiManager();

 public:
  UiManager(const UiManager& other) = delete;
  UiManager(UiManager&& other) = delete;
  UiManager& operator=(const UiManager& other) = delete;
  UiManager& operator=(UiManager&& other) = delete;
  ~UiManager() override = default;

  CaretInfo GetCaretInfo() const { return caret_info_; }

  const PredefineResources* GetPredefineResources() const {
    return &predefine_resources_;
  }

 private:
  CaretInfo caret_info_;

  PredefineResources predefine_resources_;
};
}  // namespace cru::ui