atk 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,47 +1,57 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbatkstreamablecontent.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/09/15 17:30:46 $
8
-
9
- Copyright (C) 2003 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbatk.h"
13
-
14
- #define _SELF(s) (ATK_STREAMABLE_CONTENT(RVAL2GOBJ(s)))
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 mStreamableContent
25
+ #define _SELF(s) (RVAL2ATKSTREAMABLECONTENT(s))
15
26
 
16
27
  static VALUE
17
- rbatkst_get_n_mime_types(VALUE self)
28
+ rg_n_mime_types(VALUE self)
18
29
  {
19
30
  return INT2NUM(atk_streamable_content_get_n_mime_types(_SELF(self)));
20
31
  }
21
32
 
22
33
  static VALUE
23
- rbatkst_get_mime_type(VALUE self, VALUE i)
34
+ rg_mime_type(VALUE self, VALUE i)
24
35
  {
25
36
  return CSTR2RVAL(atk_streamable_content_get_mime_type(_SELF(self), NUM2INT(i)));
26
37
  }
27
38
 
28
39
  static VALUE
29
- rbatkst_get_stream(VALUE self, VALUE mime_type)
40
+ rg_get_stream(VALUE self, VALUE mime_type)
30
41
  {
31
42
  GIOChannel* io = atk_streamable_content_get_stream(_SELF(self), RVAL2CSTR(mime_type));
32
43
  if (!io)
33
44
  rb_raise(rb_eRuntimeError, "Couldn't get the stream.");
34
45
 
35
- return BOXED2RVAL(io, G_TYPE_IO_CHANNEL);
46
+ return GIOCHANNEL2RVAL(io);
36
47
  }
37
48
 
38
-
39
49
  void
40
- Init_atk_streamable_content()
50
+ Init_atk_streamable_content(VALUE mAtk)
41
51
  {
42
- VALUE mContent = G_DEF_INTERFACE(ATK_TYPE_STREAMABLE_CONTENT, "StreamableContent", mAtk);
52
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_STREAMABLE_CONTENT, "StreamableContent", mAtk);
43
53
 
44
- rb_define_method(mContent, "n_mime_types", rbatkst_get_n_mime_types, 0);
45
- rb_define_method(mContent, "mime_type", rbatkst_get_mime_type, 1);
46
- rb_define_method(mContent, "get_stream", rbatkst_get_stream, 1);
54
+ RG_DEF_METHOD(n_mime_types, 0);
55
+ RG_DEF_METHOD(mime_type, 1);
56
+ RG_DEF_METHOD(get_stream, 1);
47
57
  }
@@ -1,146 +1,157 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbatktable.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2004/03/05 15:33:48 $
8
-
9
- Copyright (C) 2003,2004 Masao Mutoh
10
- ************************************************/
11
-
12
- #include "rbatk.h"
13
-
14
- #define _SELF(s) (ATK_TABLE(RVAL2GOBJ(s)))
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 mTable
25
+ #define _SELF(s) (RVAL2ATKTABLE(s))
15
26
 
16
27
  static VALUE
17
- rbatk_table_ref_at(VALUE self, VALUE row, VALUE column)
28
+ rg_ref_at(VALUE self, VALUE row, VALUE column)
18
29
  {
19
30
  return GOBJ2RVAL(atk_table_ref_at(_SELF(self), NUM2INT(row), NUM2INT(column)));
20
31
  }
21
32
 
22
33
  static VALUE
23
- rbatk_table_get_index_at(VALUE self, VALUE row, VALUE column)
34
+ rg_get_index_at(VALUE self, VALUE row, VALUE column)
24
35
  {
25
36
  return INT2NUM(atk_table_get_index_at(_SELF(self), NUM2INT(row), NUM2INT(column)));
26
37
  }
27
38
 
28
39
  static VALUE
29
- rbatk_table_get_column_at_index(VALUE self, VALUE index_)
40
+ rg_get_column_at_index(VALUE self, VALUE index_)
30
41
  {
31
42
  return INT2NUM(atk_table_get_column_at_index(_SELF(self), NUM2INT(index_)));
32
43
  }
33
44
 
34
45
  static VALUE
35
- rbatk_table_get_row_at_index(VALUE self, VALUE index_)
46
+ rg_get_row_at_index(VALUE self, VALUE index_)
36
47
  {
37
48
  return INT2NUM(atk_table_get_row_at_index(_SELF(self), NUM2INT(index_)));
38
49
  }
39
50
 
40
51
  static VALUE
41
- rbatk_table_get_n_columns(VALUE self)
52
+ rg_n_columns(VALUE self)
42
53
  {
43
54
  return INT2NUM(atk_table_get_n_columns(_SELF(self)));
44
55
  }
45
56
 
46
57
  static VALUE
47
- rbatk_table_get_n_rows(VALUE self)
58
+ rg_n_rows(VALUE self)
48
59
  {
49
60
  return INT2NUM(atk_table_get_n_rows(_SELF(self)));
50
61
  }
51
62
 
52
63
  static VALUE
