| 23605 | return result; |
| 23606 | } |
| 23607 | NK_LIB void |
| 23608 | nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant *variant, |
| 23609 | float inc_per_pixel, const enum nk_property_filter filter) |
| 23610 | { |
| 23611 | struct nk_window *win; |
| 23612 | struct nk_panel *layout; |
| 23613 | struct nk_input *in; |
| 23614 | const struct nk_style *style; |
| 23615 | |
| 23616 | struct nk_rect bounds; |
| 23617 | enum nk_widget_layout_states s; |
| 23618 | |
| 23619 | int *state = 0; |
| 23620 | nk_hash hash = 0; |
| 23621 | char *buffer = 0; |
| 23622 | int *len = 0; |
| 23623 | int *cursor = 0; |
| 23624 | int *select_begin = 0; |
| 23625 | int *select_end = 0; |
| 23626 | int old_state; |
| 23627 | |
| 23628 | char dummy_buffer[NK_MAX_NUMBER_BUFFER]; |
| 23629 | int dummy_state = NK_PROPERTY_DEFAULT; |
| 23630 | int dummy_length = 0; |
| 23631 | int dummy_cursor = 0; |
| 23632 | int dummy_select_begin = 0; |
| 23633 | int dummy_select_end = 0; |
| 23634 | |
| 23635 | NK_ASSERT(ctx); |
| 23636 | NK_ASSERT(ctx->current); |
| 23637 | NK_ASSERT(ctx->current->layout); |
| 23638 | if (!ctx || !ctx->current || !ctx->current->layout) |
| 23639 | return; |
| 23640 | |
| 23641 | win = ctx->current; |
| 23642 | layout = win->layout; |
| 23643 | style = &ctx->style; |
| 23644 | s = nk_widget(&bounds, ctx); |
| 23645 | if (!s) return; |
| 23646 | |
| 23647 | /* calculate hash from name */ |
| 23648 | if (name[0] == '#') { |
| 23649 | hash = nk_murmur_hash(name, (int)nk_strlen(name), win->property.seq++); |
| 23650 | name++; /* special number hash */ |
| 23651 | } else hash = nk_murmur_hash(name, (int)nk_strlen(name), 42); |
| 23652 | |
| 23653 | /* check if property is currently hot item */ |
| 23654 | if (win->property.active && hash == win->property.name) { |
| 23655 | buffer = win->property.buffer; |
| 23656 | len = &win->property.length; |
| 23657 | cursor = &win->property.cursor; |
| 23658 | state = &win->property.state; |
| 23659 | select_begin = &win->property.select_start; |
| 23660 | select_end = &win->property.select_end; |
| 23661 | } else { |
| 23662 | buffer = dummy_buffer; |
| 23663 | len = &dummy_length; |
| 23664 | cursor = &dummy_cursor; |
no test coverage detected