def _paint_bg(self, dc): """ Paints the background into the supplied device context using the associated ImageSlice object and returns the image slice used (if any). """ from image_slice import paint_parent # Repaint the parent's theme (if necessary): paint_parent(dc, self.control) # Draw the background theme (if any): if self.theme is not None: slice = self.theme.image_slice if slice is not None: wdx, wdy = self.control.GetClientSize() slice.fill(dc, 0, 0, wdx, wdy, True) if self.debug: dc.SetPen(wx.Pen(wx.RED)) dc.SetBrush(wx.TRANSPARENT_BRUSH) theme = self.theme border = theme.border dc.DrawRectangle(border.left, border.top, wdx - border.right - border.left, wdy - border.bottom - border.top) dc.DrawRectangle(border.left + 3, border.top + 3, wdx - border.right - border.left - 6, wdy - border.bottom - border.top - 6) content = theme.content x = slice.xleft + content.left y = slice.xtop + content.top dc.DrawRectangle( x - 1, y - 1, wdx - slice.xright - content.right - x + 2, wdy - slice.xbottom - content.bottom - y + 2) label = theme.label if slice.xtop >= slice.xbottom: y, dy = 0, slice.xtop else: y, dy = wdy - slice.xbottom, slice.xbottom if dy >= 13: x = slice.xleft + label.left y += label.top dc.DrawRectangle( x - 1, y - 1, wdx - slice.xright - label.right - x + 2, dy - label.bottom - label.top + 2)
def _paint_bg ( self, dc ): """ Paints the background into the supplied device context using the associated ImageSlice object and returns the image slice used (if any). """ from image_slice import paint_parent # Repaint the parent's theme (if necessary): paint_parent( dc, self.control ) # Draw the background theme (if any): if self.theme is not None: slice = self.theme.image_slice if slice is not None: wdx, wdy = self.control.GetClientSize() slice.fill( dc, 0, 0, wdx, wdy, True ) if self.debug: dc.SetPen( wx.Pen( wx.RED ) ) dc.SetBrush( wx.TRANSPARENT_BRUSH ) theme = self.theme border = theme.border dc.DrawRectangle( border.left, border.top, wdx - border.right - border.left, wdy - border.bottom - border.top ) dc.DrawRectangle( border.left + 3, border.top + 3, wdx - border.right - border.left - 6, wdy - border.bottom - border.top - 6 ) content = theme.content x = slice.xleft + content.left y = slice.xtop + content.top dc.DrawRectangle( x - 1, y - 1, wdx - slice.xright - content.right - x + 2, wdy - slice.xbottom - content.bottom - y + 2 ) label = theme.label if slice.xtop >= slice.xbottom: y, dy = 0, slice.xtop else: y, dy = wdy - slice.xbottom, slice.xbottom if dy >= 13: x = slice.xleft + label.left y += label.top dc.DrawRectangle( x - 1, y - 1, wdx - slice.xright - label.right - x + 2, dy - label.bottom - label.top + 2 )
def _on_paint(self, event): """ Paint the background using the associated ImageSlice object. """ dc = BufferDC(self) paint_parent(dc, self) if self._theme is not None: wdx, wdy = self.GetClientSize() self._image_slice.fill(dc, 0, 0, wdx, wdy, True) dc.SetTextForeground(self._image_slice.content_color) dc.SetBackgroundMode(wx.TRANSPARENT) dc.SetFont(self.GetFont()) tx, ty, tdx, tdy = self._get_text_bounds() dc.DrawText(self._text, tx, ty) dc.copy()
def _on_paint ( self, event ): """ Paint the background using the associated ImageSlice object. """ dc = BufferDC( self ) paint_parent( dc, self ) if self._theme is not None: wdx, wdy = self.GetClientSize() self._image_slice.fill( dc, 0, 0, wdx, wdy, True ) dc.SetTextForeground( self._image_slice.content_color ) dc.SetBackgroundMode( wx.TRANSPARENT ) dc.SetFont( self.GetFont() ) tx, ty, tdx, tdy = self._get_text_bounds() dc.DrawText( self._text, tx, ty ) dc.copy()
def _on_paint ( self, event ): """ Paint the background using the associated ImageSlice object. """ control = self.control dc = BufferDC( control ) # Draw the background: factory = self.factory color = factory.color_ if self._x is not None: if factory.active_color_ is not None: color = factory.active_color_ elif self._hover: if factory.hover_color_ is not None: color = factory.hover_color_ if color is None: paint_parent( dc, control ) brush = wx.TRANSPARENT_BRUSH else: brush = wx.Brush( color ) color = factory.border_color_ if color is not None: pen = wx.Pen( color ) else: pen = wx.TRANSPARENT_PEN if (pen != wx.TRANSPARENT_PEN) or (brush != wx.TRANSPARENT_BRUSH): wdx, wdy = control.GetClientSizeTuple() dc.SetBrush( brush ) dc.SetPen( pen ) dc.DrawRectangle( 0, 0, wdx, wdy ) # Draw the current text value: dc.SetBackgroundMode( wx.TRANSPARENT ) dc.SetTextForeground( factory.text_color_ ) dc.SetFont( control.GetFont() ) tx, ty, tdx, tdy = self._get_text_bounds() dc.DrawText( self.text, tx, ty ) # Copy the buffer contents to the display: dc.copy()
def _on_paint(self, event): """ Paint the background using the associated ImageSlice object. """ control = self.control dc = BufferDC(control) # Draw the background: factory = self.factory color = factory.color_ if self._x is not None: if factory.active_color_ is not None: color = factory.active_color_ elif self._hover: if factory.hover_color_ is not None: color = factory.hover_color_ if color is None: paint_parent(dc, control) brush = wx.TRANSPARENT_BRUSH else: brush = wx.Brush(color) color = factory.border_color_ if color is not None: pen = wx.Pen(color) else: pen = wx.TRANSPARENT_PEN if (pen != wx.TRANSPARENT_PEN) or (brush != wx.TRANSPARENT_BRUSH): wdx, wdy = control.GetClientSizeTuple() dc.SetBrush(brush) dc.SetPen(pen) dc.DrawRectangle(0, 0, wdx, wdy) # Draw the current text value: dc.SetBackgroundMode(wx.TRANSPARENT) dc.SetTextForeground(factory.text_color_) dc.SetFont(control.GetFont()) tx, ty, tdx, tdy = self._get_text_bounds() dc.DrawText(self.text, tx, ty) # Copy the buffer contents to the display: dc.copy()
def _on_paint(self, event): """ Paint the background using the associated ImageSlice object. """ control = self.control dc = BufferDC(control) slice = paint_parent(dc, control) slice2 = self.image_slice if slice2 is not default_image_slice: wdx, wdy = control.GetClientSizeTuple() slice2.fill(dc, 0, 0, wdx, wdy, True) slice = slice2 elif slice is None: slice = slice2 dc.SetBackgroundMode(wx.TRANSPARENT) dc.SetTextForeground(slice.content_color) dc.SetFont(control.GetFont()) tx, ty, tdx, tdy = self._get_text_bounds() dc.DrawText(self._get_text(), tx, ty) dc.copy()
def _paint ( self, event ): """ Paint the background using the associated ImageSlice object. """ paint_parent( wx.PaintDC( self.control ), self.control )
def _paint(self, event): """ Paint the background using the associated ImageSlice object. """ paint_parent(wx.PaintDC(self.control), self.control)