aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/graph/win_brush.hpp
blob: 69cd952dbf64b2058127012bfd715d54fa26b4e2 (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
#pragma once
#include "../win_pre_config.hpp"

#include "cru/platform/graph/brush.hpp"

namespace cru::win::graph {
class GraphManager;

struct WinBrush : virtual platform::graph::Brush {
  virtual ID2D1Brush* GetD2DBrush() = 0;
};

class WinSolidColorBrush : public Object,
                           public virtual platform::graph::SolidColorBrush,
                           public virtual WinBrush {
 public:
  explicit WinSolidColorBrush(GraphManager* graph_manager,
                              const ui::Color& color);
  WinSolidColorBrush(const WinSolidColorBrush& other) = delete;
  WinSolidColorBrush(WinSolidColorBrush&& other) = delete;
  WinSolidColorBrush& operator=(const WinSolidColorBrush& other) = delete;
  WinSolidColorBrush& operator=(WinSolidColorBrush&& other) = delete;
  ~WinSolidColorBrush() override = default;

  ui::Color GetColor() override;
  void SetColor(const ui::Color& color) override;

  ID2D1Brush* GetD2DBrush() override { return brush_.Get(); }

 private:
  Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> brush_;
};
}  // namespace cru::win::graph