53
- rbatk_table_get_column_extent_at(VALUE self, VALUE row, VALUE column)
64
+ rg_get_column_extent_at(VALUE self, VALUE row, VALUE column)
54
65
  {
55
66
  return INT2NUM(atk_table_get_column_extent_at(_SELF(self), NUM2INT(row), NUM2INT(column)));
56
67
  }
57
68
 
58
69
  static VALUE
59
- rbatk_table_get_row_extent_at(VALUE self, VALUE row, VALUE column)
70
+ rg_get_row_extent_at(VALUE self, VALUE row, VALUE column)
60
71
  {
61
72
  return INT2NUM(atk_table_get_row_extent_at(_SELF(self), NUM2INT(row), NUM2INT(column)));
62
73
  }
63
74
 
64
75
  static VALUE
65
- rbatk_table_get_caption(VALUE self)
76
+ rg_caption(VALUE self)
66
77
  {
67
78
  return GOBJ2RVAL(atk_table_get_caption(_SELF(self)));
68
79
  }
69
80
 
70
81
  static VALUE
71
- rbatk_table_get_column_description(VALUE self, VALUE column)
82
+ rg_get_column_description(VALUE self, VALUE column)
72
83
  {
73
84
  return CSTR2RVAL(atk_table_get_column_description(_SELF(self), NUM2INT(column)));
74
85
  }
75
86
 
76
87
  static VALUE
77
- rbatk_table_get_row_description(VALUE self, VALUE row)
88
+ rg_get_row_description(VALUE self, VALUE row)
78
89
  {
79
90
  return CSTR2RVAL(atk_table_get_row_description(_SELF(self), NUM2INT(row)));
80
91
  }
81
92
 
82
93
  static VALUE
83
- rbatk_table_get_column_header(VALUE self, VALUE column)
94
+ rg_get_column_header(VALUE self, VALUE column)
84
95
  {
85
96
  return GOBJ2RVAL(atk_table_get_column_header(_SELF(self), NUM2INT(column)));
86
97
  }
87
98
 
88
99
  static VALUE
89
- rbatk_table_get_row_header(VALUE self, VALUE row)
100
+ rg_get_row_header(VALUE self, VALUE row)
90
101
  {
91
102
  return GOBJ2RVAL(atk_table_get_row_header(_SELF(self), NUM2INT(row)));
92
103
  }
93
104
 
94
105
  static VALUE
95
- rbatk_table_get_summary(VALUE self)
106
+ rg_summary(VALUE self)
96
107
  {
97
108
  return GOBJ2RVAL(atk_table_get_summary(_SELF(self)));
98
109
  }
99
110
 
100
111
  static VALUE
101
- rbatk_table_set_caption(VALUE self, VALUE caption)
112
+ rg_set_caption(VALUE self, VALUE caption)
102
113
  {
103
- atk_table_set_caption(_SELF(self), ATK_OBJECT(RVAL2GOBJ(caption)));
114
+ atk_table_set_caption(_SELF(self), RVAL2ATKOBJECT(caption));
104
115
  return self;
105
116
  }
106
117
 
107
118
  static VALUE
108
- rbatk_table_set_row_description(VALUE self, VALUE row, VALUE description)
119
+ rg_set_row_description(VALUE self, VALUE row, VALUE description)
109
120
  {
110
121
  atk_table_set_row_description(_SELF(self), NUM2INT(row), RVAL2CSTR(description));
111
122
  return self;
112
123
  }
113
124
 
114
125
  static VALUE
115
- rbatk_table_set_column_description(VALUE self, VALUE column, VALUE description)
126
+ rg_set_column_description(VALUE self, VALUE column, VALUE description)
116
127
  {
117
128
  atk_table_set_column_description(_SELF(self), NUM2INT(column), RVAL2CSTR(description));
118
129
  return self;
119
130
  }
120
131
 
121
132
  static VALUE
122
- rbatk_table_set_row_header(VALUE self, VALUE row, VALUE header)
133
+ rg_set_row_header(VALUE self, VALUE row, VALUE header)
123
134
  {
124
- atk_table_set_row_header(_SELF(self), NUM2INT(row), ATK_OBJECT(RVAL2GOBJ(header)));
135
+ atk_table_set_row_header(_SELF(self), NUM2INT(row), RVAL2ATKOBJECT(header));
125
136
  return self;
126
137
  }
127
138
 
128
139
  static VALUE
129
- rbatk_table_set_column_header(VALUE self, VALUE column, VALUE header)
140
+ rg_set_column_header(VALUE self, VALUE column, VALUE header)
130
141
  {
131
- atk_table_set_column_header(_SELF(self), NUM2INT(column), ATK_OBJECT(RVAL2GOBJ(header)));
142
+ atk_table_set_column_header(_SELF(self), NUM2INT(column), RVAL2ATKOBJECT(header));
132
143
  return self;
133
144
  }
134
145
 
135
146
  static VALUE
