File: targetlist.hg

package info (click to toggle)
gtkmm3.0 3.24.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 22,680 kB
  • sloc: xml: 121,333; cpp: 8,531; sh: 4,250; makefile: 262; perl: 236
file content (77 lines) | stat: -rw-r--r-- 2,764 bytes parent folder | download | duplicates (3)
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
77
/* Copyright(C) 2002 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

_DEFS(gtkmm,gtk)

#include <vector>

#include <gtkmm/enums.h>
#include <gtkmm/targetentry.h>
//#include <gtkmm/textbuffer.h>
#include <gdkmm/types.h>

_CC_INCLUDE(gtk/gtk.h)

namespace Gtk
{

class TextBuffer;

class TargetList final
{
  //GtkTargetList is actually registered as a boxed type, but it has custom
  //reference-counting instead of copy/free functions, so we use it via RefPtr.
  _CLASS_OPAQUE_REFCOUNTED(TargetList, GtkTargetList, NONE, gtk_target_list_ref, gtk_target_list_unref)
  _IGNORE(gtk_target_list_ref, gtk_target_list_unref)
public:
  static Glib::RefPtr<Gtk::TargetList> create(const std::vector<TargetEntry>& targets);

#m4 _CONVERSION(`TargetFlags', `guint', `($2)($3)')
  _WRAP_METHOD(void add(const Glib::ustring& target, TargetFlags flags = TargetFlags(0), guint info = 0), gtk_target_list_add)
  void add(const std::vector<TargetEntry>& targets);
  _IGNORE(gtk_target_list_add_table)

  _WRAP_METHOD(void add_text_targets(guint info), gtk_target_list_add_text_targets)
  _WRAP_METHOD(void add_rich_text_targets(guint info, bool deserializable, const Glib::RefPtr<TextBuffer>& buffer), gtk_target_list_add_rich_text_targets)

  _WRAP_METHOD(void add_image_targets(guint info, bool writable), gtk_target_list_add_image_targets)
  _WRAP_METHOD(void add_uri_targets(guint info), gtk_target_list_add_uri_targets)

  _WRAP_METHOD(void remove(const Glib::ustring& target), gtk_target_list_remove)
  _WRAP_METHOD(bool find(const Glib::ustring& target, guint* info) const, gtk_target_list_find)
};

} // namespace Gtk

namespace Glib
{
// This is needed so Glib::RefPtr<Gtk::TargetList> can be used with
// Glib::Value and _WRAP_PROPERTY in TextBuffer.
template <>
class Value< Glib::RefPtr<Gtk::TargetList> > : public ValueBase_Boxed
{
public:
  typedef Glib::RefPtr<Gtk::TargetList> CppType;
  typedef GtkTargetList* CType;

  static GType value_type();

  void set(const CppType& data);
  CppType get() const;
};

} // namespace Glib