summaryrefslogtreecommitdiffstats
path: root/lib/efl/ecore.rb
blob: cf0a8655b0ff6790bd5e183cce2a15a97d5005fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl'
require 'efl/native/ecore'
#
module Efl
    module Ecore
        #
        # ecore-1/Ecore.h line 95
        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
        #
        def self.version
            Native::VersionStruct.new(Native.ecore_version)
        end
        #
        class REcorePipe
            def initialize cb, data
                @ptr = FFI::AutoPointer.new Native.ecore_pipe_add(cb, data), REcorePipe.method(:release)
            end
            def self.release p
                Native.ecore_pipe_del p
            end
            def del
                @ptr.autorelease=false
                REcorePipe.release @ptr
                @ptr=nil
            end
            def read_close
                Native.ecore_pipe_read_close @ptr
            end
            def write_close
                Native.ecore_pipe_write_close @ptr
            end
            def write data
                Native.ecore_pipe_write @ptr, FFI::MemoryPointer.from_string(data.to_s), data.to_s.length+1
            end
            #
        end
        #
    end
end
#
# EOF