swift
Loading...
Searching...
No Matches
mixinicon.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_MIXIN_MIXINICON_H
7#define SWIFT_MISC_MIXIN_MIXINICON_H
8
9#include <tuple>
10
11#include <QIcon>
12#include <QPixmap>
13#include <QString>
14
15#include "misc/icons.h"
16
17namespace swift::misc
18{
19 class CIcon;
20
21 namespace mixin
22 {
26 template <class Derived, CIcons::IconIndex IconIndex = CIcons::StandardIconUnknown16>
27 class Icon
28 {
29 public:
32
33 private:
34 const Derived *derived() const;
35 Derived *derived();
36 };
37
38 template <class Derived, CIcons::IconIndex IconIndex>
40 {
41 return IconIndex;
42 }
43
44 template <class Derived, CIcons::IconIndex IconIndex>
45 const Derived *Icon<Derived, IconIndex>::derived() const
46 {
47 return static_cast<const Derived *>(this);
48 }
49
50 template <class Derived, CIcons::IconIndex IconIndex>
51 Derived *Icon<Derived, IconIndex>::derived()
52 {
53 return static_cast<Derived *>(this);
54 }
55
60#define SWIFT_MISC_DECLARE_USING_MIXIN_ICON(DERIVED) using ::swift::misc::mixin::Icon<DERIVED>::toIcon;
61 } // namespace mixin
62} // namespace swift::misc
63
64#endif // SWIFT_MISC_MIXIN_MIXINICON_H
Value object for icons. An icon is stored in the global icon repository and identified by its index....
Definition icon.h:39
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
Definition icons.h:32
CRTP class template from which a derived class can inherit icon-related functions.
Definition mixinicon.h:28
CIcons::IconIndex toIcon() const
As icon, not implemented by all classes.
Definition mixinicon.h:39
Mixin classes which implement common operations for value classes.
Free functions in swift::misc.