changed layout param from zr_size to int
This commit is contained in:
parent
741217af1f
commit
de384a805b
18
demo/demo.c
18
demo/demo.c
@ -13,7 +13,7 @@
|
||||
#define UNUSED(a) ((void)(a))
|
||||
|
||||
#define MAX_BUFFER 64
|
||||
#define MAX_MEMORY (32 * 1024)
|
||||
#define MAX_MEMORY (64 * 1024)
|
||||
#define MAX_COMMAND_MEMORY (16 * 1024)
|
||||
#define WINDOW_WIDTH 1200
|
||||
#define WINDOW_HEIGHT 800
|
||||
@ -160,22 +160,22 @@ set_style(struct zr_context *ctx, enum theme theme)
|
||||
ctx->style.colors[ZR_COLOR_TEXT_HOVERING] = zr_rgba(195, 195, 195, 255);
|
||||
ctx->style.colors[ZR_COLOR_TEXT_ACTIVE] = zr_rgba(200, 200, 200, 255);
|
||||
ctx->style.colors[ZR_COLOR_WINDOW] = zr_rgba(202, 212, 214, 215);
|
||||
ctx->style.colors[ZR_COLOR_HEADER] = zr_rgba(246, 246, 246, 220);
|
||||
ctx->style.colors[ZR_COLOR_HEADER] = zr_rgba(137, 182, 224, 220);
|
||||
ctx->style.colors[ZR_COLOR_BORDER] = zr_rgba(140, 159, 173, 255);
|
||||
ctx->style.colors[ZR_COLOR_BUTTON] = zr_rgba(137, 182, 224, 255);
|
||||
ctx->style.colors[ZR_COLOR_BUTTON_HOVER] = zr_rgba(142, 187, 229, 255);
|
||||
ctx->style.colors[ZR_COLOR_BUTTON_ACTIVE] = zr_rgba(147, 192, 234, 255);
|
||||
ctx->style.colors[ZR_COLOR_TOGGLE] = zr_rgba(210, 210, 210, 255);
|
||||
ctx->style.colors[ZR_COLOR_TOGGLE] = zr_rgba(177, 210, 210, 255);
|
||||
ctx->style.colors[ZR_COLOR_TOGGLE_HOVER] = zr_rgba(245, 245, 245, 255);
|
||||
ctx->style.colors[ZR_COLOR_TOGGLE_CURSOR] = zr_rgba(142, 187, 229, 255);
|
||||
ctx->style.colors[ZR_COLOR_SELECTABLE] = zr_rgba(147, 192, 234, 255);
|
||||
ctx->style.colors[ZR_COLOR_SELECTABLE_HOVER] = zr_rgba(150, 150, 150, 255);
|
||||
ctx->style.colors[ZR_COLOR_SELECTABLE_TEXT] = zr_rgba(70, 70, 70, 255);
|
||||
ctx->style.colors[ZR_COLOR_SLIDER] = zr_rgba(210, 210, 210, 255);
|
||||
ctx->style.colors[ZR_COLOR_SLIDER] = zr_rgba(177, 210, 210, 255);
|
||||
ctx->style.colors[ZR_COLOR_SLIDER_CURSOR] = zr_rgba(137, 182, 224, 245);
|
||||
ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_HOVER] = zr_rgba(142, 188, 229, 255);
|
||||
ctx->style.colors[ZR_COLOR_SLIDER_CURSOR_ACTIVE] = zr_rgba(147, 193, 234, 255);
|
||||
ctx->style.colors[ZR_COLOR_PROGRESS] = zr_rgba(210, 210, 210, 255);
|
||||
ctx->style.colors[ZR_COLOR_PROGRESS] = zr_rgba(177, 210, 210, 255);
|
||||
ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR] = zr_rgba(137, 182, 224, 255);
|
||||
ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_HOVER] = zr_rgba(142, 188, 229, 255);
|
||||
ctx->style.colors[ZR_COLOR_PROGRESS_CURSOR_ACTIVE] = zr_rgba(147, 193, 234, 255);
|
||||
@ -260,7 +260,7 @@ control_window(struct zr_context *ctx, struct demo *gui)
|
||||
ZR_WINDOW_SCALABLE|ZR_WINDOW_BORDER))
|
||||
{
|
||||
/* Style */
|
||||
if (zr_layout_push(ctx, ZR_LAYOUT_NODE, "Metrics", ZR_MINIMIZED)) {
|
||||
if (zr_layout_push(ctx, ZR_LAYOUT_TAB, "Metrics", ZR_MINIMIZED)) {
|
||||
zr_layout_row_dynamic(ctx, 20, 2);
|
||||
zr_label(ctx,"Total:", ZR_TEXT_LEFT);
|
||||
zr_labelf(ctx, ZR_TEXT_LEFT, "%lu", gui->status.size);
|
||||
@ -272,7 +272,7 @@ control_window(struct zr_context *ctx, struct demo *gui)
|
||||
zr_labelf(ctx, ZR_TEXT_LEFT, "%lu", gui->status.calls);
|
||||
zr_layout_pop(ctx);
|
||||
}
|
||||
if (zr_layout_push(ctx, ZR_LAYOUT_NODE, "Properties", ZR_MINIMIZED)) {
|
||||
if (zr_layout_push(ctx, ZR_LAYOUT_TAB, "Properties", ZR_MINIMIZED)) {
|
||||
zr_layout_row_dynamic(ctx, 22, 3);
|
||||
for (i = 0; i <= ZR_PROPERTY_SCROLLBAR_SIZE; ++i) {
|
||||
zr_label(ctx, zr_get_property_name((enum zr_style_properties)i), ZR_TEXT_LEFT);
|
||||
@ -281,7 +281,7 @@ control_window(struct zr_context *ctx, struct demo *gui)
|
||||
}
|
||||
zr_layout_pop(ctx);
|
||||
}
|
||||
if (zr_layout_push(ctx, ZR_LAYOUT_NODE, "Rounding", ZR_MINIMIZED)) {
|
||||
if (zr_layout_push(ctx, ZR_LAYOUT_TAB, "Rounding", ZR_MINIMIZED)) {
|
||||
zr_layout_row_dynamic(ctx, 22, 2);
|
||||
for (i = 0; i < ZR_ROUNDING_MAX; ++i) {
|
||||
zr_label(ctx, zr_get_rounding_name((enum zr_style_rounding)i), ZR_TEXT_LEFT);
|
||||
@ -289,7 +289,7 @@ control_window(struct zr_context *ctx, struct demo *gui)
|
||||
}
|
||||
zr_layout_pop(ctx);
|
||||
}
|
||||
if (zr_layout_push(ctx, ZR_LAYOUT_NODE, "Color", ZR_MINIMIZED))
|
||||
if (zr_layout_push(ctx, ZR_LAYOUT_TAB, "Color", ZR_MINIMIZED))
|
||||
{
|
||||
struct zr_panel tab, combo;
|
||||
enum theme old = gui->theme;
|
||||
|
@ -132,7 +132,7 @@ node_editor_demo(struct zr_context *ctx, struct node_editor *nodedit)
|
||||
/* allocate complete window space */
|
||||
canvas = zr_window_get_canvas(ctx);
|
||||
total_space = zr_window_get_content_region(ctx);
|
||||
zr_layout_space_begin(ctx, ZR_STATIC, total_space.h, (zr_size)nodedit->node_count);
|
||||
zr_layout_space_begin(ctx, ZR_STATIC, total_space.h, nodedit->node_count);
|
||||
{
|
||||
struct zr_panel node, menu;
|
||||
struct node *it = nodedit->begin;
|
||||
|
@ -649,7 +649,7 @@ demo_window(struct zr_context *ctx)
|
||||
zr_property_int(ctx, "#Height:", 100, &group_height, 500, 10, 1);
|
||||
zr_layout_row_end(ctx);
|
||||
|
||||
zr_layout_row_static(ctx, (float)group_height, (size_t)group_width, 2);
|
||||
zr_layout_row_static(ctx, (float)group_height, group_width, 2);
|
||||
if (zr_group_begin(ctx, &tab, "Group", group_flags)) {
|
||||
int i = 0;
|
||||
static int selected[16];
|
||||
|
28
zahnrad.c
28
zahnrad.c
@ -8109,7 +8109,7 @@ zr_menubar_end(struct zr_context *ctx)
|
||||
* --------------------------------------------------------------*/
|
||||
static void
|
||||
zr_panel_layout(const struct zr_context *ctx, struct zr_window *win,
|
||||
float height, zr_size cols)
|
||||
float height, int cols)
|
||||
{
|
||||
const struct zr_style *config;
|
||||
const struct zr_color *color;
|
||||
@ -8145,7 +8145,7 @@ zr_panel_layout(const struct zr_context *ctx, struct zr_window *win,
|
||||
|
||||
static void
|
||||
zr_row_layout(struct zr_context *ctx, enum zr_layout_format fmt,
|
||||
float height, zr_size cols, zr_size width)
|
||||
float height, int cols, int width)
|
||||
{
|
||||
/* update the current row and set the current row layout */
|
||||
struct zr_window *win;
|
||||
@ -8168,17 +8168,17 @@ zr_row_layout(struct zr_context *ctx, enum zr_layout_format fmt,
|
||||
}
|
||||
|
||||
void
|
||||
zr_layout_row_dynamic(struct zr_context *ctx, float height, zr_size cols)
|
||||
zr_layout_row_dynamic(struct zr_context *ctx, float height, int cols)
|
||||
{zr_row_layout(ctx, ZR_DYNAMIC, height, cols, 0);}
|
||||
|
||||
void
|
||||
zr_layout_row_static(struct zr_context *ctx, float height,
|
||||
zr_size item_width, zr_size cols)
|
||||
int item_width, int cols)
|
||||
{zr_row_layout(ctx, ZR_STATIC, height, cols, item_width);}
|
||||
|
||||
void
|
||||
zr_layout_row_begin(struct zr_context *ctx,
|
||||
enum zr_layout_format fmt, float row_height, zr_size cols)
|
||||
enum zr_layout_format fmt, float row_height, int cols)
|
||||
{
|
||||
struct zr_window *win;
|
||||
struct zr_panel *layout;
|
||||
@ -8248,10 +8248,10 @@ zr_layout_row_end(struct zr_context *ctx)
|
||||
|
||||
void
|
||||
zr_layout_row(struct zr_context *ctx, enum zr_layout_format fmt,
|
||||
float height, zr_size cols, const float *ratio)
|
||||
float height, int cols, const float *ratio)
|
||||
{
|
||||
zr_size i;
|
||||
zr_size n_undef = 0;
|
||||
int i;
|
||||
int n_undef = 0;
|
||||
struct zr_window *win;
|
||||
struct zr_panel *layout;
|
||||
|
||||
@ -8287,8 +8287,8 @@ zr_layout_row(struct zr_context *ctx, enum zr_layout_format fmt,
|
||||
}
|
||||
|
||||
void
|
||||
zr_layout_space_begin(struct zr_context *ctx,
|
||||
enum zr_layout_format fmt, float height, zr_size widget_count)
|
||||
zr_layout_space_begin(struct zr_context *ctx, enum zr_layout_format fmt,
|
||||
float height, int widget_count)
|
||||
{
|
||||
struct zr_window *win;
|
||||
struct zr_panel *layout;
|
||||
@ -8597,7 +8597,7 @@ void
|
||||
zr_layout_peek(struct zr_rect *bounds, struct zr_context *ctx)
|
||||
{
|
||||
float y;
|
||||
zr_size index;
|
||||
int index;
|
||||
struct zr_window *win;
|
||||
struct zr_panel *layout;
|
||||
|
||||
@ -8769,9 +8769,9 @@ zr_layout_pop(struct zr_context *ctx)
|
||||
*
|
||||
* --------------------------------------------------------------*/
|
||||
void
|
||||
zr_spacing(struct zr_context *ctx, zr_size cols)
|
||||
zr_spacing(struct zr_context *ctx, int cols)
|
||||
{
|
||||
zr_size i, index, rows;
|
||||
int i, index, rows;
|
||||
struct zr_rect nil;
|
||||
struct zr_window *win;
|
||||
struct zr_panel *layout;
|
||||
@ -9797,7 +9797,7 @@ zr_propertyi(struct zr_context *ctx, const char *name, int min, int val, int max
|
||||
* --------------------------------------------------------------*/
|
||||
void
|
||||
zr_chart_begin(struct zr_context *ctx, enum zr_chart_type type,
|
||||
zr_size count, float min_value, float max_value)
|
||||
int count, float min_value, float max_value)
|
||||
{
|
||||
struct zr_rect bounds = {0, 0, 0, 0};
|
||||
struct zr_vec2 item_padding;
|
||||
|
63
zahnrad.h
63
zahnrad.h
@ -1139,9 +1139,9 @@ struct zr_chart {
|
||||
/* min and max value for correct scaling of values */
|
||||
struct zr_vec2 last;
|
||||
/* last line chart point to connect to. Only used by the line chart */
|
||||
zr_size index;
|
||||
int index;
|
||||
/* current chart value index*/
|
||||
zr_size count;
|
||||
int count;
|
||||
/* number of values inside the chart */
|
||||
};
|
||||
|
||||
@ -1167,11 +1167,11 @@ enum zr_row_layout_type {
|
||||
struct zr_row_layout {
|
||||
enum zr_row_layout_type type;
|
||||
/* type of the row layout */
|
||||
zr_size index;
|
||||
int index;
|
||||
/* index of the current widget in the current window row */
|
||||
float height;
|
||||
/* height of the current row */
|
||||
zr_size columns;
|
||||
int columns;
|
||||
/* number of columns in the current row */
|
||||
const float *ratio;
|
||||
/* row widget width ratio */
|
||||
@ -1370,10 +1370,10 @@ int zr_window_is_active(struct zr_context*, const char *name);
|
||||
void zr_window_set_bounds(struct zr_context*, struct zr_rect);
|
||||
void zr_window_set_position(struct zr_context*, struct zr_vec2);
|
||||
void zr_window_set_size(struct zr_context*, struct zr_vec2);
|
||||
void zr_window_set_focus(struct zr_context *ctx, const char *name);
|
||||
void zr_window_collapse(struct zr_context *ctx, const char *name,
|
||||
void zr_window_set_focus(struct zr_context*, const char *name);
|
||||
void zr_window_collapse(struct zr_context*, const char *name,
|
||||
enum zr_collapse_states);
|
||||
void zr_window_collapse_if(struct zr_context *ctx, const char *name,
|
||||
void zr_window_collapse_if(struct zr_context*, const char *name,
|
||||
enum zr_collapse_states, int cond);
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
@ -1461,21 +1461,20 @@ void zr_reset(struct zr_context*);
|
||||
void zr_layout_peek(struct zr_rect *bounds, struct zr_context*);
|
||||
|
||||
/* columns based layouting with generated position and width and fixed height*/
|
||||
void zr_layout_row_dynamic(struct zr_context*, float height, zr_size cols);
|
||||
void zr_layout_row_static(struct zr_context*, float height, zr_size item_width,
|
||||
zr_size cols);
|
||||
void zr_layout_row_dynamic(struct zr_context*, float height, int cols);
|
||||
void zr_layout_row_static(struct zr_context*, float height, int item_width, int cols);
|
||||
|
||||
/* widget layouting with custom widget width and fixed height */
|
||||
void zr_layout_row_begin(struct zr_context*, enum zr_layout_format,
|
||||
float row_height, zr_size cols);
|
||||
float row_height, int cols);
|
||||
void zr_layout_row_push(struct zr_context*, float value);
|
||||
void zr_layout_row_end(struct zr_context*);
|
||||
void zr_layout_row(struct zr_context*, enum zr_layout_format, float height,
|
||||
zr_size cols, const float *ratio);
|
||||
int cols, const float *ratio);
|
||||
|
||||
/* layouting with custom position and size of widgets */
|
||||
void zr_layout_space_begin(struct zr_context*, enum zr_layout_format,
|
||||
float height, zr_size widget_count);
|
||||
float height, int widget_count);
|
||||
void zr_layout_space_push(struct zr_context*, struct zr_rect);
|
||||
void zr_layout_space_end(struct zr_context*);
|
||||
|
||||
@ -1487,7 +1486,7 @@ struct zr_rect zr_layout_space_rect_to_local(struct zr_context*, struct zr_rect)
|
||||
|
||||
/* group layout */
|
||||
int zr_group_begin(struct zr_context*, struct zr_panel*, const char *title, zr_flags);
|
||||
void zr_group_end(struct zr_context *ctx);
|
||||
void zr_group_end(struct zr_context*);
|
||||
|
||||
/* tree layout */
|
||||
int zr_layout_push(struct zr_context*, enum zr_layout_node_type, const char *title,
|
||||
@ -1499,7 +1498,7 @@ void zr_layout_pop(struct zr_context*);
|
||||
* -------------------------------------------------------------*/
|
||||
enum zr_widget_state zr_widget(struct zr_rect*, const struct zr_context*);
|
||||
enum zr_widget_state zr_widget_fitting(struct zr_rect*, struct zr_context*);
|
||||
void zr_spacing(struct zr_context*, zr_size cols);
|
||||
void zr_spacing(struct zr_context*, int cols);
|
||||
void zr_seperator(struct zr_context*);
|
||||
|
||||
/* content output widgets */
|
||||
@ -1531,7 +1530,7 @@ int zr_button_image(struct zr_context*, struct zr_image img, enum zr_button_beha
|
||||
int zr_button_text_symbol(struct zr_context*, enum zr_symbol_type, const char*,
|
||||
enum zr_text_align, enum zr_button_behavior);
|
||||
int zr_button_text_image(struct zr_context*, struct zr_image img, const char*,
|
||||
enum zr_text_align align, enum zr_button_behavior);
|
||||
enum zr_text_align, enum zr_button_behavior);
|
||||
|
||||
/* simple value modifier by sliding */
|
||||
void zr_progress(struct zr_context*, zr_size *cur, zr_size max, int modifyable);
|
||||
@ -1557,8 +1556,7 @@ zr_flags zr_edit_string(struct zr_context*, zr_flags, char *buffer, zr_size *len
|
||||
zr_flags zr_edit_buffer(struct zr_context*, zr_flags, struct zr_buffer*, zr_filter);
|
||||
|
||||
/* simple chart */
|
||||
void zr_chart_begin(struct zr_context*, enum zr_chart_type, zr_size num,
|
||||
float min, float max);
|
||||
void zr_chart_begin(struct zr_context*, enum zr_chart_type, int num, float min, float max);
|
||||
zr_flags zr_chart_push(struct zr_context*, float);
|
||||
void zr_chart_end(struct zr_context*);
|
||||
|
||||
@ -1566,7 +1564,7 @@ void zr_chart_end(struct zr_context*);
|
||||
* Popups
|
||||
* -------------------------------------------------------------*/
|
||||
int zr_popup_begin(struct zr_context*, struct zr_panel*, enum zr_popup_type,
|
||||
const char *title, zr_flags, struct zr_rect bounds);
|
||||
const char*, zr_flags, struct zr_rect bounds);
|
||||
void zr_popup_close(struct zr_context*);
|
||||
void zr_popup_end(struct zr_context*);
|
||||
|
||||
@ -1578,19 +1576,19 @@ int zr_combo_begin_color(struct zr_context*, struct zr_panel*,
|
||||
int zr_combo_begin_image(struct zr_context*, struct zr_panel*,
|
||||
struct zr_image img, int max_height);
|
||||
int zr_combo_begin_icon(struct zr_context*, struct zr_panel*,
|
||||
const char *selected, struct zr_image img, int height);
|
||||
const char *selected, struct zr_image, int height);
|
||||
int zr_combo_item(struct zr_context*, const char*, enum zr_text_align);
|
||||
int zr_combo_item_icon(struct zr_context*, struct zr_image, const char*,
|
||||
enum zr_text_align align);
|
||||
int zr_combo_item_symbol(struct zr_context*, enum zr_symbol_type symbol,
|
||||
const char*, enum zr_text_align align);
|
||||
enum zr_text_align);
|
||||
int zr_combo_item_symbol(struct zr_context*, enum zr_symbol_type,
|
||||
const char*, enum zr_text_align);
|
||||
void zr_combo_close(struct zr_context*);
|
||||
void zr_combo_end(struct zr_context*);
|
||||
|
||||
/* contextual menu */
|
||||
int zr_contextual_begin(struct zr_context*, struct zr_panel*, zr_flags flags,
|
||||
struct zr_vec2 size, struct zr_rect trigger_bounds);
|
||||
int zr_contextual_item(struct zr_context*, const char*, enum zr_text_align align);
|
||||
int zr_contextual_begin(struct zr_context*, struct zr_panel*, zr_flags,
|
||||
struct zr_vec2, struct zr_rect trigger_bounds);
|
||||
int zr_contextual_item(struct zr_context*, const char*, enum zr_text_align);
|
||||
int zr_contextual_item_icon(struct zr_context*, struct zr_image,
|
||||
const char*, enum zr_text_align);
|
||||
int zr_contextual_item_symbol(struct zr_context*, enum zr_symbol_type,
|
||||
@ -1599,7 +1597,7 @@ void zr_contextual_close(struct zr_context*);
|
||||
void zr_contextual_end(struct zr_context*);
|
||||
|
||||
/* tooltip */
|
||||
void zr_tooltip(struct zr_context*, const char *text);
|
||||
void zr_tooltip(struct zr_context*, const char*);
|
||||
int zr_tooltip_begin(struct zr_context*, struct zr_panel*, float width);
|
||||
void zr_tooltip_end(struct zr_context*);
|
||||
|
||||
@ -1609,16 +1607,15 @@ void zr_tooltip_end(struct zr_context*);
|
||||
void zr_menubar_begin(struct zr_context*);
|
||||
void zr_menubar_end(struct zr_context*);
|
||||
|
||||
int zr_menu_text_begin(struct zr_context*, struct zr_panel*,
|
||||
const char *title, float width);
|
||||
int zr_menu_icon_begin(struct zr_context*, struct zr_panel*, const char *id,
|
||||
int zr_menu_text_begin(struct zr_context*, struct zr_panel*, const char*, float width);
|
||||
int zr_menu_icon_begin(struct zr_context*, struct zr_panel*, const char*,
|
||||
struct zr_image, float width);
|
||||
int zr_menu_symbol_begin(struct zr_context*, struct zr_panel*, const char *id,
|
||||
int zr_menu_symbol_begin(struct zr_context*, struct zr_panel*, const char*,
|
||||
enum zr_symbol_type, float width);
|
||||
int zr_menu_item(struct zr_context*, enum zr_text_align align, const char *id);
|
||||
int zr_menu_item(struct zr_context*, enum zr_text_align align, const char*);
|
||||
int zr_menu_item_icon(struct zr_context*, struct zr_image, const char*,
|
||||
enum zr_text_align);
|
||||
int zr_menu_item_symbol(struct zr_context*, enum zr_symbol_type, const char *id,
|
||||
int zr_menu_item_symbol(struct zr_context*, enum zr_symbol_type, const char*,
|
||||
enum zr_text_align);
|
||||
void zr_menu_close(struct zr_context*);
|
||||
void zr_menu_end(struct zr_context*);
|
||||
|
Loading…
x
Reference in New Issue
Block a user