2#include "nuklear_internal.h"
10nk_tooltip_begin(
struct nk_context *ctx,
float width)
19 NK_ASSERT(ctx->current);
20 NK_ASSERT(ctx->current->layout);
21 if (!ctx || !ctx->current || !ctx->current->layout)
27 if (win->popup.win && ((
int)win->popup.type & (
int)NK_PANEL_SET_NONBLOCK))
31 h = nk_iceilf(nk_null_rect.h);
32 x = nk_ifloorf(in->mouse.pos.x + 1) - (int)win->layout->clip.x;
33 y = nk_ifloorf(in->mouse.pos.y + 1) - (int)win->layout->clip.y;
40 ret = nk_popup_begin(ctx, NK_POPUP_DYNAMIC,
41 "__##Tooltip##__", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER, bounds);
43 win->popup.type = NK_PANEL_TOOLTIP;
44 ctx->current->layout->type = NK_PANEL_TOOLTIP;
52 NK_ASSERT(ctx->current);
53 if (!ctx || !ctx->current)
return;
59nk_tooltip(
struct nk_context *ctx,
const char *text)
69 NK_ASSERT(ctx->current);
70 NK_ASSERT(ctx->current->layout);
72 if (!ctx || !ctx->current || !ctx->current->layout || !text)
77 padding = style->window.padding;
80 text_len = nk_strlen(text);
81 text_width = style->font->
width(style->font->userdata,
82 style->font->
height, text, text_len);
83 text_width += (4 * padding.x);
84 text_height = (style->font->
height + 2 * padding.y);
87 if (nk_tooltip_begin(ctx, (
float)text_width)) {
89 nk_text(ctx, text, text_len, NK_TEXT_LEFT);
93#ifdef NK_INCLUDE_STANDARD_VARARGS
95nk_tooltipf(
struct nk_context *ctx,
const char *fmt, ...)
99 nk_tooltipfv(ctx, fmt, args);
103nk_tooltipfv(
struct nk_context *ctx,
const char *fmt, va_list args)
106 nk_strfmt(buf, NK_LEN(buf), fmt, args);
107 nk_tooltip(ctx, buf);
main API and documentation file
@ NK_WINDOW_ROM
sets window widgets into a read only mode and does not allow input changes
NK_API void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols)
Sets current row layout to share horizontal space between @cols number of widgets evenly.
nk_text_width_f width
!< max height of the font
float height
!< user provided font handle