Lines Matching defs:cursor

727 /// __nk_input_motion__ | Mirrors mouse cursor position
801 /// __x__ | Must hold an integer describing the current mouse cursor x-position
802 /// __y__ | Must hold an integer describing the current mouse cursor y-position
830 /// __x__ | Must contain an integer describing mouse cursor x-position on click up/down
831 /// __y__ | Must contain an integer describing mouse cursor y-position on click up/down
903 /// state to ensure the mouse cursor is not grabbed indefinitely.
4287 int cursor;
4860 /* cursor */
4931 /* cursor */
4964 /* cursor */
4990 /* cursor */
5024 /* cursor */
5388 int cursor;
5400 int cursor;
5595 /* draw buffer used for overlay drawing operation like cursor */
5951 NK_LIB nk_size nk_progress_behavior(nk_flags *state, struct nk_input *in, struct nk_rect r, struct nk_rect cursor, nk_size max, nk_size value, int modifiable);
5961 NK_LIB float nk_scrollbar_behavior(nk_flags *state, struct nk_input *in, int has_scrolling, const struct nk_rect *scroll, const struct nk_rect *cursor, const struct nk_rect *empty0, const struct nk_rect *empty1, float scroll_offset, float target, float scroll_step, enum nk_orientation o);
6014 NK_LIB void nk_do_property(nk_flags *ws, struct nk_command_buffer *out, struct nk_rect property, const char *name, struct nk_property_variant *variant, float inc_per_pixel, char *buffer, int *len, int *state, int *cursor, int *select_begin, int *select_end, const struct nk_style_property *style, enum nk_property_filter filter, struct nk_input *in, const struct nk_user_font *font, struct nk_text_edit *text_edit, enum nk_button_behavior behavior);
13796 /* initialize each cursor */
13808 struct nk_cursor *cursor = &atlas->cursors[i];
13809 cursor->img.w = (unsigned short)*width;
13810 cursor->img.h = (unsigned short)*height;
13811 cursor->img.region[0] = (unsigned short)(atlas->custom.x + nk_cursor_data[i][0].x);
13812 cursor->img.region[1] = (unsigned short)(atlas->custom.y + nk_cursor_data[i][0].y);
13813 cursor->img.region[2] = (unsigned short)nk_cursor_data[i][1].x;
13814 cursor->img.region[3] = (unsigned short)nk_cursor_data[i][1].y;
13815 cursor->size = nk_cursor_data[i][1];
13816 cursor->offset = nk_cursor_data[i][2];
14935 nk_style_load_cursor(struct nk_context *ctx, enum nk_style_cursor cursor,
14942 style->cursors[cursor] = c;
15211 /* draw cursor overlay */
15216 const struct nk_cursor *cursor = ctx->style.cursor_active;
15220 mouse_bounds.x = ctx->input.mouse.pos.x - cursor->offset.x;
15221 mouse_bounds.y = ctx->input.mouse.pos.y - cursor->offset.y;
15222 mouse_bounds.w = cursor->size.x;
15223 mouse_bounds.h = cursor->size.y;
15225 nk_draw_image(&ctx->overlay, mouse_bounds, &cursor->img, nk_white);
15859 /* update the current cursor Y-position to point over the last added widget */
18448 /* increase x-axis cursor widget position pointer */
18631 /* increase x-axis cursor widget position pointer */
20382 const struct nk_style_item *cursor;
20388 cursor = &style->cursor_hover;
20392 cursor = &style->cursor_hover;
20396 cursor = &style->cursor_normal;
20400 /* draw background and cursor */
20406 if (cursor->type == NK_STYLE_ITEM_IMAGE)
20407 nk_draw_image(out, *cursors, &cursor->data.image, nk_white);
20408 else nk_fill_rect(out, *cursors, 0, cursor->data.color);
20424 const struct nk_style_item *cursor;
20430 cursor = &style->cursor_hover;
20434 cursor = &style->cursor_hover;
20438 cursor = &style->cursor_normal;
20442 /* draw background and cursor */
20448 if (cursor->type == NK_STYLE_ITEM_IMAGE)
20449 nk_draw_image(out, *cursors, &cursor->data.image, nk_white);
20450 else nk_fill_circle(out, *cursors, cursor->data.color);
20468 struct nk_rect cursor;
20492 /* calculate the bounds of the cursor inside the selector */
20493 cursor.x = select.x + style->padding.x + style->border;
20494 cursor.y = select.y + style->padding.y + style->border;
20495 cursor.w = select.w - (2 * style->padding.x + 2 * style->border);
20496 cursor.h = select.h - (2 * style->padding.y + 2 * style->border);
20512 nk_draw_checkbox(out, *state, style, *active, &label, &select, &cursor, str, len, font);
20514 nk_draw_option(out, *state, style, *active, &label, &select, &cursor, str, len, font);
21012 /* check if visual cursor is being dragged */
21056 const struct nk_style_item *cursor;
21065 cursor = &style->cursor_active;
21069 cursor = &style->cursor_hover;
21073 cursor = &style->cursor_normal;
21099 /* draw cursor */
21100 if (cursor->type == NK_STYLE_ITEM_IMAGE)
21101 nk_draw_image(out, *visual_cursor, &cursor->data.image, nk_white);
21102 else nk_fill_circle(out, *visual_cursor, cursor->data.color);
21158 /* remove one cursor size to support visual cursor */
21170 /* calculate cursor
21172 and one for updating the actual cursor value. */
21260 struct nk_rect r, struct nk_rect cursor, nk_size max, nk_size value, int modifiable)
21269 NK_BUTTON_LEFT, cursor, nk_true);
21275 float ratio = NK_MAX(0, (float)(in->mouse.pos.x - cursor.x)) / (float)cursor.w;
21277 in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x = cursor.x + cursor.w/2.0f;
21294 const struct nk_style_item *cursor;
21302 cursor = &style->cursor_active;
21305 cursor = &style->cursor_hover;
21308 cursor = &style->cursor_normal;
21317 /* draw cursor */
21318 if (cursor->type == NK_STYLE_ITEM_COLOR) {
21319 nk_fill_rect(out, *scursor, style->rounding, cursor->data.color);
21321 } else nk_draw_image(out, *scursor, &cursor->data.image, nk_white);
21331 struct nk_rect cursor;
21337 /* calculate progressbar cursor */
21338 cursor.w = NK_MAX(bounds.w, 2 * style->padding.x + 2 * style->border);
21339 cursor.h = NK_MAX(bounds.h, 2 * style->padding.y + 2 * style->border);
21340 cursor = nk_pad_rect(bounds, nk_vec2(style->padding.x + style->border, style->padding.y + style->border));
21345 prog_value = nk_progress_behavior(state, in, bounds, cursor,max, prog_value, modifiable);
21346 cursor.w = cursor.w * prog_scale;
21350 nk_draw_progress(out, *state, style, &bounds, &cursor, value, max);
21404 const struct nk_rect *cursor, const struct nk_rect *empty0,
21420 NK_BUTTON_LEFT, *cursor, nk_true);
21426 /* update cursor by mouse dragging */
21435 in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.y = cursor_y + cursor->h/2.0f;
21442 in->mouse.buttons[NK_BUTTON_LEFT].clicked_pos.x = cursor_x + cursor->w/2.0f;
21458 /* update cursor by mouse scrolling */
21464 /* update cursor to the beginning */
21467 /* update cursor to the end */
21483 const struct nk_style_item *cursor;
21488 cursor = &style->cursor_active;
21491 cursor = &style->cursor_hover;
21494 cursor = &style->cursor_normal;
21505 /* draw cursor */
21506 if (cursor->type == NK_STYLE_ITEM_COLOR) {
21507 nk_fill_rect(out, *scroll, style->rounding_cursor, cursor->data.color);
21509 } else nk_draw_image(out, *scroll, &cursor->data.image, nk_white);
21520 struct nk_rect cursor;
21571 /* calculate scrollbar cursor bounds */
21572 cursor.h = NK_MAX((scroll_ratio * scroll.h) - (2*style->border + 2*style->padding.y), 0);
21573 cursor.y = scroll.y + (scroll_off * scroll.h) + style->border + style->padding.y;
21574 cursor.w = scroll.w - (2 * style->border + 2 * style->padding.x);
21575 cursor.x = scroll.x + style->border + style->padding.x;
21577 /* calculate empty space around cursor */
21581 empty_north.h = NK_MAX(cursor.y - scroll.y, 0);
21584 empty_south.y = cursor.y + cursor.h;
21586 empty_south.h = NK_MAX((scroll.y + scroll.h) - (cursor.y + cursor.h), 0);
21589 scroll_offset = nk_scrollbar_behavior(state, in, has_scrolling, &scroll, &cursor,
21592 cursor.y = scroll.y + (scroll_off * scroll.h) + style->border_cursor + style->padding.y;
21596 nk_draw_scrollbar(out, *state, style, &scroll, &cursor);
21607 struct nk_rect cursor;
21659 /* calculate cursor bounds */
21660 cursor.w = (scroll_ratio * scroll.w) - (2*style->border + 2*style->padding.x);
21661 cursor.x = scroll.x + (scroll_off * scroll.w) + style->border + style->padding.x;
21662 cursor.h = scroll.h - (2 * style->border + 2 * style->padding.y);
21663 cursor.y = scroll.y + style->border + style->padding.y;
21665 /* calculate empty space around cursor */
21668 empty_west.w = cursor.x - scroll.x;
21671 empty_east.x = cursor.x + cursor.w;
21673 empty_east.w = (scroll.x + scroll.w) - (cursor.x + cursor.w);
21677 scroll_offset = nk_scrollbar_behavior(state, in, has_scrolling, &scroll, &cursor,
21680 cursor.x = scroll.x + (scroll_off * scroll.w);
21684 nk_draw_scrollbar(out, *state, style, &scroll, &cursor);
21816 /* API click: on mouse down, move the cursor to the clicked location,
21818 state->cursor = nk_textedit_locate_coord(state, x, y, font, row_height);
21819 state->select_start = state->cursor;
21820 state->select_end = state->cursor;
21827 /* API drag: on mouse drag, move the cursor and selection endpoint
21831 state->select_start = state->cursor;
21832 state->cursor = state->select_end = p;
21894 /* make the selection/cursor state valid if client altered the string */
21899 /* if clamping forced them to be equal, move the cursor to match */
21901 state->cursor = state->select_start;
21903 if (state->cursor > n) state->cursor = n;
21922 state->select_end = state->cursor = state->select_start;
21926 state->select_start = state->cursor = state->select_end;
21944 /* move cursor to first character of selection */
21947 state->cursor = state->select_start;
21955 /* move cursor to last character of selection */
21959 state->cursor = state->select_end;
21978 int c = state->cursor - 1;
21991 int c = state->cursor+1;
22003 /* update selection and cursor to match each other */
22005 state->select_start = state->select_end = state->cursor;
22006 else state->cursor = state->select_end;
22035 if (nk_str_insert_text_char(&state->string, state->cursor, text, len)) {
22036 nk_textedit_makeundo_insert(state, state->cursor, glyphs);
22037 state->cursor += len;
22068 state->cursor < state->string.len)
22071 nk_textedit_makeundo_replace(state, state->cursor, 1, 1);
22072 nk_str_delete_runes(&state->string, state->cursor, 1);
22074 if (nk_str_insert_text_utf8(&state->string, state->cursor,
22077 ++state->cursor;
22082 if (nk_str_insert_text_utf8(&state->string, state->cursor,
22085 nk_textedit_makeundo_insert(state, state->cursor, 1);
22086 ++state->cursor;
22148 state->cursor = state->select_end;
22152 * move cursor to start of selection */
22155 else if (state->cursor > 0)
22156 --state->cursor;
22166 state->cursor = state->select_end;
22170 * move cursor to end of selection */
22173 else ++state->cursor;
22182 state->cursor = nk_textedit_move_to_word_previous(state);
22183 state->select_end = state->cursor;
22189 state->cursor = nk_textedit_move_to_word_previous(state);
22198 state->cursor = nk_textedit_move_to_word_next(state);
22199 state->select_end = state->cursor;
22205 state->cursor = nk_textedit_move_to_word_next(state);
22226 /* compute current position of cursor point */
22228 nk_textedit_find_charpos(&find, state, state->cursor, state->single_line,
22238 state->cursor = start;
22239 nk_textedit_layout_row(&row, state, state->cursor, row_height, font);
22247 ++state->cursor;
22254 state->select_end = state->cursor;
22274 /* compute current position of cursor point */
22276 nk_textedit_find_charpos(&find, state, state->cursor, state->single_line,
22285 state->cursor = find.prev_first;
22286 nk_textedit_layout_row(&row, state, state->cursor, row_height, font);
22294 ++state->cursor;
22300 if (sel) state->select_end = state->cursor;
22311 if (state->cursor < n)
22312 nk_textedit_delete(state, state->cursor, 1);
22324 if (state->cursor > 0) {
22325 nk_textedit_delete(state, state->cursor-1, 1);
22326 --state->cursor;
22335 state->cursor = state->select_end = 0;
22338 state->cursor = state->select_start = state->select_end = 0;
22346 state->cursor = state->select_end = state->string.len;
22349 state->cursor = state->string.len;
22360 if (state->string.len && state->cursor == state->string.len)
22361 --state->cursor;
22362 nk_textedit_find_charpos(&find, state,state->cursor, state->single_line,
22364 state->cursor = state->select_end = find.first_char;
22368 if (state->string.len && state->cursor == state->string.len)
22369 --state->cursor;
22372 nk_textedit_find_charpos(&find, state, state->cursor, state->single_line,
22374 state->cursor = find.first_char;
22384 nk_textedit_find_charpos(&find, state, state->cursor, state->single_line,
22387 state->cursor = find.first_char + find.length;
22388 if (find.length > 0 && nk_str_rune_at(&state->string, state->cursor-1) == '\n')
22389 --state->cursor;
22390 state->select_end = state->cursor;
22395 nk_textedit_find_charpos(&find, state, state->cursor, state->single_line,
22399 state->cursor = find.first_char + find.length;
22400 if (find.length > 0 && nk_str_rune_at(&state->string, state->cursor-1) == '\n')
22401 --state->cursor;
22573 state->cursor = (short)(u.where + u.insert_length);
22622 state->cursor = r.where + r.insert_length;
22663 state->cursor = 0;
22921 edit->cursor = edit->string.len;
23072 /* calculate total line count + total space + cursor/selection position */
23091 /* set cursor 2D position and line */
23092 if (!cursor_ptr && glyphs == edit->cursor)
23166 /* handle case when cursor is at end of text buffer */
23167 if (!cursor_ptr && edit->cursor == edit->string.len) {
23176 /* update scrollbar to follow cursor */
23305 /* cursor */
23308 if (edit->cursor >= nk_str_len(&edit->string) ||
23310 /* draw cursor at end of line */
23311 struct nk_rect cursor;
23312 cursor.w = style->cursor_size;
23313 cursor.h = font->height;
23314 cursor.x = area.x + cursor_pos.x - edit->scrollbar.x;
23315 cursor.y = area.y + cursor_pos.y + row_height/2.0f - cursor.h/2.0f;
23316 cursor.y -= edit->scrollbar.y;
23317 nk_fill_rect(out, cursor, 0, cursor_color);
23319 /* draw cursor inside text */
23422 edit->cursor = nk_utf_len(memory, *len);
23423 else edit->cursor = win->edit.cursor;
23425 edit->select_start = win->edit.cursor;
23426 edit->select_end = win->edit.cursor;
23446 win->edit.cursor = edit->cursor;
23487 edit->cursor = edit->string.len;
23489 edit->select_start = edit->cursor;
23490 edit->select_end = edit->cursor;
23632 int *state, int *cursor, int *select_begin, int *select_end,
23751 *cursor = nk_utf_len(buffer, *length);
23762 text_edit->cursor = NK_CLAMP(0, *cursor, *length);
23774 *cursor = text_edit->cursor;
23853 int *cursor = 0;
23887 cursor = &win->property.cursor;
23894 cursor = &dummy_cursor;
23906 variant, inc_per_pixel, buffer, len, state, cursor, select_begin,
23915 win->property.cursor = *cursor;
25491 /// - 2018/01/31 (3.00.5) - Fixed overcalculation of cursor data in font baking process.
25594 /// - 2016/09/29 (1.22.6) - Fixed edit widget UTF-8 text cursor drawing bug.
25732 /// - 2016/08/03 (1.04.0) - Added functions to show/hide software cursor.
25745 /// - 2016/07/15 (1.01.0) - Added software cursor to `nk_style` and `nk_context`.