atk 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,9 @@ rescue LoadError
30
30
  require 'mkmf-gnome2'
31
31
  end
32
32
 
33
+ ruby_header = 'ruby.h'
34
+ have_func 'rb_errinfo', ruby_header
35
+
33
36
  ["glib2"].each do |package|
34
37
  directory = "#{package}#{version_suffix}"
35
38
  build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
@@ -1,27 +1,66 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003-2005 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
- rbatk.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/09/28 17:38:25 $
8
-
9
- Copyright (C) 2003-2005 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbatk.h"
22
+ #include "rbatkprivate.h"
13
23
 
24
+ #define RG_TARGET_NAMESPACE mAtk
14
25
  VALUE mAtk;
15
26
 
27
+ extern void Init_atk(void);
28
+
16
29
  void
17
- Init_atk()
30
+ Init_atk(void)
18
31
  {
19
- mAtk = rb_define_module("Atk");
32
+ RG_TARGET_NAMESPACE = rb_define_module("Atk");
20
33
 
21
- rb_define_const(mAtk, "BUILD_VERSION",
22
- rb_ary_new3(3,
23
- INT2FIX(ATK_MAJOR_VERSION),
24
- INT2FIX(ATK_MINOR_VERSION),
34
+ rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION",
35
+ rb_ary_new3(3,
36
+ INT2FIX(ATK_MAJOR_VERSION),
37
+ INT2FIX(ATK_MINOR_VERSION),
25
38
  INT2FIX(ATK_MICRO_VERSION)));
26
- Init_atk_inits();
39
+
40
+ Init_atk_action(RG_TARGET_NAMESPACE);
41
+ Init_atk_component(RG_TARGET_NAMESPACE);
42
+ Init_atk_document(RG_TARGET_NAMESPACE);
43
+ Init_atk_editabletext(RG_TARGET_NAMESPACE);
44
+ Init_atk_gobjectaccessible(RG_TARGET_NAMESPACE);
45
+ Init_atk_hyperlink(RG_TARGET_NAMESPACE);
46
+ Init_atk_hypertext(RG_TARGET_NAMESPACE);
47
+ Init_atk_image(RG_TARGET_NAMESPACE);
48
+ Init_atk_implementor(RG_TARGET_NAMESPACE);
49
+ Init_atk_noopobject(RG_TARGET_NAMESPACE);
50
+ Init_atk_noopobjectfactory(RG_TARGET_NAMESPACE);
51
+ Init_atk_object(RG_TARGET_NAMESPACE);
52
+ Init_atk_objectfactory(RG_TARGET_NAMESPACE);
53
+ Init_atk_registry(RG_TARGET_NAMESPACE);
54
+ Init_atk_relation(RG_TARGET_NAMESPACE);
55
+ Init_atk_relation_set(RG_TARGET_NAMESPACE);
56
+ Init_atk_selection(RG_TARGET_NAMESPACE);
57
+ Init_atk_state(RG_TARGET_NAMESPACE);
58
+ Init_atk_state_set(RG_TARGET_NAMESPACE);
59
+ Init_atk_streamable_content(RG_TARGET_NAMESPACE);
60
+ Init_atk_table(RG_TARGET_NAMESPACE);
61
+ Init_atk_text(RG_TARGET_NAMESPACE);
62
+ Init_atk_text_range(RG_TARGET_NAMESPACE);
63
+ Init_atk_text_rectangle(RG_TARGET_NAMESPACE);
64
+ Init_atk_util(RG_TARGET_NAMESPACE);
65
+ Init_atk_value(RG_TARGET_NAMESPACE);
27
66
  }
@@ -1,12 +1,24 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
- rbatk.h -
4
-
5
- $Author: mutoh $
6
- $Date: 2005/09/15 17:30:46 $
7
-
8
- Copyright (C) 2003,2004 Masao Mutoh
9
- ************************************************/
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
+
10
22
  #include "ruby.h"
11
23
  #include <atk/atk.h>
12
24
  #include <atk/atk-enum-types.h>
@@ -14,7 +26,7 @@
14
26
  #include <atk/atknoopobjectfactory.h>
15
27
  #include "rbgobject.h"
16
28
  #include "rbatkversion.h"
17
-
29
+ #include "rbatkconversions.h"
18
30
 
19
31
  #if defined(G_PLATFORM_WIN32) && !defined(RUBY_ATK_STATIC_COMPILATION)
20
32
  # ifdef RUBY_ATK_COMPILATION
@@ -25,10 +37,7 @@
25
37
  #else
26
38
  # define RUBY_ATK_VAR extern
27
39
  #endif
28
-
29
- #define RVAL2ATKOBJECT(s) ATK_OBJECT(RVAL2GOBJ(s))
30
40
 
31
- extern void Init_atk_inits();
32
41
  extern GType atk_text_rectangle_get_type(void);
33
42
  extern GType atk_text_range_get_type(void);
34
43
 
@@ -1,74 +1,85 @@
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
- rbatkaction.c -
22
+ #include "rbatkprivate.h"
5
23
 
6
- $Author: mutoh $
7
- $Date: 2004/03/05 15:33:47 $
8
-
9
- Copyright (C) 2004 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbatk.h"
13
-
14
- #define _SELF(s) (ATK_ACTION(RVAL2GOBJ(s)))
24
+ #define RG_TARGET_NAMESPACE mAction
25
+ #define _SELF(s) (RVAL2ATKACTION(s))
15
26
 
16
27
  static VALUE
17
- rbatk_action_do_action(VALUE self, VALUE i)
28
+ rg_do_action(VALUE self, VALUE i)
18
29
  {
19
30
  return CBOOL2RVAL(atk_action_do_action(_SELF(self), NUM2INT(i)));
20
31
  }
21
32
 
22
33
  static VALUE
23
- rbatk_action_get_n_actions(VALUE self)
34
+ rg_n_actions(VALUE self)
24
35
  {
25
36
  return INT2NUM(atk_action_get_n_actions(_SELF(self)));
26
37
  }
27
38
 
28
39
  static VALUE
29
- rbatk_action_get_description(VALUE self, VALUE i)
40
+ rg_get_description(VALUE self, VALUE i)
30
41
  {
31
42
  return CSTR2RVAL(atk_action_get_description(_SELF(self), NUM2INT(i)));
32
43
  }
33
44
 
34
45
  static VALUE
35
- rbatk_action_get_name(VALUE self, VALUE i)
46
+ rg_get_name(VALUE self, VALUE i)
36
47
  {
37
48
  return CSTR2RVAL(atk_action_get_name(_SELF(self), NUM2INT(i)));
38
49
  }
39
50
 
40
51
  #ifdef HAVE_ATK_ACTION_GET_LOCALIZED_NAME
41
52
  static VALUE
42
- rbatk_action_get_localized_name(VALUE self, VALUE i)
53
+ rg_get_localized_name(VALUE self, VALUE i)
43
54
  {
44
55
  return CSTR2RVAL(atk_action_get_localized_name(_SELF(self), NUM2INT(i)));
45
56
  }
46
57
  #endif
47
58
 
48
59
  static VALUE
49
- rbatk_action_get_keybinding(VALUE self, VALUE i)
60
+ rg_get_keybinding(VALUE self, VALUE i)
50
61
  {
51
62
  return CSTR2RVAL(atk_action_get_keybinding(_SELF(self), NUM2INT(i)));
52
63
  }
53
64
 
54
65
  static VALUE
55
- rbatk_action_set_description(VALUE self, VALUE i, VALUE desc)
66
+ rg_set_description(VALUE self, VALUE i, VALUE desc)
56
67
  {
57
68
  return CBOOL2RVAL(atk_action_set_description(_SELF(self), NUM2INT(i), RVAL2CSTR(desc)));
58
69
  }
59
70
 
60
71
  void
61
- Init_atk_action()
72
+ Init_atk_action(VALUE mAtk)
62
73
  {
63
- VALUE mAction = G_DEF_INTERFACE(ATK_TYPE_ACTION, "Action", mAtk);
74
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_ACTION, "Action", mAtk);
64
75
 
65
- rb_define_method(mAction, "do_action", rbatk_action_do_action, 1);
66
- rb_define_method(mAction, "n_actions", rbatk_action_get_n_actions, 0);
67
- rb_define_method(mAction, "get_description", rbatk_action_get_description, 1);
68
- rb_define_method(mAction, "get_name", rbatk_action_get_name, 1);
76
+ RG_DEF_METHOD(do_action, 1);
77
+ RG_DEF_METHOD(n_actions, 0);
78
+ RG_DEF_METHOD(get_description, 1);
79
+ RG_DEF_METHOD(get_name, 1);
69
80
  #ifdef HAVE_ATK_ACTION_GET_LOCALIZED_NAME
70
- rb_define_method(mAction, "get_localized_name", rbatk_action_get_localized_name, 1);
81
+ RG_DEF_METHOD(get_localized_name, 1);
71
82
  #endif
72
- rb_define_method(mAction, "get_keybinding", rbatk_action_get_keybinding, 1);
73
- rb_define_method(mAction, "set_description", rbatk_action_set_description, 2);
83
+ RG_DEF_METHOD(get_keybinding, 1);
84
+ RG_DEF_METHOD(set_description, 2);
74
85
  }
