/
d.vision
/
division_engine_cpp
Обзор
Документация
Войти
/
d.vision
/
division_engine_cpp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
resources/scripts/views/view.lua
50 строк
1 KB
den163
Added 'hierarchy' primitive framework to support base oop routines
26 ноя 2024, 20:02
26 ноя 2024, 20:02
f5cc049
Код
Авторство
О чём код?
local hierarchy = require 'hierarchy' ---@class view : hierarchy.class ---@field state view.state ---@field base view ---@field type view local view = hierarchy.new_type 'view' ---@class view.state : hierarchy.class local state = hierarchy.new_type 'state' view.state = state local function not_impl_error(self, func_name) error(func_name .. " is not implemented in " .. tostring(self.__name)) end ---@param other view function view:is_same_view_type(other) return other.type == self.type end ---Override this method to create new state instance ---@return view.state function view:create_state() ---@diagnostic disable-next-line: missing-return not_impl_error(self, "view:create_state()") end ---Layout a view by constraints ---@param constraints constraints ---@param view view ---@return constrained_size function state:layout(constraints, view) ---@diagnostic disable-next-line: missing-return not_impl_error(self, "state:layout(constraints, view)") end ---Render a view ---@param render_rect rect ---@param view view function state:render(render_rect, view) ---@diagnostic disable-next-line: missing-return not_impl_error(self, "state:layout(render_rect, view)") end ---Override this function if you need the destroy behaviour function state:destroy() end return view