blob: 4db2b93fb7ca0c6b9bff89766cd44fff3a99a4b6 (
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
|
#ifndef XCB_COLORS_HH
#define XCB_COLORS_HH
#include "xcb_connection.hh"
#include <memory>
namespace xcb {
class Colors {
protected:
class Storage;
public:
virtual ~Colors() = default;
class Color {
public:
uint32_t get() {
return colors_->get(id_);
}
Color(std::shared_ptr<Storage> colors, size_t id)
: colors_(colors), id_(id) {}
private:
std::shared_ptr<Storage> colors_;
size_t id_;
};
virtual Color get_with_fallback(uint8_t r, uint8_t g, uint8_t b,
uint32_t fallback) = 0;
virtual bool sync() = 0;
static std::unique_ptr<Colors> create(shared_conn conn,
xcb_colormap_t colormap);
protected:
Colors() = default;
Colors(Colors const&) = delete;
Colors& operator=(Colors const&) = delete;
class Storage {
public:
virtual ~Storage() = default;
virtual uint32_t get(size_t id) const = 0;
protected:
Storage() = default;
};
};
} // namespace xcb
#endif // XCB_COLORS_HH
|