TUIX v0.5Beta
Viewport Widgets
v0.5 promotes scrollable and content-space widgets into first-class viewport owners. The compositor, hitmap, geometry resolver, and input router all understand viewport offsets and clipping.
ScrollContainer
ScrollContainer owns a virtual content size and offset. You can attach existing children, create children as normal proportional objects, or place children at content-space coordinates.
uid = objects.create_object(builders.SCROLL_CONTAINER, 'Main', 0.6, 0.5, 0.15, 0.2)
scroll = objects.get_object_by_uid(uid)
objects.tuix_scroll_container_set_title(scroll, 'Logs')
objects.tuix_scroll_container_set_content_size(scroll, 120, 200)
objects.tuix_scroll_container_set_offset(scroll, 0, 20)
child_uid = objects.tuix_scroll_container_add_object_at(
scroll, 'Main', builders.TEXT,
content_x=2, content_y=25, content_w=40, content_h=1,
)| Function | Purpose |
|---|---|
| tuix_scroll_container_is_viewport(obj) | Returns whether the widget acts as a viewport. |
| tuix_scroll_container_get_viewport_offset(obj) | Returns (offset_x, offset_y). |
| tuix_scroll_container_get_viewport_insets(obj) | Returns viewport insets. |
| tuix_scroll_container_set_content_size(obj, width, height) | Sets virtual content size. |
| tuix_scroll_container_set_offset(obj, offset_x, offset_y) | Sets scroll offset. |
| tuix_scroll_container_add_object_at(...) | Creates a child at content coordinates. |
Checkbox
uid = objects.create_object(builders.CHECKBOX, 'Main', 0.3, 0.06, 0.1, 0.1)
box = objects.get_object_by_uid(uid)
objects.tuix_checkbox_set_label(box, 'Enable cache')
objects.tuix_checkbox_set_checked(box, True)
if objects.tuix_checkbox_take_changed(box):
enabled = bool(objects.tuix_checkbox_get_checked(box))ListView
uid = objects.create_object(builders.LISTVIEW, 'Main', 0.4, 0.4, 0.15, 0.1)
listview = objects.get_object_by_uid(uid)
objects.tuix_listview_set_title(listview, 'Items')
objects.tuix_listview_set_items(listview, ['Alpha', 'Beta', 'Gamma'])
objects.tuix_listview_set_selected(listview, 1)
selected = objects.tuix_listview_get_selected(listview)
activated = objects.tuix_listview_take_activated(listview)TextArea
uid = objects.create_object(builders.TEXTAREA, 'Main', 0.55, 0.35, 0.5, 0.1)
area = objects.get_object_by_uid(uid)
objects.tuix_textarea_set_title(area, 'Notes')
objects.tuix_textarea_set_placeholder(area, 'Type here...')
objects.tuix_textarea_set_text(area, 'Line one
Line two')
text = objects.tuix_textarea_get_text(area)
objects.tuix_textarea_set_readonly(area, False)