atk 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,37 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbatkgobjectaccessible.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/12/07 17:18:16 $
8
+
9
+ Copyright (C) 2003 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "rbatk.h"
13
+
14
+ #define _SELF(s) (ATK_GOBJECT_ACCESSIBLE(RVAL2GOBJ(s)))
15
+
16
+ static VALUE
17
+ rbatk_gobjectaccessible_s_for_object(self, obj)
18
+ VALUE self, obj;
19
+ {
20
+ return GOBJ2RVAL(atk_gobject_accessible_for_object(RVAL2GOBJ(obj)));
21
+ }
22
+
23
+ static VALUE
24
+ rbatk_gobjectaccessible_get_object(self)
25
+ VALUE self;
26
+ {
27
+ return GOBJ2RVAL(atk_gobject_accessible_get_object(_SELF(self)));
28
+ }
29
+
30
+ void
31
+ Init_atk_gobjectaccessible()
32
+ {
33
+ VALUE macc = G_DEF_CLASS(ATK_TYPE_GOBJECT_ACCESSIBLE, "GObjectAccessible", mAtk);
34
+
35
+ rb_define_singleton_method(macc, "for_object", rbatk_gobjectaccessible_s_for_object, 1);
36
+ rb_define_method(macc, "object", rbatk_gobjectaccessible_get_object, 0);
37
+ }
@@ -0,0 +1,92 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbatkhyperlink.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2004/10/17 23:06:07 $
8
+
9
+ Copyright (C) 2003,2004 Masao Mutoh
10
+ ************************************************/
11
+ #include "rbatk.h"
12
+
13
+ #define _SELF(s) (ATK_HYPERLINK(RVAL2GOBJ(s)))
14
+
15
+ static VALUE
16
+ rbatk_hl_get_uri(self, i)
17
+ VALUE self, i;
18
+ {
19
+ return CSTR2RVAL(atk_hyperlink_get_uri(_SELF(self), NUM2INT(i)));
20
+ }
21
+
22
+ static VALUE
23
+ rbatk_hl_get_object(self, i)
24
+ VALUE self, i;
25
+ {
26
+ return GOBJ2RVAL(atk_hyperlink_get_object(_SELF(self), NUM2INT(i)));
27
+ }
28
+
29
+ static VALUE
30
+ rbatk_hl_get_end_index(self)
31
+ VALUE self;
32
+ {
33
+ return INT2NUM(atk_hyperlink_get_end_index(_SELF(self)));
34
+ }
35
+
36
+ static VALUE
37
+ rbatk_hl_get_start_index(self)
38
+ VALUE self;
39
+ {
40
+ return INT2NUM(atk_hyperlink_get_start_index(_SELF(self)));
41
+ }
42
+
43
+ static VALUE
44
+ rbatk_hl_is_valid(self)
45
+ VALUE self;
46
+ {
47
+ return CBOOL2RVAL(atk_hyperlink_is_valid(_SELF(self)));
48
+ }
49
+
50
+ #ifdef HAVE_ATK_HYPERLINK_IS_INLINE
51
+ static VALUE
52
+ rbatk_hl_is_inline(self)
53
+ VALUE self;
54
+ {
55
+ return CBOOL2RVAL(atk_hyperlink_is_inline(_SELF(self)));
56
+ }
57
+ #endif
58
+
59
+ static VALUE
60
+ rbatk_hl_get_n_anchors(self)
61
+ VALUE self;
62
+ {
63
+ return INT2NUM(atk_hyperlink_get_n_anchors(_SELF(self)));
64
+ }
65
+
66
+ #ifdef HAVE_ATK_HYPERLINK_IS_SELECTED_LINK
67
+ static VALUE
68
+ rbatk_hl_is_selected_link(self)
69
+ VALUE self;
70
+ {
71
+ return CBOOL2RVAL(atk_hyperlink_is_selected_link(_SELF(self)));
72
+ }
73
+ #endif
74
+
75
+ void
76
+ Init_atk_hyperlink()
77
+ {
78
+ VALUE hl = G_DEF_CLASS(ATK_TYPE_HYPERLINK, "Hyperlink", mAtk);
79
+
80
+ rb_define_method(hl, "get_uri", rbatk_hl_get_uri, 1);
81
+ rb_define_method(hl, "get_object", rbatk_hl_get_object, 1);
82
+ rb_define_method(hl, "end_index", rbatk_hl_get_end_index, 0);
83
+ rb_define_method(hl, "start_index", rbatk_hl_get_start_index, 0);
84
+ rb_define_method(hl, "valid?", rbatk_hl_is_valid, 0);
85
+ #ifdef HAVE_ATK_HYPERLINK_IS_INLINE
86
+ rb_define_method(hl, "inline?", rbatk_hl_is_inline, 0);
87
+ #endif
88
+ rb_define_method(hl, "n_anchors", rbatk_hl_get_n_anchors, 0);
89
+ #ifdef HAVE_ATK_HYPERLINK_IS_SELECTED_LINK
90
+ rb_define_method(hl, "selected_link?", rbatk_hl_is_selected_link, 0);
91
+ #endif
92
+ }
@@ -0,0 +1,44 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbatkhypertext.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/12/07 17:18:16 $
8
+
9
+ Copyright (C) 2003 Masao Mutoh
10
+ ************************************************/
11
+ #include "rbatk.h"
12
+
13
+ #define _SELF(s) (ATK_HYPERTEXT(RVAL2GOBJ(s)))
14
+
15
+ static VALUE
16
+ rbatk_ht_get_link(self, link_index)
17
+ VALUE self, link_index;
18
+ {
19
+ return GOBJ2RVAL(atk_hypertext_get_link(_SELF(self), NUM2INT(link_index)));
20
+ }
21
+
22
+ static VALUE
23
+ rbatk_ht_get_n_links(self)
24
+ VALUE self;
25
+ {
26
+ return INT2NUM(atk_hypertext_get_n_links(_SELF(self)));
27
+ }
28
+
29
+ static VALUE
30
+ rbatk_ht_get_link_index(self, char_index)
31
+ VALUE self, char_index;
32
+ {
33
+ return INT2NUM(atk_hypertext_get_link_index(_SELF(self), NUM2INT(char_index)));
34
+ }
35
+
36
+ void
37
+ Init_atk_hypertext()
38
+ {
39
+ VALUE ht = G_DEF_INTERFACE(ATK_TYPE_HYPERTEXT, "Hypertext", mAtk);
40
+
41
+ rb_define_method(ht, "get_link", rbatk_ht_get_link, 1);
42
+ rb_define_method(ht, "n_links", rbatk_ht_get_n_links, 0);
43
+ rb_define_method(ht, "link_index", rbatk_ht_get_link_index, 1);
44
+ }
@@ -0,0 +1,62 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbatkhypertext.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2004/03/05 15:33:47 $
8
+
9
+ Copyright (C) 2004 Masao Mutoh
10
+ ************************************************/
11
+ #include "rbatk.h"
12
+
13
+ #define _SELF(s) (ATK_IMAGE(RVAL2GOBJ(s)))
14
+
15
+ static VALUE
16
+ rbatkimage_get_image_position(self, coord_type)
17
+ VALUE self, coord_type;
18
+ {
19
+ gint x, y;
20
+ atk_image_get_image_position(_SELF(self), &x, &y,
21
+ RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE));
22
+ return rb_assoc_new(INT2NUM(x), INT2NUM(y));
23
+ }
24
+
25
+ static VALUE
26
+ rbatkimage_get_image_description(self)
27
+ VALUE self;
28
+ {
29
+ return CSTR2RVAL(atk_image_get_image_description(_SELF(self)));
30
+ }
31
+
32
+ static VALUE
33
+ rbatkimage_set_image_description(self, description)
34
+ VALUE self, description;
35
+ {
36
+ gboolean ret = atk_image_set_image_description(_SELF(self),
37
+ RVAL2CSTR(description));
38
+ if (! ret) rb_raise(rb_eRuntimeError, "Can't set image description");
39
+ return self;
40
+ }
41
+
42
+ static VALUE
43
+ rbatkimage_get_image_size(self)
44
+ VALUE self;
45
+ {
46
+ gint width, height;
47
+ atk_image_get_image_size(_SELF(self), &width, &height);
48
+ return rb_assoc_new(INT2NUM(width), INT2NUM(height));
49
+ }
50
+
51
+ void
52
+ Init_atk_image()
53
+ {
54
+ VALUE image = G_DEF_INTERFACE(ATK_TYPE_IMAGE, "Image", mAtk);
55
+
56
+ rb_define_method(image, "image_position", rbatkimage_get_image_position, 1);
57
+ rb_define_method(image, "image_description", rbatkimage_get_image_description, 0);
58
+ rb_define_method(image, "set_image_description", rbatkimage_set_image_description, 1);
59
+ rb_define_method(image, "image_size", rbatkimage_get_image_size, 0);
60
+
61
+ G_DEF_SETTERS(image);
62
+ }
@@ -0,0 +1,27 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbatkimplementor.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/12/07 17:18:16 $
8
+
9
+ Copyright (C) 2003 Masao Mutoh
10
+ ************************************************/
11
+ #include "rbatk.h"
12
+
13
+ #define _SELF(s) (ATK_IMPLEMENTOR(RVAL2GOBJ(s)))
14
+
15
+ static VALUE
16
+ rbatkimpl_ref_accessible(self)
17
+ VALUE self;
18
+ {
19
+ return GOBJ2RVAL(atk_implementor_ref_accessible(_SELF(self)));
20
+ }
21
+
22
+ void
23
+ Init_atk_implementor()
24
+ {
25
+ VALUE impl = G_DEF_INTERFACE(ATK_TYPE_IMPLEMENTOR, "Implementor", mAtk);
26
+ rb_define_method(impl, "ref_accessible", rbatkimpl_ref_accessible, 0);
27
+ }
@@ -0,0 +1,55 @@
1
+ extern void Init_atk_action();
2
+ extern void Init_atk_component();
3
+ extern void Init_atk_document();
4
+ extern void Init_atk_editabletext();
5
+ extern void Init_atk_gobjectaccessible();
6
+ extern void Init_atk_hyperlink();
7
+ extern void Init_atk_hypertext();
8
+ extern void Init_atk_image();
9
+ extern void Init_atk_implementor();
10
+ extern void Init_atk_noopobject();
11
+ extern void Init_atk_noopobjectfactory();
12
+ extern void Init_atk_object();
13
+ extern void Init_atk_objectfactory();
14
+ extern void Init_atk_registry();
15
+ extern void Init_atk_relation();
16
+ extern void Init_atk_relation_set();
17
+ extern void Init_atk_selection();
18
+ extern void Init_atk_state();
19
+ extern void Init_atk_state_set();
20
+ extern void Init_atk_streamable_content();
21
+ extern void Init_atk_table();
22
+ extern void Init_atk_text();
23
+ extern void Init_atk_text_range();
24
+ extern void Init_atk_text_rectangle();
25
+ extern void Init_atk_util();
26
+ extern void Init_atk_value();
27
+ void Init_atk_inits()
28
+ {
29
+ Init_atk_action();
30
+ Init_atk_component();
31
+ Init_atk_document();
32
+ Init_atk_editabletext();
33
+ Init_atk_gobjectaccessible();
34
+ Init_atk_hyperlink();
35
+ Init_atk_hypertext();
36
+ Init_atk_image();
37
+ Init_atk_implementor();
38
+ Init_atk_noopobject();
39
+ Init_atk_noopobjectfactory();
40
+ Init_atk_object();
41
+ Init_atk_objectfactory();
42
+ Init_atk_registry();
43
+ Init_atk_relation();
44
+ Init_atk_relation_set();
45
+ Init_atk_selection();
46
+ Init_atk_state();
47
+ Init_atk_state_set();
48
+ Init_atk_streamable_content();
49
+ Init_atk_table();
50
+ Init_atk_text();
51
+ Init_atk_text_range();
52
+ Init_atk_text_rectangle();
53
+ Init_atk_util();
54
+ Init_atk_value();
55
+ }
@@ -0,0 +1,30 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbatknoopobject.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/12/04 18:06:17 $
8
+
9
+ Copyright (C) 2003 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "rbatk.h"
13
+
14
+ #define _SELF(s) (ATK_NOOPOBJECT(RVAL2GOBJ(s)))
15
+
16
+ static VALUE
17
+ rbatk_no_op_object_initialize(self, gobj)
18
+ VALUE self, gobj;
19
+ {
20
+ G_INITIALIZE(self, atk_no_op_object_new(RVAL2GOBJ(gobj)));
21
+ return Qnil;
22
+ }
23
+
24
+ void
25
+ Init_atk_noopobject()
26
+ {
27
+ VALUE noop = G_DEF_CLASS(ATK_TYPE_NO_OP_OBJECT, "NoOpObject", mAtk);
28
+
29
+ rb_define_method(noop, "initialize", rbatk_no_op_object_initialize, 1);
30
+ }
@@ -0,0 +1,30 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbatknoopobjectfactory.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/12/07 17:18:16 $
8
+
9
+ Copyright (C) 2003 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "rbatk.h"
13
+
14
+ #define _SELF(s) (ATK_NO_OP_OBJECT_FACTORY(RVAL2GOBJ(s)))
15
+
16
+ static VALUE
17
+ rbatk_no_op_object_factory_initialize(self)
18
+ VALUE self;
19
+ {
20
+ G_INITIALIZE(self, atk_no_op_object_factory_new());
21
+ return Qnil;
22
+ }
23
+
24
+ void
25
+ Init_atk_noopobjectfactory()
26
+ {
27
+ VALUE noop = G_DEF_CLASS(ATK_TYPE_NO_OP_OBJECT_FACTORY, "NoOpObjectFactory", mAtk);
28
+
29
+ rb_define_method(noop, "initialize", rbatk_no_op_object_factory_initialize, 0);
30
+ }
@@ -0,0 +1,178 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbatkobject.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:28 $
8
+
9
+ Copyright (C) 2003,2004 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "rbatk.h"
13
+
14
+ #define _SELF(s) (ATK_OBJECT(RVAL2GOBJ(s)))
15
+
16
+ /* How can I implement this? Since 1.10
17
+ AtkObject* atk_implementor_ref_accessible (AtkImplementor *implementor);
18
+ */
19
+
20
+ /* Use properties accessible_*
21
+ G_CONST_RETURN gchar* atk_object_get_name (AtkObject *accessible);
22
+ G_CONST_RETURN gchar* atk_object_get_description
23
+ (AtkObject *accessible);
24
+ AtkObject* atk_object_get_parent (AtkObject *accessible);
25
+ (AtkObject *accessible);
26
+ */
27
+
28
+ static VALUE
29
+ rbatkobj_get_n_accessible_children(self)
30
+ VALUE self;
31
+ {
32
+ return INT2NUM(atk_object_get_n_accessible_children(_SELF(self)));
33
+ }
34
+
35
+ static VALUE
36
+ rbatkobj_ref_accessible_child(self, i)
37
+ VALUE self, i;
38
+ {
39
+ return GOBJ2RVAL(atk_object_ref_accessible_child(_SELF(self), NUM2INT(i)));
40
+ }
41
+
42
+ static VALUE
43
+ rbatkobj_ref_releation_set(self)
44
+ VALUE self;
45
+ {
46
+ return GOBJ2RVAL(atk_object_ref_relation_set(_SELF(self)));
47
+ }
48
+
49
+ /* Use properties accessible_*
50
+ AtkLayer atk_object_get_layer (AtkObject *accessible);
51
+ gint atk_object_get_mdi_zorder (AtkObject *accessible);
52
+ AtkRole atk_object_get_role (AtkObject *accessible);
53
+ */
54
+
55
+ static VALUE
56
+ rbatkobj_ref_state_set(self)
57
+ VALUE self;
58
+ {
59
+ return GOBJ2RVAL(atk_object_ref_state_set(_SELF(self)));
60
+ }
61
+
62
+ static VALUE
63
+ rbatkobj_get_index_in_parent(self)
64
+ VALUE self;
65
+ {
66
+ return INT2NUM(atk_object_get_index_in_parent(_SELF(self)));
67
+ }
68
+ /* Use properties accessible_*
69
+ void atk_object_set_name (AtkObject *accessible,
70
+ const gchar *name);
71
+ void atk_object_set_description (AtkObject *accessible,
72
+ const gchar *description);
73
+ void atk_object_set_parent (AtkObject *accessible,
74
+ AtkObject *parent);
75
+ void atk_object_set_role (AtkObject *accessible,
76
+ AtkRole role);
77
+ */
78
+
79
+ /*
80
+ guint atk_object_connect_property_change_handler
81
+ (AtkObject *accessible,
82
+ AtkPropertyChangeHandler *handler);
83
+ void atk_object_remove_property_change_handler
84
+ (AtkObject *accessible,
85
+ guint handler_id);
86
+ */
87
+
88
+ static VALUE
89
+ rbatkobj_notify_state_change(self, state, value)
90
+ VALUE self, state, value;
91
+ {
92
+ atk_object_notify_state_change(_SELF(self),
93
+ RVAL2GENUM(state, ATK_TYPE_STATE_TYPE),
94
+ RVAL2CBOOL(value));
95
+ return self;
96
+ }
97
+
98
+ /* I don't have a good idea to implement this method. Any idea?
99
+ void atk_object_initialize (AtkObject *accessible,
100
+ gpointer data);
101
+ */
102
+
103
+ #ifdef HAVE_ATK_OBJECT_ADD_RELATIONSHIP
104
+ static VALUE
105
+ rbatkobj_add_relationship(self, relationship, target)
106
+ VALUE self, relationship, target;
107
+ {
108
+ return CBOOL2RVAL(atk_object_add_relationship(
109
+ _SELF(self),
110
+ RVAL2GENUM(relationship, ATK_TYPE_RELATION_TYPE),
111
+ _SELF(target)));
112
+ }
113
+ #endif
114
+
115
+ #ifdef HAVE_ATK_OBJECT_REMOVE_RELATIONSHIP
116
+ static VALUE
117
+ rbatkobj_remove_relationship(self, relationship, target)
118
+ VALUE self, relationship, target;
119
+ {
120
+ return CBOOL2RVAL(atk_object_remove_relationship(
121
+ _SELF(self),
122
+ RVAL2GENUM(relationship, ATK_TYPE_RELATION_TYPE),
123
+ _SELF(target)));
124
+ }
125
+ #endif
126
+
127
+ /* We don't need this.
128
+ G_CONST_RETURN gchar* atk_role_get_name (AtkRole role);
129
+ */
130
+
131
+ static VALUE
132
+ rbatkrole_get_localized_name(self)
133
+ VALUE self;
134
+ {
135
+ #ifdef HAVE_ATK_ROLE_GET_LOCALIZED_NAME
136
+ return CSTR2RVAL(atk_role_get_localized_name(RVAL2GENUM(self, ATK_TYPE_ROLE)));
137
+ #else
138
+ rb_warning("not supported in this version of ATK.");
139
+ return Qnil;
140
+ #endif
141
+ }
142
+
143
+ static VALUE
144
+ rbatkrole_s_for_name(self, name)
145
+ VALUE self, name;
146
+ {
147
+ return GENUM2RVAL(atk_role_for_name(RVAL2CSTR(name)), ATK_TYPE_ROLE);
148
+ }
149
+
150
+ void
151
+ Init_atk_object()
152
+ {
153
+ VALUE obj = G_DEF_CLASS(ATK_TYPE_OBJECT, "Object", mAtk);
154
+ VALUE role;
155
+
156
+ rb_define_method(obj, "n_accessible_children", rbatkobj_get_n_accessible_children, 0);
157
+ rb_define_method(obj, "ref_accessible_child", rbatkobj_ref_accessible_child, 1);
158
+ rb_define_method(obj, "ref_relation_set", rbatkobj_ref_releation_set, 0);
159
+ rb_define_method(obj, "ref_state_set", rbatkobj_ref_state_set, 0);
160
+ rb_define_method(obj, "index_in_parent", rbatkobj_get_index_in_parent, 0);
161
+ rb_define_method(obj, "notify_state_change", rbatkobj_notify_state_change, 2);
162
+ #ifdef HAVE_ATK_OBJECT_ADD_RELATIONSHIP
163
+ rb_define_method(obj, "add_relationship", rbatkobj_add_relationship, 2);
164
+ #endif
165
+ #ifdef HAVE_ATK_OBJECT_REMOVE_RELATIONSHIP
166
+ rb_define_method(obj, "remove_relationship", rbatkobj_remove_relationship, 2);
167
+ #endif
168
+
169
+ /* AtkRole */
170
+ role = G_DEF_CLASS(ATK_TYPE_ROLE, "Role", obj);
171
+ rb_define_method(role, "localized_name", rbatkrole_get_localized_name, 0);
172
+ rb_define_singleton_method(role, "for_name", rbatkrole_s_for_name, 1);
173
+ G_DEF_CONSTANTS(obj, ATK_TYPE_ROLE, "ATK_");
174
+
175
+ /* AtkLayer */
176
+ G_DEF_CLASS(ATK_TYPE_LAYER, "Layer", obj);
177
+ G_DEF_CONSTANTS(obj, ATK_TYPE_LAYER, "ATK_");
178
+ }