def expose_button(self, widget, event, font_size, label_dcolor):
        # Init.
        rect = widget.allocation
        image = self.pixbuf_normal.get_pixbuf()
        
        # Get pixbuf along with button's sate.
        if widget.state == gtk.STATE_NORMAL:
            image = self.pixbuf_normal.get_pixbuf()
            label_dcolor = app_theme.get_color('button_text_fg_normal')
            bg_dcolor = app_theme.get_alpha_color('button_bg_normal')
        elif widget.state == gtk.STATE_PRELIGHT:
            image = self.pixbuf_hover.get_pixbuf()
            label_dcolor = app_theme.get_color('button_text_fg_hover')
            bg_dcolor = app_theme.get_alpha_color('button_bg_hover')
        elif widget.state == gtk.STATE_ACTIVE:
            image = self.pixbuf_press.get_pixbuf()
            label_dcolor = app_theme.get_color('button_text_fg_press')
            bg_dcolor = app_theme.get_alpha_color('button_bg_press')
        
        # Draw button.
        cr = widget.window.cairo_create()
        draw_pixbuf(cr, image, rect.x + self.padding_edge, rect.y)
        
        # Draw font.
        if widget.state == gtk.STATE_INSENSITIVE:
            label_color = ui_theme.get_color("disable_text").get_color()
        else:
            label_color = label_dcolor.get_color()
        if self.button_label:
            draw_text(cr, self.button_label, 
                        rect.x + image.get_width() + self.padding_edge + self.padding_middle,
                        rect.y, 
                        rect.width - image.get_width() - self.padding_middle - self.padding_edge*2,
                        rect.height,
                        font_size, 
                        label_color,
                        alignment=pango.ALIGN_LEFT
                        )

        if self.draw_background:
            cr.set_source_rgba(*alpha_color_hex_to_cairo(bg_dcolor.get_color_info()))
            draw_round_rectangle(cr, rect.x, rect.y, rect.width, rect.height, rect.height/2)
            cr.fill()
    
        # Propagate expose to children.
        propagate_expose(widget, event)
        
        return True
def draw_alpha_mask(cr, x, y, width, height, color_name):
    if not isinstance(color_name, tuple):
        color_info = app_theme.get_alpha_color(color_name).get_color_info()
    else:    
        color_info = color_name

    cr.set_source_rgba(*alpha_color_hex_to_cairo(color_info))
    cr.rectangle(x, y, width, height)
    cr.fill()
def draw_alpha_mask(cr, x, y, width, height, color_name):
    if not isinstance(color_name, tuple):
        color_info = app_theme.get_alpha_color(color_name).get_color_info()
    else:
        color_info = color_name

    cr.set_source_rgba(*alpha_color_hex_to_cairo(color_info))
    cr.rectangle(x, y, width, height)
    cr.fill()
    def expose_toggle_button(self, widget, event, font_size, label_dcolor):
        '''
        Callback for `expose-event` signal.
        
        @param widget: ToggleButton widget.
        @param event: Expose event.
        @param button_label: Button label string.
        @param padding_x: horticultural padding value.
        @param font_size: Font size.
        @param label_dcolor: Label DynamicColor.
        '''
        # Init.
        inactive_normal_dpixbuf, inactive_hover_dpixbuf, inactive_press_dpixbuf, inactive_disable_dpixbuf = self.inactive_pixbuf_group
        active_normal_dpixbuf, active_hover_dpixbuf, active_press_dpixbuf, active_disable_dpixbuf = self.active_pixbuf_group
        rect = widget.allocation
        image = inactive_normal_dpixbuf.get_pixbuf()

        if not widget.get_active():
            button_label = self.active_button_label
        else:
            button_label = self.inactive_button_label

        # Get pixbuf along with button's sate.
        if widget.state == gtk.STATE_INSENSITIVE:
            if widget.get_active():
                image = active_disable_dpixbuf.get_pixbuf()
            else:
                image = inactive_disable_dpixbuf.get_pixbuf()
        elif widget.state == gtk.STATE_NORMAL:
            label_dcolor = app_theme.get_color('button_text_fg_normal')
            bg_dcolor = app_theme.get_alpha_color('button_bg_normal')
            image = inactive_normal_dpixbuf.get_pixbuf()
        elif widget.state == gtk.STATE_PRELIGHT:
            label_dcolor = app_theme.get_color('button_text_fg_hover')
            bg_dcolor = app_theme.get_alpha_color('button_bg_hover')
            if not inactive_hover_dpixbuf and not active_hover_dpixbuf:
                if widget.get_active():
                    image = active_normal_dpixbuf.get_pixbuf()
                else:    
                    image = inactive_normal_dpixbuf.get_pixbuf()
            else:    
                if inactive_hover_dpixbuf and active_hover_dpixbuf:
                    if widget.get_active():
                        image = active_hover_dpixbuf.get_pixbuf()
                    else:    
                        image = inactive_hover_dpixbuf.get_pixbuf()
                elif inactive_hover_dpixbuf:        
                    image = inactive_hover_dpixbuf.get_pixbuf()
                elif active_hover_dpixbuf:    
                    image = active_hover_dpixbuf.get_pixbuf()
        elif widget.state == gtk.STATE_ACTIVE:
            if inactive_press_dpixbuf and active_press_dpixbuf:
                if self.button_press_flag:
                    label_dcolor = app_theme.get_color('button_text_fg_press')
                    bg_dcolor = app_theme.get_alpha_color('button_bg_press')
                    if widget.get_active():
                        image = active_press_dpixbuf.get_pixbuf()
                    else:    
                        image = inactive_press_dpixbuf.get_pixbuf()
                else:    
                    label_dcolor = app_theme.get_color('button_text_fg_normal')
                    bg_dcolor = app_theme.get_alpha_color('button_bg_normal')
                    image = active_normal_dpixbuf.get_pixbuf()
            else:        
                image = active_normal_dpixbuf.get_pixbuf()
        
        # Draw button.
        cr = widget.window.cairo_create()
        draw_pixbuf(cr, image, rect.x + self.padding_edge, rect.y)
        
        # Draw font.
        if widget.state == gtk.STATE_INSENSITIVE:
            label_color = ui_theme.get_color("disable_text").get_color()
        else:
            label_color = label_dcolor.get_color()
        if button_label:
            draw_text(cr, button_label, 
                        rect.x + image.get_width() + self.padding_edge + self.padding_middle,
                        rect.y, 
                        rect.width - image.get_width() - self.padding_edge * 2 - self.padding_middle + self.more_width,
                        rect.height,
                        font_size, 
                        label_color,
                        alignment=pango.ALIGN_LEFT
                        )

        if self.draw_background:
            cr.set_source_rgba(*alpha_color_hex_to_cairo(bg_dcolor.get_color_info()))
            draw_round_rectangle(cr, rect.x, rect.y, rect.width, rect.height, rect.height/2)
            cr.fill()
    
        # Propagate expose to children.
        propagate_expose(widget, event)
        
        return True