canvas-gui
    Preparing search index...

    Class CvsPoster

    Similar to the label contol but with much greater controls over text rendering

    Although it is possible to specify font, text size and style for the label control these are applied to the whole text. The poster control removes this restriction allowing the text attributes to be changed for any part of the text.

    Configurable attributes include

    • Font: multiple fonts can be used within one poster control. Any logical or system font or any true-type-font (TTF) previously loaded from a file can be used.
    • Text size:
    • Text style: normal, bold, thin, italic, oblique
    • Multiple paragraphs: each having their own
      • left, right, center or justied text alignment
      • leading (vetical gap) from previous paragraph
      • left and right indents
      • vertical line spacing (leading)
    • Glyphs: the fill and outline colors can be specified as well as the outine stroke weight.
    • Icons: multiple images positioned inside the poster control independantly of any text.
    • Character entities: virtually all HTML Character Entities can be embedded in the text.
    • To achieve this the user must provide tagged-text in a similar style to that used in HTML documents.

    Index

    Accessors

    • get colorCount(): number

      Get the number of colors in this poster

      Returns number

    • get fontCount(): number

      Get the number of fonts in this poster

      Returns number

    • get id(): string

      The unique identifier for this control.

      Returns string

    • get isEnabled(): boolean

      This is true if the control can respond to UI events else false.

      Use enable() and disable() to enable and disable it.

      Returns boolean

    • get isOpaque(): boolean

      This is true if the control background is opaque else false.

      Use opaque() and transparent() display / hide the background.

      Returns boolean

    • get isVisible(): boolean

      This is true if the control is visible else false.

      Use hide() and show() to set visibility.

      Returns boolean

    • get type(): string

      The type name for this control.
      (type name = class name without the Cvs prefix)

      Returns string

    • get wrapWidth(): number

      The maximum line length (pixels) possible. The length depends on the poster width and the horizontal margins.

      Returns number

    Methods

    • Add a child to this control using its relative position [rx, ry]. If rx and ry are not provided then it uses the values set in the child.

      Parameters

      • child: any

        is the actual control or its id

      • Optionalrx: number
      • Optionalry: number

      Returns any

      this control

    • This sets the background color to be used when the poster has been set to opaque by calling the 'opaque(alpha)' function.

      This method has no effect if the poster state is transparent.

      Parameters

      • index: number = 2

        the index into the colors array

      Returns CvsPoster

      this control

    • By default the user can select one of the following colors -

      • gf0 'transparent'
      • gf1 the poster's color scheme text color
      • gf2 the poster's color scheme opaque color

      Add to or replace these colors with a user defined color list.

      Parameters

      • colors: string | object | (string | object)[]

        a color or an array of CSS color definitions.

      • replace: boolean = false

        if true existing colors are replaced but if false (default) the colors are appended to existing colors.

      Returns string[] | CvsPoster

      this control

    • Execute one or more configuration methods on this control.

      The parameter is a user defined object where each field is the name of a configuration method and its value is the method's parameter(s). Multiple parameters should be in an array and use 'undefined' if the method expects no parameters.

      This object will change the color scheme, text size and alignment, it will also make sure it is visible.

      { scheme : 'red', textSize : 12, textAlign: ['left', 'top'], show : undefined }
      
      If the field name does not exist or not a valid function of this control it will be silently ignored.

      There is no error checking on the parameters, it is up to the user to ensure they are valid for the control method.

      Parameters

      • cfg: any

        the configuration object

      Returns CvsPoster

      this control

    • Get or set the corner radii used for this control.

      To set the radii the parameters must be one of the following

      • an array of 4 numbers.
      • a comma seperated list of 4 numbers.
      • a single number to be used for all 4 radii.

      If no parameter is passed or does not match one of the above then an array of the currently used radii values.

      Parameters

      • ...c: any

        valid radii combination

      Returns number[] | CvsControl

      an array of the currently used radii values

    • By default the user can select from one the logical fonts -

      • ft0 'serif'
      • ft1 'sans-serif'
      • ft2 'monospace'
      • ft3 'fantasy'
      • ft4 'cursive'

      Add to or replace these fonts with a user defined font list.

      Parameters

      • fonts: string | object | (string | object)[]

        an array of one or more fonts.

      • replace: boolean = false

        if true existing fonts are replaced but if false (default) the fonts are appended to existing fonts.

      Returns string[] | CvsPoster

      this control

    • Make this control invisible.

      Parameters

      • Optionalcascade: boolean

        if true hide any children

      Returns CvsControl

      this control

    • Parameters

      • icon: cvsIcon

        the icon to display

      • x: number = 0

        horzontal position inside poster

      • y: number = 0

        vertical position inside poster

      Returns CvsPoster

      this control

    • Remove this control from its parent

      Returns CvsPin

      this control

    • Sets the internal margins to use when formating text.

      Parameters

      • mgnX: number = 0

        left / right margin

      • mgnY: number = mgnX

        top margin

      Returns CvsPoster

      this control;

    • Move this control relative to current position.

      Parameters

      • x: number

        horizontal distance

      • y: number

        vertical distance

      Returns CvsPoster

      this control

    • Move this control to an absolute position.

      Parameters

      • x: number

        horizontal position

      • y: number

        vertical position

      Returns CvsPoster

      this control

    • Makes the controls background opaque. The actual color depends on the controls color scheme.

      The second parameter, alpha, is optional and controls the level of opaqueness from 0 - transparent to 255 - fully opaque (default value).

      Parameters

      • alpha: number = 255

        alpha value for controls background color.

      Returns CvsControl

      this control

    • Adds this control to another control which becomes its parent.

      Parameters

      • parent: any

        is the parental control or its id

      • Optionalrx: number

        x position relative to parent

      • Optionalry: number

        y position relative to parent

      Returns CvsPin

      this control

    • Remove a child control from this one so that it stays in same screen position.

      Parameters

      • child: any

        the control to remove or its id

      Returns CvsPoster

      this control

    • Removes all icons added to this poster.

      Returns CvsPoster

      this control

    • If the name of a valid color scheme is provided then it will used to display this control, non-existant scheme names will be ignored. In both cases this control is returned.

      If there is no parameter it returns the name of the current color scheme used by this control.

      Parameters

      • Optionalname: string

        the color scheme name e.g. 'blue'

      • Optionalcascade: boolean

        if true propogate scheme to all child controls.

      Returns ColorScheme | CvsControl

      this control or the control's color scheme

    • An alternative to the enable / disable methods.

      Parameters

      • enable: boolean

        true / false

      • Optionalcascade: boolean

        true apply to all children

      Returns CvsPin

      this control

    • An alternative to the show / hide methods.

      Parameters

      • visible: boolean

        true / false

      • Optionalcascade: boolean

        if true hide children

      Returns CvsPin

      this control

    • Make this control visible.

      Parameters

      • Optionalcascade: boolean

        if true then show any children

      Returns CvsControl

      this control

    • This method accepts the tagged text which it formats and styles ready to display in the control.

      The text can be a single string or an array of strings. If it is an array then the elements will be concatenated using the 'separator' between elements.

      Parameters

      • text: string | string[]

        a string or an array of strings

      • separator: string = ''

        default value is an empty string.

      Returns CvsPoster

      this control

    • Makes the controls background fully transparent.

      Returns CvsControl

      this control