summaryrefslogtreecommitdiffstats
path: root/lib/efl/ecore/event.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-04-11 23:25:23 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-04-11 23:25:23 +0200
commit0c3cbdb988566ea3e2dcd52396b834cbab02d3fa (patch)
tree837058d3a4fc728287019c401b004650c38a56e9 /lib/efl/ecore/event.rb
parent846ea53d8844b42ac85bcf3a4c8307212c2c5075 (diff)
downloadffi-efl-0c3cbdb988566ea3e2dcd52396b834cbab02d3fa.zip
ffi-efl-0c3cbdb988566ea3e2dcd52396b834cbab02d3fa.tar.gz
add ecore event functions and spec
Diffstat (limited to 'lib/efl/ecore/event.rb')
-rw-r--r--lib/efl/ecore/event.rb59
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/efl/ecore/event.rb b/lib/efl/ecore/event.rb
new file mode 100644
index 0000000..ed85a28
--- /dev/null
+++ b/lib/efl/ecore/event.rb
@@ -0,0 +1,59 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+require 'ffi'
+#
+module EFL
+ module ECORE
+ #
+ extend FFI::Library
+ #
+ EVENT_NONE = 0
+ EVENT_SIGNAL_USER = 1 # User signal event
+ EVENT_SIGNAL_HUP = 2 # Hup signal event
+ EVENT_SIGNAL_EXIT = 3 # Exit signal event
+ EVENT_SIGNAL_POWER = 4 # Power signal event
+ EVENT_SIGNAL_REALTIME = 5 # Realtime signal event
+ EVENT_COUNT = 6
+ callback :ecore_event_handler_cb, [:pointer, :int, :pointer], :bool
+ callback :ecore_end_cb, [:pointer, :pointer], :void
+ callback :ecore_data_cb, [:pointer], :pointer
+ callback :ecore_filter_cb, [:pointer, :pointer, :int, :pointer], :bool
+ #
+ ffi_lib 'ecore'
+ functions = [
+ [ :ecore_event_handler_add, [:int, :ecore_event_handler_cb, :pointer], :pointer ],
+ [ :ecore_event_handler_del, [:pointer], :void ],
+ [ :ecore_event_add, [:int, :pointer, :ecore_end_cb, :pointer], :pointer ],
+ [ :ecore_event_del, [:pointer], :void ],
+ [ :ecore_event_handler_data_get, [:pointer], :pointer ],
+ [ :ecore_event_handler_data_set, [:pointer,:pointer], :void ],
+ [ :ecore_event_type_new, [], :int ],
+ [ :ecore_event_filter_add, [:ecore_data_cb, :ecore_filter_cb, :ecore_end_cb, :pointer], :pointer ],
+ [ :ecore_event_filter_del, [:pointer], :void ],
+ [ :ecore_event_current_type_get, [], :int ],
+ [ :ecore_event_current_event_get, [], :pointer],
+ ].each do |func|
+ begin
+ attach_function *func
+ rescue Object => e
+ puts "Could not attach #{func} #{e.message}"
+ end
+ end
+ #
+ class << self
+ alias event_handler_add ecore_event_handler_add
+ alias event_handler_del ecore_event_handler_del
+ alias event_add ecore_event_add
+ alias event_del ecore_event_del
+ alias event_handler_data_get ecore_event_handler_data_get
+ alias event_handler_data_set ecore_event_handler_data_set
+ alias event_type_new ecore_event_type_new
+ alias event_current_type_get ecore_event_current_type_get
+ alias event_current_event_get ecore_event_current_event_get
+ end
+ #
+ end
+end
+#
+# EOF