* Ids are now keyed based on the parent's id, this means that an element can have the same label when placed in different divs * Divs now enable the scissor test, this way the elements cannot draw outside of the parent div bounds * Introduced a LAYOUT_ABSOLUTE that disables all layout logic, for internal use * Divs now draw scrollbars using the slider_hor and slider_ver elements
27 lines
639 B
Plaintext
27 lines
639 B
Plaintext
module ugui;
|
|
|
|
import std::io;
|
|
|
|
fn void! Ctx.text_unbounded(&ctx, String label, String text)
|
|
{
|
|
Id id = ctx.gen_id(label)!;
|
|
|
|
Elem *parent = ctx.get_parent()!;
|
|
Elem *c_elem = ctx.get_elem(id)!;
|
|
// add it to the tree
|
|
ctx.tree.add(id, ctx.active_div)!;
|
|
|
|
// 1. Fill the element fields
|
|
// this resets the flags
|
|
c_elem.type = ETYPE_TEXT;
|
|
|
|
// if the element is new or the parent was updated then redo layout
|
|
Rect text_size = ctx.get_text_bounds(text)!;
|
|
// 2. Layout
|
|
c_elem.bounds = ctx.position_element(parent, text_size, true);
|
|
// 3. Fill the button specific fields
|
|
c_elem.text.str = text;
|
|
|
|
ctx.push_string(c_elem.bounds, text)!;
|
|
}
|