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

#include "../brush.hpp"

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

class WinSolidColorBrush : public Object,
                           public virtual SolidColorBrush,
                           public virtual WinBrush {
 public:
  explicit WinSolidColorBrush(
      Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> brush);
  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::platform::win