[atkmm] Text, EditableText: Use vector instead of SListHandle<>.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atkmm] Text, EditableText: Use vector instead of SListHandle<>.
- Date: Fri, 17 Mar 2017 12:58:18 +0000 (UTC)
commit bb141d5542ad01fc74cc3f7847ea31d493d6e347
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Mar 17 13:49:23 2017 +0100
Text, EditableText: Use vector instead of SListHandle<>.
Using Glib::SListHandler<>::slist_to_vector() and
Glib::SListHandler<>::vector_to_slist() instead, and only in the
implementation instead of in the API.
atk/src/editabletext.ccg | 5 +++++
atk/src/editabletext.hg | 3 ++-
atk/src/text.ccg | 2 ++
atk/src/text.hg | 12 ++++++------
codegen/m4/convert_atk.m4 | 3 +--
5 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/atk/src/editabletext.ccg b/atk/src/editabletext.ccg
index 70762dd..cae772c 100644
--- a/atk/src/editabletext.ccg
+++ b/atk/src/editabletext.ccg
@@ -21,3 +21,8 @@
#include <atkmm/object.h>
#include <atk/atkeditabletext.h>
+namespace Atk {
+
+using SListHandler_Attribute = Glib::SListHandler<Attribute, AttributeTraits>;
+
+} // namespace Atk
diff --git a/atk/src/editabletext.hg b/atk/src/editabletext.hg
index 03ae5da..6687efd 100644
--- a/atk/src/editabletext.hg
+++ b/atk/src/editabletext.hg
@@ -45,7 +45,8 @@ class EditableText : public Glib::Interface
_CLASS_INTERFACE(EditableText, AtkEditableText, ATK_EDITABLE_TEXT, AtkEditableTextIface)
public:
- _WRAP_METHOD(bool set_run_attributes(const AttributeSet& attrib_set, int start_offset, int end_offset),
atk_editable_text_set_run_attributes)
+ _WRAP_METHOD(bool set_run_attributes(const std::vector<Attribute>& attrib_set, int start_offset, int
end_offset), atk_editable_text_set_run_attributes)
+
_WRAP_METHOD(void set_text_contents(const Glib::ustring& string), atk_editable_text_set_text_contents)
_WRAP_METHOD(void insert_text(const Glib::ustring& string, int length, int& position),
atk_editable_text_insert_text)
_WRAP_METHOD(void copy_text(int start_pos, int end_pos), atk_editable_text_copy_text)
diff --git a/atk/src/text.ccg b/atk/src/text.ccg
index 71bd9c7..a5ccf3c 100644
--- a/atk/src/text.ccg
+++ b/atk/src/text.ccg
@@ -33,6 +33,8 @@ GType Glib::Value<Atk::TextAttribute>::value_type()
namespace Atk
{
+using SListHandler_Attribute = Glib::SListHandler<Attribute, AttributeTraits>;
+
/**** Atk::Attribute *******************************************************/
Attribute::Attribute()
diff --git a/atk/src/text.hg b/atk/src/text.hg
index 70b4727..b324c47 100644
--- a/atk/src/text.hg
+++ b/atk/src/text.hg
@@ -20,7 +20,6 @@
_DEFS(atkmm,atk)
#include <atkmm/component.h> /* for Atk::CoordType */
-#include <glibmm/slisthandle.h>
#include <atk/atktext.h>
@@ -71,9 +70,6 @@ struct AttributeTraits
static void release_c_type(CType item) { g_free(const_cast<CTypeNonConst>(item)); }
};
-typedef Glib::SListHandle<Attribute, AttributeTraits> AttributeSet;
-
-
_CC_INCLUDE(atk/atk-enum-types.h)
_WRAP_ENUM(BuiltinTextAttribute, AtkTextAttribute)
@@ -145,8 +141,12 @@ public:
_WRAP_METHOD(int get_caret_offset() const, atk_text_get_caret_offset)
_WRAP_METHOD(void get_character_extents(int offset, int& x, int& y, int& width, int& height, CoordType
coords) const, atk_text_get_character_extents)
- _WRAP_METHOD(AttributeSet get_run_attributes(int offset, int& start_offset, int& end_offset) const,
atk_text_get_run_attributes)
- _WRAP_METHOD(AttributeSet get_default_attributes() const, atk_text_get_default_attributes)
+
+#m4 _CONVERSION(`AtkAttributeSet*', `std::vector<Attribute>', `SListHandler_Attribute::slist_to_vector($3,
Glib::OWNERSHIP_DEEP)')
+
+ _WRAP_METHOD(std::vector<Attribute> get_run_attributes(int offset, int& start_offset, int& end_offset)
const, atk_text_get_run_attributes)
+ _WRAP_METHOD(std::vector<Attribute> get_default_attributes() const, atk_text_get_default_attributes)
+
_WRAP_METHOD(int get_character_count() const, atk_text_get_character_count)
_WRAP_METHOD(int get_offset_at_point(int x, int y, CoordType coords) const, atk_text_get_offset_at_point)
_WRAP_METHOD(int get_n_selections() const, atk_text_get_n_selections)
diff --git a/codegen/m4/convert_atk.m4 b/codegen/m4/convert_atk.m4
index adefa94..a1fb26e 100644
--- a/codegen/m4/convert_atk.m4
+++ b/codegen/m4/convert_atk.m4
@@ -33,8 +33,7 @@ _CONVERSION(`AtkGObjectAccessible*',`Glib::RefPtr<const ObjectAccessible>',Glib:
_CONVERSION(`AtkHyperlink*',`Glib::RefPtr<Hyperlink>',Glib::wrap($3))
_CONVERSION(`AtkHyperlink*',`Glib::RefPtr<const Hyperlink>',Glib::wrap($3))
-_CONVERSION(`AtkAttributeSet*', `AttributeSet', `AttributeSet($3, Glib::OWNERSHIP_DEEP)')
-_CONVERSION(`const AttributeSet&', `AtkAttributeSet*', `($3).data()')
+_CONVERSION(`const std::vector<Attribute>&', `AtkAttributeSet*',
`SListHandler_Attribute::vector_to_slist($3).data()')
_CONVERSION(`GIOChannel*',`Glib::RefPtr<Glib::IOChannel>',Glib::wrap($3))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]