Progress on setting up app's UI and horizontal/vertical box widgets
This commit is contained in:
25
code/ui.odin
25
code/ui.odin
@ -179,10 +179,18 @@ UI_StyleFlag :: enum u32 {
|
||||
Clamp_Position_Y,
|
||||
|
||||
// Enroces the widget will maintain its size reguardless of any constraints
|
||||
// Will override parent constraints
|
||||
// Will override parent constraints (use the size.min.xy to specify the width & height)
|
||||
Fixed_Width,
|
||||
Fixed_Height,
|
||||
|
||||
// TODO(Ed): Implement this!
|
||||
// Enforces the widget will have a width specified as a ratio of its height (use the size.min/max.x to specify the scalar)
|
||||
// If you wish for the width to stay fixed couple with the Fixed_Width flag
|
||||
Scale_Width_By_Height_Ratio,
|
||||
// Enforces the widget will have a height specified as a ratio of its width (use the size.min/max.y to specify the scalar)
|
||||
// If you wish for the height to stay fixed couple with the Fixed_Height flag
|
||||
Scale_Height_By_Width_Ratio,
|
||||
|
||||
// Sets the (0, 0) position of the child box to the parents anchor's center (post-margins bounds)
|
||||
// By Default, the origin is at the top left of the anchor's bounds
|
||||
Origin_At_Anchor_Center,
|
||||
@ -244,8 +252,8 @@ UI_Box :: struct {
|
||||
// Cache ID
|
||||
key : UI_Key,
|
||||
// label : string,
|
||||
label : StringCached,
|
||||
text : StringCached,
|
||||
label : StrRunesPair,
|
||||
text : StrRunesPair,
|
||||
|
||||
// Regenerated per frame.
|
||||
using links : DLL_NodeFull( UI_Box ), // first, last, prev, next
|
||||
@ -574,3 +582,14 @@ ui_style_theme_set_layout :: proc ( layout : UI_Layout ) {
|
||||
preset.layout = layout
|
||||
}
|
||||
}
|
||||
|
||||
ui_style_theme_layout_push :: proc ( layout : UI_Layout ) {
|
||||
ui := get_state().ui_context
|
||||
ui_style_theme_push( stack_peek( & ui.theme_stack) )
|
||||
ui_style_theme_set_layout(layout)
|
||||
}
|
||||
|
||||
@(deferred_none = ui_style_theme_pop)
|
||||
ui_style_theme_layout :: proc( layout : UI_Layout ) {
|
||||
ui_style_theme_layout_push(layout)
|
||||
}
|
||||
|
Reference in New Issue
Block a user