From c589f79f167df20273f0b66f3614328f995e1352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 29 Feb 2012 17:27:09 +0100 Subject: parse elm_cnp.h, generate elm_cnp.rb --- lib/efl/elementary_all.rb | 2 +- lib/efl/elm/elm_cnp.rb | 30 ++++++++++++++++++++++++ lib/efl/native/elm/elm_cnp.rb | 54 +++++++++++++++++++++++++++++++++++++++++++ tools/genruby.rb | 2 +- 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 lib/efl/elm/elm_cnp.rb create mode 100644 lib/efl/native/elm/elm_cnp.rb diff --git a/lib/efl/elementary_all.rb b/lib/efl/elementary_all.rb index e41a38b..1785e41 100644 --- a/lib/efl/elementary_all.rb +++ b/lib/efl/elementary_all.rb @@ -17,7 +17,7 @@ require 'efl/elm/elm_button' require 'efl/elm/elm_calendar' require 'efl/elm/elm_check' require 'efl/elm/elm_clock' -#require 'efl/elm/elm_cnp' +require 'efl/elm/elm_cnp' require 'efl/elm/elm_colorselector' require 'efl/elm/elm_conform' require 'efl/elm/elm_ctxpopup' diff --git a/lib/efl/elm/elm_cnp.rb b/lib/efl/elm/elm_cnp.rb new file mode 100644 index 0000000..9f8c3e8 --- /dev/null +++ b/lib/efl/elm/elm_cnp.rb @@ -0,0 +1,30 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/elm/elm_object' +require 'efl/native/elm/elm_cnp' +# +module Efl + # + module Elm + # + class ElmObject + # + def cnp_selection_set selection, format, buf, sizet + Native.elm_cnp_selection_set @ptr, selection, format, buf, sizet + end + # + def cnp_selection_get selection, format, datacb, data + Native.elm_cnp_selection_set @ptr, selection, format, datacb, data + end + # + def cnp_selection_clear selection + Native.elm_object_cnp_selection_clear @ptr, selection + end + # + end + # + end +end +# +# EOF diff --git a/lib/efl/native/elm/elm_cnp.rb b/lib/efl/native/elm/elm_cnp.rb new file mode 100644 index 0000000..7b90c9c --- /dev/null +++ b/lib/efl/native/elm/elm_cnp.rb @@ -0,0 +1,54 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/native' +require 'efl/native/elementary' +# +module Efl + # + module ElmCnp + # + FCT_PREFIX = 'elm_cnp_' unless const_defined? :FCT_PREFIX + # + def self.method_missing meth, *args, &block + sym = Efl::MethodResolver.resolve self, meth, FCT_PREFIX + self.send sym, *args, &block + end + # + end + # + module Native + # + ffi_lib 'elementary-ver-pre-svn-09.so.0' + # + # ENUMS + # typedef enum {...} Elm_Sel_Type; + enum :elm_sel_type, [ :elm_sel_type_primary, :elm_sel_type_secondary, :elm_sel_type_xdnd, :elm_sel_type_clipboard ] + # typedef enum {...} Elm_Sel_Format; + enum :elm_sel_format, [ :elm_sel_format_targets, -1, :elm_sel_format_none, 0x0, :elm_sel_format_text, 0x01, :elm_sel_format_markup, 0x02, + :elm_sel_format_image, 0x04, :elm_sel_format_vcard, 0x08, :elm_sel_format_html, 0x10 ] + # + # TYPEDEFS + # typedef struct _Elm_Selection_Data Elm_Selection_Data; + typedef :pointer, :elm_selection_data + # + # CALLBACKS + # typedef Eina_Bool (*Elm_Drop_Cb) (void *data, Evas_Object *obj, Elm_Selection_Data *ev); + callback :elm_drop_cb, [ :pointer, :evas_object, :elm_selection_data ], :bool + # + # FUNCTIONS + fcts = [ + # EAPI Eina_Bool elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, const void *buf, size_t buflen); + [ :elm_cnp_selection_set, [ :evas_object, :elm_sel_type, :elm_sel_format, :pointer, :ulong ], :bool ], + # EAPI Eina_Bool elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata); + [ :elm_cnp_selection_get, [ :evas_object, :elm_sel_type, :elm_sel_format, :elm_drop_cb, :pointer ], :bool ], + # EAPI Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection); + [ :elm_object_cnp_selection_clear, [ :evas_object, :elm_sel_type ], :bool ], + ] + # + attach_fcts fcts + # + end +end +# +# EOF diff --git a/tools/genruby.rb b/tools/genruby.rb index 41b59b2..446fc4b 100755 --- a/tools/genruby.rb +++ b/tools/genruby.rb @@ -384,7 +384,7 @@ libs << elm_h('elm_cache.h', 'ElmCache') libs << elm_h('elm_calendar.h', 'ElmCalendar') libs << elm_h('elm_check.h', 'ElmCheck') libs << elm_h('elm_clock.h', 'ElmClock') -#libs << elm_h('elm_cnp.h', 'ElmCnp') +libs << elm_h('elm_cnp.h', 'ElmCnp') libs << elm_h('elm_colorselector.h', 'ElmColorSelector') libs << elm_h('elm_config.h', 'ElmConfig') libs << elm_h('elm_conform.h', 'ElmConform') -- cgit v1.1-2-g2b99