Lines Matching defs:layout
2004 /// To actually define a layout you just call the appropriate layouting function
2006 /// here is that if you define more widgets then columns defined inside the layout
2096 /// pushed before calling a widget. Therefore the layout is not automatically
2169 /// The row template layout has three different per widget size specifier. The first
2193 /// // second row same layout
2203 /// window. The space layout API is an immediate mode API which does not support
2235 /// nk_layout_widget_bounds | Calculates current width a static layout row can fit inside a window
2238 /// nk_layout_row_dynamic | Current layout is divided into n same sized growing columns
2239 /// nk_layout_row_static | Current layout is divided into n same fixed sized columns
2316 /// Sets current row layout to share horizontal space
2318 /// calls greater than @cols will allocate a new row with same layout.
2331 /// Sets current row layout to fill @cols number of widgets
2333 /// calls greater than @cols will allocate a new row with same layout.
2483 /// Marks the end of the layout space
2515 /// __vec__ | Position to convert from layout space into screen coordinate space
2521 /// Converts vector from layout space into screen space
2529 /// __vec__ | Position to convert from screen space into layout coordinate space
2531 /// Returns transformed `nk_vec2` in layout space coordinates
2535 /// Converts rectangle from screen space into layout space
2543 /// __bounds__ | Rectangle to convert from layout space into screen space
2549 /// Converts rectangle from layout space into screen space
2557 /// __bounds__ | Rectangle to convert from layout space into screen space
2559 /// Returns transformed `nk_rect` in layout space coordinates
2569 /// in a window to layout widgets as a group. Almost all more complex widget
5418 struct nk_panel *layout;
5904 /* layout */
9491 default: NK_ASSERT(0 && "Invalid vertex layout color format"); break;
9561 default: NK_ASSERT(0 && "invalid vertex layout format"); break;
15611 struct nk_panel *layout;
15621 NK_ASSERT(ctx->current->layout);
15622 if (!ctx || !ctx->current || !ctx->current->layout) return 0;
15623 nk_zero(ctx->current->layout, sizeof(*ctx->current->layout));
15625 nk_zero(ctx->current->layout, sizeof(struct nk_panel));
15626 ctx->current->layout->type = panel_type;
15633 layout = win->layout;
15674 layout->type = panel_type;
15675 layout->flags = win->flags;
15676 layout->bounds = win->bounds;
15677 layout->bounds.x += panel_padding.x;
15678 layout->bounds.w -= 2*panel_padding.x;
15680 layout->border = nk_panel_get_border(style, win->flags, panel_type);
15681 layout->bounds = nk_shrink_rect(layout->bounds, layout->border);
15682 } else layout->border = 0;
15683 layout->at_y = layout->bounds.y;
15684 layout->at_x = layout->bounds.x;
15685 layout->max_x = 0;
15686 layout->header_height = 0;
15687 layout->footer_height = 0;
15689 layout->row.index = 0;
15690 layout->row.columns = 0;
15691 layout->row.ratio = 0;
15692 layout->row.item_width = 0;
15693 layout->row.tree_depth = 0;
15694 layout->row.height = panel_padding.y;
15695 layout->has_scrolling = nk_true;
15697 layout->bounds.w -= scrollbar_size.x;
15699 layout->footer_height = 0;
15701 layout->footer_height = scrollbar_size.y;
15702 layout->bounds.h -= layout->footer_height;
15720 layout->header_height = header.h;
15721 layout->bounds.y += header.h;
15722 layout->bounds.h -= header.h;
15723 layout->at_y += header.h;
15766 layout->flags |= NK_WINDOW_HIDDEN;
15767 layout->flags &= (nk_flags)~NK_WINDOW_MINIMIZED;
15785 if (nk_do_button_symbol(&ws, &win->buffer, button, (layout->flags & NK_WINDOW_MINIMIZED)?
15788 layout->flags = (layout->flags & NK_WINDOW_MINIMIZED) ?
15789 layout->flags & (nk_flags)~NK_WINDOW_MINIMIZED:
15790 layout->flags | NK_WINDOW_MINIMIZED;
15809 if (!(layout->flags & NK_WINDOW_MINIMIZED) && !(layout->flags & NK_WINDOW_DYNAMIC)) {
15813 body.y = (win->bounds.y + layout->header_height);
15814 body.h = (win->bounds.h - layout->header_height);
15822 layout->clip = layout->bounds;
15823 nk_unify(&clip, &win->buffer.clip, layout->clip.x, layout->clip.y,
15824 layout->clip.x + layout->clip.w, layout->clip.y + layout->clip.h);
15826 layout->clip = clip;}
15827 return !(layout->flags & NK_WINDOW_HIDDEN) && !(layout->flags & NK_WINDOW_MINIMIZED);
15834 struct nk_panel *layout;
15843 NK_ASSERT(ctx->current->layout);
15844 if (!ctx || !ctx->current || !ctx->current->layout)
15848 layout = window->layout;
15851 in = (layout->flags & NK_WINDOW_ROM || layout->flags & NK_WINDOW_NO_INPUT) ? 0 :&ctx->input;
15852 if (!nk_panel_is_sub(layout->type))
15857 panel_padding = nk_panel_get_padding(style, layout->type);
15860 layout->at_y += layout->row.height;
15863 if (layout->flags & NK_WINDOW_DYNAMIC && !(layout->flags & NK_WINDOW_MINIMIZED))
15867 if (layout->at_y < (layout->bounds.y + layout->bounds.h))
15868 layout->bounds.h = layout->at_y - layout->bounds.y;
15872 empty_space.y = layout->bounds.y;
15879 empty_space.y = layout->bounds.y;
15880 empty_space.w = panel_padding.x + layout->border;
15881 empty_space.h = layout->bounds.h;
15885 empty_space.x = layout->bounds.x + layout->bounds.w;
15886 empty_space.y = layout->bounds.y;
15887 empty_space.w = panel_padding.x + layout->border;
15888 empty_space.h = layout->bounds.h;
15889 if (*layout->offset_y == 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR))
15894 if (layout->footer_height > 0) {
15896 empty_space.y = layout->bounds.y + layout->bounds.h;
15898 empty_space.h = layout->footer_height;
15904 if (!(layout->flags & NK_WINDOW_NO_SCROLLBAR) &&
15905 !(layout->flags & NK_WINDOW_MINIMIZED) &&
15916 if (nk_panel_is_sub(layout->type))
15920 struct nk_panel *root_panel = window->layout;
15928 if ((root_window == ctx->active) && layout->has_scrolling) {
15930 if (nk_input_is_mouse_hovering_rect(in, layout->bounds) &&
15931 NK_INTERSECT(layout->bounds.x, layout->bounds.y, layout->bounds.w, layout->bounds.h,
15935 root_panel = window->layout;
15944 } else if (!nk_panel_is_sub(layout->type)) {
15946 scroll_has_scrolling = (window == ctx->active) && layout->has_scrolling;
15955 scroll.x = layout->bounds.x + layout->bounds.w + panel_padding.x;
15956 scroll.y = layout->bounds.y;
15958 scroll.h = layout->bounds.h;
15960 scroll_offset = (float)*layout->offset_y;
15963 scroll_target = (float)(int)(layout->at_y - scroll.y);
15967 *layout->offset_y = (nk_uint)scroll_offset;
15974 scroll.x = layout->bounds.x;
15975 scroll.y = layout->bounds.y + layout->bounds.h;
15976 scroll.w = layout->bounds.w;
15979 scroll_offset = (float)*layout->offset_x;
15980 scroll_target = (float)(int)(layout->max_x - scroll.x);
15981 scroll_step = layout->max_x * 0.05f;
15982 scroll_inc = layout->max_x * 0.005f;
15986 *layout->offset_x = (nk_uint)scroll_offset;
16001 if (layout->flags & NK_WINDOW_BORDER)
16003 struct nk_color border_color = nk_panel_get_border_color(style, layout->type);
16004 const float padding_y = (layout->flags & NK_WINDOW_MINIMIZED)
16005 ? (style->window.border + window->bounds.y + layout->header_height)
16006 : ((layout->flags & NK_WINDOW_DYNAMIC)
16007 ? (layout->bounds.y + layout->bounds.h + layout->footer_height)
16011 nk_stroke_rect(out, b, 0, layout->border, border_color);
16015 if ((layout->flags & NK_WINDOW_SCALABLE) && in && !(layout->flags & NK_WINDOW_MINIMIZED))
16021 scaler.y = layout->bounds.y + layout->bounds.h;
16022 if (layout->flags & NK_WINDOW_SCALE_LEFT)
16023 scaler.x = layout->bounds.x - panel_padding.x * 0.5f;
16024 else scaler.x = layout->bounds.x + layout->bounds.w + panel_padding.x;
16025 if (layout->flags & NK_WINDOW_NO_SCROLLBAR)
16033 if (layout->flags & NK_WINDOW_SCALE_LEFT) {
16052 if (layout->flags & NK_WINDOW_SCALE_LEFT) {
16064 if (!(layout->flags & NK_WINDOW_DYNAMIC)) {
16078 if (!nk_panel_is_sub(layout->type)) {
16080 if (layout->flags & NK_WINDOW_HIDDEN)
16087 if (layout->flags & NK_WINDOW_REMOVE_ROM) {
16088 layout->flags &= ~(nk_flags)NK_WINDOW_ROM;
16089 layout->flags &= ~(nk_flags)NK_WINDOW_REMOVE_ROM;
16091 window->flags = layout->flags;
16122 NK_ASSERT(!layout->row.tree_depth);
16332 win->layout = 0;
16413 win->layout = (struct nk_panel*)nk_create_panel(ctx);
16416 win->layout->offset_x = &win->scrollbar.x;
16417 win->layout->offset_y = &win->scrollbar.y;
16423 struct nk_panel *layout;
16429 layout = ctx->current->layout;
16430 if (!layout || (layout->type == NK_PANEL_WINDOW && (ctx->current->flags & NK_WINDOW_HIDDEN))) {
16435 nk_free_panel(ctx, ctx->current->layout);
16484 return ctx->current->layout->clip;
16491 NK_ASSERT(ctx->current->layout);
16493 return nk_vec2(ctx->current->layout->clip.x, ctx->current->layout->clip.y);
16500 NK_ASSERT(ctx->current->layout);
16502 return nk_vec2(ctx->current->layout->clip.x + ctx->current->layout->clip.w,
16503 ctx->current->layout->clip.y + ctx->current->layout->clip.h);
16510 NK_ASSERT(ctx->current->layout);
16512 return nk_vec2(ctx->current->layout->clip.w, ctx->current->layout->clip.h);
16519 NK_ASSERT(ctx->current->layout);
16529 return ctx->current->layout;
16550 NK_ASSERT(ctx->current->layout);
16816 NK_ASSERT(ctx->current->layout);
16817 if (!ctx || !ctx->current || !ctx->current->layout)
16821 panel = win->layout;
16848 rect.x += win->layout->clip.x;
16849 rect.y += win->layout->clip.y;
16855 popup->layout = (struct nk_panel*)nk_create_panel(ctx);
16869 root = win->layout;
16876 popup->layout->offset_x = &popup->scrollbar.x;
16877 popup->layout->offset_y = &popup->scrollbar.y;
16878 popup->layout->parent = win->layout;
16883 root = win->layout;
16892 nk_free_panel(ctx, popup->layout);
16893 popup->layout = 0;
16909 NK_ASSERT(ctx->current->layout);
16910 if (!ctx || !ctx->current || !ctx->current->layout)
16915 panel = win->layout;
16943 struct nk_panel *root = win->layout;
16952 popup->layout = (struct nk_panel*)nk_create_panel(ctx);
16958 NK_ASSERT(popup->layout);
16967 popup->layout->parent = win->layout;
16968 popup->layout->offset_x = &popup->scrollbar.x;
16969 popup->layout->offset_y = &popup->scrollbar.y;
16973 root = win->layout;
16989 NK_ASSERT(popup->layout->type & NK_PANEL_SET_POPUP);
17000 NK_ASSERT(ctx->current->layout);
17001 if (!ctx || !ctx->current || !ctx->current->layout)
17009 root = win->layout;
17022 nk_push_scissor(&win->buffer, win->layout->clip);
17031 NK_ASSERT(ctx->current->layout);
17032 if (!ctx || !ctx->current || !ctx->current->layout)
17048 NK_ASSERT(ctx->current->layout);
17049 if (!ctx || !ctx->current || !ctx->current->layout)
17080 NK_ASSERT(ctx->current->layout);
17081 if (!ctx || !ctx->current || !ctx->current->layout)
17137 NK_ASSERT(ctx->current->layout);
17138 if (!ctx || !ctx->current || !ctx->current->layout)
17146 in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
17172 NK_ASSERT(ctx->current->layout);
17173 if (!ctx || !ctx->current || !ctx->current->layout)
17181 in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
17208 NK_ASSERT(ctx->current->layout);
17209 if (!ctx || !ctx->current || !ctx->current->layout)
17217 in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
17236 NK_ASSERT(ctx->current->layout);
17237 if (!ctx || !ctx->current || !ctx->current->layout) return;
17250 panel = popup->layout;
17290 struct nk_panel *layout;
17293 NK_ASSERT(ctx->current->layout);
17294 if (!ctx || !ctx->current || !ctx->current->layout)
17297 layout = ctx->current->layout;
17298 NK_ASSERT(layout->at_y == layout->bounds.y);
17314 if (layout->flags & NK_WINDOW_HIDDEN || layout->flags & NK_WINDOW_MINIMIZED)
17317 layout->menu.x = layout->at_x;
17318 layout->menu.y = layout->at_y + layout->row.height;
17319 layout->menu.w = layout->bounds.w;
17320 layout->menu.offset.x = *layout->offset_x;
17321 layout->menu.offset.y = *layout->offset_y;
17322 *layout->offset_y = 0;
17328 struct nk_panel *layout;
17333 NK_ASSERT(ctx->current->layout);
17334 if (!ctx || !ctx->current || !ctx->current->layout)
17339 layout = win->layout;
17340 if (layout->flags & NK_WINDOW_HIDDEN || layout->flags & NK_WINDOW_MINIMIZED)
17343 layout->menu.h = layout->at_y - layout->menu.y;
17344 layout->bounds.y += layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
17345 layout->bounds.h -= layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
17347 *layout->offset_x = layout->menu.offset.x;
17348 *layout->offset_y = layout->menu.offset.y;
17349 layout->at_y = layout->bounds.y - layout->row.height;
17351 layout->clip.y = layout->bounds.y;
17352 layout->clip.h = layout->bounds.h;
17353 nk_push_scissor(out, layout->clip);
17367 NK_ASSERT(ctx->current->layout);
17368 if (!ctx || !ctx->current || !ctx->current->layout)
17400 NK_ASSERT(ctx->current->layout);
17401 if (!ctx || !ctx->current || !ctx->current->layout)
17430 NK_ASSERT(ctx->current->layout);
17431 if (!ctx || !ctx->current || !ctx->current->layout)
17437 in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
17455 NK_ASSERT(ctx->current->layout);
17456 if (!ctx || !ctx->current || !ctx->current->layout)
17462 in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
17480 NK_ASSERT(ctx->current->layout);
17481 if (!ctx || !ctx->current || !ctx->current->layout)
17487 in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
17512 NK_ASSERT(ctx->current->layout);
17513 if (!ctx || !ctx->current || !ctx->current->layout)
17520 in = (state == NK_WIDGET_ROM || win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
17587 struct nk_panel *layout;
17591 NK_ASSERT(ctx->current->layout);
17592 if (!ctx || !ctx->current || !ctx->current->layout)
17596 layout = win->layout;
17597 layout->row.min_height = height;
17603 struct nk_panel *layout;
17607 NK_ASSERT(ctx->current->layout);
17608 if (!ctx || !ctx->current || !ctx->current->layout)
17612 layout = win->layout;
17613 layout->row.min_height = ctx->style.font->height;
17614 layout->row.min_height += ctx->style.text.padding.y*2;
17615 layout->row.min_height += ctx->style.window.min_row_height_padding*2;
17641 struct nk_panel *layout;
17650 NK_ASSERT(ctx->current->layout);
17651 if (!ctx || !ctx->current || !ctx->current->layout)
17655 layout = win->layout;
17666 NK_ASSERT(!(layout->flags & NK_WINDOW_MINIMIZED));
17667 NK_ASSERT(!(layout->flags & NK_WINDOW_HIDDEN));
17668 NK_ASSERT(!(layout->flags & NK_WINDOW_CLOSED));
17670 /* update the current row and set the current row layout */
17671 layout->row.index = 0;
17672 layout->at_y += layout->row.height;
17673 layout->row.columns = cols;
17675 layout->row.height = NK_MAX(height, layout->row.min_height) + item_spacing.y;
17676 else layout->row.height = height + item_spacing.y;
17678 layout->row.item_offset = 0;
17679 if (layout->flags & NK_WINDOW_DYNAMIC) {
17684 background.y = layout->at_y - 1.0f;
17685 background.h = layout->row.height + 1.0f;
17693 /* update the current row and set the current row layout */
17697 NK_ASSERT(ctx->current->layout);
17698 if (!ctx || !ctx->current || !ctx->current->layout)
17704 win->layout->row.type = NK_LAYOUT_DYNAMIC_FIXED;
17705 else win->layout->row.type = NK_LAYOUT_STATIC_FIXED;
17707 win->layout->row.ratio = 0;
17708 win->layout->row.filled = 0;
17709 win->layout->row.item_offset = 0;
17710 win->layout->row.item_width = (float)width;
17718 if (!ctx || !ctx->current || !ctx->current->layout) return 0;
17737 struct nk_panel *layout;
17741 NK_ASSERT(ctx->current->layout);
17742 if (!ctx || !ctx->current || !ctx->current->layout)
17746 layout = win->layout;
17749 layout->row.type = NK_LAYOUT_DYNAMIC_ROW;
17750 else layout->row.type = NK_LAYOUT_STATIC_ROW;
17752 layout->row.ratio = 0;
17753 layout->row.filled = 0;
17754 layout->row.item_width = 0;
17755 layout->row.item_offset = 0;
17756 layout->row.columns = cols;
17762 struct nk_panel *layout;
17766 NK_ASSERT(ctx->current->layout);
17767 if (!ctx || !ctx->current || !ctx->current->layout)
17771 layout = win->layout;
17772 NK_ASSERT(layout->row.type == NK_LAYOUT_STATIC_ROW || layout->row.type == NK_LAYOUT_DYNAMIC_ROW);
17773 if (layout->row.type != NK_LAYOUT_STATIC_ROW && layout->row.type != NK_LAYOUT_DYNAMIC_ROW)
17776 if (layout->row.type == NK_LAYOUT_DYNAMIC_ROW) {
17778 if ((ratio + layout->row.filled) > 1.0f) return;
17780 layout->row.item_width = NK_SATURATE(ratio);
17781 else layout->row.item_width = 1.0f - layout->row.filled;
17782 } else layout->row.item_width = ratio_or_width;
17788 struct nk_panel *layout;
17792 NK_ASSERT(ctx->current->layout);
17793 if (!ctx || !ctx->current || !ctx->current->layout)
17797 layout = win->layout;
17798 NK_ASSERT(layout->row.type == NK_LAYOUT_STATIC_ROW || layout->row.type == NK_LAYOUT_DYNAMIC_ROW);
17799 if (layout->row.type != NK_LAYOUT_STATIC_ROW && layout->row.type != NK_LAYOUT_DYNAMIC_ROW)
17801 layout->row.item_width = 0;
17802 layout->row.item_offset = 0;
17811 struct nk_panel *layout;
17815 NK_ASSERT(ctx->current->layout);
17816 if (!ctx || !ctx->current || !ctx->current->layout)
17820 layout = win->layout;
17825 layout->row.ratio = ratio;
17832 layout->row.type = NK_LAYOUT_DYNAMIC;
17833 layout->row.item_width = (r > 0 && n_undef > 0) ? (r / (float)n_undef):0;
17835 layout->row.ratio = ratio;
17836 layout->row.type = NK_LAYOUT_STATIC;
17837 layout->row.item_width = 0;
17838 layout->row.item_offset = 0;
17840 layout->row.item_offset = 0;
17841 layout->row.filled = 0;
17847 struct nk_panel *layout;
17851 NK_ASSERT(ctx->current->layout);
17852 if (!ctx || !ctx->current || !ctx->current->layout)
17856 layout = win->layout;
17858 layout->row.type = NK_LAYOUT_TEMPLATE;
17859 layout->row.columns = 0;
17860 layout->row.ratio = 0;
17861 layout->row.item_width = 0;
17862 layout->row.item_height = 0;
17863 layout->row.item_offset = 0;
17864 layout->row.filled = 0;
17865 layout->row.item.x = 0;
17866 layout->row.item.y = 0;
17867 layout->row.item.w = 0;
17868 layout->row.item.h = 0;
17874 struct nk_panel *layout;
17878 NK_ASSERT(ctx->current->layout);
17879 if (!ctx || !ctx->current || !ctx->current->layout)
17883 layout = win->layout;
17884 NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE);
17885 NK_ASSERT(layout->row.columns < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS);
17886 if (layout->row.type != NK_LAYOUT_TEMPLATE) return;
17887 if (layout->row.columns >= NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS) return;
17888 layout->row.templates[layout->row.columns++] = -1.0f;
17894 struct nk_panel *layout;
17898 NK_ASSERT(ctx->current->layout);
17899 if (!ctx || !ctx->current || !ctx->current->layout)
17903 layout = win->layout;
17904 NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE);
17905 NK_ASSERT(layout->row.columns < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS);
17906 if (layout->row.type != NK_LAYOUT_TEMPLATE) return;
17907 if (layout->row.columns >= NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS) return;
17908 layout->row.templates[layout->row.columns++] = -min_width;
17914 struct nk_panel *layout;
17918 NK_ASSERT(ctx->current->layout);
17919 if (!ctx || !ctx->current || !ctx->current->layout)
17923 layout = win->layout;
17924 NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE);
17925 NK_ASSERT(layout->row.columns < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS);
17926 if (layout->row.type != NK_LAYOUT_TEMPLATE) return;
17927 if (layout->row.columns >= NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS) return;
17928 layout->row.templates[layout->row.columns++] = width;
17934 struct nk_panel *layout;
17945 NK_ASSERT(ctx->current->layout);
17946 if (!ctx || !ctx->current || !ctx->current->layout)
17950 layout = win->layout;
17951 NK_ASSERT(layout->row.type == NK_LAYOUT_TEMPLATE);
17952 if (layout->row.type != NK_LAYOUT_TEMPLATE) return;
17953 for (i = 0; i < layout->row.columns; ++i) {
17954 float width = layout->row.templates[i];
17969 float space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type,
17970 layout->bounds.w, layout->row.columns);
17975 for (i = 0; i < layout->row.columns; ++i) {
17976 float *width = &layout->row.templates[i];
17986 struct nk_panel *layout;
17990 NK_ASSERT(ctx->current->layout);
17991 if (!ctx || !ctx->current || !ctx->current->layout)
17995 layout = win->layout;
17998 layout->row.type = NK_LAYOUT_STATIC_FREE;
17999 else layout->row.type = NK_LAYOUT_DYNAMIC_FREE;
18001 layout->row.ratio = 0;
18002 layout->row.filled = 0;
18003 layout->row.item_width = 0;
18004 layout->row.item_offset = 0;
18010 struct nk_panel *layout;
18014 NK_ASSERT(ctx->current->layout);
18015 if (!ctx || !ctx->current || !ctx->current->layout)
18019 layout = win->layout;
18020 layout->row.item_width = 0;
18021 layout->row.item_height = 0;
18022 layout->row.item_offset = 0;
18023 nk_zero(&layout->row.item, sizeof(layout->row.item));
18029 struct nk_panel *layout;
18033 NK_ASSERT(ctx->current->layout);
18034 if (!ctx || !ctx->current || !ctx->current->layout)
18038 layout = win->layout;
18039 layout->row.item = rect;
18046 struct nk_panel *layout;
18050 NK_ASSERT(ctx->current->layout);
18052 layout = win->layout;
18054 ret.x = layout->clip.x;
18055 ret.y = layout->clip.y;
18056 ret.w = layout->clip.w;
18057 ret.h = layout->row.height;
18065 struct nk_panel *layout;
18069 NK_ASSERT(ctx->current->layout);
18071 layout = win->layout;
18073 ret.x = layout->at_x;
18074 ret.y = layout->at_y;
18075 ret.w = layout->bounds.w - NK_MAX(layout->at_x - layout->bounds.x,0);
18076 ret.h = layout->row.height;
18083 struct nk_panel *layout;
18087 NK_ASSERT(ctx->current->layout);
18089 layout = win->layout;
18091 ret.x += layout->at_x - (float)*layout->offset_x;
18092 ret.y += layout->at_y - (float)*layout->offset_y;
18099 struct nk_panel *layout;
18103 NK_ASSERT(ctx->current->layout);
18105 layout = win->layout;
18107 ret.x += -layout->at_x + (float)*layout->offset_x;
18108 ret.y += -layout->at_y + (float)*layout->offset_y;
18115 struct nk_panel *layout;
18119 NK_ASSERT(ctx->current->layout);
18121 layout = win->layout;
18123 ret.x += layout->at_x - (float)*layout->offset_x;
18124 ret.y += layout->at_y - (float)*layout->offset_y;
18131 struct nk_panel *layout;
18135 NK_ASSERT(ctx->current->layout);
18137 layout = win->layout;
18139 ret.x += -layout->at_x + (float)*layout->offset_x;
18140 ret.y += -layout->at_y + (float)*layout->offset_y;
18146 struct nk_panel *layout = win->layout;
18148 const float row_height = layout->row.height - spacing.y;
18149 nk_panel_layout(ctx, win, row_height, layout->row.columns);
18155 struct nk_panel *layout;
18168 NK_ASSERT(ctx->current->layout);
18169 if (!ctx || !ctx->current || !ctx->current->layout)
18173 layout = win->layout;
18178 padding = nk_panel_get_padding(style, layout->type);
18179 panel_space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type,
18180 layout->bounds.w, layout->row.columns);
18183 /* calculate the width of one item inside the current layout space */
18184 switch (layout->row.type) {
18187 float w = NK_MAX(1.0f,panel_space) / (float)layout->row.columns;
18188 item_offset = (float)layout->row.index * w;
18190 item_spacing = (float)layout->row.index * spacing.x;
18194 float w = layout->row.item_width * panel_space;
18195 item_offset = layout->row.item_offset;
18200 layout->row.item_offset += w + spacing.x;
18201 layout->row.filled += layout->row.item_width;
18202 layout->row.index = 0;
18207 bounds->x = layout->at_x + (layout->bounds.w * layout->row.item.x);
18208 bounds->x -= (float)*layout->offset_x;
18209 bounds->y = layout->at_y + (layout->row.height * layout->row.item.y);
18210 bounds->y -= (float)*layout->offset_y;
18211 bounds->w = layout->bounds.w * layout->row.item.w + NK_FRAC(bounds->x);
18212 bounds->h = layout->row.height * layout->row.item.h + NK_FRAC(bounds->y);
18218 NK_ASSERT(layout->row.ratio);
18219 ratio = (layout->row.ratio[layout->row.index] < 0) ?
18220 layout->row.item_width : layout->row.ratio[layout->row.index];
18223 item_spacing = (float)layout->row.index * spacing.x;
18224 item_offset = layout->row.item_offset;
18228 layout->row.item_offset += w;
18229 layout->row.filled += ratio;
18234 item_width = layout->row.item_width;
18235 item_offset = (float)layout->row.index * item_width;
18236 item_spacing = (float)layout->row.index * spacing.x;
18240 item_width = layout->row.item_width;
18241 item_offset = layout->row.item_offset;
18242 item_spacing = (float)layout->row.index * spacing.x;
18243 if (modify) layout->row.item_offset += item_width;
18247 bounds->x = layout->at_x + layout->row.item.x;
18248 bounds->w = layout->row.item.w;
18249 if (((bounds->x + bounds->w) > layout->max_x) && modify)
18250 layout->max_x = (bounds->x + bounds->w);
18251 bounds->x -= (float)*layout->offset_x;
18252 bounds->y = layout->at_y + layout->row.item.y;
18253 bounds->y -= (float)*layout->offset_y;
18254 bounds->h = layout->row.item.h;
18259 item_spacing = (float)layout->row.index * spacing.x;
18260 item_width = layout->row.ratio[layout->row.index];
18261 item_offset = layout->row.item_offset;
18262 if (modify) layout->row.item_offset += item_width;
18265 /* stretchy row layout with combined dynamic/static widget width*/
18267 NK_ASSERT(layout->row.index < layout->row.columns);
18268 NK_ASSERT(layout->row.index < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS);
18269 w = layout->row.templates[layout->row.index];
18270 item_offset = layout->row.item_offset;
18272 item_spacing = (float)layout->row.index * spacing.x;
18273 if (modify) layout->row.item_offset += w;
18281 bounds->h = layout->row.height - spacing.y;
18282 bounds->y = layout->at_y - (float)*layout->offset_y;
18283 bounds->x = layout->at_x + item_offset + item_spacing + padding.x;
18284 if (((bounds->x + bounds->w) > layout->max_x) && modify)
18285 layout->max_x = bounds->x + bounds->w;
18286 bounds->x -= (float)*layout->offset_x;
18292 struct nk_panel *layout;
18296 NK_ASSERT(ctx->current->layout);
18297 if (!ctx || !ctx->current || !ctx->current->layout)
18302 layout = win->layout;
18303 if (layout->row.index >= layout->row.columns)
18308 layout->row.index++;
18316 struct nk_panel *layout;
18320 NK_ASSERT(ctx->current->layout);
18321 if (!ctx || !ctx->current || !ctx->current->layout)
18325 layout = win->layout;
18326 y = layout->at_y;
18327 index = layout->row.index;
18328 if (layout->row.index >= layout->row.columns) {
18329 layout->at_y += layout->row.height;
18330 layout->row.index = 0;
18333 if (!layout->row.index) {
18334 bounds->x -= layout->row.item_offset;
18336 layout->at_y = y;
18337 layout->row.index = index;
18354 struct nk_panel *layout;
18372 NK_ASSERT(ctx->current->layout);
18373 if (!ctx || !ctx->current || !ctx->current->layout)
18378 layout = win->layout;
18404 in = (!(layout->flags & NK_WINDOW_ROM)) ? &ctx->input: 0;
18450 layout->at_x = header.x + (float)*layout->offset_x + style->tab.indent;
18451 layout->bounds.w = NK_MAX(layout->bounds.w, style->tab.indent);
18452 layout->bounds.w -= (style->tab.indent + style->window.padding.x);
18453 layout->row.tree_depth++;
18495 struct nk_panel *layout = 0;
18499 NK_ASSERT(ctx->current->layout);
18500 if (!ctx || !ctx->current || !ctx->current->layout)
18504 layout = win->layout;
18505 layout->at_x -= ctx->style.tab.indent + ctx->style.window.padding.x;
18506 layout->bounds.w += ctx->style.tab.indent + ctx->style.window.padding.x;
18507 NK_ASSERT(layout->row.tree_depth);
18508 layout->row.tree_depth--;
18535 struct nk_panel *layout;
18557 NK_ASSERT(ctx->current->layout);
18558 if (!ctx || !ctx->current || !ctx->current->layout)
18563 layout = win->layout;
18589 in = (!(layout->flags & NK_WINDOW_ROM)) ? &ctx->input: 0;
18633 layout->at_x = header.x + (float)*layout->offset_x + style->tab.indent;
18634 layout->bounds.w = NK_MAX(layout->bounds.w, style->tab.indent);
18635 layout->bounds.w -= (style->tab.indent + style->window.padding.x);
18636 layout->row.tree_depth++;
18701 {const struct nk_rect *c = &win->layout->clip;
18716 panel.layout = (struct nk_panel*)nk_create_panel(ctx);
18721 win->buffer.clip = panel.layout->clip;
18722 panel.layout->offset_x = x_offset;
18723 panel.layout->offset_y = y_offset;
18724 panel.layout->parent = win->layout;
18725 win->layout = panel.layout;
18728 if ((panel.layout->flags & NK_WINDOW_CLOSED) ||
18729 (panel.layout->flags & NK_WINDOW_MINIMIZED))
18731 nk_flags f = panel.layout->flags;
18759 NK_ASSERT(win->layout);
18760 g = win->layout;
18785 pan.layout = g;
18798 win->layout = parent;
18821 NK_ASSERT(ctx->current->layout);
18822 if (!ctx || !ctx->current || !ctx->current->layout || !id)
18863 NK_ASSERT(ctx->current->layout);
18864 if (!ctx || !ctx->current || !ctx->current->layout || !id)
18898 NK_ASSERT(ctx->current->layout);
18899 if (!ctx || !ctx->current || !ctx->current->layout || !id)
18939 struct nk_panel *layout;
18972 layout = win->layout;
18976 view->count = (int)NK_MAX(nk_iceilf((layout->clip.h)/(float)row_height),0);
18987 struct nk_panel *layout;
18996 layout = win->layout;
18997 layout->at_y = layout->bounds.y + (float)view->total_height;
19080 c = ctx->current->layout->clip;
19102 c = ctx->current->layout->clip;
19124 c = ctx->current->layout->clip;
19141 struct nk_panel *layout;
19146 NK_ASSERT(ctx->current->layout);
19147 if (!ctx || !ctx->current || !ctx->current->layout)
19153 layout = win->layout;
19155 c = layout->clip;
19162 NK_ASSERT(!(layout->flags & NK_WINDOW_MINIMIZED));
19163 NK_ASSERT(!(layout->flags & NK_WINDOW_HIDDEN));
19164 NK_ASSERT(!(layout->flags & NK_WINDOW_CLOSED));
19191 struct nk_panel *layout;
19197 NK_ASSERT(ctx->current->layout);
19198 if (!ctx || !ctx->current || !ctx->current->layout)
19203 layout = win->layout;
19206 panel_padding = nk_panel_get_padding(style, layout->type);
19207 if (layout->row.index == 1) {
19212 if (layout->row.index == layout->row.columns)
19221 struct nk_panel *layout;
19227 NK_ASSERT(ctx->current->layout);
19228 if (!ctx || !ctx->current || !ctx->current->layout)
19233 layout = win->layout;
19234 index = (layout->row.index + cols) % layout->row.columns;
19235 rows = (layout->row.index + cols) / layout->row.columns;
19241 /* non table layout need to allocate space */
19242 if (layout->row.type != NK_LAYOUT_DYNAMIC_FIXED &&
19243 layout->row.type != NK_LAYOUT_STATIC_FIXED) {
19246 } layout->row.index = index;
19355 NK_ASSERT(ctx->current->layout);
19356 if (!ctx || !ctx->current || !ctx->current->layout) return;
19382 NK_ASSERT(ctx->current->layout);
19383 if (!ctx || !ctx->current || !ctx->current->layout) return;
19660 NK_ASSERT(ctx->current->layout);
19661 if (!ctx || !ctx->current || !ctx->current->layout) return;
19675 NK_ASSERT(ctx->current->layout);
19676 if (!ctx || !ctx->current || !ctx->current->layout) return;
20119 struct nk_panel *layout;
20128 NK_ASSERT(ctx->current->layout);
20129 if (!style || !ctx || !ctx->current || !ctx->current->layout) return 0;
20132 layout = win->layout;
20136 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20161 struct nk_panel *layout;
20172 NK_ASSERT(ctx->current->layout);
20173 if (!ctx || !ctx->current || !ctx->current->layout)
20177 layout = win->layout;
20181 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20197 struct nk_panel *layout;
20205 NK_ASSERT(ctx->current->layout);
20206 if (!ctx || !ctx->current || !ctx->current->layout)
20210 layout = win->layout;
20213 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20229 struct nk_panel *layout;
20237 NK_ASSERT(ctx->current->layout);
20238 if (!ctx || !ctx->current || !ctx->current->layout)
20242 layout = win->layout;
20246 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20263 struct nk_panel *layout;
20271 NK_ASSERT(ctx->current->layout);
20272 if (!ctx || !ctx->current || !ctx->current->layout)
20276 layout = win->layout;
20280 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20310 struct nk_panel *layout;
20318 NK_ASSERT(ctx->current->layout);
20319 if (!ctx || !ctx->current || !ctx->current->layout)
20323 layout = win->layout;
20327 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20529 struct nk_panel *layout;
20538 NK_ASSERT(ctx->current->layout);
20539 if (!ctx || !ctx->current || !ctx->current->layout)
20544 layout = win->layout;
20548 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20624 struct nk_panel *layout;
20633 NK_ASSERT(ctx->current->layout);
20634 if (!ctx || !ctx->current || !ctx->current->layout)
20639 layout = win->layout;
20643 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20865 struct nk_panel *layout;
20875 NK_ASSERT(ctx->current->layout);
20876 if (!ctx || !ctx->current || !ctx->current->layout || !value)
20880 layout = win->layout;
20885 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20894 struct nk_panel *layout;
20904 NK_ASSERT(ctx->current->layout);
20905 if (!ctx || !ctx->current || !ctx->current->layout || !value)
20909 layout = win->layout;
20914 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
20923 struct nk_panel *layout;
20933 NK_ASSERT(ctx->current->layout);
20934 if (!ctx || !ctx->current || !ctx->current->layout || !value)
20938 layout = win->layout;
20943 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
21198 struct nk_panel *layout;
21209 NK_ASSERT(ctx->current->layout);
21211 if (!ctx || !ctx->current || !ctx->current->layout || !value)
21216 layout = win->layout;
21220 in = (/*state == NK_WIDGET_ROM || */ layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
21358 struct nk_panel *layout;
21369 NK_ASSERT(ctx->current->layout);
21370 if (!ctx || !ctx->current || !ctx->current->layout || !cur)
21375 layout = win->layout;
21379 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
23473 NK_ASSERT(ctx->current->layout);
23474 if (!ctx || !ctx->current || !ctx->current->layout)
23481 in = (win->layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
23842 struct nk_panel *layout;
23867 NK_ASSERT(ctx->current->layout);
23868 if (!ctx || !ctx->current || !ctx->current->layout)
23872 layout = win->layout;
23904 layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
24046 NK_ASSERT(ctx->current->layout);
24048 if (!ctx || !ctx->current || !ctx->current->layout) return 0;
24050 chart = &ctx->current->layout->chart;
24057 chart = &win->layout->chart;
24104 NK_ASSERT(ctx->current->layout);
24105 NK_ASSERT(ctx->current->layout->chart.slot < NK_CHART_MAX_SLOT);
24106 if (!ctx || !ctx->current || !ctx->current->layout) return;
24107 if (ctx->current->layout->chart.slot >= NK_CHART_MAX_SLOT) return;
24110 {struct nk_chart *chart = &ctx->current->layout->chart;
24131 struct nk_panel *layout = win->layout;
24158 if (!(layout->flags & NK_WINDOW_ROM) &&
24181 if (!(layout->flags & NK_WINDOW_ROM)) {
24203 struct nk_panel *layout = win->layout;
24232 if (!(layout->flags & NK_WINDOW_ROM) &&
24252 NK_ASSERT(slot < ctx->current->layout->chart.slot);
24254 if (slot >= ctx->current->layout->chart.slot) return nk_false;
24257 if (win->layout->chart.slot < slot) return nk_false;
24258 switch (win->layout->chart.slots[slot].type) {
24260 flags = nk_chart_push_line(ctx, win, &win->layout->chart, value, slot); break;
24262 flags = nk_chart_push_column(ctx, win, &win->layout->chart, value, slot); break;
24286 chart = &win->layout->chart;
24512 struct nk_panel *layout;
24522 NK_ASSERT(ctx->current->layout);
24523 if (!ctx || !ctx->current || !ctx->current->layout || !color)
24528 layout = win->layout;
24531 in = (state == NK_WIDGET_ROM || layout->flags & NK_WINDOW_ROM) ? 0 : &ctx->input;
24564 NK_ASSERT(ctx->current->layout);
24565 if (!ctx || !ctx->current || !ctx->current->layout)
24603 NK_ASSERT(ctx->current->layout);
24604 if (!ctx || !ctx->current || !ctx->current->layout || !selected)
24613 in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input;
24694 NK_ASSERT(ctx->current->layout);
24695 if (!ctx || !ctx->current || !ctx->current->layout)
24704 in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input;
24773 NK_ASSERT(ctx->current->layout);
24774 if (!ctx || !ctx->current || !ctx->current->layout)
24783 in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input;
24861 NK_ASSERT(ctx->current->layout);
24862 if (!ctx || !ctx->current || !ctx->current->layout)
24870 in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input;
24954 NK_ASSERT(ctx->current->layout);
24955 if (!ctx || !ctx->current || !ctx->current->layout)
24964 in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input;
25033 NK_ASSERT(ctx->current->layout);
25034 if (!ctx || !ctx->current || !ctx->current->layout)
25042 in = (win->layout->flags & NK_WINDOW_ROM || s == NK_WIDGET_ROM)? 0: &ctx->input;
25178 window_padding = nk_panel_get_padding(&ctx->style, ctx->current->layout->type);
25211 window_padding = nk_panel_get_padding(&ctx->style, ctx->current->layout->type);
25264 window_padding = nk_panel_get_padding(&ctx->style, ctx->current->layout->type);
25327 NK_ASSERT(ctx->current->layout);
25328 if (!ctx || !ctx->current || !ctx->current->layout)
25339 x = nk_ifloorf(in->mouse.pos.x + 1) - (int)win->layout->clip.x;
25340 y = nk_ifloorf(in->mouse.pos.y + 1) - (int)win->layout->clip.y;
25349 if (ret) win->layout->flags &= ~(nk_flags)NK_WINDOW_ROM;
25351 ctx->current->layout->type = NK_PANEL_TOOLTIP;
25377 NK_ASSERT(ctx->current->layout);
25379 if (!ctx || !ctx->current || !ctx->current->layout || !text)
25527 /// - 2017/06/08 (1.40.0) - Removed the breaking part of last commit. Auto layout now only
25644 /// - 2016/09/02 (1.15.0) - Changed nuklear to not have any default vertex layout and
25714 /// - 2016/08/07 (1.05.2) - Fixed old bug in dynamic immediate mode layout API, calculating