Ver Fonte

LibGUI: Use SystemColor::Text in more places

Andreas Kling há 5 anos atrás
pai
commit
9171aef724

+ 2 - 0
Libraries/LibDraw/Color.h

@@ -35,6 +35,8 @@ enum class SystemColor {
     ThreedShadow1,
     ThreedShadow1,
     ThreedShadow2,
     ThreedShadow2,
     HoverHighlight,
     HoverHighlight,
+
+    DisabledText = ThreedShadow1,
 };
 };
 
 
 class Color {
 class Color {

+ 1 - 1
Libraries/LibGUI/GAbstractButton.cpp

@@ -154,7 +154,7 @@ void GAbstractButton::paint_text(GPainter& painter, const Rect& rect, const Font
 
 
     if (text().is_empty())
     if (text().is_empty())
         return;
         return;
-    painter.draw_text(clipped_rect, text(), font, text_alignment, foreground_color(), TextElision::Right);
+    painter.draw_text(clipped_rect, text(), font, text_alignment, SystemColor::Text, TextElision::Right);
     if (is_focused())
     if (is_focused())
         painter.draw_rect(clipped_rect.inflated(6, 4), Color(140, 140, 140));
         painter.draw_rect(clipped_rect.inflated(6, 4), Color(140, 140, 140));
 }
 }

+ 1 - 1
Libraries/LibGUI/GListView.cpp

@@ -129,7 +129,7 @@ void GListView::paint_event(GPaintEvent& event)
             if (is_selected_row)
             if (is_selected_row)
                 text_color = Color::White;
                 text_color = Color::White;
             else
             else
-                text_color = model()->data(index, GModel::Role::ForegroundColor).to_color(Color::Black);
+                text_color = model()->data(index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
             auto text_rect = row_rect;
             auto text_rect = row_rect;
             text_rect.move_by(horizontal_padding(), 0);
             text_rect.move_by(horizontal_padding(), 0);
             text_rect.set_width(text_rect.width() - horizontal_padding() * 2);
             text_rect.set_width(text_rect.width() - horizontal_padding() * 2);

+ 2 - 2
Libraries/LibGUI/GScrollBar.cpp

@@ -209,8 +209,8 @@ void GScrollBar::paint_event(GPaintEvent& event)
     StylePainter::paint_button(painter, increment_button_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::IncrementButton);
     StylePainter::paint_button(painter, increment_button_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::IncrementButton);
 
 
     if (length(orientation()) > default_button_size()) {
     if (length(orientation()) > default_button_size()) {
-        painter.draw_bitmap(decrement_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_up_arrow_bitmap : *s_left_arrow_bitmap, has_scrubber() ? Color::Black : Color::MidGray);
-        painter.draw_bitmap(increment_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_down_arrow_bitmap : *s_right_arrow_bitmap, has_scrubber() ? Color::Black : Color::MidGray);
+        painter.draw_bitmap(decrement_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_up_arrow_bitmap : *s_left_arrow_bitmap, has_scrubber() ? SystemColor::Text : SystemColor::DisabledText);
+        painter.draw_bitmap(increment_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_down_arrow_bitmap : *s_right_arrow_bitmap, has_scrubber() ? SystemColor::Text : SystemColor::DisabledText);
     }
     }
 
 
     if (has_scrubber())
     if (has_scrubber())

+ 1 - 1
Libraries/LibGUI/GTableView.cpp

@@ -95,7 +95,7 @@ void GTableView::paint_event(GPaintEvent& event)
                     if (is_selected_row)
                     if (is_selected_row)
                         text_color = Color::White;
                         text_color = Color::White;
                     else
                     else
-                        text_color = model()->data(cell_index, GModel::Role::ForegroundColor).to_color(Color::Black);
+                        text_color = model()->data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
                     painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
                     painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
                 }
                 }
             }
             }

+ 2 - 2
Libraries/LibGUI/GTreeView.cpp

@@ -178,7 +178,7 @@ void GTreeView::paint_event(GPaintEvent& event)
 
 
         bool is_selected_row = selection().contains(index);
         bool is_selected_row = selection().contains(index);
 
 
-        Color text_color = Color::Black;
+        Color text_color = SystemColor::Text;
         if (is_selected_row)
         if (is_selected_row)
             text_color = Color::White;
             text_color = Color::White;
 
 
@@ -226,7 +226,7 @@ void GTreeView::paint_event(GPaintEvent& event)
                             painter.blit(cell_rect.location(), *bitmap, bitmap->rect());
                             painter.blit(cell_rect.location(), *bitmap, bitmap->rect());
                     } else {
                     } else {
                         if (!is_selected_row)
                         if (!is_selected_row)
-                            text_color = model.data(cell_index, GModel::Role::ForegroundColor).to_color(Color::Black);
+                            text_color = model.data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
                         painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
                         painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
                     }
                     }
                 }
                 }