1.10
imagegroup.h
1/*
2 * Copyright (C) 2024 Microchip Technology Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef EGT_IMAGE_GROUP_H
7#define EGT_IMAGE_GROUP_H
8
14#include <egt/detail/meta.h>
15#include <egt/palette.h>
16
17namespace egt
18{
19inline namespace v1
20{
21
22class Image;
23
24class EGT_API ImageGroup
25{
26public:
27 ImageGroup(const std::string& suffix) noexcept;
28
29 EGT_NODISCARD Image* get(Palette::GroupId group, bool allow_fallback = false) const;
30 void set(Palette::GroupId group, const Image& image);
32
33 void serialize(Serializer& serializer) const;
34 bool deserialize(const std::string& name, const std::string& value);
35
36private:
37
38 std::unique_ptr<Image>& select(Palette::GroupId group, bool allow_fallback = false);
39 const std::unique_ptr<Image>& select(Palette::GroupId group, bool allow_fallback) const
40 {
41 return const_cast<ImageGroup*>(this)->select(group, allow_fallback);
42 }
43
44 std::string m_suffix;
45 std::unique_ptr<Image> m_normal;
46 std::unique_ptr<Image> m_active;
47 std::unique_ptr<Image> m_disabled;
48 std::unique_ptr<Image> m_checked;
49};
50
51}
52}
53
54#endif
Definition imagegroup.h:25
void serialize(Serializer &serializer) const
ImageGroup(const std::string &suffix) noexcept
EGT_NODISCARD Image * get(Palette::GroupId group, bool allow_fallback=false) const
bool reset(Palette::GroupId group)
void set(Palette::GroupId group, const Image &image)
bool deserialize(const std::string &name, const std::string &value)
Raster image resource used for drawing or displaying.
Definition image.h:39
GroupId
Used to define a category of patterns that usually relate to the state of a widget.
Definition palette.h:219
Abstract base serializer class.
Definition serialize.h:34
EGT framework namespace.
Definition animation.h:24