summaryrefslogtreecommitdiffstats
path: root/lib/efl/ecore_evas.rb
blob: 215bb3faa4214a9610dea01743120f8fbddf969c (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl/ffi/ecore_evas'
#
module Efl
    #
    module EcoreEvas
        #
        def self.ecore_evas_list
            Efl::EinaList::REinaList.new Efl::EcoreEvas.ecore_evas_ecore_evas_list_get
        end
        def self.engines_list
            Efl::EinaList::REinaList.new Efl::EcoreEvas.engines_get
        end
        #
        class REcoreEvas
            include Efl::ClassHelper
            proxy_list [Efl::EcoreEvas,'ecore_evas_'].freeze
            def initialize o=nil
                @ptr = (
                    case o
                    when NilClass
                        FFI::AutoPointer.new Efl::EcoreEvas.ecore_evas_new(nil, 0, 0, 0, 0, nil), REcoreEvas.method(:release)
                    when Hash
                        FFI::AutoPointer.new Efl::EcoreEvas.ecore_evas_new(o[:engine_name], o[:x], o[:y], o[:w], o[:h], o[:extra_options]), REcoreEvas.method(:release)
                    when FFI::Pointer
                        o
                    else
                        raise ArgumentError.new "wrong argument #{o.class.name}"
                    end
                )
                yield self if block_given?
            end
            def self.release p
                Efl::EcoreEvas.ecore_evas_free p unless p.nil?
            end
            def free p=nil
                @ptr.autorelease=false
                REcoreEvas.release @ptr
                @ptr=nil
            end
            def geometry_get
                x = FFI::MemoryPointer.new :int
                y = FFI::MemoryPointer.new :int
                w = FFI::MemoryPointer.new :int
                h = FFI::MemoryPointer.new :int
                Efl::EcoreEvas.ecore_evas_geometry_get @ptr, x, y, w, h
                [ x.read_int, y.read_int, w.read_int, h.read_int ]
            end
            alias :geometry :geometry_get
            def size
                geometry_get[2..-1]
            end
            def size= wh
                Efl::Evas.evas_object_resize @ptr, *wh
            end
            def name_class_get
                n = FFI::MemoryPointer.new :pointer
                c = FFI::MemoryPointer.new :pointer
                Efl::EcoreEvas.ecore_evas_name_class_get @ptr, n, c
                [ n.read_pointer.read_string, c.read_pointer.read_string ]
            end
            def size_min_get
                w = FFI::MemoryPointer.new :int
                h = FFI::MemoryPointer.new :int
                Efl::EcoreEvas.ecore_evas_size_min_get @ptr, w, h
                [ w.read_int, h.read_int ]
            end
            def size_max_get
                w = FFI::MemoryPointer.new :int
                h = FFI::MemoryPointer.new :int
                Efl::EcoreEvas.ecore_evas_size_max_get @ptr, w, h
                [ w.read_int, h.read_int ]
            end
            def size_base_get
                w = FFI::MemoryPointer.new :int
                h = FFI::MemoryPointer.new :int
                Efl::EcoreEvas.ecore_evas_size_base_get @ptr, w, h
                [ w.read_int, h.read_int ]
            end
            def size_step_get
                w = FFI::MemoryPointer.new :int
                h = FFI::MemoryPointer.new :int
                Efl::EcoreEvas.ecore_evas_size_step_get @ptr, w, h
                [ w.read_int, h.read_int ]
            end
            def evas
                # EAPI Evas *ecore_evas_get(const Ecore_Evas *ee);
                Efl::Evas::REvas.new Efl::EcoreEvas.ecore_evas_get @ptr
            end
            alias :get :evas
            def object_image_new
                # EAPI Evas_Object *ecore_evas_object_image_new(Ecore_Evas *ee_target);
                Efl::Evas::REvasObject.new Efl::EcoreEvas.ecore_evas_object_image_new @prt
            end
            def object_associate_get
                # EAPI Evas_Object *ecore_evas_object_associate_get(const Ecore_Evas *ee);
                Efl::Evas::REvasObject.new Efl::EcoreEvas.ecore_evas_object_associate_get @prt
            end
            #
        end
        #
    end
    #
    module Evas
        #
        class REvas
            def ecore_evas_get
                # EAPI Ecore_Evas *ecore_evas_ecore_evas_get(const Evas *e);
                Efl::EcoreEvas::REcoreEvas.new Efl::EcoreEvas.ecore_evas_ecore_evas_get @ptr
            end
        end
        #
        class REvasObject
            def ecore_evas_get
                # EAPI Ecore_Evas *ecore_evas_object_ecore_evas_get(Evas_Object *obj);
                Efl::EcoreEvas::REcoreEvas.new Efl::EcoreEvas.ecore_evas_object_ecore_evas_get @ptr
            end
            def evas_get
                # EAPI Evas *ecore_evas_object_evas_get(Evas_Object *obj);
                Efl::Evas::REvas.new Efl::EcoreEvas.ecore_evas_object_evas_get @ptr
            end
        end
    end
    #
end
#
# EOF