예제 #1
0
    def DrawCaptionBackground(self, dc, rect, pane):
        """
        Draws the text caption background in the pane.

        :param `dc`: a `wx.DC` device context;
        :param `rect`: the text caption rectangle;
        :param `pane`: the pane for which the text background is drawn.
        """

        active = pane.state & optionActive

        if self._gradient_type == AUI_GRADIENT_NONE:
            if active:
                dc.SetBrush(wx.Brush(self._active_caption_colour))
            else:
                dc.SetBrush(wx.Brush(self._inactive_caption_colour))

            dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)

        else:

            switch_gradient = pane.HasCaptionLeft()
            gradient_type = self._gradient_type
            if switch_gradient:
                gradient_type = (self._gradient_type == AUI_GRADIENT_HORIZONTAL and [AUI_GRADIENT_VERTICAL] or \
                                 [AUI_GRADIENT_HORIZONTAL])[0]

            if active:
                if wx.Platform == "__WXMAC__":
                    DrawGradientRectangle(dc, rect,
                                          self._active_caption_colour,
                                          self._active_caption_gradient_colour,
                                          gradient_type)
                else:
                    DrawGradientRectangle(dc, rect,
                                          self._active_caption_gradient_colour,
                                          self._active_caption_colour,
                                          gradient_type)
            else:
                if wx.Platform == "__WXMAC__":
                    DrawGradientRectangle(
                        dc, rect, self._inactive_caption_gradient_colour,
                        self._inactive_caption_colour, gradient_type)
                else:
                    DrawGradientRectangle(
                        dc, rect, self._inactive_caption_colour,
                        self._inactive_caption_gradient_colour, gradient_type)
    def DrawCaptionBackground(self, dc, rect, active):
        """
        Draws the text caption background in the pane.

        :param `dc`: a wx.DC device context;
        :param `rect`: the text caption rectangle;
        :param `active`: whether the pane is active or not.
        """

        if self._gradient_type == AUI_GRADIENT_NONE:
            if active:
                dc.SetBrush(wx.Brush(self._active_caption_colour))
            else:
                dc.SetBrush(wx.Brush(self._inactive_caption_colour))

            dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
        else:
            if active:
                if wx.Platform == "__WXMAC__":
                    DrawGradientRectangle(dc, rect,
                                          self._active_caption_colour,
                                          self._active_caption_gradient_colour,
                                          self._gradient_type)
                else:
                    DrawGradientRectangle(dc, rect,
                                          self._active_caption_gradient_colour,
                                          self._active_caption_colour,
                                          self._gradient_type)
            else:
                if wx.Platform == "__WXMAC__":
                    DrawGradientRectangle(
                        dc, rect, self._inactive_caption_gradient_colour,
                        self._inactive_caption_colour, self._gradient_type)
                else:
                    DrawGradientRectangle(
                        dc, rect, self._inactive_caption_colour,
                        self._inactive_caption_gradient_colour,
                        self._gradient_type)
예제 #3
0
    def DrawBackground(self, dc, window, orient, rect):
        """
        Draws a background.

        :param `dc`: a `wx.DC` device context;
        :param `window`: an instance of `wx.Window`;
        :param `orient`: the gradient (if any) orientation;
        :param `rect`: the background rectangle.
        """

        dc.SetPen(wx.TRANSPARENT_PEN)
        if wx.Platform == "__WXMAC__":
            # we have to clear first, otherwise we are drawing a light striped pattern
            # over an already darker striped background
            dc.SetBrush(wx.WHITE_BRUSH)
            dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)

        DrawGradientRectangle(dc, rect, self._background_brush.GetColour(),
                              self._background_gradient_colour,
                              AUI_GRADIENT_HORIZONTAL, rect.x, 700)