.. role:: ts-api-decorator

#######
TextBox
#######

.. js:module:: Markup.Shapes
   :noindex:

.. container:: ts-api-section

   .. js:class:: TextBox

      This object encapsulates a text and rectangle object into one entity. Sizing of the box and positioning of the string is handled by the system.
      This class consists of two portions which control the look and feel of the markup. The text portion controls the styling of the text,
      while the box portion controls the styling of the outer rectangle.



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~Markup.Shapes.TextBox.constructor`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~Markup.Shapes.TextBox.getBoxPortion`
   * :js:meth:`~Markup.Shapes.TextBox.getPadding`
   * :js:meth:`~Markup.Shapes.TextBox.getPosition`
   * :js:meth:`~Markup.Shapes.TextBox.getTextPortion`
   * :js:meth:`~Markup.Shapes.TextBox.getTextString`
   * :js:meth:`~Markup.Shapes.TextBox.setPadding`
   * :js:meth:`~Markup.Shapes.TextBox.setPosition`
   * :js:meth:`~Markup.Shapes.TextBox.setTextString`





------------

Constructors
============

.. container:: ts-api-section

   .. js:function:: TextBox.constructor([ position[, text]])

      :param position: :ts-api-decorator:`optional` the screen space point of the top left of the box. Default value is (0,0).
      :type position: Point2
      :param text: :ts-api-decorator:`optional` the text string for the box. Default value is empty string.
      :type text: string


      Creates a new TextBox Markup Shape.


      :rtype: TextBox



Methods
=======

.. rst-class:: ts-api-section

getBoxPortion
-------------

.. js:method:: TextBox.getBoxPortion()



   Gets the Box portion of the TextBox. Use the methods on this object to modify the appearance of the rectangle around the text string

   :returns: the rectangle markup object.


   :rtype: RectangleBase

.. rst-class:: ts-api-section

getPadding
----------

.. js:method:: TextBox.getPadding()



   Gets the Pixel distance between the text and outer rectangle

   :returns: the padding value.


   :rtype: number

.. rst-class:: ts-api-section

getPosition
-----------

.. js:method:: TextBox.getPosition()



   Gets the position in screen space of the top-left corner of the TextBox rectangle

   :returns: the TextBox position


   :rtype: Point2

.. rst-class:: ts-api-section

getTextPortion
--------------

.. js:method:: TextBox.getTextPortion()



   Gets the Text portion of the TextBox. Use the methods on this object to modify the appearance of the text string

   :returns: the text markup object


   :rtype: TextMarkupBase

.. rst-class:: ts-api-section

getTextString
-------------

.. js:method:: TextBox.getTextString()



   Gets the text string for this box

   :returns: the text string


   :rtype: string

.. rst-class:: ts-api-section

setPadding
----------

.. js:method:: TextBox.setPadding( padding)

   :param padding: the padding value.
   :type padding: number


   Sets the Pixel distance between the text and outer rectangle


   :rtype: void

.. rst-class:: ts-api-section

setPosition
-----------

.. js:method:: TextBox.setPosition( position)

   :param position: the TextBox position
   :type position: Point2


   Sets the position in screen space of the top-left corner of the TextBox rectangle


   :rtype: void

.. rst-class:: ts-api-section

setTextString
-------------

.. js:method:: TextBox.setTextString( text)

   :param text: the text string
   :type text: string


   Sets the text string for this box


   :rtype: void