136
- rbatk_table_set_summary(VALUE self, VALUE accessible)
147
+ rg_set_summary(VALUE self, VALUE accessible)
137
148
  {
138
- atk_table_set_summary(_SELF(self), ATK_OBJECT(RVAL2GOBJ(accessible)));
149
+ atk_table_set_summary(_SELF(self), RVAL2ATKOBJECT(accessible));
139
150
  return self;
140
151
  }
141
152
 
142
153
  static VALUE
143
- rbatk_table_get_selected_columns(VALUE self)
154
+ rg_selected_columns(VALUE self)
144
155
  {
145
156
  gint ret;
146
157
  gint* selected;
@@ -157,7 +168,7 @@ rbatk_table_get_selected_columns(VALUE self)
157
168
  }
158
169
 
159
170
  static VALUE
160
- rbatk_table_get_selected_rows(VALUE self)
171
+ rg_selected_rows(VALUE self)
161
172
  {
162
173
  gint ret;
163
174
  gint* selected;
@@ -174,25 +185,25 @@ rbatk_table_get_selected_rows(VALUE self)
174
185
  }
175
186
 
176
187
  static VALUE
177
- rbatk_table_is_column_selected(VALUE self, VALUE column)
188
+ rg_column_selected_p(VALUE self, VALUE column)
178
189
  {
179
190
  return CBOOL2RVAL(atk_table_is_column_selected(_SELF(self), NUM2INT(column)));
180
191
  }
181
192
 
182
193
  static VALUE
183
- rbatk_table_is_row_selected(VALUE self, VALUE row)
194
+ rg_row_selected_p(VALUE self, VALUE row)
184
195
  {
185
196
  return CBOOL2RVAL(atk_table_is_row_selected(_SELF(self), NUM2INT(row)));
186
197
  }
187
198
 
188
199
  static VALUE
189
- rbatk_table_is_selected(VALUE self, VALUE row, VALUE column)
200
+ rg_selected_p(VALUE self, VALUE row, VALUE column)
190
201
  {
191
202
  return CBOOL2RVAL(atk_table_is_selected(_SELF(self), NUM2INT(row), NUM2INT(column)));
192
203
  }
193
204
 
194
205
  static VALUE
195
- rbatk_table_add_column_selection(VALUE self, VALUE column)
206
+ rg_add_column_selection(VALUE self, VALUE column)
196
207
  {
197
208
  gboolean ret = atk_table_add_column_selection(_SELF(self), NUM2INT(column));
198
209
  if (! ret) rb_raise(rb_eRuntimeError, "not implement this interface");
@@ -200,7 +211,7 @@ rbatk_table_add_column_selection(VALUE self, VALUE column)
200
211
  }
201
212
 
202
213
  static VALUE
203
- rbatk_table_add_row_selection(VALUE self, VALUE row)
214
+ rg_add_row_selection(VALUE self, VALUE row)
204
215
  {
205
216
  gboolean ret = atk_table_add_row_selection(_SELF(self), NUM2INT(row));
206
217
  if (! ret) rb_raise(rb_eRuntimeError, "not implement this interface");
@@ -208,7 +219,7 @@ rbatk_table_add_row_selection(VALUE self, VALUE row)
208
219
  }
209
220
 
210
221
  static VALUE
211
- rbatk_table_remove_column_selection(VALUE self, VALUE column)
222
+ rg_remove_column_selection(VALUE self, VALUE column)
212
223
  {
213
224
  gboolean ret = atk_table_remove_column_selection(_SELF(self), NUM2INT(column));
214
225
  if (! ret) rb_raise(rb_eRuntimeError, "not implement this interface");
@@ -216,7 +227,7 @@ rbatk_table_remove_column_selection(VALUE self, VALUE column)
216
227
  }
217
228
 
218
229
  static VALUE
219
- rbatk_table_remove_row_selection(VALUE self, VALUE row)
230
+ rg_remove_row_selection(VALUE self, VALUE row)
220
231
  {
221
232
  gboolean ret = atk_table_remove_row_selection(_SELF(self), NUM2INT(row));
222
233
  if (! ret) rb_raise(rb_eRuntimeError, "not implement this interface");
@@ -224,39 +235,39 @@ rbatk_table_remove_row_selection(VALUE self, VALUE row)
224
235
  }
225
236
 
226
237
  void
