def layout(self, x, y): """ Lays out all Widgets within this layout. @param x X coordinate of lower left corner @param y Y coordinate of lower left corner """ Widget.layout(self, x, y) row_index = 0 placement = Widget() placement.y = y + self.height for row in self.content: col_index = 0 placement.x = x placement.height = self.max_heights[row_index] placement.y -= placement.height for cell in row: placement.width = self.max_widths[col_index] if cell is not None: if cell.is_expandable(): cell.expand(placement.width, placement.height) cell.layout(*GetRelativePoint(placement, self.anchor, cell, self.anchor, self.offset)) placement.x += placement.width col_index += 1 row_index += 1
def layout(self, x, y): """ Lays out the child Widgets, in order from left to right. @param x X coordinate of the lower left corner @param y Y coordinate of the lower left corner """ Widget.layout(self, x, y) # Expand any expandable content to our height for item in self.content: if item.is_expandable() and item.height < self.height: item.expand(item.width, self.height) left = x if self.align == VALIGN_TOP: for item in self.content: item.layout(left, y + self.height - item.height) left += item.width + self.padding elif self.align == VALIGN_CENTER: for item in self.content: item.layout(left, y + self.height / 2 - item.height / 2) left += item.width + self.padding else: # VALIGN_BOTTOM for item in self.content: item.layout(left, y) left += item.width + self.padding
def layout(self, x, y): """ Lays out the child Widgets, in order from top to bottom. @param x X coordinate of the lower left corner @param y Y coordinate of the lower left corner """ Widget.layout(self, x, y) # Expand any expandable content to our width for item in self.content: if item.is_expandable() and item.width < self.width: item.expand(self.width, item.height) top = y + self.height if self.align == HALIGN_RIGHT: for item in self.content: item.layout(x + self.width - item.width, top - item.height) top -= item.height + self.padding elif self.align == HALIGN_CENTER: for item in self.content: item.layout(x + self.width / 2 - item.width / 2, top - item.height) top -= item.height + self.padding else: # HALIGN_LEFT for item in self.content: item.layout(x, top - item.height) top -= item.height + self.padding
def layout(self, x, y): """ Lays out the child Widgets, in order from left to right. @param x X coordinate of the lower left corner @param y Y coordinate of the lower left corner """ Widget.layout(self, x, y) # Expand any expandable content to our height for item in self.content: if item.is_expandable() and item.height < self.height: item.expand(item.width, self.height) left = x if self.align == VALIGN_TOP: for item in self.content: item.layout(left, y + self.height - item.height) left += item.width + self.padding elif self.align == VALIGN_CENTER: for item in self.content: item.layout(left, y + self.height/2 - item.height/2) left += item.width + self.padding else: # VALIGN_BOTTOM for item in self.content: item.layout(left, y) left += item.width + self.padding
def layout(self, x, y): """ Lays out the child Widgets, in order from top to bottom. @param x X coordinate of the lower left corner @param y Y coordinate of the lower left corner """ Widget.layout(self, x, y) # Expand any expandable content to our width for item in self.content: if item.is_expandable() and item.width < self.width: item.expand(self.width, item.height) top = y + self.height if self.align == HALIGN_RIGHT: for item in self.content: item.layout(x + self.width - item.width, top - item.height) top -= item.height + self.padding elif self.align == HALIGN_CENTER: for item in self.content: item.layout(x + self.width/2 - item.width/2, top - item.height) top -= item.height + self.padding else: # HALIGN_LEFT for item in self.content: item.layout(x, top - item.height) top -= item.height + self.padding
def layout(self, x, y): """ Assigns a new position to the Wrapper. @param x X coordinate of the Wrapper's lower left corner @param y Y coordinate of the Wrapper's lower left corner """ Widget.layout(self, x, y) if self.content is not None: x, y = GetRelativePoint(self, self.anchor, self.content, self.anchor, self.content_offset) self.content.layout(x, y)