150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
-- TODO alignments
state.x=state.x + state.spacing + st.w
state.h = math.max(state.h, st.h)
end
state.h = state.h + state.padding
state.w = state.x + state.padding/2
elseif def.kind == 'pane' then
widget('scroll_container[%s,%s;%s,%s;%s;vertical]',
state.x, state.y, state.w, state.h,
def.id)
local y = 0
for _, w in ipairs(def) do
local src, st = starlit.ui.build(w, state)
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
150
151
152
153
154
155
156
157
158
159
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
|
widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
-- TODO alignments
state.x=state.x + state.spacing + st.w
state.h = math.max(state.h, st.h)
end
state.h = state.h + state.padding
state.w = state.x + state.padding/2
elseif def.kind == 'hwrap' then
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
widget('scroll_container[%s,%s;%s,%s;%s;vertical]',
state.x, state.y, state.w, state.h,
def.id)
local y = 0
for _, w in ipairs(def) do
local src, st = starlit.ui.build(w, state)
|