Return newly added text box shape appended to this shape tree.

        The text box is of the specified size, located at the specified
        position on the slide.
329668
def add_textbox(self, left, top, width, height):
        
        sp = self._add_textbox_sp(left, top, width, height)
        self._recalculate_extents()
        return self._shape_factory(sp)
1111926
function () {
            newEdit = {
                type: "textInsert",
                content: newChild.content,
                parentID: newChild.parent.tagID
            };

            // text changes will generally have afterID and beforeID, but we make
            // special note if it's the first child.
            if (textAfterID) {
                newEdit.afterID = textAfterID;
            } else {
                newEdit.firstChild = true;
            }
            newEdits.push(newEdit);

            // The text node is in the new tree, so we move to the next new tree item
            newIndex++;
        }
975749
public static PopupPanel newPopup (String styleName, Widget contents,
                                       Position pos, Widget target)
    {
        PopupPanel panel = newPopup(styleName, contents);
        show(panel, pos, target);
        return panel;
    }
1303371
function appendHTML() {
		if (!$box && document.body) {
			init = false;
			$window = $(window);
			$box = $tag(div).attr({
				id: colorbox,
				'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
				role: 'dialog',
				tabindex: '-1'
			}).hide();
			$overlay = $tag(div, "Overlay").hide();
			$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
			$wrap = $tag(div, "Wrapper");
			$content = $tag(div, "Content").append(
				$title = $tag(div, "Title"),
				$current = $tag(div, "Current"),
				$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
				$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
				$slideshow = $tag('button', "Slideshow"),
				$loadingOverlay
			);

			$close = $('<button type="button"/>').attr({id:prefix+'Close'});
			
			$wrap.append( // The 3x3 Grid that makes up Colorbox
				$tag(div).append(
					$tag(div, "TopLeft"),
					$topBorder = $tag(div, "TopCenter"),
					$tag(div, "TopRight")
				),
				$tag(div, false, 'clear:left').append(
					$leftBorder = $tag(div, "MiddleLeft"),
					$content,
					$rightBorder = $tag(div, "MiddleRight")
				),
				$tag(div, false, 'clear:left').append(
					$tag(div, "BottomLeft"),
					$bottomBorder = $tag(div, "BottomCenter"),
					$tag(div, "BottomRight")
				)
			).find('div div').css({'float': 'left'});
			
			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
			
			$groupControls = $next.add($prev).add($current).add($slideshow);

			$(document.body).append($overlay, $box.append($wrap, $loadingBay));
		}
	}
433885
function add () {

    var a = arguments; 

    var type, o, ref = false, n = null;

    if( typeof a[0] === 'string' ){ 

        type = a[0];
        o = a[1] || {};

    } else if ( typeof a[0] === 'object' ){ // like dat gui

        ref = true;
        if( a[2] === undefined ) [].push.call(a, {});

        type = a[2].type ? a[2].type : 'slide';//autoType.apply( this, a );

        o = a[2];
        o.name = a[1];
        o.value = a[0][a[1]];

    }

    var name = type.toLowerCase();

    switch( name ){

        case 'bool': n = new Bool(o); break;
        case 'button': n = new Button(o); break;
        case 'circular': n = new Circular(o); break;
        case 'color': n = new Color(o); break;
        case 'fps': n = new Fps(o); break;
        case 'graph': n = new Graph(o); break;
        case 'group': n = new Group(o); break;
        case 'joystick': n = new Joystick(o); break;
        case 'knob': n = new Knob(o); break;
        case 'list': n = new List(o); break;
        case 'numeric': case 'number': n = new Numeric(o); break;
        case 'slide': n = new Slide(o); break;
        case 'textInput': case 'string': n = new TextInput(o); break;
        case 'title': n = new Title(o); break;

    }

    if( n !== null ){

        if( ref ) n.setReferency( a[0], a[1] );
        return n;

    }
    

}
199194
def autoLayout(self):
        
        try:
            direction = self.currentSlide().scene().direction()
        except AttributeError:
            direction = QtGui.QBoxLayout.TopToBottom
        
        size = self.size()
        self._slideshow.resize(size)
        
        prev = self._previousButton
        next = self._nextButton
        
        if direction == QtGui.QBoxLayout.BottomToTop:
            y = 9
        else:
            y = size.height() - prev.height() - 9
        
        prev.move(9, y)
        next.move(size.width() - next.width() - 9, y)
        
        # update the layout for the slides
        for i in range(self._slideshow.count()):
            widget = self._slideshow.widget(i)
            widget.scene().autoLayout(size)
