Skip to content

Commit

Permalink
modify to support displaying any color of the backgroud in c_label in…
Browse files Browse the repository at this point in the history
…stead of being consistent with the m_parent c_wnd (idea4good#45)
  • Loading branch information
iysheng authored Sep 21, 2020
1 parent 03fd297 commit 6aeadc8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions workspace/widgets_include/label.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ class c_label : public c_wnd
virtual void on_paint()
{
c_rect rect;
unsigned int bg_color = m_bg_color ? m_bg_color \
: m_parent->get_bg_color();
get_screen_rect(rect);

if (m_str)
{
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, m_parent->get_bg_color(), m_z_order);
c_word::draw_string_in_rect(m_surface, m_z_order, m_str, rect, m_font_type, m_font_color, m_parent->get_bg_color(), ALIGN_LEFT | ALIGN_VCENTER);
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, bg_color, m_z_order);
c_word::draw_string_in_rect(m_surface, m_z_order, m_str, rect, m_font_type, m_font_color, bg_color, ALIGN_LEFT | ALIGN_VCENTER);
}
}
protected:
Expand Down

0 comments on commit 6aeadc8

Please sign in to comment.