227
- Init_atk_table()
238
+ Init_atk_table(VALUE mAtk)
228
239
  {
229
- VALUE mTable = G_DEF_INTERFACE(ATK_TYPE_TABLE, "Table", mAtk);
230
-
231
- rb_define_method(mTable, "ref_at", rbatk_table_ref_at, 2);
232
- rb_define_method(mTable, "get_index_at", rbatk_table_get_index_at, 2);
233
- rb_define_method(mTable, "get_column_at_index", rbatk_table_get_column_at_index, 1);
234
- rb_define_method(mTable, "get_row_at_index", rbatk_table_get_row_at_index, 1);
235
- rb_define_method(mTable, "n_columns", rbatk_table_get_n_columns, 0);
236
- rb_define_method(mTable, "n_rows", rbatk_table_get_n_rows, 0);
237
- rb_define_method(mTable, "get_column_extent_at", rbatk_table_get_column_extent_at, 2);
238
- rb_define_method(mTable, "get_row_extent_at", rbatk_table_get_row_extent_at, 2);
239
- rb_define_method(mTable, "caption", rbatk_table_get_caption, 0);
240
- rb_define_method(mTable, "get_column_description", rbatk_table_get_column_description, 1);
241
- rb_define_method(mTable, "get_row_description", rbatk_table_get_row_description, 1);
242
- rb_define_method(mTable, "get_column_header", rbatk_table_get_column_header, 1);
243
- rb_define_method(mTable, "get_row_header", rbatk_table_get_row_header, 1);
244
- rb_define_method(mTable, "summary", rbatk_table_get_summary, 0);
245
- rb_define_method(mTable, "set_caption", rbatk_table_set_caption, 1);
246
- rb_define_method(mTable, "set_row_description", rbatk_table_set_row_description, 2);
247
- rb_define_method(mTable, "set_column_description", rbatk_table_set_column_description, 2);
248
- rb_define_method(mTable, "set_row_header", rbatk_table_set_row_header, 2);
249
- rb_define_method(mTable, "set_column_header", rbatk_table_set_column_header, 2);
250
- rb_define_method(mTable, "set_summary", rbatk_table_set_summary, 1);
251
- rb_define_method(mTable, "selected_columns", rbatk_table_get_selected_columns, 0);
252
- rb_define_method(mTable, "selected_rows", rbatk_table_get_selected_rows, 0);
253
- rb_define_method(mTable, "column_selected?", rbatk_table_is_column_selected, 1);
254
- rb_define_method(mTable, "row_selected?", rbatk_table_is_row_selected, 1);
255
- rb_define_method(mTable, "selected?", rbatk_table_is_selected, 2);
256
- rb_define_method(mTable, "add_column_selection", rbatk_table_add_column_selection, 1);
257
- rb_define_method(mTable, "add_row_selection", rbatk_table_add_row_selection, 1);
258
- rb_define_method(mTable, "remove_column_selection", rbatk_table_remove_column_selection, 1);
259
- rb_define_method(mTable, "remove_row_selection", rbatk_table_remove_row_selection, 1);
260
-
261
- G_DEF_SETTERS(mTable);
240
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_TABLE, "Table", mAtk);
241
+
242
+ RG_DEF_METHOD(ref_at, 2);
243
+ RG_DEF_METHOD(get_index_at, 2);
244
+ RG_DEF_METHOD(get_column_at_index, 1);
245
+ RG_DEF_METHOD(get_row_at_index, 1);
246
+ RG_DEF_METHOD(n_columns, 0);
247
+ RG_DEF_METHOD(n_rows, 0);
248
+ RG_DEF_METHOD(get_column_extent_at, 2);
249
+ RG_DEF_METHOD(get_row_extent_at, 2);
250
+ RG_DEF_METHOD(caption, 0);
251
+ RG_DEF_METHOD(get_column_description, 1);
252
+ RG_DEF_METHOD(get_row_description, 1);
253
+ RG_DEF_METHOD(get_column_header, 1);
254
+ RG_DEF_METHOD(get_row_header, 1);
255
+ RG_DEF_METHOD(summary, 0);
256
+ RG_DEF_METHOD(set_caption, 1);
257
+ RG_DEF_METHOD(set_row_description, 2);
258
+ RG_DEF_METHOD(set_column_description, 2);
259
+ RG_DEF_METHOD(set_row_header, 2);
260
+ RG_DEF_METHOD(set_column_header, 2);
261
+ RG_DEF_METHOD(set_summary, 1);
262
+ RG_DEF_METHOD(selected_columns, 0);
263
+ RG_DEF_METHOD(selected_rows, 0);
264
+ RG_DEF_METHOD_P(column_selected, 1);
265
+ RG_DEF_METHOD_P(row_selected, 1);
266
+ RG_DEF_METHOD_P(selected, 2);
267
+ RG_DEF_METHOD(add_column_selection, 1);
268
+ RG_DEF_METHOD(add_row_selection, 1);
269
+ RG_DEF_METHOD(remove_column_selection, 1);
270
+ RG_DEF_METHOD(remove_row_selection, 1);
271
+
272
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
262
273
  }
@@ -1,20 +1,31 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbatktext.c -
5
-
6
- $Author: sakai $
7
- $Date: 2006/05/26 14:12:06 $
8
-
9
- Copyright (C) 2004 Masao Mutoh
10
- ************************************************/
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
+ */
11
21
 
12
- #include "rbatk.h"
22
+ #include "rbatkprivate.h"
13
23
 
14
- #define _SELF(s) (ATK_TEXT(RVAL2GOBJ(s)))
24
+ #define RG_TARGET_NAMESPACE mText
25
+ #define _SELF(s) (RVAL2ATKTEXT(s))
15
26
 
16
27
  static VALUE
