-- EFL LuaJIT bindings: efl_canvas_output.eo (class Efl.Canvas.Output)
-- For use with Elua; automatically generated, do not modify

local cutil = require("cutil")
local util  = require("util")
local ffi   = require("ffi")
local eo    = require("eo")

local M, __lib = ...

local __class
local __body

local init = function()
    __class = __lib.efl_canvas_output_class_get()
    eo.class_register("Efl_Canvas_Output", {"Efl_Object"}, {"Efl_Gfx_Buffer"}, __body, __class)
end

cutil.init_module(init, function() end)

ffi.cdef [[
    const Eo_Class *efl_canvas_output_class_get(void);
    void efl_canvas_output_view_set(Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
    void efl_canvas_output_view_get(Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
    Eina_Bool efl_canvas_output_engine_info_set(Evas_Engine_Info * info);
    Evas_Engine_Info *efl_canvas_output_engine_info_get(void);
    Eina_Bool efl_canvas_output_lock(void);
    Eina_Bool efl_canvas_output_unlock(void);
    extern const Eo_Event_Description _EFL_CANVAS_OUTPUT_EVENT_PIXELS_READY;
]]

local __M = util.get_namespace(M, { "canvas" })
__body = {
    __eo_ctor = function(self, __func)
        if __func then __func() end
    end,

    view_set = function(self, x, y, w, h)
        eo.__do_start(self, __class)
        __lib.efl_canvas_output_view_set(x, y, w, h)
        eo.__do_end()
    end,

    view_get = function(self)
        eo.__do_start(self, __class)
        local x = ffi.new("Evas_Coord[1]")
        local y = ffi.new("Evas_Coord[1]")
        local w = ffi.new("Evas_Coord[1]")
        local h = ffi.new("Evas_Coord[1]")
        __lib.efl_canvas_output_view_get(x, y, w, h)
        eo.__do_end()
        return x[0], y[0], w[0], h[0]
    end,

    engine_info_set = function(self, info)
        eo.__do_start(self, __class)
        local v = __lib.efl_canvas_output_engine_info_set(info)
        eo.__do_end()
    end,

    engine_info_get = function(self)
        eo.__do_start(self, __class)
        local v = __lib.efl_canvas_output_engine_info_get()
        eo.__do_end()
        return v
    end,

    lock = function(self)
        eo.__do_start(self, __class)
        local v = __lib.efl_canvas_output_lock()
        eo.__do_end()
        return ((v) ~= 0)
    end,

    unlock = function(self)
        eo.__do_start(self, __class)
        local v = __lib.efl_canvas_output_unlock()
        eo.__do_end()
        return ((v) ~= 0)
    end,

    __events = {
        ["pixels,ready"] = __lib._EFL_CANVAS_OUTPUT_EVENT_PIXELS_READY
    },

    __properties = {
        ["engine_info"] = { 0, 0, 1, 1, true, true },
        ["view"] = { 0, 0, 4, 4, true, true }
    }
}

__M.Output = function(parent, ...)
    return eo.__ctor_common(__class, parent, eo.class_get("Efl_Canvas_Output").__eo_ctor,
                            1, ...)
end

return M
