Skip to content

Commit

Permalink
feat(obj): return obj for all set API (#46)
Browse files Browse the repository at this point in the history
This allows chain several set methods like:

obj:add_flag(lvgl.FLAG.SCROLLABLE):center()

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
  • Loading branch information
XuNeo authored May 26, 2024
1 parent f9d8882 commit 4e27ee8
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 41 deletions.
43 changes: 26 additions & 17 deletions src/lvgl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -303,23 +303,23 @@ lvgl.LAYOUT_GRID = 0

--- return a opacity value in lvgl unit(0..255)
---@param p integer opacity value in range of 0..100
---@return integer
--- @return integer
function lvgl.OPA(p)
end

--- return a layout in percent
---@param p integer
---@return integer
--- @return integer
function lvgl.PCT(p)
end

--- return lvgl horizontal resolution
---@return integer
--- @return integer
function lvgl.HOR_RES()
end

--- return lvgl vertical resolution
---@return integer
--- @return integer
function lvgl.VER_RES()
end

Expand Down Expand Up @@ -538,6 +538,7 @@ end
---
--- Set object property
--- @param p StyleProp
--- @return Object
---
function obj:set(p)
end
Expand All @@ -553,6 +554,7 @@ end
---
--- Set object property
--- @param p AlignToPara
--- @return Object
---
function obj:align_to(p)
end
Expand All @@ -565,7 +567,7 @@ end

---
--- Delete all children of this object
--- @return nil
--- @return Object
function obj:clean()
end

Expand Down Expand Up @@ -622,7 +624,7 @@ end
--- @field anim boolean
---
--- @param p ScrollToPara
--- @return ObjState
--- @return Object
function obj:scroll_to(p)
end

Expand All @@ -641,36 +643,36 @@ end
---
--- add flag to object
--- @param p ObjFlag
--- @return nil
--- @return Object
function obj:add_flag(p)
end

---
--- clear object flag
--- @param p ObjFlag
--- @return nil
--- @return Object
function obj:clear_flag(p)
end

---
--- add state to object
--- @param p ObjState
--- @return nil
--- @return Object
function obj:add_state(p)
end

---
--- clear object state
--- @param p ObjState
--- @return nil
--- @return Object
function obj:clear_state(p)
end

---
--- add style to object
--- @param s Style
--- @param selector? integer
--- @return nil
--- @return Object
function obj:add_style(s, selector)
end

Expand All @@ -692,71 +694,78 @@ end
---@param x integer
---@param y integer
---@param anim_en? boolean
--- @return Object
function obj:scroll_by(x, y, anim_en)
end

---scroll obj by x,y
---@param x integer
---@param y integer
---@param anim_en boolean
--- @return Object
function obj:scroll_by_bounded(x, y, anim_en)
end

--- Scroll to an object until it becomes visible on its parent
---@param anim_en? boolean
--- @return Object
function obj:scroll_to_view(anim_en)
end

--- Scroll to an object until it becomes visible on its parent
--- Do the same on the parent's parent, and so on.
--- Therefore the object will be scrolled into view even it has nested scrollable parents
---@param anim_en? boolean
--- @return Object
function obj:scroll_to_view_recursive(anim_en)
end

---scroll obj by x,y, low level APIs
---@param x integer
---@param y integer
---@param anim_en boolean
--- @return Object
function obj:scroll_by_raw(x, y, anim_en)
end

---Invalidate the area of the scrollbars
--- @return Object
function obj:scrollbar_invalidate()
end

---Checked if the content is scrolled "in" and adjusts it to a normal position.
---@param anim_en boolean
--- @return Object
function obj:readjust_scroll(anim_en)
end

---If object is editable
---@return boolean
--- @return boolean
function obj:is_editable()
end

--- class group def
---@return boolean
--- @return boolean
function obj:is_group_def()
end

--- Test whether the and object is positioned by a layout or not
---@return boolean
--- @return boolean
function obj:is_layout_positioned()
end

--- Mark the object for layout update.
---@return nil
--- @return Object
function obj:mark_layout_as_dirty()
end

--- Align an object to the center on its parent. same as obj:set{align={type = lvgl.ALIGN.CENTER}}
---@return nil
--- @return Object
function obj:center()
end

--- Align an object to the center on its parent. same as obj:set{align={type = lvgl.ALIGN.CENTER}}
---@return nil
--- @return nil
function obj:invalidate()
end

Expand Down
Loading

0 comments on commit 4e27ee8

Please sign in to comment.