[atkmm/vector] Adapt Atk to vector utils.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atkmm/vector] Adapt Atk to vector utils.
- Date: Sat, 22 Jan 2011 20:37:03 +0000 (UTC)
commit 7552127a13d7c9527799f9721d27551278578568
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Sat Jan 22 21:35:21 2011 +0100
Adapt Atk to vector utils.
atk/src/editabletext.ccg | 2 ++
atk/src/editabletext.hg | 5 ++++-
atk/src/relation.ccg | 15 +++++++++------
atk/src/relation.hg | 9 +++++----
atk/src/stateset.ccg | 10 ++++++----
atk/src/stateset.hg | 5 +++--
atk/src/table.ccg | 10 ++++++----
atk/src/table.hg | 6 ++++--
atk/src/text.ccg | 8 ++++++--
atk/src/text.hg | 12 +++++++-----
configure.ac | 2 +-
11 files changed, 53 insertions(+), 31 deletions(-)
---
diff --git a/atk/src/editabletext.ccg b/atk/src/editabletext.ccg
index 70762dd..325a4d2 100644
--- a/atk/src/editabletext.ccg
+++ b/atk/src/editabletext.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <atkmm/object.h>
#include <atk/atkeditabletext.h>
diff --git a/atk/src/editabletext.hg b/atk/src/editabletext.hg
index 03ae5da..86586af 100644
--- a/atk/src/editabletext.hg
+++ b/atk/src/editabletext.hg
@@ -19,6 +19,8 @@
_DEFS(atkmm,atk)
+#include <vector>
+
#include <atkmm/text.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -45,7 +47,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)
+#m4 _CONVERSION(`const std::vector<Attribute>&',`AtkAttributeSet*',`Glib::SListHandler<Attribute, AttributeTraits>::vector_to_slist ($3).data ()')
+ _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/relation.ccg b/atk/src/relation.ccg
index 16b90b0..0f1cc74 100644
--- a/atk/src/relation.ccg
+++ b/atk/src/relation.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <atkmm/object.h>
#include <atk/atkobject.h>
#include <atk/atkrelation.h>
@@ -27,26 +29,27 @@ namespace Atk
{
//TODO: Implement this with the new GValue array thingy. See bug #74246.
-Relation::Relation(const Glib::ArrayHandle< Glib::RefPtr<Atk::Object> >& targets,
+Relation::Relation(const std::vector< Glib::RefPtr<Atk::Object> >& targets,
RelationType relationship)
:
- Glib::Object((GObject*) atk_relation_new(const_cast<AtkObject**>(targets.data()), targets.size(),
+ Glib::Object((GObject*) atk_relation_new(const_cast<AtkObject**>(Glib::ArrayHandler<Glib::RefPtr<Atk::Object> >::vector_to_array (targets).data()),
+ targets.size(),
(AtkRelationType) relationship))
{}
-Glib::ArrayHandle< Glib::RefPtr<Atk::Object> > Relation::get_target()
+std::vector< Glib::RefPtr<Atk::Object> > Relation::get_target()
{
GPtrArray *const parray = atk_relation_get_target(gobj());
- return Glib::ArrayHandle< Glib::RefPtr<Atk::Object> >
+ return Glib::ArrayHandler< Glib::RefPtr<Atk::Object> >::array_to_vector
(reinterpret_cast<AtkObject**>(parray->pdata), parray->len, Glib::OWNERSHIP_NONE);
}
-Glib::ArrayHandle< Glib::RefPtr<const Atk::Object> > Relation::get_target() const
+std::vector< Glib::RefPtr<const Atk::Object> > Relation::get_target() const
{
GPtrArray *const parray = atk_relation_get_target(const_cast<AtkRelation*>(gobj()));
- return Glib::ArrayHandle< Glib::RefPtr<const Atk::Object> >
+ return Glib::ArrayHandler< Glib::RefPtr<const Atk::Object> >::array_to_vector
(reinterpret_cast<AtkObject**>(parray->pdata), parray->len, Glib::OWNERSHIP_NONE);
}
diff --git a/atk/src/relation.hg b/atk/src/relation.hg
index 0205963..e67af9c 100644
--- a/atk/src/relation.hg
+++ b/atk/src/relation.hg
@@ -21,6 +21,7 @@
_DEFS(atkmm,atk)
_PINCLUDE(glibmm/private/object_p.h)
+#include <vector>
namespace Atk
{
@@ -39,17 +40,17 @@ class Relation : public Glib::Object
_CLASS_GOBJECT(Relation, AtkRelation, ATK_RELATION, Glib::Object, GObject)
protected:
- explicit Relation(const Glib::ArrayHandle< Glib::RefPtr<Atk::Object> >& targets,
+ explicit Relation(const std::vector< Glib::RefPtr<Atk::Object> >& targets,
RelationType relationship);
public:
- _WRAP_CREATE(const Glib::ArrayHandle< Glib::RefPtr<Atk::Object> >& targets,
+ _WRAP_CREATE(const std::vector< Glib::RefPtr<Atk::Object> >& targets,
RelationType relationship = RELATION_NULL)
_WRAP_METHOD(RelationType get_relation_type() const, atk_relation_get_relation_type)
- Glib::ArrayHandle< Glib::RefPtr<Atk::Object> > get_target();
- Glib::ArrayHandle< Glib::RefPtr<const Atk::Object> > get_target() const;
+ std::vector< Glib::RefPtr<Atk::Object> > get_target();
+ std::vector< Glib::RefPtr<const Atk::Object> > get_target() const;
_IGNORE(atk_relation_get_target)
_WRAP_METHOD(void add_target(const Glib::RefPtr<Atk::Object>& target), atk_relation_add_target)
diff --git a/atk/src/stateset.ccg b/atk/src/stateset.ccg
index 411fdb1..c3cf61c 100644
--- a/atk/src/stateset.ccg
+++ b/atk/src/stateset.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <atk/atkobject.h>
#include <atk/atkstateset.h>
@@ -25,15 +27,15 @@
namespace Atk
{
-void StateSet::add_states(const Glib::ArrayHandle<StateType>& types)
+void StateSet::add_states(const std::vector<StateType>& types)
{
- atk_state_set_add_states(gobj(), (AtkStateType*) types.data(), types.size());
+ atk_state_set_add_states(gobj(), (AtkStateType*) Glib::ArrayHandler<StateType>::vector_to_array (types).data(), types.size());
}
-bool StateSet::contains_states(const Glib::ArrayHandle<StateType>& types) const
+bool StateSet::contains_states(const std::vector<StateType>& types) const
{
return atk_state_set_contains_states(
- const_cast<AtkStateSet*>(gobj()), (AtkStateType*) types.data(), types.size());
+ const_cast<AtkStateSet*>(gobj()), (AtkStateType*) Glib::ArrayHandler<StateType>::vector_to_array (types).data(), types.size());
}
} // namespace Atk
diff --git a/atk/src/stateset.hg b/atk/src/stateset.hg
index cb2c17d..18e6750 100644
--- a/atk/src/stateset.hg
+++ b/atk/src/stateset.hg
@@ -20,6 +20,7 @@
_DEFS(atkmm,atk)
_PINCLUDE(glibmm/private/object_p.h)
+#include <vector>
namespace Atk
{
@@ -44,11 +45,11 @@ public:
//Note that we use Atk::StateType instead of StateType, because there is a Gtk::StateType too, and Doxygen gets confused.
_WRAP_METHOD(bool add_state(Atk::StateType type), atk_state_set_add_state)
- void add_states(const Glib::ArrayHandle<Atk::StateType>& types);
+ void add_states(const std::vector<Atk::StateType>& types);
_IGNORE(atk_state_set_add_states)
_WRAP_METHOD(void clear_states(),atk_state_set_clear_states)
_WRAP_METHOD(bool contains_state(Atk::StateType type), atk_state_set_contains_state)
- bool contains_states(const Glib::ArrayHandle<Atk::StateType>& types) const;
+ bool contains_states(const std::vector<Atk::StateType>& types) const;
_IGNORE(atk_state_set_contains_states)
_WRAP_METHOD(bool remove_state(Atk::StateType type), atk_state_set_remove_state)
_WRAP_METHOD(Glib::RefPtr<StateSet> and_sets(const Glib::RefPtr<StateSet>& compare_set), atk_state_set_and_sets)
diff --git a/atk/src/table.ccg b/atk/src/table.ccg
index b074c2b..f1c1c53 100644
--- a/atk/src/table.ccg
+++ b/atk/src/table.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <atkmm/object.h>
#include <atk/atktable.h>
@@ -25,20 +27,20 @@
namespace Atk
{
-Glib::ArrayHandle<int> Table::get_selected_columns() const
+std::vector<int> Table::get_selected_columns() const
{
int* selected = 0;
const int n_selected = atk_table_get_selected_columns(const_cast<AtkTable*>(gobj()), &selected);
- return Glib::ArrayHandle<int>(selected, n_selected, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<int>::array_to_vector (selected, n_selected, Glib::OWNERSHIP_SHALLOW);
}
-Glib::ArrayHandle<int> Table::get_selected_rows() const
+std::vector<int> Table::get_selected_rows() const
{
int* selected = 0;
const int n_selected = atk_table_get_selected_rows(const_cast<AtkTable*>(gobj()), &selected);
- return Glib::ArrayHandle<int>(selected, n_selected, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<int>::array_to_vector (selected, n_selected, Glib::OWNERSHIP_SHALLOW);
}
} // namespace Atk
diff --git a/atk/src/table.hg b/atk/src/table.hg
index 1e30361..7d3f8b5 100644
--- a/atk/src/table.hg
+++ b/atk/src/table.hg
@@ -20,6 +20,8 @@
_DEFS(atkmm,atk)
_PINCLUDE(atk/atkobject.h)
+#include <vector>
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C"
{
@@ -86,8 +88,8 @@ public:
_WRAP_METHOD(void set_summary(const Glib::RefPtr<Atk::Object>& accessible), atk_table_set_summary)
_IGNORE(atk_table_get_selected_columns, atk_table_get_selected_rows)
- Glib::ArrayHandle<int> get_selected_columns() const;
- Glib::ArrayHandle<int> get_selected_rows() const;
+ std::vector<int> get_selected_columns() const;
+ std::vector<int> get_selected_rows() const;
_WRAP_METHOD(bool is_column_selected(int column) const, atk_table_is_column_selected)
_WRAP_METHOD(bool is_row_selected(int row) const, atk_table_is_row_selected)
diff --git a/atk/src/text.ccg b/atk/src/text.ccg
index 3c9b2f1..da2c0a9 100644
--- a/atk/src/text.ccg
+++ b/atk/src/text.ccg
@@ -18,10 +18,14 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <atkmm/object.h>
-#include <glib.h>
#include <algorithm> /* for std::swap() */
+#include <glib.h>
+
+#include <glibmm/vectorutils.h>
+
+#include <atkmm/object.h>
+
// static
GType Glib::Value<Atk::TextAttribute>::value_type()
diff --git a/atk/src/text.hg b/atk/src/text.hg
index 7a81d59..7421018 100644
--- a/atk/src/text.hg
+++ b/atk/src/text.hg
@@ -19,9 +19,12 @@
_DEFS(atkmm,atk)
-#include <atkmm/component.h> /* for Atk::CoordType */
+#include <vector>
+
#include <atk/atktext.h>
+#include <atkmm/component.h> /* for Atk::CoordType */
+
namespace Atk
{
@@ -70,8 +73,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)
@@ -141,8 +142,9 @@ public:
_WRAP_METHOD(Glib::ustring get_text_before_offset(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const, atk_text_get_text_before_offset)
_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>',`Glib::SListHandler<Attribute, AttributeTraits>::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/configure.ac b/configure.ac
index e1a31ec..4e21e28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,7 @@ AC_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
-AC_SUBST([ATKMM_MODULES], ['atk >= 1.12 glibmm-2.4 >= 2.24'])
+AC_SUBST([ATKMM_MODULES], ['atk >= 1.12 glibmm-2.4 >= 2.27.91.1'])
PKG_CHECK_MODULES([ATKMM], [$ATKMM_MODULES])
MM_PKG_CONFIG_SUBST([GTHREAD_CFLAGS], [--cflags-only-other gthread-2.0])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]