summaryrefslogtreecommitdiffstats
path: root/lib/efl/elm/elm_theme.rb
blob: 27ff2fa4b6b733e4136b1645f35ec607d9f7f030 (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
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl/elm/elm_object'
require 'efl/native/elm/elm_theme'
#
module Efl
    #
    module Elm
        #
        class ElmTheme < ElmObject
            #
            search_prefixes 'elm_theme_'
            #
            def initialize o=nil, &block
                @ptr = (
                    case o
                    when NilClass
                        FFI::AutoPointer.new Native.elm_theme_new, ElmTheme.method(:release)
                    when FFI::Pointer
                        o
                    else
                        raise ArgumentError.new "wrong argument #{o.class.name}"
                    end
                )
                instance_eval &block if block
            end
            def self.release p
                Native.elm_theme_free p
            end
            def free
                @ptr.autorelease=false if @ptr.is_a? FFI::AutoPointer
                ElmTheme.release @ptr
                @ptr=nil
            end
            #
        end
        #
    end
end
#
# EOF