1148559
public static TextBox initTextBox (TextBox box, String text, int maxLength, int visibleLength)
    {
        if (text != null) {
            box.setText(text);
        }
        box.setMaxLength(maxLength > 0 ? maxLength : 255);
        if (visibleLength > 0) {
            box.setVisibleLength(visibleLength);
        }
        return box;
    }
578864
function() {
				var view = that.view,
					editable = that.editable,
					trigger = that.trigger,
					upper = trigger.upper,
					lower = trigger.lower,
					any = upper || lower,
					parent = any.getParent(),
					styleSet = {};

				// Save recent trigger for further insertion.
				// It is necessary due to the fact, that that.trigger may
				// contain different boxTrigger at the moment of insertion
				// or may be even null.
				this.trigger = trigger;

				upper && updateSize( that, upper, true );
				lower && updateSize( that, lower, true );
				updateSize( that, parent, true );

				// Yeah, that's gonna be useful in inline-mode case.
				if ( that.inInlineMode )
					updateEditableSize( that, true );

				// Set X coordinate (left, right, width).
				if ( parent.equals( editable ) ) {
					styleSet.left = view.scroll.x;
					styleSet.right = -view.scroll.x;
					styleSet.width = '';
				} else {
					styleSet.left = any.size.left - any.size.margin.left + view.scroll.x - ( that.inInlineMode ? view.editable.left + view.editable.border.left : 0 );
					styleSet.width = any.size.outerWidth + any.size.margin.left + any.size.margin.right + view.scroll.x;
					styleSet.right = '';
				}

				// Set Y coordinate (top) for trigger consisting of two elements.
				if ( upper && lower ) {
					// No margins at all or they're equal. Place box right between.
					if ( upper.size.margin.bottom === lower.size.margin.top )
						styleSet.top = 0 | ( upper.size.bottom + upper.size.margin.bottom / 2 );
					else {
						// Upper margin < lower margin. Place at lower margin.
						if ( upper.size.margin.bottom < lower.size.margin.top )
							styleSet.top = upper.size.bottom + upper.size.margin.bottom;
						// Upper margin > lower margin. Place at upper margin - lower margin.
						else
							styleSet.top = upper.size.bottom + upper.size.margin.bottom - lower.size.margin.top;
					}
				}
				// Set Y coordinate (top) for single-edge trigger.
				else if ( !upper )
					styleSet.top = lower.size.top - lower.size.margin.top;
				else if ( !lower )
					styleSet.top = upper.size.bottom + upper.size.margin.bottom;

				// Set box button modes if close to the viewport horizontal edge
				// or look forced by the trigger.
				if ( trigger.is( LOOK_TOP ) || inBetween( styleSet.top, view.scroll.y - 15, view.scroll.y + 5 ) ) {
					styleSet.top = that.inInlineMode ? 0 : view.scroll.y;
					this.look( LOOK_TOP );
				} else if ( trigger.is( LOOK_BOTTOM ) || inBetween( styleSet.top, view.pane.bottom - 5, view.pane.bottom + 15 ) ) {
					styleSet.top = that.inInlineMode ?
							view.editable.height + view.editable.padding.top + view.editable.padding.bottom
						:
							view.pane.bottom - 1;

					this.look( LOOK_BOTTOM );
				} else {
					if ( that.inInlineMode )
						styleSet.top -= view.editable.top + view.editable.border.top;

					this.look( LOOK_NORMAL );
				}

				if ( that.inInlineMode ) {
					// 1px bug here...
					styleSet.top--;

					// Consider the editable to be an element with overflow:scroll
					// and non-zero scrollTop/scrollLeft value.
					// For example: divarea editable. (#9383)
					styleSet.top += view.editable.scroll.top;
					styleSet.left += view.editable.scroll.left;
				}

				// Append `px` prefixes.
				for ( var style in styleSet )
					styleSet[ style ] = CKEDITOR.tools.cssLength( styleSet[ style ] );

				this.setStyles( styleSet );
			}
