
// We create a box with no flags of size size, and push it to
// the hierarchy.
root_function void 
UI_spacer(UI_Size size)
{
  UI_Box *parent = UI_top_parent();
  Axis2 parent_axis = parent->child_layout_axis;
  UI_set_next_pref_size(parent_axis, size);
  UI_set_next_pref_size(Axis2_flip(parent_axis), UI_pixels(0, 0));
  UI_Box *box = UI_box_make(0, str8_lit(""));
  unused_variable(box);
}

root_function UI_Signal 
UI_button(String8 string)
{
  UI_Box *box = UI_box_make(UI_BoxFlag_DrawBorder        |
                            UI_BoxFlag_DrawBackground    |
                            UI_BoxFlag_DrawText          |
                            UI_BoxFlag_DrawHotEffects    |
                            UI_BoxFlag_DrawActiveEffects |
                            //UI_BoxFlag_DrawDropShadow    |
                            UI_BoxFlag_Clickable,
                            string);
  UI_Signal result = UI_signal_from_box(box);
  return result;            
}

root_function void
UI_named_column_begin(String8 name)
{
  UI_set_next_child_layout_axis(Axis2_Y);
  UI_Box *box = UI_box_make(0, name);
  UI_push_parent(box);
}

root_function void
UI_column_begin(void)
{
  UI_named_column_begin(str8_lit(""));
}

root_function void
UI_column_end(void)
{
  UI_pop_parent();
}

root_function void
UI_named_row_begin(String8 name)
{
  UI_set_next_child_layout_axis(Axis2_X);
  UI_Box *box = UI_box_make(0, name);
  UI_push_parent(box);
}

root_function void
UI_row_begin(void)
{
  UI_named_row_begin(str8_lit(""));
}

root_function void
UI_row_end(void)
{
  UI_pop_parent(); 
}


root_function UI_Box *
UI_pane_begin(Rng2_F32 rect, String8 string)
{
  UI_push_rect(rect);
  UI_set_next_child_layout_axis(Axis2_Y);
  
  UI_Box *box = UI_box_make(UI_BoxFlag_Clickable|UI_BoxFlag_Clip|UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground,
                            string);
  UI_pop_rect();
  UI_push_parent(box);
  UI_push_pref_width(UI_pct(1, 0));
  return box;
}

root_function void
UI_pane_end(void)
{
  UI_pop_pref_width();
  UI_pop_parent();
}