def render(self, rect, data):
        """Draws the managed element in the correct alignment."""
        # We can't use our get minimum size, because that enforces
        # the size limits.
        size = self.element.get_minimum_size(data)

        # Assume we're bottom left at our natural size.
        x = rect.x
        y = rect.y
        w = size.x
        h = size.y

        extra_width = rect.w - w
        extra_height = rect.h - h

        if self.horizontal_align == AlignLM.ALIGN_CENTER:
            x += extra_width * 0.5
        elif self.horizontal_align == AlignLM.ALIGN_RIGHT:
            x += extra_width
        elif self.horizontal_align == AlignLM.GROW_X:
            w = rect.w

        if self.vertical_align == AlignLM.ALIGN_MIDDLE:
            y += extra_height * 0.5
        elif self.vertical_align == AlignLM.ALIGN_TOP:
            y += extra_height
        elif self.vertical_align == AlignLM.GROW_Y:
            h = rect.h

        self.element.render(datatypes.Rectangle(x, y, w, h), data)
def render ( self , rect , data ) : size = self . element . get_minimum_size ( data ) x = rect . x y = rect . y w = size . x h = size . y extra_width = rect . w - w extra_height = rect . h - h if self . horizontal_align == AlignLM . ALIGN_CENTER : x += extra_width * 0.5 elif self . horizontal_align == AlignLM . ALIGN_RIGHT : x += extra_width elif self . horizontal_align == AlignLM . GROW_X : w = rect . w if self . vertical_align == AlignLM . ALIGN_MIDDLE : y += extra_height * 0.5 elif self . vertical_align == AlignLM . ALIGN_TOP : y += extra_height elif self . vertical_align == AlignLM . GROW_Y : h = rect . h self . element . render ( datatypes . Rectangle ( x , y , w , h ) , data )
Draws the managed element in the correct alignment.