projects
/
ruby-evas.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ab841e7
)
Class instantiation fixes.
author
Tilman Sauerbeck
<tilman@code-monkey.de>
Fri, 10 Feb 2006 18:14:08 +0000
(18:14 +0000)
committer
Tilman Sauerbeck
<tilman@code-monkey.de>
Fri, 10 Feb 2006 18:14:08 +0000
(18:14 +0000)
src/rb_evas.c
patch
|
blob
|
history
src/rb_evas_object.c
patch
|
blob
|
history
src/rb_evas_object.h
patch
|
blob
|
history
src/rb_gradient.c
patch
|
blob
|
history
src/rb_image.c
patch
|
blob
|
history
src/rb_line.c
patch
|
blob
|
history
src/rb_polygon.c
patch
|
blob
|
history
src/rb_rectangle.c
patch
|
blob
|
history
src/rb_smart.c
patch
|
blob
|
history
src/rb_text.c
patch
|
blob
|
history
diff --git
a/src/rb_evas.c
b/src/rb_evas.c
index 96d26de1713dbd0196f9e3f73f4e97ab8252f075..f1b433fdba21e75567c79d9ae44c668c082933fa 100644
(file)
--- a/
src/rb_evas.c
+++ b/
src/rb_evas.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_evas.c
283 2005-03-15 17:59:03
Z tilman $
+ * $Id: rb_evas.c
354 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-34,21
+34,27
@@
static void c_mark (RbEvas *e)
rb_gc_mark (e->parent);
}
rb_gc_mark (e->parent);
}
+static VALUE c_alloc (VALUE klass)
+{
+ RbEvas *evas = NULL;
+
+ return Data_Make_Struct (cEvas, RbEvas, c_mark, free, evas);
+}
+
VALUE TO_EVAS (VALUE parent, Evas *e)
{
VALUE self;
VALUE TO_EVAS (VALUE parent, Evas *e)
{
VALUE self;
- RbEvas *evas = NULL;
if (NIL_P (parent) || !e)
return Qnil;
if (NIL_P (parent) || !e)
return Qnil;
- self = Data_Make_Struct (cEvas, RbEvas,
- c_mark, free, evas);
+ self = rb_class_new_instance (0, NULL, cEvas);
+
+ GET_OBJ (self, RbEvas, evas);
+
evas->real = e;
evas->parent = parent;
evas->real = e;
evas->parent = parent;
- rb_obj_call_init (self, 0, NULL);
-
return self;
}
return self;
}
@@
-329,6
+335,8
@@
void Init_Evas (void)
{
cEvas = rb_define_class_under (mEvas, "Evas", rb_cObject);
{
cEvas = rb_define_class_under (mEvas, "Evas", rb_cObject);
+ rb_define_alloc_func (cEvas, c_alloc);
+
/* not publically instantiable yet */
rb_define_private_method (rb_singleton_class (cEvas),
"new", NULL, 0);
/* not publically instantiable yet */
rb_define_private_method (rb_singleton_class (cEvas),
"new", NULL, 0);
diff --git
a/src/rb_evas_object.c
b/src/rb_evas_object.c
index 22b03153f88988d5006940df84fd99239b16f914..a35477ab340b74070b0d34ae4ce5e46a4c6f07ed 100644
(file)
--- a/
src/rb_evas_object.c
+++ b/
src/rb_evas_object.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_evas_object.c 35
0 2006-02-08 21:13:34
Z tilman $
+ * $Id: rb_evas_object.c 35
4 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-66,6
+66,19
@@
void c_evas_object_free (RbEvasObject *e, bool free_mem)
free (e);
}
free (e);
}
+static void c_free (RbEvasObject *e)
+{
+ c_evas_object_free (e, true);
+}
+
+static VALUE c_alloc (VALUE klass)
+{
+ RbEvasObject *e;
+
+ return Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
+ c_free, e);
+}
+
/* :nodoc: */
static VALUE c_init (VALUE self, VALUE parent)
{
/* :nodoc: */
static VALUE c_init (VALUE self, VALUE parent)
{
@@
-565,8
+578,7
@@
void Init_EvasObject (void)
cEvasObject = rb_define_class_under (mEvas, "EvasObject",
rb_cObject);
cEvasObject = rb_define_class_under (mEvas, "EvasObject",
rb_cObject);
- rb_define_private_method (rb_singleton_class (cEvasObject),
- "new", NULL, 0);
+ rb_define_alloc_func (cEvasObject, c_alloc);
rb_define_method (cEvasObject, "initialize", c_init, 1);
rb_define_method (cEvasObject, "inspect", c_inspect, 0);
rb_define_method (cEvasObject, "type", c_type_get, 0);
rb_define_method (cEvasObject, "initialize", c_init, 1);
rb_define_method (cEvasObject, "inspect", c_inspect, 0);
rb_define_method (cEvasObject, "type", c_type_get, 0);
diff --git
a/src/rb_evas_object.h
b/src/rb_evas_object.h
index 99e0743dd684a5203209770ddb740bd9b7d36769..fb08ed0cf4aac9cf6fa667874542b0a38111d211 100644
(file)
--- a/
src/rb_evas_object.h
+++ b/
src/rb_evas_object.h
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_evas_object.h 3
04 2005-03-22 17:51:51
Z tilman $
+ * $Id: rb_evas_object.h 3
54 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-34,9
+34,6
@@
typedef struct {
void Init_EvasObject (void);
void Init_EvasObject (void);
-void c_evas_object_free (RbEvasObject *e, bool free_mem);
-void c_evas_object_mark (RbEvasObject *e);
-
VALUE TO_EVAS_OBJECT (Evas_Object *o);
#ifndef __RB_EVAS_OBJECT_C
VALUE TO_EVAS_OBJECT (Evas_Object *o);
#ifndef __RB_EVAS_OBJECT_C
diff --git
a/src/rb_gradient.c
b/src/rb_gradient.c
index 2129e01235b8b96f7aa223042ebed2c9cde77983..0b31640ef2e66b9cc8200119e8a9debc3e6be883 100644
(file)
--- a/
src/rb_gradient.c
+++ b/
src/rb_gradient.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_gradient.c
58 2004-08-10 14:10:02
Z tilman $
+ * $Id: rb_gradient.c
354 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-26,31
+26,21
@@
#include "rb_evas.h"
#include "rb_evas_object.h"
#include "rb_evas.h"
#include "rb_evas_object.h"
-static void c_free (RbEvasObject *e)
-{
- c_evas_object_free (e, true);
-}
-
/*
* call-seq:
* Evas::Gradient.new(evas) => gradient
*
* Creates an Evas::Gradient object.
*/
/*
* call-seq:
* Evas::Gradient.new(evas) => gradient
*
* Creates an Evas::Gradient object.
*/
-static VALUE c_
new (VALUE klass
, VALUE evas)
+static VALUE c_
init (VALUE self
, VALUE evas)
{
{
- VALUE self, argv[1];
- RbEvasObject *rect;
-
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
+ GET_OBJ (self, RbEvasObject, grad);
- self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
- c_free, rect);
- rect->real = evas_object_gradient_add (e->real);
+ grad->real = evas_object_gradient_add (e->real);
- argv[0] = evas;
- rb_obj_call_init (self, 1, argv);
+ rb_call_super (1, &evas);
return self;
}
return self;
}
@@
-128,7
+118,7
@@
void Init_Gradient (void)
{
VALUE c = rb_define_class_under (mEvas, "Gradient", cEvasObject);
{
VALUE c = rb_define_class_under (mEvas, "Gradient", cEvasObject);
- rb_define_
singleton_method (c, "new", c_new
, 1);
+ rb_define_
method (c, "initialize", c_init
, 1);
rb_define_method (c, "add_color", c_add_color, 5);
rb_define_method (c, "clear_colors", c_clear_colors, 0);
rb_define_method (c, "angle", c_angle_get, 0);
rb_define_method (c, "add_color", c_add_color, 5);
rb_define_method (c, "clear_colors", c_clear_colors, 0);
rb_define_method (c, "angle", c_angle_get, 0);
diff --git
a/src/rb_image.c
b/src/rb_image.c
index 7bd0f06a0ad9398d5c2ffac2e6bf438bb3705ae8..8e7f5ed797f96d404087d2fb16e0cd21e5ecc567 100644
(file)
--- a/
src/rb_image.c
+++ b/
src/rb_image.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_image.c
284 2005-03-15 18:00:33
Z tilman $
+ * $Id: rb_image.c
354 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-26,31
+26,21
@@
#include "rb_evas.h"
#include "rb_evas_object.h"
#include "rb_evas.h"
#include "rb_evas_object.h"
-static void c_free (RbEvasObject *e)
-{
- c_evas_object_free (e, true);
-}
-
/*
* call-seq:
* Evas::Image.new(evas) => img
*
* Creates an Evas::Image object.
*/
/*
* call-seq:
* Evas::Image.new(evas) => img
*
* Creates an Evas::Image object.
*/
-static VALUE c_
new (VALUE klass
, VALUE evas)
+static VALUE c_
init (VALUE self
, VALUE evas)
{
{
- VALUE self, argv[1];
- RbEvasObject *img;
-
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
+ GET_OBJ (self, RbEvasObject, img);
- self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
- c_free, img);
img->real = evas_object_image_add (e->real);
img->real = evas_object_image_add (e->real);
- argv[0] = evas;
- rb_obj_call_init (self, 1, argv);
+ rb_call_super (1, &evas);
return self;
}
return self;
}
@@
-269,7
+259,7
@@
void Init_Image (void)
{
VALUE c = rb_define_class_under (mEvas, "Image", cEvasObject);
{
VALUE c = rb_define_class_under (mEvas, "Image", cEvasObject);
- rb_define_
singleton_method (c, "new", c_new
, 1);
+ rb_define_
method (c, "initialize", c_init
, 1);
rb_define_method (c, "get_file", c_get_file, -1);
rb_define_method (c, "set_file", c_set_file, -1);
rb_define_method (c, "has_alpha?", c_has_alpha_get, 0);
rb_define_method (c, "get_file", c_get_file, -1);
rb_define_method (c, "set_file", c_set_file, -1);
rb_define_method (c, "has_alpha?", c_has_alpha_get, 0);
diff --git
a/src/rb_line.c
b/src/rb_line.c
index 59986df89360f4831ad196e847d3d0da648c56f1..8600d22625f7a689144541e13dc37ae18febc190 100644
(file)
--- a/
src/rb_line.c
+++ b/
src/rb_line.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_line.c
49 2004-08-01 10:17:39
Z tilman $
+ * $Id: rb_line.c
354 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-26,25
+26,15
@@
#include "rb_evas.h"
#include "rb_evas_object.h"
#include "rb_evas.h"
#include "rb_evas_object.h"
-static
void c_free (RbEvasObject *e
)
+static
VALUE c_init (VALUE self, VALUE evas
)
{
{
- c_evas_object_free (e, true);
-}
-
-static VALUE c_new (VALUE klass, VALUE evas)
-{
- VALUE self, argv[1];
- RbEvasObject *line;
-
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
+ GET_OBJ (self, RbEvasObject, line);
- self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
- c_free, line);
line->real = evas_object_line_add (e->real);
line->real = evas_object_line_add (e->real);
- argv[0] = evas;
- rb_obj_call_init (self, 1, argv);
+ rb_call_super (1, &evas);
return self;
}
return self;
}
@@
-82,7
+72,7
@@
void Init_Line (void)
{
VALUE c = rb_define_class_under (mEvas, "Line", cEvasObject);
{
VALUE c = rb_define_class_under (mEvas, "Line", cEvasObject);
- rb_define_
singleton_method (c, "new", c_new
, 1);
+ rb_define_
method (c, "initialize", c_init
, 1);
rb_define_method (c, "get_xy", c_get_xy, 0);
rb_define_method (c, "set_xy", c_set_xy, 4);
}
rb_define_method (c, "get_xy", c_get_xy, 0);
rb_define_method (c, "set_xy", c_set_xy, 4);
}
diff --git
a/src/rb_polygon.c
b/src/rb_polygon.c
index 9a8913c116ea010397a0318a67de27958373eebb..39f1dafa4221e81b53bd49d024ff2fcc78436495 100644
(file)
--- a/
src/rb_polygon.c
+++ b/
src/rb_polygon.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_polygon.c
58 2004-08-10 14:10:02
Z tilman $
+ * $Id: rb_polygon.c
354 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-26,31
+26,21
@@
#include "rb_evas.h"
#include "rb_evas_object.h"
#include "rb_evas.h"
#include "rb_evas_object.h"
-static void c_free (RbEvasObject *e)
-{
- c_evas_object_free (e, true);
-}
-
/*
* call-seq:
* Evas::Polygon.new(evas) => polygon
*
* Creates an new Evas::Polygon object.
*/
/*
* call-seq:
* Evas::Polygon.new(evas) => polygon
*
* Creates an new Evas::Polygon object.
*/
-static VALUE c_
new (VALUE klass
, VALUE evas)
+static VALUE c_
init (VALUE self
, VALUE evas)
{
{
- VALUE self, argv[1];
- RbEvasObject *poly;
-
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
+ GET_OBJ (self, RbEvasObject, poly);
- self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
- c_free, poly);
poly->real = evas_object_polygon_add (e->real);
poly->real = evas_object_polygon_add (e->real);
- argv[0] = evas;
- rb_obj_call_init (self, 1, argv);
+ rb_call_super (1, &evas);
return self;
}
return self;
}
@@
-92,7
+82,7
@@
void Init_Polygon (void)
{
VALUE c = rb_define_class_under (mEvas, "Polygon", cEvasObject);
{
VALUE c = rb_define_class_under (mEvas, "Polygon", cEvasObject);
- rb_define_
singleton_method (c, "new", c_new
, 1);
+ rb_define_
method (c, "initialize", c_init
, 1);
rb_define_method (c, "add_point", c_add_point, 2);
rb_define_method (c, "clear_points", c_clear_points, 0);
}
rb_define_method (c, "add_point", c_add_point, 2);
rb_define_method (c, "clear_points", c_clear_points, 0);
}
diff --git
a/src/rb_rectangle.c
b/src/rb_rectangle.c
index bf32908a1cc143fcadb3e8f26374477ce0eb4005..e3d8ca10574ec9e68dc40d40ea98fabb7a363dd3 100644
(file)
--- a/
src/rb_rectangle.c
+++ b/
src/rb_rectangle.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_rectangle.c
58 2004-08-10 14:10:02
Z tilman $
+ * $Id: rb_rectangle.c
354 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-26,31
+26,21
@@
#include "rb_evas.h"
#include "rb_evas_object.h"
#include "rb_evas.h"
#include "rb_evas_object.h"
-static void c_free (RbEvasObject *e)
-{
- c_evas_object_free (e, true);
-}
-
/*
* call-seq:
* Evas::Rectangle.new(evas) => rect
*
* Creates an Evas::Rectangle object.
*/
/*
* call-seq:
* Evas::Rectangle.new(evas) => rect
*
* Creates an Evas::Rectangle object.
*/
-static VALUE c_
new (VALUE klass
, VALUE evas)
+static VALUE c_
init (VALUE self
, VALUE evas)
{
{
- VALUE self, argv[1];
- RbEvasObject *rect;
-
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
+ GET_OBJ (self, RbEvasObject, rect);
- self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
- c_free, rect);
rect->real = evas_object_rectangle_add (e->real);
rect->real = evas_object_rectangle_add (e->real);
- argv[0] = evas;
- rb_obj_call_init (self, 1, argv);
+ rb_call_super (1, &evas);
return self;
}
return self;
}
@@
-59,5
+49,5
@@
void Init_Rectangle (void)
{
VALUE c = rb_define_class_under (mEvas, "Rectangle", cEvasObject);
{
VALUE c = rb_define_class_under (mEvas, "Rectangle", cEvasObject);
- rb_define_
singleton_method (c, "new", c_new
, 1);
+ rb_define_
method (c, "initialize", c_init
, 1);
}
}
diff --git
a/src/rb_smart.c
b/src/rb_smart.c
index b9379e0d90dc95916a736ded4e1b91a1ecd7f97e..4abce295972d66d648d7681efbda24956c7f7777 100644
(file)
--- a/
src/rb_smart.c
+++ b/
src/rb_smart.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_smart.c
68 2004-08-16 15:42:19
Z tilman $
+ * $Id: rb_smart.c
354 2006-02-10 18:14:08
Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-26,23
+26,9
@@
#include "rb_evas.h"
#include "rb_evas_object.h"
#include "rb_evas.h"
#include "rb_evas_object.h"
-#define RUBY_EVAS_SMART_OBJECT_KEY "__RB_EVAS_OBJECT_SMART_OBJECT"
-
-#define GET_EVAS_OBJECT(obj, o) \
- VALUE (obj); \
-\
- obj = (VALUE) evas_object_data_get (o, \
- RUBY_EVAS_SMART_OBJECT_KEY); \
- if (!obj) { \
- rb_raise (rb_eException, \
- "EvasObject Ruby object key missing"); \
- return; \
- }
-
#define SMART_CB_BODY(name) \
#define SMART_CB_BODY(name) \
+ VALUE self = TO_EVAS_OBJECT (o); \
static ID id; \
static ID id; \
-\
- GET_EVAS_OBJECT (self, o); \
\
if (!id) \
id = rb_intern ("on_"#name); \
\
if (!id) \
id = rb_intern ("on_"#name); \
@@
-98,20
+84,25
@@
static void on_color_set (Evas_Object *o, int r, int g, int b, int a)
INT2FIX (a));
}
INT2FIX (a));
}
+static VALUE c_alloc (VALUE klass)
+{
+ Evas_Smart **smart = NULL;
+
+ return Data_Make_Struct (klass, Evas_Smart *, NULL, free, smart);
+}
+
/*
* call-seq:
* Evas::Smart.new(name) => smart
*
* Creates a Evas::Smart object with the given name.
*/
/*
* call-seq:
* Evas::Smart.new(name) => smart
*
* Creates a Evas::Smart object with the given name.
*/
-static VALUE c_
new (VALUE klass
, VALUE name)
+static VALUE c_
init (VALUE self
, VALUE name)
{
{
- VALUE self;
- Evas_Smart **smart;
+ GET_OBJ (self, Evas_Smart *, smart);
Check_Type (name, T_STRING);
Check_Type (name, T_STRING);
- self = Data_Make_Struct (klass, Evas_Smart *, NULL, free, smart);
*smart = evas_smart_new (StringValuePtr (name),
NULL, on_delete, on_layer_set,
on_raise, on_lower, on_stack_above,
*smart = evas_smart_new (StringValuePtr (name),
NULL, on_delete, on_layer_set,
on_raise, on_lower, on_stack_above,
@@
-119,16
+110,9
@@
static VALUE c_new (VALUE klass, VALUE name)
on_show, on_hide, on_color_set,
on_clip_set, on_clip_unset, NULL);
on_show, on_hide, on_color_set,
on_clip_set, on_clip_unset, NULL);
- rb_obj_call_init (self, 0, NULL);
-
return self;
}
return self;
}
-static void c_object_free (RbEvasObject *e)
-{
- c_evas_object_free (e, true);
-}
-
/*
* call-seq:
* smart.new_object(class, evas) => smart_obj
/*
* call-seq:
* smart.new_object(class, evas) => smart_obj
@@
-137,23
+121,20
@@
static void c_object_free (RbEvasObject *e)
*/
static VALUE c_new_object (VALUE self, VALUE klass, VALUE evas)
{
*/
static VALUE c_new_object (VALUE self, VALUE klass, VALUE evas)
{
- VALUE obj, argv[1];
- RbEvasObject *smart;
+ VALUE obj;
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
GET_OBJ (self, Evas_Smart *, s);
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
GET_OBJ (self, Evas_Smart *, s);
- obj = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
- c_object_free, smart);
- smart->real = evas_object_smart_add (e->real, *s);
+ obj = rb_obj_alloc (klass);
- evas_object_data_set (smart->real, RUBY_EVAS_SMART_OBJECT_KEY,
- (void *) obj);
+ GET_OBJ (obj, RbEvasObject, smart);
+
+ smart->real = evas_object_smart_add (e->real, *s);
- argv[0] = evas;
- rb_obj_call_init (obj, 1, argv);
+ rb_obj_call_init (obj, 1, &evas);
return obj;
}
return obj;
}
@@
-162,6
+143,7
@@
void Init_Smart (void)
{
VALUE c = rb_define_class_under (mEvas, "Smart", rb_cObject);
{
VALUE c = rb_define_class_under (mEvas, "Smart", rb_cObject);
- rb_define_singleton_method (c, "new", c_new, 1);
+ rb_define_alloc_func (c, c_alloc);
+ rb_define_method (c, "initialize", c_init, 1);
rb_define_method (c, "new_object", c_new_object, 2);
}
rb_define_method (c, "new_object", c_new_object, 2);
}
diff --git
a/src/rb_text.c
b/src/rb_text.c
index 431e8edfbb848107e8067b4595cf2b1804c810a5..14b22fa0d69d608b79db5fd6ffaa4bbadd656793 100644
(file)
--- a/
src/rb_text.c
+++ b/
src/rb_text.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_text.c
143 2004-11-26 21:39
:08Z tilman $
+ * $Id: rb_text.c
354 2006-02-10 18:14
:08Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-26,31
+26,21
@@
#include "rb_evas.h"
#include "rb_evas_object.h"
#include "rb_evas.h"
#include "rb_evas_object.h"
-static void c_free (RbEvasObject *e)
-{
- c_evas_object_free (e, true);
-}
-
/*
* call-seq:
* Evas::Text.new(evas) => text
*
* Creates an Evas::Text object.
*/
/*
* call-seq:
* Evas::Text.new(evas) => text
*
* Creates an Evas::Text object.
*/
-static VALUE c_
new (VALUE klass
, VALUE evas)
+static VALUE c_
init (VALUE self
, VALUE evas)
{
{
- VALUE self, argv[1];
- RbEvasObject *text;
-
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
CHECK_CLASS (evas, cEvas);
GET_OBJ (evas, RbEvas, e);
+ GET_OBJ (self, RbEvasObject, text);
- self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
- c_free, text);
text->real = evas_object_text_add (e->real);
text->real = evas_object_text_add (e->real);
- argv[0] = evas;
- rb_obj_call_init (self, 1, argv);
+ rb_call_super (1, &evas);
return self;
}
return self;
}
@@
-172,7
+162,7
@@
void Init_Text (void)
{
VALUE c = rb_define_class_under (mEvas, "Text", cEvasObject);
{
VALUE c = rb_define_class_under (mEvas, "Text", cEvasObject);
- rb_define_
singleton_method (c, "new", c_new
, 1);
+ rb_define_
method (c, "initialize", c_init
, 1);
rb_define_method (c, "font_source", c_font_source_get, 0);
rb_define_method (c, "font_source=", c_font_source_set, 1);
rb_define_method (c, "get_font", c_get_font, 0);
rb_define_method (c, "font_source", c_font_source_get, 0);
rb_define_method (c, "font_source=", c_font_source_set, 1);
rb_define_method (c, "get_font", c_get_font, 0);