17
- rbatk_text_get_text(VALUE self, VALUE start_offset, VALUE end_offset)
28
+ rg_get_text(VALUE self, VALUE start_offset, VALUE end_offset)
18
29
  {
19
30
  VALUE ret;
20
31
  gchar* text = atk_text_get_text(_SELF(self),
@@ -26,7 +37,7 @@ rbatk_text_get_text(VALUE self, VALUE start_offset, VALUE end_offset)
26
37
  }
27
38
 
28
39
  static VALUE
29
- rbatk_text_get_character_at_offset(VALUE self, VALUE offset)
40
+ rg_get_character_at_offset(VALUE self, VALUE offset)
30
41
  {
31
42
  gchar buf[10];
32
43
  gint len = g_unichar_to_utf8(atk_text_get_character_at_offset
@@ -36,14 +47,14 @@ rbatk_text_get_character_at_offset(VALUE self, VALUE offset)
36
47
  }
37
48
 
38
49
  static VALUE
39
- rbatk_text_get_text_after_offset(VALUE self, VALUE offset, VALUE boundary_type)
50
+ rg_get_text_after_offset(VALUE self, VALUE offset, VALUE boundary_type)
40
51
  {
41
52
  gchar* ret;
42
53
  VALUE result;
43
54
  gint start_offset, end_offset;
44
55
 
45
56
  ret = atk_text_get_text_after_offset(_SELF(self), NUM2INT(offset),
46
- RVAL2GENUM(boundary_type, ATK_TYPE_TEXT_BOUNDARY),
57
+ RVAL2ATKTEXTBOUNDARY(boundary_type),
47
58
  &start_offset, &end_offset);
48
59
  result = rb_ary_new3(3, CSTR2RVAL(ret),
49
60
  INT2NUM(start_offset), INT2NUM(end_offset));
@@ -53,14 +64,14 @@ rbatk_text_get_text_after_offset(VALUE self, VALUE offset, VALUE boundary_type)
53
64
  }
54
65
 
55
66
  static VALUE
56
- rbatk_text_get_text_at_offset(VALUE self, VALUE offset, VALUE boundary_type)
67
+ rg_get_text_at_offset(VALUE self, VALUE offset, VALUE boundary_type)
57
68
  {
58
69
  gchar* ret;
59
70
  VALUE result;
60
71
  gint start_offset, end_offset;
61
72
 
62
73
  ret = atk_text_get_text_at_offset(_SELF(self), NUM2INT(offset),
63
- RVAL2GENUM(boundary_type, ATK_TYPE_TEXT_BOUNDARY),
74
+ RVAL2ATKTEXTBOUNDARY(boundary_type),
64
75
  &start_offset, &end_offset);
65
76
  result = rb_ary_new3(3, CSTR2RVAL(ret),
66
77
  INT2NUM(start_offset), INT2NUM(end_offset));
@@ -70,14 +81,14 @@ rbatk_text_get_text_at_offset(VALUE self, VALUE offset, VALUE boundary_type)
70
81
  }
71
82
 
72
83
  static VALUE
73
- rbatk_text_get_text_before_offset(VALUE self, VALUE offset, VALUE boundary_type)
84
+ rg_get_text_before_offset(VALUE self, VALUE offset, VALUE boundary_type)
74
85
  {
75
86
  gchar* ret;
76
87
  VALUE result;
77
88
  gint start_offset, end_offset;
78
89
 
79
90
  ret = atk_text_get_text_before_offset(_SELF(self), NUM2INT(offset),
80
- RVAL2GENUM(boundary_type, ATK_TYPE_TEXT_BOUNDARY),
91
+ RVAL2ATKTEXTBOUNDARY(boundary_type),
81
92
  &start_offset, &end_offset);
82
93
  result = rb_ary_new3(3, CSTR2RVAL(ret),
83
94
  INT2NUM(start_offset), INT2NUM(end_offset));
@@ -87,23 +98,23 @@ rbatk_text_get_text_before_offset(VALUE self, VALUE offset, VALUE boundary_type)
87
98
  }
88
99
 
89
100
  static VALUE
90
- rbatk_text_get_caret_offset(VALUE self)
101
+ rg_caret_offset(VALUE self)
91
102
  {
92
103
  return INT2NUM(atk_text_get_caret_offset(_SELF(self)));
93
104
  }
94
105
 
95
106
  static VALUE
96
- rbatk_text_get_character_extents(VALUE self, VALUE offset, VALUE coords)
107
+ rg_get_character_extents(VALUE self, VALUE offset, VALUE coords)
97
108
  {
98
109
  gint x, y, width, height;
99
110
  atk_text_get_character_extents(_SELF(self), NUM2INT(offset),
100
111
  &x, &y, &width, &height,
101
- RVAL2GENUM(coords, ATK_TYPE_COORD_TYPE));
112
+ RVAL2ATKCOORDTYPE(coords));
102
113
  return rb_ary_new3(4, INT2NUM(x), INT2NUM(y), INT2NUM(width), INT2NUM(height));
103
114
  }
104
115
 
105
116
  static VALUE
106
- rbatk_text_get_run_attributes(VALUE self, VALUE offset)
117
+ rg_get_run_attributes(VALUE self, VALUE offset)
107
118
  {
108
119
  gint start_offset, end_offset;
109
120
  AtkAttributeSet* list;
@@ -113,7 +124,7 @@ rbatk_text_get_run_attributes(VALUE self, VALUE offset)
113
124
  &start_offset, &end_offset);
114
125
 
115
126
  ary = rb_ary_new();
116
-
127
+
117
128
  while (list) {
118
129
  AtkAttribute* data = (AtkAttribute*)list->data;
119
130
  rb_ary_push(ary, rb_assoc_new(CSTR2RVAL(data->name),
@@ -125,14 +136,14 @@ rbatk_text_get_run_attributes(VALUE self, VALUE offset)
125
136
  }
126
137
 
127
138
  static VALUE
128
- rbatk_text_get_default_attributes(VALUE self)
139
+ rg_default_attributes(VALUE self)
129
140
  {
130
141
  AtkAttributeSet* list;
131
142
  VALUE ary;
132
143
 
133
144
  list = atk_text_get_default_attributes(_SELF(self));
134
145
  ary = rb_ary_new();
135
-
146
+
136
147
  while (list) {
137
148
  AtkAttribute* data = (AtkAttribute*)list->data;
138
149
  rb_ary_push(ary, rb_assoc_new(CSTR2RVAL(data->name),
@@ -144,35 +155,35 @@ rbatk_text_get_default_attributes(VALUE self)
144
155
  }
145
156
 
146
157
  static VALUE
147
- rbatk_text_get_character_count(VALUE self)
158
+ rg_character_count(VALUE self)
148
159
  {
149
160
  return INT2NUM(atk_text_get_character_count(_SELF(self)));
150
161
  }
151
162
 
152
163
  static VALUE
153
- rbatk_text_get_offset_at_point(VALUE self, VALUE x, VALUE y, VALUE coords)
164
+ rg_get_offset_at_point(VALUE self, VALUE x, VALUE y, VALUE coords)
154
165
  {
155
166
  return INT2NUM(atk_text_get_offset_at_point(_SELF(self),
156
167
  NUM2INT(x), NUM2INT(y),
157
- RVAL2GENUM(coords, ATK_TYPE_COORD_TYPE)));
168
+ RVAL2ATKCOORDTYPE(coords)));
158
169
  }
159
170
 
160
171
  #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES
161
172
  #ifdef HAVE_ATK_TEXT_CLIP_TYPE_GET_TYPE
162
173
  static VALUE
163
- rbatk_text_get_bounded_ranges(VALUE self, VALUE rect, VALUE coord_type, VALUE x_clip_type, VALUE y_clip_type)
174
+ rg_get_bounded_ranges(VALUE self, VALUE rect, VALUE coord_type, VALUE x_clip_type, VALUE y_clip_type)
164
175
  {
165
176
  AtkTextRange** ranges;
166
177
  int i = 0;
167
178
  VALUE ary;
168
179
  ranges = atk_text_get_bounded_ranges(_SELF(self),
169
- RVAL2BOXED(rect, ATK_TYPE_TEXT_RECTANGLE),
170
- RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE),
171
- RVAL2GENUM(x_clip_type, ATK_TYPE_TEXT_CLIP_TYPE),
172
- RVAL2GENUM(y_clip_type, ATK_TYPE_TEXT_CLIP_TYPE));
180
+ RVAL2ATKTEXTRECTANGLE(rect),
181
+ RVAL2ATKCOORDTYPE(coord_type),
182
+ RVAL2ATKTEXTCLIPTYPE(x_clip_type),
183
+ RVAL2ATKTEXTCLIPTYPE(y_clip_type));
173
184
  ary = rb_ary_new();
174
185
  while(ranges[i]){
175
- rb_ary_push(ary, BOXED2RVAL(ranges[i], ATK_TYPE_TEXT_RANGE));
186
+ rb_ary_push(ary, ATKTEXTRANGE2RVAL(ranges[i]));
176
187
  i++;
177
188
  }
178
189
  #ifdef HAVE_ATK_TEXT_FREE_RANGES
@@ -183,14 +194,14 @@ rbatk_text_get_bounded_ranges(VALUE self, VALUE rect, VALUE coord_type, VALUE x_
183
194
  #endif
184
195
 
185
196
  static VALUE
186
- rbatk_text_get_range_extents(VALUE self, VALUE start_offset, VALUE end_offset, VALUE coord_type)
197
+ rg_get_range_extents(VALUE self, VALUE start_offset, VALUE end_offset, VALUE coord_type)
187
198
  {
188
199
  AtkTextRectangle rect;
189
200
  atk_text_get_range_extents(_SELF(self), NUM2INT(start_offset),
190
201
  NUM2INT(end_offset),
191
- RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE),
202
+ RVAL2ATKCOORDTYPE(coord_type),
192
203
  &rect);
193
- return BOXED2RVAL(&rect, ATK_TYPE_TEXT_RECTANGLE);
204
+ return ATKTEXTRECTANGLE2RVAL(&rect);
194
205
  }
195
206
 
196
207
  /* Don't need this
@@ -199,13 +210,13 @@ void atk_text_free_ranges (AtkTextRange **ranges);
199
210
  #endif
200
211
 
201
212
  static VALUE
202
- rbatk_text_get_n_selections(VALUE self)
213
+ rg_n_selections(VALUE self)
203
214
  {
204
215
  return INT2NUM(atk_text_get_n_selections(_SELF(self)));
205
216
  }
206
217
 
207
218
  static VALUE
208
- rbatk_text_get_selection(VALUE self, VALUE selection_num)
219
+ rg_get_selection(VALUE self, VALUE selection_num)
209
220
  {
210
221
  gint start_offset, end_offset;
211
222
  VALUE ret;
@@ -218,7 +229,7 @@ rbatk_text_get_selection(VALUE self, VALUE selection_num)
218
229
  }
219
230
 
220
231
  static VALUE
221
- rbatk_text_add_selection(VALUE self, VALUE start_offset, VALUE end_offset)
232
+ rg_add_selection(VALUE self, VALUE start_offset, VALUE end_offset)
222
233
  {
223
234
  gboolean ret = atk_text_add_selection(_SELF(self), NUM2INT(start_offset),
224
235
  NUM2INT(end_offset));
@@ -227,7 +238,7 @@ rbatk_text_add_selection(VALUE self, VALUE start_offset, VALUE end_offset)
227
238
  }
228
239
 
229
240
  static VALUE
230
- rbatk_text_remove_selection(VALUE self, VALUE selection_num)
241
+ rg_remove_selection(VALUE self, VALUE selection_num)
231
242
  {
232
243
  gint num;
233
244
  gboolean ret;
@@ -240,7 +251,7 @@ rbatk_text_remove_selection(VALUE self, VALUE selection_num)
240
251
  }
241
252
 
242
253
  static VALUE
243
- rbatk_text_set_selection(VALUE self, VALUE selection_num, VALUE start_offset, VALUE end_offset)
254
+ rg_set_selection(VALUE self, VALUE selection_num, VALUE start_offset, VALUE end_offset)
244
255
  {
245
256
  gboolean ret = atk_text_set_selection(_SELF(self), NUM2INT(selection_num),
246
257
  NUM2INT(start_offset),
@@ -250,93 +261,60 @@ rbatk_text_set_selection(VALUE self, VALUE selection_num, VALUE start_offset, VA
250
261
  }
251
262
 
252
263
  static VALUE
253
- rbatk_text_set_caret_offset(VALUE self, VALUE offset)
264
+ rg_set_caret_offset(VALUE self, VALUE offset)
254
265
  {
255
266
  gboolean ret = atk_text_set_caret_offset(_SELF(self), NUM2INT(offset));
256
267
  if (! ret) rb_raise(rb_eRuntimeError, "Can't set caret offset");
257
268
  return self;
258
269
  }
259
270
 
260
-
261
271
  /* We don't need them.
262
272
  void atk_attribute_set_free (AtkAttributeSet *attrib_set);
263
273
  */
264
274
 
265
- /*
266
- * Atk::TextAttribute
267
- */
268
- static VALUE
269
- rbatk_tattr_s_register(VALUE self, VALUE name)
270
- {
271
- return GENUM2RVAL(atk_text_attribute_register(RVAL2CSTR(name)), ATK_TYPE_TEXT_ATTRIBUTE);
272
- }
273
-
274
- /* We don't need this.
275
- G_CONST_RETURN gchar* atk_textattribute_type_get_name
276
- (AtkTextattributeType type);
277
- */
278
-
279
- static VALUE
280
- rbatk_tattr_s_for_name(VALUE self, VALUE name)
281
- {
282
- return GENUM2RVAL(atk_text_attribute_for_name(RVAL2CSTR(name)), ATK_TYPE_TEXT_ATTRIBUTE);
283
- }
284
-
285
- static VALUE
286
- rbatk_tattr_get_value(VALUE self, VALUE index)
287
- {
288
- return CSTR2RVAL(atk_text_attribute_get_value(RVAL2GENUM(self, ATK_TYPE_TEXT_ATTRIBUTE),
289
- NUM2INT(index)));
290
- }
291
275
  void
292
- Init_atk_text()
276
+ Init_atk_text(VALUE mAtk)
293
277
  {
294
- VALUE tattr;
295
- VALUE mText = G_DEF_INTERFACE(ATK_TYPE_TEXT, "Text", mAtk);
296
-
297
- rb_define_method(mText, "get_text", rbatk_text_get_text, 2);
298
- rb_define_method(mText, "get_character_at_offset", rbatk_text_get_character_at_offset, 1);
299
- rb_define_method(mText, "get_text_after_offset", rbatk_text_get_text_after_offset, 2);
300
- rb_define_method(mText, "get_text_at_offset", rbatk_text_get_text_at_offset, 2);
301
- rb_define_method(mText, "get_text_before_offset", rbatk_text_get_text_before_offset, 2);
302
- rb_define_method(mText, "caret_offset", rbatk_text_get_caret_offset, 0);
303
- rb_define_method(mText, "get_character_extents", rbatk_text_get_character_extents, 2);
304
- rb_define_method(mText, "get_run_attributes", rbatk_text_get_run_attributes, 1);
305
- rb_define_method(mText, "default_attributes", rbatk_text_get_default_attributes, 0);
306
- rb_define_method(mText, "character_count", rbatk_text_get_character_count, 0);
307
- rb_define_method(mText, "get_offset_at_point", rbatk_text_get_offset_at_point, 3);
278
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(ATK_TYPE_TEXT, "Text", mAtk);
279
+
280
+ RG_DEF_METHOD(get_text, 2);
281
+ RG_DEF_METHOD(get_character_at_offset, 1);
282
+ RG_DEF_METHOD(get_text_after_offset, 2);
283
+ RG_DEF_METHOD(get_text_at_offset, 2);
284
+ RG_DEF_METHOD(get_text_before_offset, 2);
285
+ RG_DEF_METHOD(caret_offset, 0);
286
+ RG_DEF_METHOD(get_character_extents, 2);
287
+ RG_DEF_METHOD(get_run_attributes, 1);
288
+ RG_DEF_METHOD(default_attributes, 0);
289
+ RG_DEF_METHOD(character_count, 0);
290
+ RG_DEF_METHOD(get_offset_at_point, 3);
308
291
  #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES
309
292
  #ifdef HAVE_ATK_TEXT_CLIP_TYPE_GET_TYPE
310
- rb_define_method(mText, "get_bounded_ranges", rbatk_text_get_bounded_ranges, 4);
311
- rb_define_method(mText, "get_range_extents", rbatk_text_get_range_extents, 3);
293
+ RG_DEF_METHOD(get_bounded_ranges, 4);
294
+ RG_DEF_METHOD(get_range_extents, 3);
312
295
  #endif
313
296
  #endif
314
- rb_define_method(mText, "n_selections", rbatk_text_get_n_selections, 0);
315
- rb_define_method(mText, "get_selection", rbatk_text_get_selection, 1);
316
- rb_define_method(mText, "add_selection", rbatk_text_add_selection, 2);
317
- rb_define_method(mText, "remove_selection", rbatk_text_remove_selection, 1);
318
- rb_define_method(mText, "set_selection", rbatk_text_set_selection, 3);
319
- rb_define_method(mText, "set_caret_offset", rbatk_text_set_caret_offset, 1);
320
-
321
- G_DEF_SETTERS(mText);
322
-
297
+ RG_DEF_METHOD(n_selections, 0);
298
+ RG_DEF_METHOD(get_selection, 1);
299
+ RG_DEF_METHOD(add_selection, 2);
300
+ RG_DEF_METHOD(remove_selection, 1);
301
+ RG_DEF_METHOD(set_selection, 3);
302
+ RG_DEF_METHOD(set_caret_offset, 1);
303
+
304
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
305
+
323
306
  /* AtkTextBoundary */
324
307
  #ifdef ATK_TYPE_TEXT_BOUNDARY
325
- G_DEF_CLASS(ATK_TYPE_TEXT_BOUNDARY, "Boundary", mText);
326
- G_DEF_CONSTANTS(mText, ATK_TYPE_TEXT_BOUNDARY, "ATK_TEXT_");
308
+ G_DEF_CLASS(ATK_TYPE_TEXT_BOUNDARY, "Boundary", RG_TARGET_NAMESPACE);
309
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, ATK_TYPE_TEXT_BOUNDARY, "ATK_TEXT_");
327
310
  #endif
328
311
  /* AtkTextClipType */
329
312
  #ifdef HAVE_ATK_TEXT_GET_BOUNDED_RANGES
330
313
  #ifdef HAVE_ATK_TEXT_CLIP_TYPE_GET_TYPE
331
- G_DEF_CLASS(ATK_TYPE_TEXT_CLIP_TYPE, "ClipType", mText);
332
- G_DEF_CONSTANTS(mText, ATK_TYPE_TEXT_CLIP_TYPE, "ATK_TEXT_");
314
+ G_DEF_CLASS(ATK_TYPE_TEXT_CLIP_TYPE, "ClipType", RG_TARGET_NAMESPACE);
315
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, ATK_TYPE_TEXT_CLIP_TYPE, "ATK_TEXT_");
333
316
  #endif
334
317
  #endif
335
318
 
336
- tattr = G_DEF_CLASS(ATK_TYPE_TEXT_ATTRIBUTE, "Attribute", mText);
337
- G_DEF_CONSTANTS(mText, ATK_TYPE_TEXT_ATTRIBUTE, "ATK_TEXT_");
338
-
339
- rb_define_singleton_method(tattr, "type_register", rbatk_tattr_s_register, 1);
340
- rb_define_singleton_method(tattr, "for_name", rbatk_tattr_s_for_name, 1);
341
- rb_define_method(tattr, "get_value", rbatk_tattr_get_value, 1);
319
+ Init_atk_text_attribute(RG_TARGET_NAMESPACE);
342
320
  }