Search Results for

    Show / Hide Table of Contents

    Struct Length

    CSS3 has multiple possible 'modes' for a Length, the two most common being: PIXELS (px) and PERCENT (%); this wraps the mode with a float value, giving you e.g. "10 px", or eg "50 %".

    Namespace: NinjaTools.FlexBuilder.CSS3
    Assembly: cs.temp.dll.dll
    Syntax
    [Serializable]
    public struct Length

    Constructors

    - (void) Length(LengthType)

    Creates a Length in px or %, defaulting the value to 0.

    Parameters
    LengthType t

    - (void) Length(Boolean)

    Failings in Microsoft's C# (not fixed until C# v8 or so) require a parameter here that does literally nothing

    Parameters
    Boolean fakeArgument

    - (void) Length(Single)

    Creates a Length in px

    Parameters
    Single f

    - (void) Length(Single, LengthType)

    Creates a Length in px or % based on what type you choose

    Parameters
    Single f
    LengthType t

    Fields

    - (LengthType) mode

    Internal, do NOT modify directly - this is only public because C# doesnt have a 'package' keyword

    - (Single) value

    Internal, do NOT modify directly - this is only public because C# doesnt have a 'package' keyword

    Properties

    - (Boolean) hasNonRelativeValue

    hasResolvableValue(ContentLength, out Single)

    - (Boolean) hasRelativeValue

    Checks if its a non-fixed (i.e. relative) value, e.g. a percent

    - (Length) None

    Shorthand for creating a new struct with NONE (i.e. initial, 0) value explicitly (C# doesn't fully support struct-constructors)

    Methods

    - (Boolean) Equals(Object)

    Parameters
    Object obj
    Returns
    Boolean
    Overrides
    ValueType.Equals(Object)

    - (Int32) GetHashCode()

    Returns
    Int32
    Overrides
    ValueType.GetHashCode()

    - (Boolean) HasNonRelativeValue(out Single)

    Parameters
    Single resolvedValue
    Returns
    Boolean

    - (Boolean) HasResolvableValue(CSSAvailableLength, out BoxLength)

    Parameters
    CSSAvailableLength parentSize
    BoxLength resolvedValue
    Returns
    Boolean

    - (Boolean) HasResolvableValue(CSSAvailableLength, out Single)

    Checks if this length can be 'resolved' ie turned into a pixel value, using only the supplied (possibly empty) InnerContentLength of its parent. If this is a px value it will always return true, if its a % value it will return true or false depending on the supplied (or missing) ContentLength

    Parameters
    CSSAvailableLength parentSize
    Single resolvedValue
    Returns
    Boolean

    - (Boolean) hasResolvableValue(ContentLength, out Single)

    Checks if this length can be 'resolved' ie turned into a pixel value, using only the supplied (possibly empty) InnerContentLength of its parent. If this is a px value it will always return true, if its a % value it will return true or false depending on the supplied (or missing) ContentLength

    Parameters
    ContentLength parentSize
    Single resolvedValue
    Returns
    Boolean

    - (String) ToString()

    Returns
    String
    Overrides
    ValueType.ToString()

    - (Single) ValueNonRelative()

    Requires the value to be non-relative, i.e. resolvable - and throws an exception if it is not e.g. a fixed value in pixels.

    Returns
    Single
    Exceptions
    Exception

    - (Nullable<Single>) ValueOrNull(CSSAvailableLength)

    Upgraded / preferred / future version of ValueOrNull(Nullable<Single>)

    Parameters
    CSSAvailableLength containerLength
    Returns
    Nullable<Single>

    - (Nullable<Single>) ValueOrNull(Func<>>)

    Resolves a value if possible without even calculating the parent-container's size (e.g. if this is a PIXEL length); if it needs the parent-container's size (e.g. if this is a PERCENT length) it will lazily invoke the supplied lambda; if that lambda fails to provide a value, this returns null (i.e. unresolvable), otherwise it gives the final value resolved into pixels.

    Parameters
    Func<Nullable<Single>> lazilyGenerateDefiniteContainerSize
    Returns
    Nullable<Single>

    - (Nullable<Single>) ValueOrNull(Nullable)

    This is the preferred method: all callers should upgrade to this or a variant. In future this will be further converted to require a ContentLength or as arg instead of a float.

    Already has a variant for CSSAvailableLength -

    Parameters
    Nullable<Single> containerLength
    Returns
    Nullable<Single>

    value if possible, or null if EITHER you requested a "percent of null", OR requested "none of (something)"

    - (Single) ValueOrZero(Nullable)

    Parameters
    Nullable<Single> containerLength
    Returns
    Single

    - (Single) ValueOrZero(Single)

    Parameters
    Single containerLength
    Returns
    Single

    Operators

    - (Boolean) Equality(Length, Length)

    Parameters
    Length left
    Length right
    Returns
    Boolean

    - (Boolean) Inequality(Length, Length)

    Parameters
    Length left
    Length right
    Returns
    Boolean
    In This Article
    Back to top http://flexbuilder.ninja