blob: 9fcfe35f67e1c6a4381fa3cb02fb18c76a4c6684 (
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
|
#pragma once
#include "iconstreams.h"
#include "trayparser.h"
#include <cstdint>
#include <vector>
#include <memory>
#include <string>
#include <functional>
#include <list>
class TrayJuggler
{
public:
TrayJuggler(const TrayParser &parser);
// Find record based on substring present in record's application path.
std::shared_ptr<ICON_STREAMS_RECORD> findRecord(const std::wstring &path) const;
enum class TraySearchGroup
{
Visible,
Hidden
};
uint32_t getNextFreeOrdinal(TraySearchGroup searchGroup) const;
//
// Fix up and inject record.
// The icon will be displayed in the rightmost position.
//
void injectRecord(const ICON_STREAMS_RECORD &record);
//
// Update and promote existing record.
// The icon will be displayed in the rightmost position.
//
void promoteRecord(std::shared_ptr<ICON_STREAMS_RECORD> record);
bool enumerateRecords(std::function<bool(std::shared_ptr<ICON_STREAMS_RECORD> record)> callback) const;
// Generate a valid stream including header.
std::vector<uint8_t> pack() const;
static std::wstring DecodeString(const uint16_t *encoded, size_t bufferSize);
private:
//
// This is the original header.
// We keep it around to be able to preserve the values for
// the unknown fields.
//
ICON_STREAMS_HEADER m_header;
std::list<std::shared_ptr<ICON_STREAMS_RECORD> > m_records;
};
|