summaryrefslogtreecommitdiff
path: root/gio/src/loadableicon.hg
blob: 3b82a08245a488387c222d285616259b2aee7e09 (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
65
66
67
68
69
70
71
72
73
74
75
76
/* Copyright (C) 2007 The giomm 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/interface.h>
#include <giomm/inputstream.h>

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

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GLoadableIconIface GLoadableIconIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gio
{

/** Extends the Icon interface and adds the ability to load icons from streams.
 *
 * @newin{2,16}
 */
class GIOMM_API LoadableIcon : public Glib::Interface
{
  _CLASS_INTERFACE(LoadableIcon, GLoadableIcon, G_LOADABLE_ICON, GLoadableIconIface, , , GIOMM_API)

public:
/**
 * Loads a loadable icon. For the asynchronous version of this function,
 * see load_async().
 *
 * @param size an integer.
 * @param type a location to store the type of the loaded icon
 * @param cancellable a Cancellable object
 *
 * @return a InputStream to read the icon from.
 **/
  Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable);
  /** Non-cancellable version of load()
   */
  Glib::RefPtr<InputStream> load(int size, Glib::ustring& type);
  //TODO: 'type' can be nullptr as well, but I don't really want to add 2 more
  //overloads -- one cancellable, and one not...

  /**
   * Loads an icon asynchronously. To finish this function, see load_finish().
   * For the synchronous, blocking version of this function, see load().
   *
   * @param size an integer.
   * @param cancellable a Cancellable object
   * @param slot a function to call when the request is satisfied
   **/
  void load_async(int size, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
  /** Non-cancellable version of load_async()
   */
  void load_async(int size, const SlotAsyncReady& slot);
  //_WRAP_METHOD(Glib::RefPtr<InputStream> load_finish(const Glib::RefPtr<AsyncResult>& res, Glib::ustring& type), g_loadable_icon_load_finish, errthrow)

protected:
  //_WRAP_VFUNC(Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable), "load")
};


} // namespace Gio