def setCaptionBar(self, captionBar): if self._captionBar: Base.removeChild(self, self._captionBar) self._captionBar = captionBar Base.addChild(self, self._captionBar) self._captionBar.setWindow(self) self._captionBar.moveto(self.theme.getFrameBorderLeft(), self.theme.getFrameBorderTop()) self._captionBar.resize(self.innerRect[2], self._captionBar.height) self.calcInnerRect() self.placeInnerObjects()
def replacePanel(self, panel): for c in self.children: if c.id == self._panel.id: self.children.remove(c) self._panel = panel Base.addChild(self, self._panel) self._panel.setWindow(self) self.calcInnerRect() self.placeInnerObjects() self._panel.moveto(self.innerRect[0], self.innerRect[1]) self._panel.resize(self.innerRect[2], self.innerRect[3]) self._panel.calcInnerRect() self._panel.placeInnerObjects()
def addChild(self, child, option = None): if child.getID() == "": self.createChildID(child) Base.addChild(self, child) self.childOptions[child.id] = option if child.width > self.width: self.width = child.width if child.height > self.height: self.height = child.height # panel cannot be larger than parent if self.parent: if self.width > self.parent.width: self.width = self.parent.width if self.height > self.parent.height: self.height = self.parent.height
def __init__(self, x, y, w, h, topmost = 0): self._panel = Panel() Base.__init__(self) self.topMost = topmost # the content panel is added as a child through Base::addChild to avoid recursively adding it to itself Base.addChild(self, self._panel) self._panel.setWindow(self) self._panel.setParent(self) self.placeInnerObjects() self.drawCommands = [] # these are drawing callbacks to draw _after_ all the widgets are drawn self.drawLastCallbacks = [] self.moveto(x, y) self.resize(w, h) getDesktop().addWindow(self) # Create the graphics context that will be used to display this window self.graphicsContext = getPresenter().getDeviceContext().createGraphicsContext((w, h))