@@ -1,17 +1,28 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbatkcomponent.c -
5
-
6
- $Author: sakai $
7
- $Date: 2007/07/08 02:51:52 $
8
-
9
- Copyright (C) 2004 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbatk.h"
13
-
14
- #define _SELF(s) (ATK_COMPONENT(RVAL2GOBJ(s)))
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
+ */
21
+
22
+ #include "rbatkprivate.h"
23
+
24
+ #define RG_TARGET_NAMESPACE mComponent
25
+ #define _SELF(s) (RVAL2ATKCOMPONENT(s))
15
26
 
16
27
  /*
17
28
  static void
@@ -21,7 +32,7 @@ focus_handler(AtkObject *aobj, gboolean bool)
21
32
  GOBJ2RVAL(aobj), CBOOL2RVAL(bool));
22
33
  }
23
34
  static VALUE
24
- comp_add_focus_handler(VALUE self)
35
+ rg_add_focus_handler(VALUE self)
25
36
  {
26
37
  VALUE func = rb_block_proc();
27
38
  G_RELATIVE(self, func);
@@ -30,49 +41,49 @@ comp_add_focus_handler(VALUE self)
30
41
  */
31
42
 
32
43
  static VALUE
33
- comp_contains(VALUE self, VALUE x, VALUE y, VALUE coord_type)
44
+ rg_contains_p(VALUE self, VALUE x, VALUE y, VALUE coord_type)
34
45
  {
35
46
  return CBOOL2RVAL(atk_component_contains(_SELF(self),
36
47
  NUM2INT(x), NUM2INT(y),
37
- RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE)));
48
+ RVAL2ATKCOORDTYPE(coord_type)));
38
49
  }
