blob: b5ce9eae6dfe7fe0bb19a0a30b807c8b0ad41f91 (
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
|
// *****************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: https://www.gnu.org/licenses/gpl-3.0 *
// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved *
// *****************************************************************************
#ifndef ICON_BUFFER_H_8425703245726394256
#define ICON_BUFFER_H_8425703245726394256
#include <vector>
#include <memory>
#include <zen/zstring.h>
#include <wx/bitmap.h>
#include "afs/abstract.h"
namespace fff
{
class IconBuffer
{
public:
enum IconSize
{
SIZE_SMALL,
SIZE_MEDIUM,
SIZE_LARGE
};
IconBuffer(IconSize sz);
~IconBuffer();
static int getSize(IconSize sz); //expected and *maximum* icon size in pixel
int getSize() const { return getSize(iconSizeType_); } //
void setWorkload (const std::vector<AbstractPath>& load); //(re-)set new workload of icons to be retrieved;
bool readyForRetrieval(const AbstractPath& filePath);
std::optional<wxBitmap> retrieveFileIcon (const AbstractPath& filePath); //... and mark as hot
wxBitmap getIconByExtension(const Zstring& filePath); //...and add to buffer
//retrieveFileIcon() + getIconByExtension() are safe to call from within WM_PAINT handler! no COM calls (...on calling thread)
static wxBitmap genericFileIcon(IconSize sz);
static wxBitmap genericDirIcon (IconSize sz);
static wxBitmap linkOverlayIcon(IconSize sz);
private:
struct Impl;
const std::unique_ptr<Impl> pimpl_;
const IconSize iconSizeType_;
};
bool hasLinkExtension(const Zstring& filepath);
}
#endif //ICON_BUFFER_H_8425703245726394256
|