From 1f6059ba8be27832fc4b6f88c99548e39f4264cb Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Tue, 10 Aug 2004 14:10:02 +0000 Subject: [PATCH] Documentation arrived. --- Makefile.am | 13 +++- README | 29 ++++++++ src/rb_evas.c | 88 +++++++++++++++++++++- src/rb_evas_object.c | 170 +++++++++++++++++++++++++++++++++++++++---- src/rb_gradient.c | 32 +++++++- src/rb_polygon.c | 20 ++++- src/rb_rectangle.c | 8 +- src/rb_text.c | 49 ++++++++++++- 8 files changed, 387 insertions(+), 22 deletions(-) diff --git a/Makefile.am b/Makefile.am index b0de932..c4e5c55 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,14 @@ -## $Id: Makefile.am 2 2004-06-19 18:55:39Z tilman $ +## $Id: Makefile.am 58 2004-08-10 14:10:02Z tilman $ SUBDIRS = m4 src +DOC_INPUT = src/rb_evas_main.c \ + src/rb_evas.c \ + src/rb_evas_object.c \ + src/rb_image.c \ + src/rb_line.c \ + src/rb_polygon.c \ + src/rb_rectangle.c \ + src/rb_text.c + +doc: $(DOC_INPUT) + rdoc $(DOC_INPUT) diff --git a/README b/README index e69de29..b339f5a 100644 --- a/README +++ b/README @@ -0,0 +1,29 @@ +$Id: README 58 2004-08-10 14:10:02Z tilman $ + +ruby-evas - Ruby bindings for Evas +================================== + + +About +----- + +ruby-evas is a set of Ruby language bindings for Enlightenment's Canvas +library, Evas. + + +Installation +------------ + +Please see INSTALL. + + +Documentation +------------- + +To create the HTML documentation for ruby-evas, a patched version of +rdoc is required. The necessary patches can be found at +http://code-monkey.de/?patches + +After you've patched rdoc, please run "make doc" to create the HTML. +The docs can also be found at +http://code-monkey.de/ruby-efl-docs/evas diff --git a/src/rb_evas.c b/src/rb_evas.c index fb02482..3e333a5 100644 --- a/src/rb_evas.c +++ b/src/rb_evas.c @@ -1,5 +1,5 @@ /* - * $Id: rb_evas.c 49 2004-08-01 10:17:39Z tilman $ + * $Id: rb_evas.c 58 2004-08-10 14:10:02Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -52,11 +52,18 @@ VALUE TO_EVAS (VALUE parent, Evas *e) return self; } +/* :nodoc: */ static VALUE c_inspect (VALUE self) { INSPECT (self, RbEvas); } +/* + * call-seq: + * e.render => nil + * + * Forces a re-render of the Evas. + */ static VALUE c_render (VALUE self) { GET_OBJ (self, RbEvas, e); @@ -75,6 +82,12 @@ static VALUE c_font_path_clear (VALUE self) return Qnil; } +/* + * call-seq: + * e.font_path_append(path) => nil + * + * Appends a path to the font path for e. + */ static VALUE c_font_path_append (VALUE self, VALUE path) { GET_OBJ (self, RbEvas, e); @@ -86,6 +99,12 @@ static VALUE c_font_path_append (VALUE self, VALUE path) return Qnil; } +/* + * call-seq: + * e.font_path_prepend(path) => nil + * + * Prepends a path to the font path for e. + */ static VALUE c_font_path_prepend (VALUE self, VALUE path) { GET_OBJ (self, RbEvas, e); @@ -97,6 +116,12 @@ static VALUE c_font_path_prepend (VALUE self, VALUE path) return Qnil; } +/* + * call-seq: + * e.font_path => array + * + * Returns the font path for e. + */ static VALUE c_font_path_get (VALUE self) { VALUE ary; @@ -114,7 +139,12 @@ static VALUE c_font_path_get (VALUE self) return ary; } - +/* + * call-seq: + * e.font_cache => fixnum + * + * Returns the size of the font cache for e. + */ static VALUE c_font_cache_get (VALUE self) { GET_OBJ (self, RbEvas, e); @@ -122,6 +152,12 @@ static VALUE c_font_cache_get (VALUE self) return INT2FIX (evas_font_cache_get (e->real)); } +/* + * call-seq: + * e.font_cache(fixnum) + * + * Sets the size of the font cache for e. + */ static VALUE c_font_cache_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvas, e); @@ -133,6 +169,12 @@ static VALUE c_font_cache_set (VALUE self, VALUE val) return Qnil; } +/* + * call-seq: + * e.font_cache_reload => nil + * + * Flushes the font cache for e. + */ static VALUE c_font_cache_flush (VALUE self) { GET_OBJ (self, RbEvas, e); @@ -142,6 +184,12 @@ static VALUE c_font_cache_flush (VALUE self) return Qnil; } +/* + * call-seq: + * e.image_cache => fixnum + * + * Returns the size of the image cache for e. + */ static VALUE c_image_cache_get (VALUE self) { GET_OBJ (self, RbEvas, e); @@ -149,6 +197,12 @@ static VALUE c_image_cache_get (VALUE self) return INT2FIX (evas_image_cache_get (e->real)); } +/* + * call-seq: + * e.image_cache(fixnum) + * + * Sets the size of the image cache for e. + */ static VALUE c_image_cache_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvas, e); @@ -160,6 +214,12 @@ static VALUE c_image_cache_set (VALUE self, VALUE val) return Qnil; } +/* + * call-seq: + * e.image_cache_reload => nil + * + * Flushes the image cache for e. + */ static VALUE c_image_cache_reload (VALUE self) { GET_OBJ (self, RbEvas, e); @@ -169,6 +229,12 @@ static VALUE c_image_cache_reload (VALUE self) return Qnil; } +/* + * call-seq: + * e.image_cache_flush => nil + * + * Flushes the image cache for e. + */ static VALUE c_image_cache_flush (VALUE self) { GET_OBJ (self, RbEvas, e); @@ -178,6 +244,12 @@ static VALUE c_image_cache_flush (VALUE self) return Qnil; } +/* + * call-seq: + * e.top => evasobject + * + * Returns the Evas::EvasObject at the top of e. + */ static VALUE c_top_get (VALUE self) { Evas_Object *o; @@ -196,6 +268,12 @@ static VALUE c_top_get (VALUE self) return (VALUE) obj; } +/* + * call-seq: + * e.bottom => evasobject + * + * Returns the Evas::EvasObject at the bottom of e. + */ static VALUE c_bottom_get (VALUE self) { Evas_Object *o; @@ -214,6 +292,12 @@ static VALUE c_bottom_get (VALUE self) return (VALUE) obj; } +/* + * call-seq: + * e.find_object(name) => evasobject + * + * Returns the Evas::EvasObject with the name name. + */ static VALUE c_find_object (VALUE self, VALUE name) { Evas_Object *o; diff --git a/src/rb_evas_object.c b/src/rb_evas_object.c index 98a05fb..e465bfc 100644 --- a/src/rb_evas_object.c +++ b/src/rb_evas_object.c @@ -1,5 +1,5 @@ /* - * $Id: rb_evas_object.c 49 2004-08-01 10:17:39Z tilman $ + * $Id: rb_evas_object.c 58 2004-08-10 14:10:02Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -45,6 +45,7 @@ void c_evas_object_free (RbEvasObject *e, bool free_mem) free (e); } +/* :nodoc: */ static VALUE c_init (VALUE self, VALUE parent) { GET_OBJ (self, RbEvasObject, e); @@ -56,11 +57,18 @@ static VALUE c_init (VALUE self, VALUE parent) return self; } +/* :nodoc: */ static VALUE c_inspect (VALUE self) { INSPECT (self, RbEvasObject); } +/* + * call-seq: + * e.delete => nil + * + * Deletes e. + */ static VALUE c_delete (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -71,6 +79,14 @@ static VALUE c_delete (VALUE self) return Qnil; } +/* + * call-seq: + * e.resize(width, height) => nil + * + * Resizes e to width x height. + * + * e.resize(100, 200) #=> nil + */ static VALUE c_resize (VALUE self, VALUE w, VALUE h) { GET_OBJ (self, RbEvasObject, e); @@ -84,6 +100,15 @@ static VALUE c_resize (VALUE self, VALUE w, VALUE h) return Qnil; } +/* + * call-seq: + * e.move(x, y) => nil + * + * Moves e to the coordinates specified in + * x and y. + * + * e.move(100, 200) #=> nil + */ static VALUE c_move (VALUE self, VALUE x, VALUE y) { GET_OBJ (self, RbEvasObject, e); @@ -97,6 +122,16 @@ static VALUE c_move (VALUE self, VALUE x, VALUE y) return Qnil; } +/* + * call-seq: + * e.geometry => array + * + * Returns an array containing the geometry of e. + * + * e.move(150, 300) #=> nil + * e.resize(200, 200) #=> nil + * e.geometry #=> [150, 300, 200, 200] + */ static VALUE c_geometry_get (VALUE self) { int x = 0, y = 0, w = 0, h = 0; @@ -111,6 +146,12 @@ static VALUE c_geometry_get (VALUE self) INT2FIX (h)); } +/* + * call-seq: + * e.show => nil + * + * Shows e. + */ static VALUE c_show (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -120,6 +161,12 @@ static VALUE c_show (VALUE self) return Qnil; } +/* + * call-seq: + * e.hide => nil + * + * Hides e. + */ static VALUE c_hide (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -129,6 +176,12 @@ static VALUE c_hide (VALUE self) return Qnil; } +/* + * call-seq: + * e.visible? => true or false + * + * Returns true if e is visible, else false. + */ static VALUE c_visible_get (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -136,6 +189,12 @@ static VALUE c_visible_get (VALUE self) return evas_object_visible_get (e->real) ? Qtrue : Qfalse; } +/* + * call-seq: + * e.evas => evas + * + * Returns the Evas::Evas for e. + */ static VALUE c_evas_get (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -143,6 +202,12 @@ static VALUE c_evas_get (VALUE self) return e->parent; } +/* + * call-seq: + * e.name => string + * + * Returns the name of e. + */ static VALUE c_name_get (VALUE self) { const char *name; @@ -155,6 +220,12 @@ static VALUE c_name_get (VALUE self) return rb_str_new2 (name); } +/* + * call-seq: + * e.name(string) + * + * Sets the name of e. + */ static VALUE c_name_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvasObject, e); @@ -166,6 +237,12 @@ static VALUE c_name_set (VALUE self, VALUE val) return Qnil; } +/* + * call-seq: + * e.layer => fixnum + * + * Returns the layer e is in. + */ static VALUE c_layer_get (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -173,6 +250,12 @@ static VALUE c_layer_get (VALUE self) return INT2FIX (evas_object_layer_get (e->real)); } +/* + * call-seq: + * e.layer(fixnum) + * + * Sets the layer e is in. + */ static VALUE c_layer_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvasObject, e); @@ -184,6 +267,15 @@ static VALUE c_layer_set (VALUE self, VALUE val) return Qnil; } +/* + * call-seq: + * e.get_color => array + * + * Returns the color of e. + * + * e.set_color(128, 128, 128, 0) #=> nil + * e.get_color #=> [128, 128, 128, 0] + */ static VALUE c_get_color (VALUE self) { int r = 0, g = 0, b = 0, a = 0; @@ -196,6 +288,14 @@ static VALUE c_get_color (VALUE self) INT2FIX (a)); } +/* + * call-seq: + * e.set_color(r, g, b, a) => nil + * + * Sets the color of e. + * + * e.set_color(128, 128, 128, 0) #=> nil + */ static VALUE c_set_color (VALUE self, VALUE r, VALUE g, VALUE b, VALUE a) { @@ -212,6 +312,13 @@ static VALUE c_set_color (VALUE self, VALUE r, VALUE g, VALUE b, return Qnil; } +/* + * call-seq: + * e.pass_events? => true or false + * + * Returns true if e passes events on to EvasObjects that are + * below itself, else false. + */ static VALUE c_pass_events_get (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -219,6 +326,13 @@ static VALUE c_pass_events_get (VALUE self) return evas_object_pass_events_get (e->real) ? Qtrue : Qfalse; } +/* + * call-seq: + * e.pass_events(true or false) + * + * Sets whether e passes events on to EvasObjects that are + * below itself. + */ static VALUE c_pass_events_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvasObject, e); @@ -230,6 +344,12 @@ static VALUE c_pass_events_set (VALUE self, VALUE val) return Qnil; } +/* + * call-seq: + * e.raise => nil + * + * Raises e. + */ static VALUE c_raise (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -239,6 +359,12 @@ static VALUE c_raise (VALUE self) return Qnil; } +/* + * call-seq: + * e.lower => nil + * + * Lowers e. + */ static VALUE c_lower (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -248,17 +374,17 @@ static VALUE c_lower (VALUE self) return Qnil; } +/* + * call-seq: + * e.stack_above(evasobject) => nil + * + * Positions e above evasobject. + */ static VALUE c_stack_above (VALUE self, VALUE target) { GET_OBJ (self, RbEvasObject, e); - if (!rb_obj_is_kind_of (target, cEvasObject)) { - rb_raise (rb_eTypeError, - "wrong argument type %s (expected EvasObject)", - rb_obj_classname (target)); - return Qnil; - } - + CHECK_CLASS (target, cEvasObject); GET_OBJ (target, RbEvasObject, t); evas_object_stack_above (e->real, t->real); @@ -266,17 +392,17 @@ static VALUE c_stack_above (VALUE self, VALUE target) return Qnil; } +/* + * call-seq: + * e.stack_below(evasobject) => nil + * + * Positions e below evasobject. + */ static VALUE c_stack_below (VALUE self, VALUE target) { GET_OBJ (self, RbEvasObject, e); - if (!rb_obj_is_kind_of (target, cEvasObject)) { - rb_raise (rb_eTypeError, - "wrong argument type %s (expected EvasObject)", - rb_obj_classname (target)); - return Qnil; - } - + CHECK_CLASS (target, cEvasObject); GET_OBJ (target, RbEvasObject, t); evas_object_stack_below (e->real, t->real); @@ -284,6 +410,13 @@ static VALUE c_stack_below (VALUE self, VALUE target) return Qnil; } +/* + * call-seq: + * e.above => evasobject + * + * Returns the Evas::EvasObject that's positioned above + * e. + */ static VALUE c_above_get (VALUE self) { Evas_Object *o; @@ -302,6 +435,13 @@ static VALUE c_above_get (VALUE self) return (VALUE) obj; } +/* + * call-seq: + * e.below => evasobject + * + * Returns the Evas::EvasObject that's positioned below + * e. + */ static VALUE c_below_get (VALUE self) { Evas_Object *o; diff --git a/src/rb_gradient.c b/src/rb_gradient.c index a59f051..2129e01 100644 --- a/src/rb_gradient.c +++ b/src/rb_gradient.c @@ -1,5 +1,5 @@ /* - * $Id: rb_gradient.c 54 2004-08-09 10:51:39Z tilman $ + * $Id: rb_gradient.c 58 2004-08-10 14:10:02Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -31,6 +31,12 @@ static void c_free (RbEvasObject *e) c_evas_object_free (e, true); } +/* + * call-seq: + * Evas::Gradient.new(evas) => gradient + * + * Creates an Evas::Gradient object. + */ static VALUE c_new (VALUE klass, VALUE evas) { VALUE self, argv[1]; @@ -49,6 +55,12 @@ static VALUE c_new (VALUE klass, VALUE evas) return self; } +/* + * call-seq: + * gradient.add_color(r, g, b, a, distance) => nil + * + * Adds a color to gradient. + */ static VALUE c_add_color (VALUE self, VALUE r, VALUE g, VALUE b, VALUE a, VALUE distance) { @@ -67,6 +79,12 @@ static VALUE c_add_color (VALUE self, VALUE r, VALUE g, VALUE b, return Qnil; } +/* + * call-seq: + * gradient.clear_colors => nil + * + * Clears the colors of gradient. + */ static VALUE c_clear_colors (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -76,6 +94,12 @@ static VALUE c_clear_colors (VALUE self) return Qnil; } +/* + * call-seq: + * gradient.angle => fixnum + * + * Returns the angle of gradient. + */ static VALUE c_angle_get (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -83,6 +107,12 @@ static VALUE c_angle_get (VALUE self) return INT2FIX (evas_object_gradient_angle_get (e->real)); } +/* + * call-seq: + * gradient.angle(fixnum) + * + * Sets the angle of gradient. + */ static VALUE c_angle_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvasObject, e); diff --git a/src/rb_polygon.c b/src/rb_polygon.c index 8c4cc13..9a8913c 100644 --- a/src/rb_polygon.c +++ b/src/rb_polygon.c @@ -1,5 +1,5 @@ /* - * $Id: rb_polygon.c 54 2004-08-09 10:51:39Z tilman $ + * $Id: rb_polygon.c 58 2004-08-10 14:10:02Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -31,6 +31,12 @@ 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. + */ static VALUE c_new (VALUE klass, VALUE evas) { VALUE self, argv[1]; @@ -49,6 +55,12 @@ static VALUE c_new (VALUE klass, VALUE evas) return self; } +/* + * call-seq: + * polygon.add_point(x, y) => nil + * + * Adds a point to polygon. + */ static VALUE c_add_point (VALUE self, VALUE x, VALUE y) { GET_OBJ (self, RbEvasObject, e); @@ -61,6 +73,12 @@ static VALUE c_add_point (VALUE self, VALUE x, VALUE y) return Qnil; } +/* + * call-seq: + * polygon.clear_points => nil + * + * Clears the points of polygon. + */ static VALUE c_clear_points (VALUE self) { GET_OBJ (self, RbEvasObject, e); diff --git a/src/rb_rectangle.c b/src/rb_rectangle.c index a058fa6..bf32908 100644 --- a/src/rb_rectangle.c +++ b/src/rb_rectangle.c @@ -1,5 +1,5 @@ /* - * $Id: rb_rectangle.c 49 2004-08-01 10:17:39Z tilman $ + * $Id: rb_rectangle.c 58 2004-08-10 14:10:02Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -31,6 +31,12 @@ static void c_free (RbEvasObject *e) c_evas_object_free (e, true); } +/* + * call-seq: + * Evas::Rectangle.new(evas) => rect + * + * Creates an Evas::Rectangle object. + */ static VALUE c_new (VALUE klass, VALUE evas) { VALUE self, argv[1]; diff --git a/src/rb_text.c b/src/rb_text.c index 7788465..076fd9e 100644 --- a/src/rb_text.c +++ b/src/rb_text.c @@ -1,5 +1,5 @@ /* - * $Id: rb_text.c 49 2004-08-01 10:17:39Z tilman $ + * $Id: rb_text.c 58 2004-08-10 14:10:02Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -31,6 +31,12 @@ static void c_free (RbEvasObject *e) c_evas_object_free (e, true); } +/* + * call-seq: + * Evas::Text.new(evas) => text + * + * Creates an Evas::Text object. + */ static VALUE c_new (VALUE klass, VALUE evas) { VALUE self, argv[1]; @@ -49,6 +55,12 @@ static VALUE c_new (VALUE klass, VALUE evas) return self; } +/* + * call-seq: + * text.font_source => string or nil + * + * Returns the font source of text. + */ static VALUE c_font_source_get (VALUE self) { const char *tmp; @@ -61,6 +73,12 @@ static VALUE c_font_source_get (VALUE self) return rb_str_new2 (tmp); } +/* + * call-seq: + * text.font_source(source) + * + * Sets the font source of text. + */ static VALUE c_font_source_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvasObject, e); @@ -72,6 +90,15 @@ static VALUE c_font_source_set (VALUE self, VALUE val) return Qnil; } +/* + * call-seq: + * text.get_font => array + * + * Returns the font name and font size of text. + * + * text.set_font("vera", 10) #=> nil + * text_get_font #=> ["vera", 10] + */ static VALUE c_get_font (VALUE self) { char *font = NULL; @@ -85,6 +112,14 @@ static VALUE c_get_font (VALUE self) INT2FIX (size)); } +/* + * call-seq: + * text.set_font(font, size) => nil + * + * Sets the font name and font size of text. + * + * text.set_font("vera", 10) #=> nil + */ static VALUE c_set_font (VALUE self, VALUE font, VALUE size) { GET_OBJ (self, RbEvasObject, e); @@ -98,6 +133,12 @@ static VALUE c_set_font (VALUE self, VALUE font, VALUE size) return Qnil; } +/* + * call-seq: + * text.text => string + * + * Returns the text of text. + */ static VALUE c_text_get (VALUE self) { const char *tmp; @@ -110,6 +151,12 @@ static VALUE c_text_get (VALUE self) return rb_str_new2 (tmp); } +/* + * call-seq: + * text.text(string) + * + * Sets the text of text. + */ static VALUE c_text_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvasObject, e); -- 2.30.2