| 1 |
/* Copyright (C) 2002 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
_DEFS(gtkmm,gtk) |
| 18 |
|
| 19 |
#include <vector> |
| 20 |
|
| 21 |
#include <gtkmm/enums.h> |
| 22 |
#include <gtkmm/targetentry.h> |
| 23 |
//#include <gtkmm/textbuffer.h> |
| 24 |
#include <gdkmm/types.h> |
| 25 |
|
| 26 |
_CC_INCLUDE(gtk/gtk.h) |
| 27 |
|
| 28 |
namespace Gtk |
| 29 |
{ |
| 30 |
|
| 31 |
class GTKMM_API TextBuffer; |
| 32 |
|
| 33 |
class GTKMM_API TargetList final |
| 34 |
{ |
| 35 |
//GtkTargetList is actually registered as a boxed type, but it has custom |
| 36 |
//reference-counting instead of copy/free functions, so we use it via RefPtr. |
| 37 |
_CLASS_OPAQUE_REFCOUNTED(TargetList, GtkTargetList, NONE, gtk_target_list_ref, gtk_target_list_unref, GTKMM_API) |
| 38 |
_IGNORE(gtk_target_list_ref, gtk_target_list_unref) |
| 39 |
public: |
| 40 |
static Glib::RefPtr<Gtk::TargetList> create(const std::vector<TargetEntry>& targets); |
| 41 |
|
| 42 |
#m4 _CONVERSION(`TargetFlags', `guint', `($2)($3)') |
| 43 |
_WRAP_METHOD(void add(const Glib::ustring& target, TargetFlags flags = TargetFlags(0), guint info = 0), gtk_target_list_add) |
| 44 |
void add(const std::vector<TargetEntry>& targets); |
| 45 |
_IGNORE(gtk_target_list_add_table) |
| 46 |
|
| 47 |
_WRAP_METHOD(void add_text_targets(guint info), gtk_target_list_add_text_targets) |
| 48 |
_WRAP_METHOD(void add_rich_text_targets(guint info, bool deserializable, const Glib::RefPtr<TextBuffer>& buffer), gtk_target_list_add_rich_text_targets) |
| 49 |
|
| 50 |
_WRAP_METHOD(void add_image_targets(guint info, bool writable), gtk_target_list_add_image_targets) |
| 51 |
_WRAP_METHOD(void add_uri_targets(guint info), gtk_target_list_add_uri_targets) |
| 52 |
|
| 53 |
_WRAP_METHOD(void remove(const Glib::ustring& target), gtk_target_list_remove) |
| 54 |
_WRAP_METHOD(bool find(const Glib::ustring& target, guint* info) const, gtk_target_list_find) |
| 55 |
}; |
| 56 |
|
| 57 |
} // namespace Gtk |
| 58 |
|
| 59 |
namespace Glib |
| 60 |
{ |
| 61 |
// This is needed so Glib::RefPtr<Gtk::TargetList> can be used with |
| 62 |
// Glib::Value and _WRAP_PROPERTY in TextBuffer. |
| 63 |
template <> |
| 64 |
class GTKMM_API Value< Glib::RefPtr<Gtk::TargetList> > : public ValueBase_Boxed |
| 65 |
{ |
| 66 |
public: |
| 67 |
typedef Glib::RefPtr<Gtk::TargetList> CppType; |
| 68 |
typedef GtkTargetList* CType; |
| 69 |
|
| 70 |
static GType value_type(); |
| 71 |
|
| 72 |
void set(const CppType& data); |
| 73 |
CppType get() const; |
| 74 |
}; |
| 75 |
|
| 76 |
} // namespace Glib |