summaryrefslogtreecommitdiff
path: root/gio/src/bytesicon.hg
blob: 0c8f61e9edeec929ba0b14a22c1b90e4837457f6 (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
59
60
61
62
63
64
/* Copyright (C) 2022 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glibmm/object.h>
#include <giomm/icon.h>
#include <giomm/loadableicon.h>
#include <glibmm/bytes.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gio
{

/** An icon stored in memory as a Glib::Bytes.
 *
 * %Gio::BytesIcon specifies an image held in memory in a common format
 * (usually png) to be used as icon.
 *
 * @see Icon, LoadableIcon, Glib::Bytes
 * @newin{2,76}
 */
class GIOMM_API BytesIcon : public Glib::Object, public Icon, public LoadableIcon
{
  _CLASS_GOBJECT(BytesIcon, GBytesIcon, G_BYTES_ICON, Glib::Object, GObject, , , GIOMM_API)
  _IMPLEMENTS_INTERFACE(Icon)
  _IMPLEMENTS_INTERFACE(LoadableIcon)

protected:
  _WRAP_CTOR(BytesIcon(const Glib::RefPtr<const Glib::Bytes>& bytes), g_bytes_icon_new)

public:
  /** Creates a new icon for a Glib::Bytes.
   *
   * This cannot fail, but loading and interpreting the bytes may fail later on
   * (for example, if Gio::LoadableIcon::load() is called) if the image is invalid.
   *
   * @newin{2,76}
   *
   * @param bytes A Glib::Bytes.
   * @return A Icon for the given @a bytes.
   */
  _WRAP_CREATE(const Glib::RefPtr<const Glib::Bytes>& bytes)

  _WRAP_METHOD(Glib::RefPtr<const Glib::Bytes> get_bytes() const,
    g_bytes_icon_get_bytes, refreturn, newin "2,76")

  _WRAP_PROPERTY("bytes", Glib::RefPtr<Glib::Bytes>, newin "2,76")
};

} // namespace Gio