160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
local idx, rowH, totalH = 0,0,0
local cols = def.cols or math.huge
local startX = state.x
local maxX = startX
for _, w in ipairs(def) do idx = idx + 1
local src, st = starlit.ui.build(w, state)
-- TODO alignments
rowH = math.max(rowH, st.h)
if idx > cols or (def.w and (state.x + state.spacing + st.w > def.w)) then
totalH = totalH + rowH
state.x = startX
rowH,idx = 0,0
state.y = state.y + state.spacing + st.h
end
widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
state.x=state.x + state.spacing + st.w
maxX = math.max(state.x, maxX)
end
totalH = totalH + rowH
state.h = math.max(state.h, totalH) + state.padding
state.w = state.x + state.padding/2
state.x = maxX
elseif def.kind == 'pane' then
local top = state.y
widget('scroll_container[%s,%s;%s,%s;%s;vertical]',
state.x, state.y, state.w, state.h,
|
|
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
local idx, rowH, totalH = 0,0,0
local cols = def.cols or math.huge
local startX = state.x
local maxX = startX
for _, w in ipairs(def) do idx = idx + 1
local src, st = starlit.ui.build(w, state)
-- TODO alignments
if idx > cols or (def.w and (state.x + state.spacing + st.w > def.w)) then
totalH = totalH + rowH
state.x = startX
state.y = state.y + state.spacing + rowH
rowH,idx = 0,0
end
rowH = math.max(rowH, st.h)
widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
state.x=state.x + state.spacing + st.w
maxX = math.max(state.x, maxX)
end
totalH = totalH + rowH
state.y = state.y + rowH
state.h = math.max(state.h, totalH) + state.padding
state.w = state.x + state.padding/2
state.x = maxX
elseif def.kind == 'pane' then
local top = state.y
widget('scroll_container[%s,%s;%s,%s;%s;vertical]',
state.x, state.y, state.w, state.h,
|