820428
def new(cls, partname, package, slide_layout_part):
        
        sld = CT_Slide.new()
        slide_part = cls(partname, CT.PML_SLIDE, sld, package)
        slide_part.relate_to(slide_layout_part, RT.SLIDE_LAYOUT)
        return slide_part
1232990
private void ShapePostParsing() {
        if (!gvrRenderingDataUSEd) {
            // SHAPE node not being USEd (shared) elsewhere

            // Shape containts Text
            if (gvrTextViewSceneObject != null) {
                gvrTextViewSceneObject.setTextColor((((0xFF << 8)
                        + (int) (shaderSettings.diffuseColor[0] * 255) << 8)
                        + (int) (shaderSettings.diffuseColor[1] * 255) << 8)
                        + (int) (shaderSettings.diffuseColor[2] * 255));
                gvrTextViewSceneObject = null;
            }

            {
                // UNIVERSAL_LIGHTS

                if (!gvrMaterialUSEd) { // if GVRMaterial is NOT set by a USE statement.

                    if (meshAttachedSceneObject == null) {
                        gvrMaterial = shaderSettings.material;
                        gvrRenderData.setMaterial(gvrMaterial);
                    } else {
                        // This GVRSceneObject came with a GVRRenderData and GVRMaterial
                        // already attached.  Examples of this are Text or primitives
                        // such as the Box, Cone, Cylinder, Sphere

                        DefinedItem definedGRRenderingData = null;
                        if (gvrRenderData != null) {
                            // <Shape> node created an unused gvrRenderData
                            // Check if we had a DEF in Shape node so that we can point to
                            // the new gvrRenderData
                            for (DefinedItem definedItem : mDefinedItems) {
                                if (definedItem.getGVRRenderData() == gvrRenderData) {
                                    definedGRRenderingData = definedItem;
                                    break;
                                }
                            }
                        }
                        gvrRenderData = meshAttachedSceneObject.getRenderData();
                        // reset the DEF item to now point to the shader
                        if (definedGRRenderingData != null)
                            definedGRRenderingData.setGVRRenderData(gvrRenderData);
                        gvrMaterial = gvrRenderData.getMaterial();
                    }
                    // X3D doesn't have an ambient color so need to do color
                    // calibration tests on how to set this.
                    gvrMaterial.setVec4("diffuse_color",
                            shaderSettings.diffuseColor[0],
                            shaderSettings.diffuseColor[1],
                            shaderSettings.diffuseColor[2],
                            (1.0f - shaderSettings.getTransparency()) );
                    gvrMaterial.setVec4("specular_color",
                            shaderSettings.specularColor[0],
                            shaderSettings.specularColor[1],
                            shaderSettings.specularColor[2], 1.0f);
                    gvrMaterial.setVec4("emissive_color",
                            shaderSettings.emissiveColor[0],
                            shaderSettings.emissiveColor[1],
                            shaderSettings.emissiveColor[2], 1.0f);
                    gvrMaterial.setFloat("specular_exponent",
                            128.0f * shaderSettings.shininess);

                    if (!shaderSettings.getMaterialName().isEmpty()) {
                        DefinedItem definedItem = new DefinedItem(
                                shaderSettings.getMaterialName());
                        definedItem.setGVRMaterial(gvrMaterial);
                        mDefinedItems.add(definedItem); // Add gvrMaterial to Array list
                        // of DEFined items Clones
                        // objects with USE
                    }

                    if ( shaderSettings.getMultiTexture()) {
                        if ( !shaderSettings.getMultiTextureName().isEmpty() ) {
                            DefinedItem definedItem = new DefinedItem(
                                    shaderSettings.getMultiTextureName() );
                            definedItem.setGVRMaterial(gvrMaterial);
                            mDefinedItems.add(definedItem); // Add gvrMaterial to Array list
                        }
                        gvrMaterial.setTexture("diffuseTexture", shaderSettings.getMultiTextureGVRTexture(0) );
                        gvrMaterial.setTexture("diffuseTexture1", shaderSettings.getMultiTextureGVRTexture(1) );
                        // 0:Mul; 1=for ADD; 2 for SUBTRACT; 3 for DIVIDE; 4=smooth add; 5=Signed add
                        gvrMaterial.setInt("diffuseTexture1_blendop", shaderSettings.getMultiTextureMode().ordinal());
                        gvrMaterial.setTexCoord("diffuseTexture", "a_texcoord", "diffuse_coord");
                        gvrMaterial.setTexCoord("diffuseTexture1", "a_texcoord", "diffuse_coord1");

                    }
                    else if (shaderSettings.texture != null) {
                        gvrMaterial.setTexture("diffuseTexture",
                                shaderSettings.texture);
                        // if the TextureMap is a DEFined item, then set the
                        // GVRMaterial to it as well to help if we set the
                        // in a SCRIPT node.
                        for (DefinedItem definedItem: mDefinedItems) {
                            if ( definedItem.getGVRTexture() == shaderSettings.texture) {
                                definedItem.setGVRMaterial(gvrMaterial);
                                break;
                            }
                        }
                    }

                    if ( !shaderSettings.movieTextures.isEmpty()) {
                        try {
                            GVRVideoSceneObjectPlayer<?> videoSceneObjectPlayer = null;
                            try {
                                videoSceneObjectPlayer = utility.makeExoPlayer(shaderSettings.movieTextures.get(0));
                            }
                            catch (Exception e) {
                                Log.e(TAG, "Exception getting videoSceneObjectPlayer: " + e);
                            }
                            videoSceneObjectPlayer.start();

                            GVRVideoSceneObject gvrVideoSceneObject =
                                    new GVRVideoSceneObject(gvrContext, gvrRenderData.getMesh(), videoSceneObjectPlayer,
                                            GVRVideoSceneObject.GVRVideoType.MONO);
                            currentSceneObject.addChildObject(gvrVideoSceneObject);
                            // Primitives such as Box, Cone, etc come with their own mesh
                            // so we need to remove these.
                            if ( meshAttachedSceneObject != null) {
                                GVRSceneObject primitiveParent = meshAttachedSceneObject.getParent();
                                primitiveParent.removeChildObject(meshAttachedSceneObject);
                            }
                            meshAttachedSceneObject = gvrVideoSceneObject;

                            if (shaderSettings.getMovieTextureName() != null) {
                                gvrVideoSceneObject.setName(shaderSettings.getMovieTextureName());
                                DefinedItem item = new DefinedItem(shaderSettings.getMovieTextureName());
                                item.setGVRVideoSceneObject(gvrVideoSceneObject);
                                mDefinedItems.add(item);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                            Log.e(TAG, "X3D MovieTexture Exception:\n" + e);
                        }
                    }  // end MovieTexture

                    // Texture Transform
                    // If DEFined iteam, add to the DeFinedItem list. Maay be interactive
                    // GearVR may not be doing texture transforms on primitives or text
                    // crash otherwise.

                    if (meshAttachedSceneObject == null) {
                        if (!shaderSettings.getTextureTransformName().isEmpty()) {
                            DefinedItem definedItem = new DefinedItem(
                                    shaderSettings.getTextureTransformName());
                            definedItem.setGVRMaterial(gvrMaterial);
                            definedItem.setTextureTranslation(shaderSettings.getTextureTranslation());
                            definedItem.setTextureCenter(shaderSettings.getTextureCenter());
                            definedItem.setTextureScale(shaderSettings.getTextureScale());
                            definedItem.setTextureRotation(shaderSettings.getTextureRotation().getValue());
                            definedItem.setName(shaderSettings.getTextureTransformName());
                            mDefinedItems.add(definedItem); // Add gvrMaterial to Array list
                        }
                        // Texture Transform Matrix equation:
                        // TC' = -C * S * R * C * T * TC
                        //where TC' is the transformed texture coordinate
                        //   TC is the original Texture Coordinate
                        //   C = center, S = scale, R = rotation, T = translation
                        Matrix3f textureTransform = animationInteractivityManager.SetTextureTransformMatrix(
                                shaderSettings.getTextureTranslation(),
                                shaderSettings.getTextureCenter(),
                                shaderSettings.getTextureScale(),
                                shaderSettings.getTextureRotation());

                        shaderSettings.textureMatrix = textureTransform;
                        float[] texMtx = new float[9];
                        shaderSettings.textureMatrix.get(texMtx);
                        gvrMaterial.setFloatArray("texture_matrix", texMtx);
                    }

                    // Appearance node thus far contains properties of GVRMaterial
                    // node
                    if (!shaderSettings.getAppearanceName().isEmpty()) {
                        DefinedItem definedItem = new DefinedItem(
                                shaderSettings.getAppearanceName());
                        definedItem.setGVRMaterial(gvrMaterial);
                        mDefinedItems.add(definedItem);
                        // Add gvrMaterial to Array list
                        // of DEFined items Clones
                        // objects with USE
                    }

                    if ((shaderSettings.getTransparency() != 0) && (shaderSettings.getTransparency() != 1)) {
                        gvrRenderData.setRenderingOrder(GVRRenderingOrder.TRANSPARENT);
                    }

                } // end ! gvrMaterialUSEd

                gvrTexture = null;
            }
        } // end !gvrRenderingDataUSEd

        if (meshAttachedSceneObject != null) {
            // gvrRenderData already attached to a GVRSceneObject such as a
            // Cone or Cylinder or a Movie Texture
            meshAttachedSceneObject = null;
        } else
            currentSceneObject.attachRenderData(gvrRenderData);

        if (lodManager.shapeLODSceneObject != null) {
            // if this Shape node was a direct child of a
            // Level-of-Detial (LOD),then restore the parent object
            // since we had to add a GVRSceneObject to support
            // the Shape node's attachement to LOD.
            currentSceneObject = currentSceneObject.getParent();
            lodManager.shapeLODSceneObject = null;
        }

        gvrMaterialUSEd = false; // for DEFine and USE, true if we encounter a
        // USE
        gvrRenderingDataUSEd = false; // for DEFine and USE gvrRenderingData for
        // x3d SHAPE node
        gvrRenderData = null;

    }
615239
function () {
		var wrapper = this,
			element = wrapper.element,
			bBox = wrapper.bBox;

		// faking getBBox in exported SVG in legacy IE
		if (!bBox) {
			// faking getBBox in exported SVG in legacy IE (is this a duplicate of the fix for #1079?)
			if (element.nodeName === 'text') {
				element.style.position = ABSOLUTE;
			}

			bBox = wrapper.bBox = {
				x: element.offsetLeft,
				y: element.offsetTop,
				width: element.offsetWidth,
				height: element.offsetHeight
			};
		}

		return bBox;
	}
380094
function(shape) {
            var fillEnabled = shape.getFillEnabled();
            if(fillEnabled) {
                this._fill(shape);
            }
            if(shape.getStrokeEnabled()) {
                this._stroke(shape);
            }
        }
552352
function show() {
            var position,
                ttWidth,
                ttHeight,
                ttPosition;

            // Don't show empty tooltips.
            if ( ! scope.tt_content ) {
              return;
            }

            // If there is a pending remove transition, we must cancel it, lest the
            // tooltip be mysteriously removed.
            if ( transitionTimeout ) {
              $timeout.cancel( transitionTimeout );
            }

            // Set the initial positioning.
            tooltip.css({ top: 0, left: 0, display: 'block' });

            // Now we add it to the DOM because need some info about it. But it's not
            // visible yet anyway.
            if ( appendToBody ) {
                $body.append( tooltip );
            } else {
              element.after( tooltip );
            }

            // Get the position of the directive element.
            position = appendToBody ? $position.offset( element ) : $position.position( element );

            // Get the height and width of the tooltip so we can center it.
            ttWidth = tooltip.prop( 'offsetWidth' );
            ttHeight = tooltip.prop( 'offsetHeight' );

            // Calculate the tooltip's top and left coordinates to center it with
            // this directive.
            switch ( scope.tt_placement ) {
              case 'right':
                ttPosition = {
                  top: position.top + position.height / 2 - ttHeight / 2,
                  left: position.left + position.width
                };
                break;
              case 'bottom':
                ttPosition = {
                  top: position.top + position.height,
                  left: position.left + position.width / 2 - ttWidth / 2
                };
                break;
              case 'left':
                ttPosition = {
                  top: position.top + position.height / 2 - ttHeight / 2,
                  left: position.left - ttWidth
                };
                break;
              default:
                ttPosition = {
                  top: position.top - ttHeight,
                  left: position.left + position.width / 2 - ttWidth / 2
                };
                break;
            }

            ttPosition.top += 'px';
            ttPosition.left += 'px';

            // Now set the calculated positioning.
            tooltip.css( ttPosition );

            // And show the tooltip.
            scope.tt_isOpen = true;
          }
450852
function (x, y, width, height) {

                // create a dummy element
                var clipRect = this.createElement(),
                  isObj = isObject(x);

                // mimic a rectangle with its style object for automatic updating in attr
                return extend(clipRect, {
                    members: [],
                    left: (isObj ? x.x : x) + 1,
                    top: (isObj ? x.y : y) + 1,
                    width: (isObj ? x.width : width) - 1,
                    height: (isObj ? x.height : height) - 1,
                    getCSS: function (wrapper) {
                        var element = wrapper.element,
                          nodeName = element.nodeName,
                          isShape = nodeName === 'shape',
                          inverted = wrapper.inverted,
                          rect = this,
                          top = rect.top - (isShape ? element.offsetTop : 0),
                          left = rect.left,
                          right = left + rect.width,
                          bottom = top + rect.height,
                          ret = {
                              clip: 'rect(' +
                              mathRound(inverted ? left : top) + 'px,' +
                              mathRound(inverted ? bottom : right) + 'px,' +
                              mathRound(inverted ? right : bottom) + 'px,' +
                              mathRound(inverted ? top : left) + 'px)'
                          };

                        // issue 74 workaround
                        if (!inverted && docMode8 && nodeName === 'DIV') {
                            extend(ret, {
                                width: right + PX,
                                height: bottom + PX
                            });
                        }
                        return ret;
                    },

                    // used in attr and animation to update the clipping of all members
                    updateClipping: function () {
                        each(clipRect.members, function (member) {
                            if (member.element) { // Deleted series, like in stock/members/series-remove demo. Should be removed from members, but this will do.
                                member.css(clipRect.getCSS(member));
                            }
                        });
                    }
                });

            }
391697
public static TextBox newTextBox (String text, int maxLength, int visibleLength)
    {
        return initTextBox(new TextBox(), text, maxLength, visibleLength);
    }
1021480
def new_textbox_sp(id_, name, left, top, width, height):
        
        tmpl = CT_Shape._textbox_sp_tmpl()
        xml = tmpl % (id_, name, left, top, width, height)
        sp = parse_xml(xml)
        return sp
500231
private Box locateBox(Box root, int x, int y)
    {
        if (root.isVisible())
        {
            Box found = null;
            //Rectangle bounds = root.getAbsoluteContentBounds().intersection(root.getClipBlock().getAbsoluteContentBounds());
            Rectangle bounds = root.getAbsoluteBounds();
            if (bounds.contains(x, y))
            {
                found = root;
                System.out.println("Fnd: " + found);
                found.drawExtent(((BrowserCanvas)cssbox).getImageGraphics());
            }
            
            //find if there is something smallest that fits among the child boxes
            if (root instanceof ElementBox)
            {
                ElementBox eb = (ElementBox) root;
                for (int i = eb.getStartChild(); i < eb.getEndChild(); i++)
                {
                    Box inside = locateBox(((ElementBox) root).getSubBox(i), x, y);
                    if (inside != null)
                    {
                        if (found == null)
                            found = inside;
                        else
                        {
                            if (inside.getAbsoluteBounds().width * inside.getAbsoluteBounds().height < found.getAbsoluteBounds().width * found.getAbsoluteBounds().height)
                                found = inside;
                        }
                    }
                }
            }
            return found;
        }
        else
            return null;
    }