diff --git a/core/layout.go b/core/layout.go index f799d187a8..ed33e5b636 100644 --- a/core/layout.go +++ b/core/layout.go @@ -754,7 +754,7 @@ func (wb *WidgetBase) sizeUpParts() { } func (fr *Frame) SizeUp() { - if fr.Styles.Display == styles.NoLayout { + if fr.Styles.Display == styles.Custom { fr.SizeUpWidget() fr.sizeUpChildren() return @@ -1152,7 +1152,7 @@ func (fr *Frame) SizeDown(iter int) bool { // iteration is required. It allocates sizes to fit given parent-allocated // total size. func (fr *Frame) sizeDownFrame(iter int) bool { - if fr.Styles.Display == styles.NoLayout { + if fr.Styles.Display == styles.Custom { fr.WidgetBase.SizeDown(iter) // behave like a widget return fr.sizeDownChildren(iter) } @@ -1545,7 +1545,7 @@ func (wb *WidgetBase) sizeFinalParts() { } func (fr *Frame) SizeFinal() { - if fr.Styles.Display == styles.NoLayout { + if fr.Styles.Display == styles.Custom { fr.WidgetBase.SizeFinal() // behave like a widget fr.sizeFinalChildren() return @@ -1653,7 +1653,7 @@ func (wb *WidgetBase) positionChildren() { // Position: uses the final sizes to position everything within layouts // according to alignment settings. func (fr *Frame) Position() { - if fr.Styles.Display == styles.NoLayout { + if fr.Styles.Display == styles.Custom { fr.positionFromPos() return } @@ -1847,7 +1847,7 @@ func (fr *Frame) applyScenePosChildren() { // This step can be performed when scrolling after updating Scroll. func (fr *Frame) ApplyScenePos() { fr.scrollResetIfNone() - if fr.Styles.Display == styles.NoLayout { + if fr.Styles.Display == styles.Custom { fr.WidgetBase.ApplyScenePos() fr.applyScenePosChildren() fr.PositionScrolls() @@ -1875,12 +1875,11 @@ func (fr *Frame) scrollResetIfNone() { } } -// positionFromPos does NoLayout positioning from style positions. +// positionFromPos does Custom positioning from style positions. func (fr *Frame) positionFromPos() { fr.forVisibleChildren(func(i int, cw Widget, cwb *WidgetBase) bool { cwb.Geom.RelPos.X = cwb.Styles.Pos.X.Dots cwb.Geom.RelPos.Y = cwb.Styles.Pos.Y.Dots - fmt.Println("set pos:", cwb.Geom.RelPos) return tree.Continue }) } diff --git a/core/layout_test.go b/core/layout_test.go index c85f7a9a93..44512760be 100644 --- a/core/layout_test.go +++ b/core/layout_test.go @@ -236,14 +236,14 @@ func TestParentRelativeSize(t *testing.T) { b.AssertRender(t, "layout/parent-relative") } -func TestNoLayoutPos(t *testing.T) { +func TestCustomLayout(t *testing.T) { b := NewBody() b.Styler(func(s *styles.Style) { s.Min.Set(units.Dp(100)) }) fr := NewFrame(b) fr.Styler(func(s *styles.Style) { - s.Display = styles.NoLayout + s.Display = styles.Custom s.Grow.Set(1, 1) }) NewFrame(fr).Styler(func(s *styles.Style) { @@ -256,5 +256,5 @@ func TestNoLayoutPos(t *testing.T) { s.Min.Set(units.Dp(40)) s.Pos.Set(units.Dp(50)) }) - b.AssertRender(t, "layout/no-layout") + b.AssertRender(t, "layout/custom") } diff --git a/styles/enumgen.go b/styles/enumgen.go index 546fc5a9cc..9fab29eedd 100644 --- a/styles/enumgen.go +++ b/styles/enumgen.go @@ -371,11 +371,11 @@ var _DisplaysValues = []Displays{0, 1, 2, 3, 4} // DisplaysN is the highest valid value for type Displays, plus one. const DisplaysN Displays = 5 -var _DisplaysValueMap = map[string]Displays{`flex`: 0, `stacked`: 1, `grid`: 2, `no-layout`: 3, `none`: 4} +var _DisplaysValueMap = map[string]Displays{`flex`: 0, `stacked`: 1, `grid`: 2, `custom`: 3, `none`: 4} -var _DisplaysDescMap = map[Displays]string{0: `Flex is the default layout model, based on a simplified version of the CSS flex layout: uses MainAxis to specify the direction, Wrap for wrapping of elements, and Min, Max, and Grow values on elements to determine sizing.`, 1: `Stacked is a stack of elements, with one on top that is visible`, 2: `Grid is the X, Y grid layout, with Columns specifying the number of elements in the X axis.`, 3: `NoLayout means that no automatic layout will be applied to elements, which can then be managed via custom code.`, 4: `None means the item is not displayed: sets the Invisible state`} +var _DisplaysDescMap = map[Displays]string{0: `Flex is the default layout model, based on a simplified version of the CSS flex layout: uses MainAxis to specify the direction, Wrap for wrapping of elements, and Min, Max, and Grow values on elements to determine sizing.`, 1: `Stacked is a stack of elements, with one on top that is visible`, 2: `Grid is the X, Y grid layout, with Columns specifying the number of elements in the X axis.`, 3: `Custom means that no automatic layout will be applied to elements, which can then be managed via custom code by setting the [Style.Pos] position.`, 4: `None means the item is not displayed: sets the Invisible state`} -var _DisplaysMap = map[Displays]string{0: `flex`, 1: `stacked`, 2: `grid`, 3: `no-layout`, 4: `none`} +var _DisplaysMap = map[Displays]string{0: `flex`, 1: `stacked`, 2: `grid`, 3: `custom`, 4: `none`} // String returns the string representation of this Displays value. func (i Displays) String() string { return enums.String(i, _DisplaysMap) } @@ -924,7 +924,7 @@ const WhiteSpacesN WhiteSpaces = 5 var _WhiteSpacesValueMap = map[string]WhiteSpaces{`Normal`: 0, `Nowrap`: 1, `Pre`: 2, `PreLine`: 3, `PreWrap`: 4} -var _WhiteSpacesDescMap = map[WhiteSpaces]string{0: `WhiteSpaceNormal means that all white space is collapsed to a single space, and text wraps when necessary. To get full word wrapping to expand to all available space, you also need to set GrowWrap = 1. Use the SetTextWrap convenience method to set both.`, 1: `WhiteSpaceNowrap means that sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line except if there is an explicit line break via a <br> tag. In general you also don't want simple non-wrapping text labels to Grow (GrowWrap = 0). Use the SetTextWrap method to set both.`, 2: `WhiteSpacePre means that whitespace is preserved. Text will only wrap on line breaks. Acts like the <pre> tag in HTML. This invokes a different hand-written parser because the default Go parser automatically throws away whitespace.`, 3: `WhiteSpacePreLine means that sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks`, 4: `WhiteSpacePreWrap means that whitespace is preserved. Text will wrap when necessary, and on line breaks`} +var _WhiteSpacesDescMap = map[WhiteSpaces]string{0: `WhiteSpaceNormal means that all white space is collapsed to a single space, and text wraps when necessary. To get full word wrapping to expand to all available space, you also need to set GrowWrap = true. Use the SetTextWrap convenience method to set both.`, 1: `WhiteSpaceNowrap means that sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line except if there is an explicit line break via a <br> tag. In general you also don't want simple non-wrapping text labels to Grow (GrowWrap = false). Use the SetTextWrap method to set both.`, 2: `WhiteSpacePre means that whitespace is preserved. Text will only wrap on line breaks. Acts like the <pre> tag in HTML. This invokes a different hand-written parser because the default Go parser automatically throws away whitespace.`, 3: `WhiteSpacePreLine means that sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks`, 4: `WhiteSpacePreWrap means that whitespace is preserved. Text will wrap when necessary, and on line breaks`} var _WhiteSpacesMap = map[WhiteSpaces]string{0: `Normal`, 1: `Nowrap`, 2: `Pre`, 3: `PreLine`, 4: `PreWrap`} diff --git a/styles/layout.go b/styles/layout.go index 6ff8d8330e..6864a05a0c 100644 --- a/styles/layout.go +++ b/styles/layout.go @@ -109,9 +109,9 @@ const ( // of elements in the X axis. Grid - // NoLayout means that no automatic layout will be applied to elements, + // Custom means that no automatic layout will be applied to elements, // which can then be managed via custom code by setting the [Style.Pos] position. - NoLayout + Custom // None means the item is not displayed: sets the Invisible state DisplayNone diff --git a/styles/style.go b/styles/style.go index 9f426822ee..0f93e5e499 100644 --- a/styles/style.go +++ b/styles/style.go @@ -185,7 +185,7 @@ type Style struct { //types:add VirtualKeyboard VirtualKeyboards // Pos is used for the position of the widget if the parent frame - // has [Style.Display] = [NoLayout]. + // has [Style.Display] = [Custom]. Pos units.XY `display:"inline"` // ordering factor for rendering depth -- lower numbers rendered first. diff --git a/styles/typegen.go b/styles/typegen.go index 15bfced6d0..e2517383ec 100644 --- a/styles/typegen.go +++ b/styles/typegen.go @@ -10,7 +10,7 @@ var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.Border", IDN var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.Shadow", IDName: "shadow", Doc: "style parameters for shadows", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Fields: []types.Field{{Name: "OffsetX", Doc: "OffsetX is th horizontal offset of the shadow.\nPositive moves it right, negative moves it left."}, {Name: "OffsetY", Doc: "OffsetY is the vertical offset of the shadow.\nPositive moves it down, negative moves it up."}, {Name: "Blur", Doc: "Blur specifies the blur radius of the shadow.\nHigher numbers make it more blurry."}, {Name: "Spread", Doc: "Spread specifies the spread radius of the shadow.\nPositive numbers increase the size of the shadow,\nand negative numbers decrease the size."}, {Name: "Color", Doc: "Color specifies the color of the shadow."}, {Name: "Inset", Doc: "Inset specifies whether the shadow is inset within the\nbox instead of outset outside of the box.\nTODO: implement."}}}) -var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.Font", IDName: "font", Doc: "Font contains all font styling information.\nMost of font information is inherited.\nFont does not include all information needed\nfor rendering -- see [FontRender] for that.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Fields: []types.Field{{Name: "Size", Doc: "size of font to render (inherited); converted to points when getting font to use"}, {Name: "Family", Doc: "font family (inherited): ordered list of comma-separated names from more general to more specific to use; use split on , to parse"}, {Name: "Style", Doc: "style (inherited): normal, italic, etc"}, {Name: "Weight", Doc: "weight (inherited): normal, bold, etc"}, {Name: "Stretch", Doc: "font stretch / condense options (inherited)"}, {Name: "Variant", Doc: "normal or small caps (inherited)"}, {Name: "Decoration", Doc: "underline, line-through, etc (not inherited)"}, {Name: "Shift", Doc: "super / sub script (not inherited)"}, {Name: "Face", Doc: "full font information including enhanced metrics and actual font codes for drawing text; this is a pointer into FontLibrary of loaded fonts"}}}) +var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.Font", IDName: "font", Doc: "Font contains all font styling information.\nMost of font information is inherited.\nFont does not include all information needed\nfor rendering -- see [FontRender] for that.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Fields: []types.Field{{Name: "Size", Doc: "size of font to render (inherited); converted to points when getting font to use"}, {Name: "Family", Doc: "font family (inherited): ordered list of comma-separated names from more general to more specific to use; use split on , to parse"}, {Name: "Style", Doc: "style (inherited): normal, italic, etc"}, {Name: "Weight", Doc: "weight (inherited): normal, bold, etc"}, {Name: "Stretch", Doc: "font stretch / condense options (inherited)"}, {Name: "Variant", Doc: "normal or small caps (inherited)"}, {Name: "Decoration", Doc: "Decoration contains the bit flag [TextDecorations]\n(underline, line-through, etc). It must be set using\n[Font.SetDecoration] since it contains bit flags.\nIt is not inherited."}, {Name: "Shift", Doc: "super / sub script (not inherited)"}, {Name: "Face", Doc: "full font information including enhanced metrics and actual font codes for drawing text; this is a pointer into FontLibrary of loaded fonts"}}}) var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.FontRender", IDName: "font-render", Doc: "FontRender contains all font styling information\nthat is needed for SVG text rendering. It is passed to\nPaint and Style functions. It should typically not be\nused by end-user code -- see [Font] for that.\nIt stores all values as pointers so that they correspond\nto the values of the style object it was derived from.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Embeds: []types.Field{{Name: "Font"}}, Fields: []types.Field{{Name: "Color", Doc: "text color (inherited)"}, {Name: "Background", Doc: "background color (not inherited, transparent by default)"}, {Name: "Opacity", Doc: "alpha value between 0 and 1 to apply to the foreground and background of this element and all of its children"}}}) @@ -30,7 +30,7 @@ var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.SideFloats", var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.SideColors", IDName: "side-colors", Doc: "SideColors contains color values for each side/corner of a box", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Embeds: []types.Field{{Name: "Sides"}}}) -var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.Style", IDName: "style", Doc: "Style contains all of the style properties used for GUI widgets.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Fields: []types.Field{{Name: "State", Doc: "State holds style-relevant state flags, for convenient styling access,\ngiven that styles typically depend on element states."}, {Name: "Abilities", Doc: "Abilities specifies the abilities of this element, which determine\nwhich kinds of states the element can express.\nThis is used by the system/events system. Putting this info next\nto the State info makes it easy to configure and manage."}, {Name: "Cursor", Doc: "the cursor to switch to upon hovering over the element (inherited)"}, {Name: "Padding", Doc: "Padding is the transparent space around central content of box,\nwhich is _included_ in the size of the standard box rendering."}, {Name: "Margin", Doc: "Margin is the outer-most transparent space around box element,\nwhich is _excluded_ from standard box rendering."}, {Name: "Display", Doc: "Display controls how items are displayed, in terms of layout"}, {Name: "Direction", Doc: "Direction specifies the way in which elements are laid out, or\nthe dimension on which an element is longer / travels in."}, {Name: "Wrap", Doc: "Wrap causes elements to wrap around in the CrossAxis dimension\nto fit within sizing constraints (on by default)."}, {Name: "Justify", Doc: "Justify specifies the distribution of elements along the main axis,\ni.e., the same as Direction, for Flex Display. For Grid, the main axis is\ngiven by the writing direction (e.g., Row-wise for latin based languages)."}, {Name: "Align", Doc: "Align specifies the cross-axis alignment of elements, orthogonal to the\nmain Direction axis. For Grid, the cross-axis is orthogonal to the\nwriting direction (e.g., Column-wise for latin based languages)."}, {Name: "Min", Doc: "Min is the minimum size of the actual content, exclusive of additional space\nfrom padding, border, margin; 0 = default is sum of Min for all content\n(which _includes_ space for all sub-elements).\nThis is equivalent to the Basis for the CSS flex styling model."}, {Name: "Max", Doc: "Max is the maximum size of the actual content, exclusive of additional space\nfrom padding, border, margin; 0 = default provides no Max size constraint"}, {Name: "Grow", Doc: "Grow is the proportional amount that the element can grow (stretch)\nif there is more space available. 0 = default = no growth.\nExtra available space is allocated as: Grow / sum (all Grow).\nImportant: grow elements absorb available space and thus are not\nsubject to alignment (Center, End)."}, {Name: "GrowWrap", Doc: "GrowWrap is a special case for Text elements where it grows initially\nin the horizontal axis to allow for longer, word wrapped text to fill\nthe available space, but then it does not grow thereafter, so that alignment\noperations still work (Grow elements do not align because they absorb all\navailable space)."}, {Name: "RenderBox", Doc: "RenderBox determines whether to render the standard box model for the element.\nThis is typically necessary for most elements and helps prevent text, border,\nand box shadow from rendering over themselves. Therefore, it should be kept at\nits default value of true in most circumstances, but it can be set to false\nwhen the element is fully managed by something that is guaranteed to render the\nappropriate background color and/or border for the element."}, {Name: "FillMargin", Doc: "FillMargin determines is whether to fill the margin with\nthe surrounding background color before rendering the element itself.\nThis is typically necessary to prevent text, border, and box shadow from\nrendering over themselves. Therefore, it should be kept at its default value\nof true in most circumstances, but it can be set to false when the element\nis fully managed by something that is guaranteed to render the\nappropriate background color for the element. It is irrelevant if RenderBox\nis false."}, {Name: "Overflow", Doc: "Overflow determines how to handle overflowing content in a layout.\nDefault is OverflowVisible. Set to OverflowAuto to enable scrollbars."}, {Name: "Gap", Doc: "For layouts, extra space added between elements in the layout."}, {Name: "Columns", Doc: "For grid layouts, the number of columns to use.\nIf > 0, number of rows is computed as N elements / Columns.\nUsed as a constraint in layout if individual elements\ndo not specify their row, column positions"}, {Name: "ObjectFit", Doc: "If this object is a replaced object (image, video, etc)\nor has a background image, ObjectFit specifies the way\nin which the replaced object should be fit into the element."}, {Name: "ObjectPosition", Doc: "If this object is a replaced object (image, video, etc)\nor has a background image, ObjectPosition specifies the\nX,Y position of the object within the space allocated for\nthe object (see ObjectFit)."}, {Name: "Border", Doc: "Border is a rendered border around the element."}, {Name: "MaxBorder", Doc: "MaxBorder is the largest border that will ever be rendered\naround the element, the size of which is used for computing\nthe effective margin to allocate for the element."}, {Name: "BoxShadow", Doc: "BoxShadow is the box shadows to render around box (can have multiple)"}, {Name: "MaxBoxShadow", Doc: "MaxBoxShadow contains the largest shadows that will ever be rendered\naround the element, the size of which are used for computing the\neffective margin to allocate for the element."}, {Name: "Color", Doc: "Color specifies the text / content color, and it is inherited."}, {Name: "Background", Doc: "Background specifies the background of the element. It is not inherited,\nand it is nil (transparent) by default."}, {Name: "Opacity", Doc: "alpha value between 0 and 1 to apply to the foreground and background of this element and all of its children"}, {Name: "StateLayer", Doc: "StateLayer, if above zero, indicates to create a state layer over the element with this much opacity (on a scale of 0-1) and the\ncolor Color (or StateColor if it defined). It is automatically set based on State, but can be overridden in stylers."}, {Name: "StateColor", Doc: "StateColor, if not nil, is the color to use for the StateLayer instead of Color. If you want to disable state layers\nfor an element, do not use this; instead, set StateLayer to 0."}, {Name: "ActualBackground", Doc: "ActualBackground is the computed actual background rendered for the element,\ntaking into account its Background, Opacity, StateLayer, and parent\nActualBackground. It is automatically computed and should not be set manually."}, {Name: "VirtualKeyboard", Doc: "VirtualKeyboard is the virtual keyboard to display, if any,\non mobile platforms when this element is focused. It is not\nused if the element is read only."}, {Name: "Pos", Doc: "position is only used for Layout = Nil cases"}, {Name: "ZIndex", Doc: "ordering factor for rendering depth -- lower numbers rendered first.\nSort children according to this factor"}, {Name: "Row", Doc: "specifies the row that this element should appear within a grid layout"}, {Name: "Col", Doc: "specifies the column that this element should appear within a grid layout"}, {Name: "RowSpan", Doc: "specifies the number of sequential rows that this element should occupy\nwithin a grid layout (todo: not currently supported)"}, {Name: "ColSpan", Doc: "specifies the number of sequential columns that this element should occupy\nwithin a grid layout"}, {Name: "ScrollbarWidth", Doc: "ScrollbarWidth is the width of layout scrollbars. It defaults\nto [DefaultScrollbarWidth], and it is inherited."}, {Name: "Font", Doc: "font styling parameters"}, {Name: "Text", Doc: "text styling parameters"}, {Name: "UnitContext", Doc: "unit context: parameters necessary for anchoring relative units"}}}) +var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.Style", IDName: "style", Doc: "Style contains all of the style properties used for GUI widgets.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Fields: []types.Field{{Name: "State", Doc: "State holds style-relevant state flags, for convenient styling access,\ngiven that styles typically depend on element states."}, {Name: "Abilities", Doc: "Abilities specifies the abilities of this element, which determine\nwhich kinds of states the element can express.\nThis is used by the system/events system. Putting this info next\nto the State info makes it easy to configure and manage."}, {Name: "Cursor", Doc: "the cursor to switch to upon hovering over the element (inherited)"}, {Name: "Padding", Doc: "Padding is the transparent space around central content of box,\nwhich is _included_ in the size of the standard box rendering."}, {Name: "Margin", Doc: "Margin is the outer-most transparent space around box element,\nwhich is _excluded_ from standard box rendering."}, {Name: "Display", Doc: "Display controls how items are displayed, in terms of layout"}, {Name: "Direction", Doc: "Direction specifies the way in which elements are laid out, or\nthe dimension on which an element is longer / travels in."}, {Name: "Wrap", Doc: "Wrap causes elements to wrap around in the CrossAxis dimension\nto fit within sizing constraints."}, {Name: "Justify", Doc: "Justify specifies the distribution of elements along the main axis,\ni.e., the same as Direction, for Flex Display. For Grid, the main axis is\ngiven by the writing direction (e.g., Row-wise for latin based languages)."}, {Name: "Align", Doc: "Align specifies the cross-axis alignment of elements, orthogonal to the\nmain Direction axis. For Grid, the cross-axis is orthogonal to the\nwriting direction (e.g., Column-wise for latin based languages)."}, {Name: "Min", Doc: "Min is the minimum size of the actual content, exclusive of additional space\nfrom padding, border, margin; 0 = default is sum of Min for all content\n(which _includes_ space for all sub-elements).\nThis is equivalent to the Basis for the CSS flex styling model."}, {Name: "Max", Doc: "Max is the maximum size of the actual content, exclusive of additional space\nfrom padding, border, margin; 0 = default provides no Max size constraint"}, {Name: "Grow", Doc: "Grow is the proportional amount that the element can grow (stretch)\nif there is more space available. 0 = default = no growth.\nExtra available space is allocated as: Grow / sum (all Grow).\nImportant: grow elements absorb available space and thus are not\nsubject to alignment (Center, End)."}, {Name: "GrowWrap", Doc: "GrowWrap is a special case for Text elements where it grows initially\nin the horizontal axis to allow for longer, word wrapped text to fill\nthe available space, but then it does not grow thereafter, so that alignment\noperations still work (Grow elements do not align because they absorb all\navailable space). Do NOT set this for non-Text elements."}, {Name: "RenderBox", Doc: "RenderBox determines whether to render the standard box model for the element.\nThis is typically necessary for most elements and helps prevent text, border,\nand box shadow from rendering over themselves. Therefore, it should be kept at\nits default value of true in most circumstances, but it can be set to false\nwhen the element is fully managed by something that is guaranteed to render the\nappropriate background color and/or border for the element."}, {Name: "FillMargin", Doc: "FillMargin determines is whether to fill the margin with\nthe surrounding background color before rendering the element itself.\nThis is typically necessary to prevent text, border, and box shadow from\nrendering over themselves. Therefore, it should be kept at its default value\nof true in most circumstances, but it can be set to false when the element\nis fully managed by something that is guaranteed to render the\nappropriate background color for the element. It is irrelevant if RenderBox\nis false."}, {Name: "Overflow", Doc: "Overflow determines how to handle overflowing content in a layout.\nDefault is OverflowVisible. Set to OverflowAuto to enable scrollbars."}, {Name: "Gap", Doc: "For layouts, extra space added between elements in the layout."}, {Name: "Columns", Doc: "For grid layouts, the number of columns to use.\nIf > 0, number of rows is computed as N elements / Columns.\nUsed as a constraint in layout if individual elements\ndo not specify their row, column positions"}, {Name: "ObjectFit", Doc: "If this object is a replaced object (image, video, etc)\nor has a background image, ObjectFit specifies the way\nin which the replaced object should be fit into the element."}, {Name: "ObjectPosition", Doc: "If this object is a replaced object (image, video, etc)\nor has a background image, ObjectPosition specifies the\nX,Y position of the object within the space allocated for\nthe object (see ObjectFit)."}, {Name: "Border", Doc: "Border is a rendered border around the element."}, {Name: "MaxBorder", Doc: "MaxBorder is the largest border that will ever be rendered\naround the element, the size of which is used for computing\nthe effective margin to allocate for the element."}, {Name: "BoxShadow", Doc: "BoxShadow is the box shadows to render around box (can have multiple)"}, {Name: "MaxBoxShadow", Doc: "MaxBoxShadow contains the largest shadows that will ever be rendered\naround the element, the size of which are used for computing the\neffective margin to allocate for the element."}, {Name: "Color", Doc: "Color specifies the text / content color, and it is inherited."}, {Name: "Background", Doc: "Background specifies the background of the element. It is not inherited,\nand it is nil (transparent) by default."}, {Name: "Opacity", Doc: "alpha value between 0 and 1 to apply to the foreground and background of this element and all of its children"}, {Name: "StateLayer", Doc: "StateLayer, if above zero, indicates to create a state layer over the element with this much opacity (on a scale of 0-1) and the\ncolor Color (or StateColor if it defined). It is automatically set based on State, but can be overridden in stylers."}, {Name: "StateColor", Doc: "StateColor, if not nil, is the color to use for the StateLayer instead of Color. If you want to disable state layers\nfor an element, do not use this; instead, set StateLayer to 0."}, {Name: "ActualBackground", Doc: "ActualBackground is the computed actual background rendered for the element,\ntaking into account its Background, Opacity, StateLayer, and parent\nActualBackground. It is automatically computed and should not be set manually."}, {Name: "VirtualKeyboard", Doc: "VirtualKeyboard is the virtual keyboard to display, if any,\non mobile platforms when this element is focused. It is not\nused if the element is read only."}, {Name: "Pos", Doc: "Pos is used for the position of the widget if the parent frame\nhas [Style.Display] = [Custom]."}, {Name: "ZIndex", Doc: "ordering factor for rendering depth -- lower numbers rendered first.\nSort children according to this factor"}, {Name: "Row", Doc: "specifies the row that this element should appear within a grid layout"}, {Name: "Col", Doc: "specifies the column that this element should appear within a grid layout"}, {Name: "RowSpan", Doc: "specifies the number of sequential rows that this element should occupy\nwithin a grid layout (todo: not currently supported)"}, {Name: "ColSpan", Doc: "specifies the number of sequential columns that this element should occupy\nwithin a grid layout"}, {Name: "ScrollbarWidth", Doc: "ScrollbarWidth is the width of layout scrollbars. It defaults\nto [DefaultScrollbarWidth], and it is inherited."}, {Name: "Font", Doc: "font styling parameters"}, {Name: "Text", Doc: "text styling parameters"}, {Name: "UnitContext", Doc: "unit context: parameters necessary for anchoring relative units"}}}) var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/styles.Text", IDName: "text", Doc: "Text is used for layout-level (widget, html-style) text styling --\nFontStyle contains all the lower-level text rendering info used in SVG --\nmost of these are inherited", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Fields: []types.Field{{Name: "Align", Doc: "how to align text, horizontally (inherited).\nThis *only* applies to the text within its containing element,\nand is typically relevant only for multi-line text:\nfor single-line text, if element does not have a specified size\nthat is different from the text size, then this has *no effect*."}, {Name: "AlignV", Doc: "vertical alignment of text (inherited).\nThis *only* applies to the text within its containing element:\nif that element does not have a specified size\nthat is different from the text size, then this has *no effect*."}, {Name: "Anchor", Doc: "for svg rendering only (inherited):\ndetermines the alignment relative to text position coordinate.\nFor RTL start is right, not left, and start is top for TB"}, {Name: "LetterSpacing", Doc: "spacing between characters and lines"}, {Name: "WordSpacing", Doc: "extra space to add between words (inherited)"}, {Name: "LineHeight", Doc: "specified height of a line of text (inherited); text is centered within the overall lineheight;\nthe standard way to specify line height is in terms of em"}, {Name: "WhiteSpace", Doc: "WhiteSpace (not inherited) specifies how white space is processed,\nand how lines are wrapped. If set to WhiteSpaceNormal (default) lines are wrapped.\nSee info about interactions with Grow.X setting for this and the NoWrap case."}, {Name: "UnicodeBidi", Doc: "determines how to treat unicode bidirectional information (inherited)"}, {Name: "Direction", Doc: "bidi-override or embed -- applies to all text elements (inherited)"}, {Name: "WritingMode", Doc: "overall writing mode -- only for text elements, not span (inherited)"}, {Name: "OrientationVert", Doc: "for TBRL writing mode (only), determines orientation of alphabetic characters (inherited);\n90 is default (rotated); 0 means keep upright"}, {Name: "OrientationHoriz", Doc: "for horizontal LR/RL writing mode (only), determines orientation of all characters (inherited);\n0 is default (upright)"}, {Name: "Indent", Doc: "how much to indent the first line in a paragraph (inherited)"}, {Name: "ParaSpacing", Doc: "extra spacing between paragraphs (inherited); copied from [Style.Margin] per CSS spec\nif that is non-zero, else can be set directly with para-spacing"}, {Name: "TabSize", Doc: "tab size, in number of characters (inherited)"}}}) diff --git a/yaegicore/symbols/cogentcore_org-core-styles.go b/yaegicore/symbols/cogentcore_org-core-styles.go index f47a3f8da2..5a280593c4 100644 --- a/yaegicore/symbols/cogentcore_org-core-styles.go +++ b/yaegicore/symbols/cogentcore_org-core-styles.go @@ -59,6 +59,7 @@ func init() { "ClampMin": reflect.ValueOf(styles.ClampMin), "ClampMinVector": reflect.ValueOf(styles.ClampMinVector), "Column": reflect.ValueOf(styles.Column), + "Custom": reflect.ValueOf(styles.Custom), "DecoBackgroundColor": reflect.ValueOf(styles.DecoBackgroundColor), "DecoBlink": reflect.ValueOf(styles.DecoBlink), "DecoDottedUnderline": reflect.ValueOf(styles.DecoDottedUnderline), @@ -151,7 +152,6 @@ func init() { "NewSideFloats": reflect.ValueOf(styles.NewSideFloats), "NewSideValues": reflect.ValueOf(styles.NewSideValues), "NewStyle": reflect.ValueOf(styles.NewStyle), - "NoLayout": reflect.ValueOf(styles.NoLayout), "ObjectFitsN": reflect.ValueOf(styles.ObjectFitsN), "ObjectFitsValues": reflect.ValueOf(styles.ObjectFitsValues), "ObjectSizeFromFit": reflect.ValueOf(styles.ObjectSizeFromFit),