fixed static tiled widget layout
This commit is contained in:
parent
8d1607a747
commit
c3a389813e
13
zahnrad.c
13
zahnrad.c
|
@ -4686,6 +4686,7 @@ zr_tiled_begin_local(struct zr_tiled_layout *layout, enum zr_layout_format fmt,
|
|||
layout->fmt = fmt;
|
||||
layout->bounds.w = width;
|
||||
layout->bounds.h = height;
|
||||
layout->spacing = zr_vec2(0,0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5207,7 +5208,7 @@ zr_end(struct zr_context *layout, struct zr_window *window)
|
|||
|
||||
scroll_offset = layout->offset.x;
|
||||
scroll_step = layout->max_x * 0.05f;
|
||||
scroll_target = (layout->max_x - layout->at_x) - 2 * window_padding.x;
|
||||
scroll_target = (layout->max_x - bounds.x) - window_padding.x;
|
||||
scroll.has_scrolling = zr_false;
|
||||
window->offset.x = zr_widget_scrollbarh(out, bounds, scroll_offset,
|
||||
scroll_target, scroll_step, &scroll, in);
|
||||
|
@ -5967,7 +5968,7 @@ zr_layout_row_tiled_begin(struct zr_context *layout,
|
|||
|
||||
config = layout->style;
|
||||
padding = config->properties[ZR_PROPERTY_PADDING];
|
||||
padding = config->properties[ZR_PROPERTY_ITEM_SPACING];
|
||||
spacing = config->properties[ZR_PROPERTY_ITEM_SPACING];
|
||||
tiled->spacing = spacing;
|
||||
tiled->bounds.x = layout->at_x + padding.x - layout->offset.x;
|
||||
tiled->bounds.y = layout->at_y - layout->offset.y;
|
||||
|
@ -6063,8 +6064,8 @@ zr_panel_alloc_space(struct zr_rect *bounds, struct zr_context *layout)
|
|||
bounds->w = layout->row.item.w;
|
||||
bounds->h = layout->row.item.h;
|
||||
layout->row.index = 0;
|
||||
if ((bounds->x + bounds->w) > layout->max_x)
|
||||
layout->max_x = bounds->x + bounds->w;
|
||||
if ((bounds->x + bounds->w + layout->offset.x) > layout->max_x)
|
||||
layout->max_x = bounds->x + bounds->w + layout->offset.x;
|
||||
return;
|
||||
} break;
|
||||
case ZR_LAYOUT_DYNAMIC_FREE: {
|
||||
|
@ -6114,8 +6115,8 @@ zr_panel_alloc_space(struct zr_rect *bounds, struct zr_context *layout)
|
|||
bounds->y -= layout->offset.y;
|
||||
bounds->w = layout->row.item.w;
|
||||
bounds->h = layout->row.item.h;
|
||||
if ((bounds->x + bounds->w) > layout->max_x)
|
||||
layout->max_x = bounds->x + bounds->w;
|
||||
if ((bounds->x + bounds->w + layout->offset.x) > layout->max_x)
|
||||
layout->max_x = bounds->x + bounds->w + layout->offset.x;
|
||||
return;
|
||||
} break;
|
||||
case ZR_LAYOUT_STATIC: {
|
||||
|
|
30
zahnrad.h
30
zahnrad.h
|
@ -362,8 +362,8 @@ zr_bool zr_input_is_key_down(const struct zr_input*, enum zr_keys);
|
|||
*/
|
||||
/* BUFFER
|
||||
----------------------------
|
||||
A basic (double)-buffer API with linear allocation and resetting as only freeing.
|
||||
The buffer main purpose is to control all memory management inside
|
||||
A basic (double)-buffer API with linear allocation and resetting as only
|
||||
freeing policy. The buffers main purpose is to control all memory management inside
|
||||
the GUI toolkit and still leave memory control as much as possible in the hand
|
||||
of the user. The memory is provided in three different ways.
|
||||
The first way is to use a fixed size block of memory to be filled up.
|
||||
|
@ -387,7 +387,7 @@ zr_bool zr_input_is_key_down(const struct zr_input*, enum zr_keys);
|
|||
initialization function and provide a memory block in the first case and
|
||||
an allocator in the second case.
|
||||
To allocate memory from the buffer you would call zr_buffer_alloc with a request
|
||||
memory block size aswell as an alignment for the block. Finally to reset the memory
|
||||
memory block size as well as an alignment for the block. Finally to reset the memory
|
||||
at the end of the frame and when the memory buffer inside the buffer is no longer
|
||||
needed you would call zr_buffer_reset. To free all memory that has been allocated
|
||||
by an allocator if the buffer is no longer being used you have to call
|
||||
|
@ -1300,7 +1300,7 @@ void zr_draw_list_path_stroke(struct zr_draw_list*, struct zr_color,
|
|||
and is not possible for the optional vertex buffer output.
|
||||
|
||||
The second way of font handling is by using the same `zr_user_font` struct
|
||||
to reference a font as before but providing a second callback for
|
||||
to referencing a font as before but providing a second callback for
|
||||
`zr_user_font_glyph` querying which is used for text drawing in the optional vertex
|
||||
buffer output. In addition to the callback it is also required to provide
|
||||
a texture atlas from the font to draw.
|
||||
|
@ -3054,6 +3054,13 @@ void zr_menubar_end(struct zr_context*);
|
|||
zr_layout_row_push -- pushes the next widget width
|
||||
zr_layout_row_end -- ends the row build up process
|
||||
|
||||
tiled widget placing layout API
|
||||
zr_layout_row_tiled_begin -- begins tiled layout based placing of widgets
|
||||
zr_layout_row_tiled_slot_bounds -- returns the bounds of a slot in the tiled layout
|
||||
zr_layout_row_tiled_bounds -- returns the bounds of a widget in the tiled layout
|
||||
zr_layout_row_tiled_push -- pushes a widget into a slot in the tiled layout
|
||||
zr_layout_row_tiled_end -- ends tiled layout based placing of widgets
|
||||
|
||||
custom widget placing layout API
|
||||
zr_layout_row_space_begin -- creates a free placing space in the window
|
||||
zr_layout_row_space_push -- pushes a widget into the space
|
||||
|
@ -3064,13 +3071,6 @@ void zr_menubar_end(struct zr_context*);
|
|||
zr_layout_row_space_rect_to_screen -- converts rect from local space to screen
|
||||
zr_layout_row_space_rect_to_local -- converts rect from screen to local space
|
||||
|
||||
tiled widget placing layout API
|
||||
zr_layout_row_tiled_begin -- begins tiled layout based placing of widgets
|
||||
zr_layout_row_tiled_slot_bounds -- returns the bounds of a slot in the tiled layout
|
||||
zr_layout_row_tiled_bounds -- returns the bounds of a widget in the tiled layout
|
||||
zr_layout_row_tiled_push -- pushes a widget into a slot in the tiled layout
|
||||
zr_layout_row_tiled_end -- ends tiled layout based placing of widgets
|
||||
|
||||
window tree layout function API
|
||||
zr_layout_push -- pushes a new node/collapseable header/tab
|
||||
zr_layout_pop -- pops the the previously added node
|
||||
|
@ -3171,9 +3171,6 @@ struct zr_rect zr_layout_row_space_rect_to_local(struct zr_context*, struct zr_r
|
|||
*/
|
||||
void zr_layout_row_space_end(struct zr_context*);
|
||||
/* this functions finishes the scaleable space filling process */
|
||||
|
||||
|
||||
|
||||
void zr_layout_row_tiled_begin(struct zr_context*, struct zr_tiled_layout*);
|
||||
/* this functions begins the tiled layout
|
||||
Input:
|
||||
|
@ -3188,10 +3185,6 @@ void zr_layout_row_tiled_push(struct zr_context*, struct zr_tiled_layout*,
|
|||
*/
|
||||
void zr_layout_row_tiled_end(struct zr_context*);
|
||||
/* this functions ends the tiled layout */
|
||||
|
||||
|
||||
|
||||
|
||||
zr_bool zr_layout_push(struct zr_context*, enum zr_layout_node_type,
|
||||
const char *title, zr_state*);
|
||||
/* this functions pushes either a tree node or collapseable header into
|
||||
|
@ -3241,7 +3234,6 @@ void zr_layout_pop(struct zr_context*);
|
|||
zr_button_text_image -- button widget with text and icon
|
||||
zr_button_text_symbol -- button widget with text and a triangle
|
||||
zr_button_fitting -- button widget without border and fitting space
|
||||
zr_button_toggle_fitting -- toggle widget without border and fitting space
|
||||
zr_image -- image widget for outputing a image to a window
|
||||
zr_check -- add a checkbox widget
|
||||
zr_option -- radiobutton widget
|
||||
|
|
Loading…
Reference in New Issue