39
50
 
40
51
  static VALUE
41
- comp_get_extents(VALUE self, VALUE coord_type)
52
+ rg_get_extents(VALUE self, VALUE coord_type)
42
53
  {
43
54
  gint x, y, width, height;
44
55
  atk_component_get_extents(_SELF(self), &x, &y, &width, &height,
45
- RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE));
56
+ RVAL2ATKCOORDTYPE(coord_type));
46
57
  return rb_ary_new3(4, INT2NUM(x), INT2NUM(y), INT2NUM(width), INT2NUM(height));
47
58
  }
48
59
 
49
60
  #ifdef HAVE_ATK_COMPONENT_GET_LAYER
50
61
  static VALUE
51
- comp_get_layer(VALUE self)
62
+ rg_layer(VALUE self)
52
63
  {
53
- return GENUM2RVAL(atk_component_get_layer(_SELF(self)), ATK_TYPE_LAYER);
64
+ return ATKLAYER2RVAL(atk_component_get_layer(_SELF(self)));
54
65
  }
55
66
  #endif
56
67
 
57
68
  #ifdef HAVE_ATK_COMPONENT_GET_MDI_ZORDER
58
69
  static VALUE
59
- comp_get_mdi_zorder(VALUE self)
70
+ rg_mdi_zorder(VALUE self)
60
71
  {
61
72
  return INT2NUM(atk_component_get_mdi_zorder(_SELF(self)));
62
73
  }
63
74
 
64
75
  #endif
65
76
  static VALUE
66
- comp_get_position(VALUE self, VALUE coord_type)
77
+ rg_position(VALUE self, VALUE coord_type)
67
78
  {
68
79
  gint x, y;
69
80
  atk_component_get_position(_SELF(self), &x, &y,
70
- RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE));
81
+ RVAL2ATKCOORDTYPE(coord_type));
71
82
  return rb_assoc_new(INT2NUM(x), INT2NUM(y));
72
83
  }
73
84
 
74
85
  static VALUE
75
- comp_get_size(VALUE self)
86
+ rg_size(VALUE self)
76
87
  {
77
88
  gint width, height;
78
89
  atk_component_get_size(_SELF(self), &width, &height);
@@ -80,50 +91,50 @@ comp_get_size(VALUE self)
80
91
  }
81
92
 
82
93
  static VALUE
83
- comp_grab_focus(VALUE self)
94
+ rg_grab_focus(VALUE self)
84
95
  {
85
96
  return CBOOL2RVAL(atk_component_grab_focus(_SELF(self)));
86
97
  }
87
98
 
88
99
  static VALUE
89
- comp_ref_accessible_at_point(VALUE self, VALUE x, VALUE y, VALUE coord_type)
100
+ rg_ref_accessible_at_point(VALUE self, VALUE x, VALUE y, VALUE coord_type)
90
101
  {
91
102
  return GOBJ2RVAL(atk_component_ref_accessible_at_point(
92
103
  _SELF(self),
93
104
  NUM2INT(x), NUM2INT(y),
94
- RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE)));
105
+ RVAL2ATKCOORDTYPE(coord_type)));
95
106
  }
96
107
 
97
108
  static VALUE
98
- comp_remove_focus_handler(VALUE self, VALUE handler_id)
109
+ rg_remove_focus_handler(VALUE self, VALUE handler_id)
99
110
  {
100
111
  atk_component_remove_focus_handler(_SELF(self), NUM2UINT(handler_id));
101
112
  return self;
102
113
  }
