atk 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/atk/extconf.rb +3 -0
- data/ext/atk/rbatk.c +56 -17
- data/ext/atk/rbatk.h +21 -12
- data/ext/atk/rbatkaction.c +38 -27
- data/ext/atk/rbatkcomponent.c +61 -50
- data/ext/atk/rbatkconversions.h +70 -0
- data/ext/atk/rbatkdocument.c +38 -27
- data/ext/atk/rbatkeditabletext.c +123 -39
- data/ext/atk/rbatkgobjectaccessible.c +30 -19
- data/ext/atk/rbatkhyperlink.c +34 -22
- data/ext/atk/rbatkhypertext.c +32 -20
- data/ext/atk/rbatkimage.c +34 -22
- data/ext/atk/rbatkimplementor.c +26 -14
- data/ext/atk/rbatknoopobject.c +28 -17
- data/ext/atk/rbatknoopobjectfactory.c +28 -17
- data/ext/atk/rbatkobject.c +48 -63
- data/ext/atk/rbatkobjectfactory.c +32 -20
- data/ext/atk/rbatkobjectrole.c +50 -0
- data/ext/atk/rbatkprivate.h +48 -0
- data/ext/atk/rbatkregistry.c +34 -22
- data/ext/atk/rbatkrelation.c +68 -43
- data/ext/atk/rbatkrelationset.c +44 -32
- data/ext/atk/rbatkrelationtype.c +38 -0
- data/ext/atk/rbatkselection.c +38 -26
- data/ext/atk/rbatkstate.c +32 -20
- data/ext/atk/rbatkstateset.c +113 -65
- data/ext/atk/rbatkstreamablecontent.c +33 -23
- data/ext/atk/rbatktable.c +91 -80
- data/ext/atk/rbatktext.c +85 -107
- data/ext/atk/rbatktextattribute.c +54 -0
- data/ext/atk/rbatktextrange.c +38 -33
- data/ext/atk/rbatktextrectangle.c +53 -48
- data/ext/atk/rbatkutil.c +44 -35
- data/ext/atk/rbatkvalue.c +39 -29
- metadata +14 -12
- data/ChangeLog +0 -278
- data/ext/atk/makeinits.rb +0 -39
- data/ext/atk/rbatkinits.c +0 -56
@@ -0,0 +1,38 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbatkprivate.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE cType
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
rg_s_for_name(G_GNUC_UNUSED VALUE self, VALUE name)
|
28
|
+
{
|
29
|
+
return ATKRELATIONTYPE2RVAL(atk_relation_type_for_name(RVAL2CSTR(name)));
|
30
|
+
}
|
31
|
+
|
32
|
+
void
|
33
|
+
Init_atk_relation_type(VALUE cRelation)
|
34
|
+
{
|
35
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_RELATION_TYPE, "Type", cRelation);
|
36
|
+
RG_DEF_SMETHOD(for_name, 1);
|
37
|
+
G_DEF_CONSTANTS(cRelation, ATK_TYPE_RELATION_TYPE, "ATK_");
|
38
|
+
}
|
data/ext/atk/rbatkselection.c
CHANGED
@@ -1,19 +1,31 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2004 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
3
21
|
|
4
|
-
|
22
|
+
#include "rbatkprivate.h"
|
5
23
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Copyright (C) 2004 Masao Mutoh
|
10
|
-
************************************************/
|
11
|
-
#include "rbatk.h"
|
12
|
-
|
13
|
-
#define _SELF(s) (ATK_SELECTION(RVAL2GOBJ(s)))
|
24
|
+
#define RG_TARGET_NAMESPACE mSelection
|
25
|
+
#define _SELF(s) (RVAL2ATKSELECTION(s))
|
14
26
|
|
15
27
|
static VALUE
|
16
|
-
|
28
|
+
rg_add_selection(VALUE self, VALUE i)
|
17
29
|
{
|
18
30
|
gboolean ret = atk_selection_add_selection(_SELF(self), NUM2INT(i));
|
19
31
|
if (! ret) rb_raise(rb_eRuntimeError, "Can't add selection");
|
@@ -21,7 +33,7 @@ rbatksel_add_selection(VALUE self, VALUE i)
|
|
21
33
|
}
|
22
34
|
|
23
35
|
static VALUE
|
24
|
-
|
36
|
+
rg_clear_selection(VALUE self)
|
25
37
|
{
|
26
38
|
gboolean ret = atk_selection_clear_selection(_SELF(self));
|
27
39
|
if (! ret) rb_raise(rb_eRuntimeError, "Can't clear selection");
|
@@ -29,25 +41,25 @@ rbatksel_clear_selection(VALUE self)
|
|
29
41
|
}
|
30
42
|
|
31
43
|
static VALUE
|
32
|
-
|
44
|
+
rg_ref_selection(VALUE self, VALUE i)
|
33
45
|
{
|
34
46
|
return GOBJ2RVAL(atk_selection_ref_selection(_SELF(self), NUM2INT(i)));
|
35
47
|
}
|
36
48
|
|
37
49
|
static VALUE
|
38
|
-
|
50
|
+
rg_selection_count(VALUE self)
|
39
51
|
{
|
40
52
|
return INT2NUM(atk_selection_get_selection_count(_SELF(self)));
|
41
53
|
}
|
42
54
|
|
43
55
|
static VALUE
|
44
|
-
|
56
|
+
rg_child_selected_p(VALUE self, VALUE i)
|
45
57
|
{
|
46
58
|
return CBOOL2RVAL(atk_selection_is_child_selected(_SELF(self), NUM2INT(i)));
|
47
59
|
}
|
48
60
|
|
49
61
|
static VALUE
|
50
|
-
|
62
|
+
rg_remove_selection(VALUE self, VALUE i)
|
51
63
|
{
|
52
64
|
gboolean ret = atk_selection_remove_selection(_SELF(self), NUM2INT(i));
|
53
65
|
if (! ret) rb_raise(rb_eRuntimeError, "Can't remove selection");
|
@@ -55,21 +67,21 @@ rbatksel_remove_selection(VALUE self, VALUE i)
|
|
55
67
|
}
|
56
68
|
|
57
69
|
static VALUE
|
58
|
-
|
70
|
+
rg_select_all_selection(VALUE self)
|
59
71
|
{
|
60
72
|
return CBOOL2RVAL(atk_selection_select_all_selection(_SELF(self)));
|
61
73
|
}
|
62
74
|
|
63
75
|
void
|
64
|
-
Init_atk_selection()
|
76
|
+
Init_atk_selection(VALUE mAtk)
|
65
77
|
{
|
66
|
-
VALUE
|
78
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_SELECTION, "Selection", mAtk);
|
67
79
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
80
|
+
RG_DEF_METHOD(add_selection, 1);
|
81
|
+
RG_DEF_METHOD(clear_selection, 0);
|
82
|
+
RG_DEF_METHOD(ref_selection, 1);
|
83
|
+
RG_DEF_METHOD(selection_count, 0);
|
84
|
+
RG_DEF_METHOD_P(child_selected, 1);
|
85
|
+
RG_DEF_METHOD(remove_selection, 1);
|
86
|
+
RG_DEF_METHOD(select_all_selection, 0);
|
75
87
|
}
|
data/ext/atk/rbatkstate.c
CHANGED
@@ -1,21 +1,33 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003,2004 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbatkprivate.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE cState
|
25
|
+
#define _SELF(s) (RVAL2ATKSTATE(s))
|
14
26
|
|
15
27
|
static VALUE
|
16
|
-
|
28
|
+
rg_s_type_register(G_GNUC_UNUSED VALUE self, VALUE name)
|
17
29
|
{
|
18
|
-
return
|
30
|
+
return ATKSTATETYPE2RVAL(atk_state_type_register(RVAL2CSTR(name)));
|
19
31
|
}
|
20
32
|
|
21
33
|
/* We don't need this.
|
@@ -24,16 +36,16 @@ G_CONST_RETURN gchar* atk_state_type_get_name
|
|
24
36
|
*/
|
25
37
|
|
26
38
|
static VALUE
|
27
|
-
|
39
|
+
rg_s_for_name(G_GNUC_UNUSED VALUE self, VALUE name)
|
28
40
|
{
|
29
|
-
return
|
41
|
+
return ATKSTATETYPE2RVAL(atk_state_type_for_name(RVAL2CSTR(name)));
|
30
42
|
}
|
31
43
|
|
32
44
|
void
|
33
|
-
Init_atk_state()
|
45
|
+
Init_atk_state(VALUE mAtk)
|
34
46
|
{
|
35
|
-
VALUE
|
36
|
-
|
37
|
-
|
47
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_STATE_TYPE, "State", mAtk);
|
48
|
+
RG_DEF_SMETHOD(type_register, 1);
|
49
|
+
RG_DEF_SMETHOD(for_name, 1);
|
38
50
|
G_DEF_CONSTANTS(mAtk, ATK_TYPE_STATE_TYPE, "ATK_");
|
39
51
|
}
|
data/ext/atk/rbatkstateset.c
CHANGED
@@ -1,132 +1,180 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbatkprivate.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE cStateSet
|
25
|
+
#define _SELF(s) (RVAL2ATKSTATESET(s))
|
15
26
|
|
16
27
|
static VALUE
|
17
|
-
|
28
|
+
rg_initialize(VALUE self)
|
18
29
|
{
|
19
30
|
G_INITIALIZE(self, atk_state_set_new());
|
20
31
|
return Qnil;
|
21
32
|
}
|
22
33
|
|
23
34
|
static VALUE
|
24
|
-
|
35
|
+
rg_empty_p(VALUE self)
|
25
36
|
{
|
26
37
|
return CBOOL2RVAL(atk_state_set_is_empty(_SELF(self)));
|
27
38
|
}
|
28
39
|
|
29
40
|
static VALUE
|
30
|
-
|
41
|
+
rg_add_state(VALUE self, VALUE type)
|
31
42
|
{
|
32
43
|
return CBOOL2RVAL(atk_state_set_add_state(_SELF(self),
|
33
|
-
|
44
|
+
RVAL2ATKSTATETYPE(type)));
|
45
|
+
}
|
46
|
+
|
47
|
+
struct rval2atkstatetype_args {
|
48
|
+
VALUE ary;
|
49
|
+
long n;
|
50
|
+
AtkStateType *result;
|
51
|
+
};
|
52
|
+
|
53
|
+
static VALUE
|
54
|
+
rval2atkstatetype_body(VALUE value)
|
55
|
+
{
|
56
|
+
long i;
|
57
|
+
struct rval2atkstatetype_args *args = (struct rval2atkstatetype_args *)value;
|
58
|
+
|
59
|
+
for (i = 0; i < args->n; i++)
|
60
|
+
args->result[i] = RVAL2ATKSTATETYPE(RARRAY_PTR(args->ary)[i]);
|
61
|
+
|
62
|
+
return Qnil;
|
34
63
|
}
|
35
64
|
|
65
|
+
static G_GNUC_NORETURN VALUE
|
66
|
+
rval2atkstatetype_rescue(VALUE value)
|
67
|
+
{
|
68
|
+
g_free(((struct rval2atkstatetype_args *)value)->result);
|
69
|
+
|
70
|
+
rb_exc_raise(rb_errinfo());
|
71
|
+
}
|
72
|
+
|
73
|
+
static AtkStateType *
|
74
|
+
rval2atkstatetype(VALUE value, long *n)
|
75
|
+
{
|
76
|
+
struct rval2atkstatetype_args args;
|
77
|
+
|
78
|
+
args.ary = rb_ary_to_ary(value);
|
79
|
+
args.n = RARRAY_LEN(args.ary);
|
80
|
+
args.result = g_new(AtkStateType, args.n + 1);
|
81
|
+
|
82
|
+
rb_rescue(rval2atkstatetype_body, (VALUE)&args,
|
83
|
+
rval2atkstatetype_rescue, (VALUE)&args);
|
84
|
+
|
85
|
+
if (n != NULL)
|
86
|
+
*n = args.n;
|
87
|
+
|
88
|
+
return args.result;
|
89
|
+
}
|
90
|
+
|
91
|
+
#define RVAL2ATKSTATETYPES(value, n) rval2atkstatetype(value, n)
|
92
|
+
|
36
93
|
static VALUE
|
37
|
-
|
94
|
+
rg_add_states(VALUE self, VALUE rbtypes)
|
38
95
|
{
|
39
|
-
|
40
|
-
|
41
|
-
AtkStateType*
|
96
|
+
AtkStateSet *set = _SELF(self);
|
97
|
+
long n;
|
98
|
+
AtkStateType *types = RVAL2ATKSTATETYPES(rbtypes, &n);
|
42
99
|
|
43
|
-
|
100
|
+
atk_state_set_add_states(set, types, n);
|
44
101
|
|
45
|
-
|
46
|
-
atypes[i] = RVAL2GENUM(RARRAY_PTR(types)[i], ATK_TYPE_STATE_TYPE);
|
47
|
-
}
|
102
|
+
g_free(types);
|
48
103
|
|
49
|
-
atk_state_set_add_states(_SELF(self), atypes, n_types);
|
50
|
-
g_free(atypes);
|
51
104
|
return self;
|
52
105
|
}
|
53
106
|
|
54
107
|
static VALUE
|
55
|
-
|
108
|
+
rg_clear_states(VALUE self)
|
56
109
|
{
|
57
110
|
atk_state_set_clear_states(_SELF(self));
|
58
111
|
return self;
|
59
112
|
}
|
60
113
|
|
61
114
|
static VALUE
|
62
|
-
|
115
|
+
rg_contains_state(VALUE self, VALUE type)
|
63
116
|
{
|
64
117
|
return CBOOL2RVAL(atk_state_set_contains_state(_SELF(self),
|
65
|
-
|
118
|
+
RVAL2ATKSTATETYPE(type)));
|
66
119
|
}
|
67
120
|
|
68
121
|
static VALUE
|
69
|
-
|
122
|
+
rg_contains_states(VALUE self, VALUE rbtypes)
|
70
123
|
{
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
124
|
+
AtkStateSet *set = _SELF(self);
|
125
|
+
long n;
|
126
|
+
AtkStateType *types = RVAL2ATKSTATETYPES(rbtypes, &n);
|
127
|
+
gboolean result;
|
75
128
|
|
76
|
-
|
129
|
+
result = atk_state_set_contains_states(set, types, n);
|
77
130
|
|
78
|
-
|
79
|
-
atypes[i] = RVAL2GENUM(RARRAY_PTR(types)[i], ATK_TYPE_STATE_TYPE);
|
80
|
-
}
|
81
|
-
|
82
|
-
ret = CBOOL2RVAL(atk_state_set_contains_states(_SELF(self), atypes, n_types));
|
131
|
+
g_free(types);
|
83
132
|
|
84
|
-
|
85
|
-
return ret;
|
133
|
+
return CBOOL2RVAL(result);
|
86
134
|
}
|
87
135
|
|
88
136
|
static VALUE
|
89
|
-
|
137
|
+
rg_remove_state(VALUE self, VALUE type)
|
90
138
|
{
|
91
139
|
return CBOOL2RVAL(atk_state_set_remove_state(_SELF(self),
|
92
|
-
|
140
|
+
RVAL2ATKSTATETYPE(type)));
|
93
141
|
}
|
94
142
|
|
95
143
|
static VALUE
|
96
|
-
|
144
|
+
rg_and(VALUE self, VALUE compare_set)
|
97
145
|
{
|
98
146
|
return GOBJ2RVAL(atk_state_set_and_sets(_SELF(self), _SELF(compare_set)));
|
99
147
|
}
|
100
148
|
|
101
149
|
static VALUE
|
102
|
-
|
150
|
+
rg_or(VALUE self, VALUE compare_set)
|
103
151
|
{
|
104
152
|
return GOBJ2RVAL(atk_state_set_or_sets(_SELF(self), _SELF(compare_set)));
|
105
153
|
}
|
106
154
|
|
107
155
|
static VALUE
|
108
|
-
|
156
|
+
rg_xor(VALUE self, VALUE compare_set)
|
109
157
|
{
|
110
158
|
return GOBJ2RVAL(atk_state_set_xor_sets(_SELF(self), _SELF(compare_set)));
|
111
159
|
}
|
112
160
|
|
113
161
|
void
|
114
|
-
Init_atk_state_set()
|
162
|
+
Init_atk_state_set(VALUE mAtk)
|
115
163
|
{
|
116
|
-
VALUE
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
164
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_STATE_SET, "StateSet", mAtk);
|
165
|
+
|
166
|
+
RG_DEF_METHOD(initialize, 0);
|
167
|
+
RG_DEF_METHOD_P(empty, 0);
|
168
|
+
RG_DEF_METHOD(add_state, 1);
|
169
|
+
RG_DEF_METHOD(add_states, 1);
|
170
|
+
RG_DEF_METHOD(clear_states, 0);
|
171
|
+
RG_DEF_METHOD(contains_state, 1);
|
172
|
+
RG_DEF_METHOD(contains_states, 1);
|
173
|
+
RG_DEF_METHOD(remove_state, 1);
|
174
|
+
RG_DEF_METHOD(and, 1);
|
175
|
+
RG_DEF_ALIAS("&", "and");
|
176
|
+
RG_DEF_METHOD(or, 1);
|
177
|
+
RG_DEF_ALIAS("|", "or");
|
178
|
+
RG_DEF_METHOD(xor, 1);
|
179
|
+
RG_DEF_ALIAS("^", "xor");
|
132
180
|
}
|