103
114
 
104
115
  static VALUE
105
- comp_set_extents(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, VALUE coord_type)
116
+ rg_set_extents(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, VALUE coord_type)
106
117
  {
107
118
  gboolean ret = atk_component_set_extents(_SELF(self),
108
119
  NUM2INT(x), NUM2INT(y),
109
120
  NUM2INT(width), NUM2INT(height),
110
- RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE));
121
+ RVAL2ATKCOORDTYPE(coord_type));
111
122
  if (! ret) rb_raise(rb_eRuntimeError, "Can't set extents");
112
123
  return self;
113
124
  }
114
125
 
115
126
  static VALUE
116
- comp_set_position(VALUE self, VALUE x, VALUE y, VALUE coord_type)
127
+ rg_set_position(VALUE self, VALUE x, VALUE y, VALUE coord_type)
117
128
  {
118
129
  gboolean ret = atk_component_set_position(_SELF(self),
119
130
  NUM2INT(x), NUM2INT(y),
120
- RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE));
131
+ RVAL2ATKCOORDTYPE(coord_type));
121
132
  if (! ret) rb_raise(rb_eRuntimeError, "Can't set the position");
122
133
  return self;
123
134
  }
124
135
 
125
136
  static VALUE
126
- comp_set_size(VALUE self, VALUE width, VALUE height)
137
+ rg_set_size(VALUE self, VALUE width, VALUE height)
127
138
  {
128
139
  gboolean ret = atk_component_set_size(_SELF(self),
129
140
  NUM2INT(width), NUM2INT(height));
@@ -133,36 +144,36 @@ comp_set_size(VALUE self, VALUE width, VALUE height)
133
144
 
134
145
  #if ATK_CHECK_VERSION(1,12,0)
135
146
  static VALUE
136
- comp_get_alpha(VALUE self)
147
+ rg_alpha(VALUE self)
137
148
  {
138
149
  return rb_float_new(atk_component_get_alpha(_SELF(self)));
139
150
  }
140
151
  #endif
141
152
 
142
153
  void
143
- Init_atk_component()
154
+ Init_atk_component(VALUE mAtk)
144
155
  {
145
- VALUE comp = G_DEF_INTERFACE(ATK_TYPE_COMPONENT, "Component", mAtk);
156
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_COMPONENT, "Component", mAtk);
146
157
  /*
147
- rb_define_method(comp, "add_focus_handler", comp_add_focus_handler, 0);
158
+ RG_DEF_METHOD(add_focus_handler, 0);
148
159
  */
149
- rb_define_method(comp, "contains?", comp_contains, 3);
150
- rb_define_method(comp, "get_extents", comp_get_extents, 1);
160
+ RG_DEF_METHOD_P(contains, 3);
161
+ RG_DEF_METHOD(get_extents, 1);
151
162
  #ifdef HAVE_ATK_COMPONENT_GET_LAYER
152
- rb_define_method(comp, "layer", comp_get_layer, 0);
163
+ RG_DEF_METHOD(layer, 0);
153
164
  #endif
154
165
  #ifdef HAVE_ATK_COMPONENT_GET_MDI_ZORDER
155
- rb_define_method(comp, "mdi_zorder", comp_get_mdi_zorder, 0);
166
+ RG_DEF_METHOD(mdi_zorder, 0);
156
167
  #endif
157
- rb_define_method(comp, "position", comp_get_position, 1);
158
- rb_define_method(comp, "size", comp_get_size, 0);
159
- rb_define_method(comp, "grab_focus", comp_grab_focus, 0);
160
- rb_define_method(comp, "ref_accessible_at_point", comp_ref_accessible_at_point, 3);
161
- rb_define_method(comp, "remove_focus_handler", comp_remove_focus_handler, 1);
162
- rb_define_method(comp, "set_extents", comp_set_extents, 5);
163
- rb_define_method(comp, "set_position", comp_set_position, 2);
164
- rb_define_method(comp, "set_size", comp_set_size, 2);
168
+ RG_DEF_METHOD(position, 1);
169
+ RG_DEF_METHOD(size, 0);
170
+ RG_DEF_METHOD(grab_focus, 0);
171
+ RG_DEF_METHOD(ref_accessible_at_point, 3);
172
+ RG_DEF_METHOD(remove_focus_handler, 1);
173
+ RG_DEF_METHOD(set_extents, 5);
174
+ RG_DEF_METHOD(set_position, 2);
175
+ RG_DEF_METHOD(set_size, 2);
165
176
  #if ATK_CHECK_VERSION(1,12,0)
166
- rb_define_method(comp, "alpha", comp_get_alpha, 0);
177
+ RG_DEF_METHOD(alpha, 0);
167
178
  #endif
168
179
  }