mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 01:02:45 +00:00 
			
		
		
		
	LibDraw: Add Button and ButtonText system theme colors
These are now separate from the Window and WindowText colors.
This commit is contained in:
		
							parent
							
								
									9171aef724
								
							
						
					
					
						commit
						df3a2dba43
					
				
					 21 changed files with 57 additions and 39 deletions
				
			
		|  | @ -22,7 +22,10 @@ MenuStripe=#bbb7b0 | ||||||
| MenuSelection=#ad714f | MenuSelection=#ad714f | ||||||
| 
 | 
 | ||||||
| Window=#d4d0c8 | Window=#d4d0c8 | ||||||
| Text=black | WindowText=black | ||||||
|  | Button=#d4d0c8 | ||||||
|  | ButtonText=black | ||||||
|  | 
 | ||||||
| Base=white | Base=white | ||||||
| 
 | 
 | ||||||
| ThreedHighlight=white | ThreedHighlight=white | ||||||
|  |  | ||||||
|  | @ -21,8 +21,11 @@ MenuBase=#57691f | ||||||
| MenuStripe=#2b3018 | MenuStripe=#2b3018 | ||||||
| MenuSelection=#ff8742 | MenuSelection=#ff8742 | ||||||
| 
 | 
 | ||||||
| Window=#d46c64 | Window=#5a0103 | ||||||
| Text=black | WindowText=white | ||||||
|  | Button=#d46c64 | ||||||
|  | ButtonText=black | ||||||
|  | 
 | ||||||
| Base=#d3d7c4 | Base=#d3d7c4 | ||||||
| 
 | 
 | ||||||
| ThreedHighlight=#e69e99 | ThreedHighlight=#e69e99 | ||||||
|  |  | ||||||
|  | @ -11,8 +11,8 @@ Color::Color(SystemColor system_color) | ||||||
|     case SystemColor::Window: |     case SystemColor::Window: | ||||||
|         m_value = theme.window.value(); |         m_value = theme.window.value(); | ||||||
|         break; |         break; | ||||||
|     case SystemColor::Text: |     case SystemColor::WindowText: | ||||||
|         m_value = theme.text.value(); |         m_value = theme.window_text.value(); | ||||||
|         break; |         break; | ||||||
|     case SystemColor::Base: |     case SystemColor::Base: | ||||||
|         m_value = theme.base.value(); |         m_value = theme.base.value(); | ||||||
|  | @ -26,6 +26,12 @@ Color::Color(SystemColor system_color) | ||||||
|     case SystemColor::ThreedHighlight: |     case SystemColor::ThreedHighlight: | ||||||
|         m_value = theme.threed_highlight.value(); |         m_value = theme.threed_highlight.value(); | ||||||
|         break; |         break; | ||||||
|  |     case SystemColor::Button: | ||||||
|  |         m_value = theme.button.value(); | ||||||
|  |         break; | ||||||
|  |     case SystemColor::ButtonText: | ||||||
|  |         m_value = theme.button_text.value(); | ||||||
|  |         break; | ||||||
|     case SystemColor::HoverHighlight: |     case SystemColor::HoverHighlight: | ||||||
|         m_value = theme.hover_highlight.value(); |         m_value = theme.hover_highlight.value(); | ||||||
|         break; |         break; | ||||||
|  |  | ||||||
|  | @ -29,7 +29,9 @@ enum class SystemColor { | ||||||
|     MenuBase, |     MenuBase, | ||||||
|     MenuSelection, |     MenuSelection, | ||||||
|     Window, |     Window, | ||||||
|     Text, |     WindowText, | ||||||
|  |     Button, | ||||||
|  |     ButtonText, | ||||||
|     Base, |     Base, | ||||||
|     ThreedHighlight, |     ThreedHighlight, | ||||||
|     ThreedShadow1, |     ThreedShadow1, | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| 
 | 
 | ||||||
| void StylePainter::paint_tab_button(Painter& painter, const Rect& rect, bool active, bool hovered, bool enabled) | void StylePainter::paint_tab_button(Painter& painter, const Rect& rect, bool active, bool hovered, bool enabled) | ||||||
| { | { | ||||||
|     Color base_color = SystemColor::Window; |     Color base_color = SystemColor::Button; | ||||||
|     Color highlight_color2 = SystemColor::ThreedHighlight; |     Color highlight_color2 = SystemColor::ThreedHighlight; | ||||||
|     Color shadow_color1 = SystemColor::ThreedShadow1; |     Color shadow_color1 = SystemColor::ThreedShadow1; | ||||||
|     Color shadow_color2 = SystemColor::ThreedShadow2; |     Color shadow_color2 = SystemColor::ThreedShadow2; | ||||||
|  | @ -44,7 +44,7 @@ void StylePainter::paint_tab_button(Painter& painter, const Rect& rect, bool act | ||||||
| 
 | 
 | ||||||
| static void paint_button_new(Painter& painter, const Rect& rect, bool pressed, bool checked, bool hovered, bool enabled) | static void paint_button_new(Painter& painter, const Rect& rect, bool pressed, bool checked, bool hovered, bool enabled) | ||||||
| { | { | ||||||
|     Color button_color = SystemColor::Window; |     Color button_color = SystemColor::Button; | ||||||
|     Color highlight_color2 = SystemColor::ThreedHighlight; |     Color highlight_color2 = SystemColor::ThreedHighlight; | ||||||
|     Color shadow_color1 = SystemColor::ThreedShadow1; |     Color shadow_color1 = SystemColor::ThreedShadow1; | ||||||
|     Color shadow_color2 = SystemColor::ThreedShadow2; |     Color shadow_color2 = SystemColor::ThreedShadow2; | ||||||
|  | @ -53,7 +53,7 @@ static void paint_button_new(Painter& painter, const Rect& rect, bool pressed, b | ||||||
|         if (hovered) |         if (hovered) | ||||||
|             button_color = SystemColor::HoverHighlight; |             button_color = SystemColor::HoverHighlight; | ||||||
|         else |         else | ||||||
|             button_color = SystemColor::Window; |             button_color = SystemColor::Button; | ||||||
|     } else if (hovered && enabled) |     } else if (hovered && enabled) | ||||||
|         button_color = StylePainter::hover_highlight_color(); |         button_color = StylePainter::hover_highlight_color(); | ||||||
| 
 | 
 | ||||||
|  | @ -92,7 +92,7 @@ void StylePainter::paint_button(Painter& painter, const Rect& rect, ButtonStyle | ||||||
|     if (button_style == ButtonStyle::Normal) |     if (button_style == ButtonStyle::Normal) | ||||||
|         return paint_button_new(painter, rect, pressed, checked, hovered, enabled); |         return paint_button_new(painter, rect, pressed, checked, hovered, enabled); | ||||||
| 
 | 
 | ||||||
|     Color button_color = SystemColor::Window; |     Color button_color = SystemColor::Button; | ||||||
|     Color highlight_color = Color::White; |     Color highlight_color = Color::White; | ||||||
|     Color shadow_color = Color(96, 96, 96); |     Color shadow_color = Color(96, 96, 96); | ||||||
| 
 | 
 | ||||||
|  | @ -129,8 +129,8 @@ void StylePainter::paint_button(Painter& painter, const Rect& rect, ButtonStyle | ||||||
| 
 | 
 | ||||||
| void StylePainter::paint_surface(Painter& painter, const Rect& rect, bool paint_vertical_lines, bool paint_top_line) | void StylePainter::paint_surface(Painter& painter, const Rect& rect, bool paint_vertical_lines, bool paint_top_line) | ||||||
| { | { | ||||||
|     painter.fill_rect({ rect.x(), rect.y() + 1, rect.width(), rect.height() - 2 }, SystemColor::Window); |     painter.fill_rect({ rect.x(), rect.y() + 1, rect.width(), rect.height() - 2 }, SystemColor::Button); | ||||||
|     painter.draw_line(rect.top_left(), rect.top_right(), paint_top_line ? SystemColor::ThreedHighlight : SystemColor::Window); |     painter.draw_line(rect.top_left(), rect.top_right(), paint_top_line ? SystemColor::ThreedHighlight : SystemColor::Button); | ||||||
|     painter.draw_line(rect.bottom_left(), rect.bottom_right(), SystemColor::ThreedShadow1); |     painter.draw_line(rect.bottom_left(), rect.bottom_right(), SystemColor::ThreedShadow1); | ||||||
|     if (paint_vertical_lines) { |     if (paint_vertical_lines) { | ||||||
|         painter.draw_line(rect.top_left().translated(0, 1), rect.bottom_left().translated(0, -1), SystemColor::ThreedHighlight); |         painter.draw_line(rect.top_left().translated(0, 1), rect.bottom_left().translated(0, -1), SystemColor::ThreedHighlight); | ||||||
|  | @ -176,7 +176,7 @@ void StylePainter::paint_frame(Painter& painter, const Rect& rect, FrameShape sh | ||||||
|         Color top_left_color; |         Color top_left_color; | ||||||
|         Color bottom_right_color; |         Color bottom_right_color; | ||||||
|         Color dark_shade = SystemColor::ThreedShadow2; |         Color dark_shade = SystemColor::ThreedShadow2; | ||||||
|         Color light_shade = SystemColor::Window; |         Color light_shade = SystemColor::Button; | ||||||
|         if (shadow == FrameShadow::Raised) { |         if (shadow == FrameShadow::Raised) { | ||||||
|             dark_shade = SystemColor::ThreedShadow1; |             dark_shade = SystemColor::ThreedShadow1; | ||||||
|             top_left_color = light_shade; |             top_left_color = light_shade; | ||||||
|  | @ -207,7 +207,7 @@ void StylePainter::paint_frame(Painter& painter, const Rect& rect, FrameShape sh | ||||||
| 
 | 
 | ||||||
| void StylePainter::paint_window_frame(Painter& painter, const Rect& rect) | void StylePainter::paint_window_frame(Painter& painter, const Rect& rect) | ||||||
| { | { | ||||||
|     Color base_color = SystemColor::Window; |     Color base_color = SystemColor::Button; | ||||||
|     Color dark_shade = SystemColor::ThreedShadow2; |     Color dark_shade = SystemColor::ThreedShadow2; | ||||||
|     Color mid_shade = SystemColor::ThreedShadow1; |     Color mid_shade = SystemColor::ThreedShadow1; | ||||||
|     Color light_shade = SystemColor::ThreedHighlight; |     Color light_shade = SystemColor::ThreedHighlight; | ||||||
|  |  | ||||||
|  | @ -47,8 +47,10 @@ RefPtr<SharedBuffer> load_system_theme(const String& path) | ||||||
|     data->threed_shadow2 = get("ThreedShadow2"); |     data->threed_shadow2 = get("ThreedShadow2"); | ||||||
|     data->hover_highlight = get("HoverHighlight"); |     data->hover_highlight = get("HoverHighlight"); | ||||||
|     data->window = get("Window"); |     data->window = get("Window"); | ||||||
|     data->text = get("Text"); |     data->window_text = get("WindowText"); | ||||||
|     data->base = get("Base"); |     data->base = get("Base"); | ||||||
|  |     data->button = get("Button"); | ||||||
|  |     data->button_text = get("ButtonText"); | ||||||
|     data->desktop_background = get("DesktopBackground"); |     data->desktop_background = get("DesktopBackground"); | ||||||
|     data->active_window_border1 = get("ActiveWindowBorder1"); |     data->active_window_border1 = get("ActiveWindowBorder1"); | ||||||
|     data->active_window_border2 = get("ActiveWindowBorder2"); |     data->active_window_border2 = get("ActiveWindowBorder2"); | ||||||
|  |  | ||||||
|  | @ -28,8 +28,10 @@ struct SystemTheme { | ||||||
|     Color menu_selection; |     Color menu_selection; | ||||||
| 
 | 
 | ||||||
|     Color window; |     Color window; | ||||||
|     Color text; |     Color window_text; | ||||||
|     Color base; |     Color base; | ||||||
|  |     Color button; | ||||||
|  |     Color button_text; | ||||||
| 
 | 
 | ||||||
|     Color threed_highlight; |     Color threed_highlight; | ||||||
|     Color threed_shadow1; |     Color threed_shadow1; | ||||||
|  |  | ||||||
|  | @ -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, SystemColor::Text, TextElision::Right); |     painter.draw_text(clipped_rect, text(), font, text_alignment, SystemColor::ButtonText, 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)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -129,7 +129,7 @@ void GAbstractColumnView::paint_headers(GPainter& painter) | ||||||
|         auto text_rect = cell_rect.translated(horizontal_padding(), 0); |         auto text_rect = cell_rect.translated(horizontal_padding(), 0); | ||||||
|         if (pressed) |         if (pressed) | ||||||
|             text_rect.move_by(1, 1); |             text_rect.move_by(1, 1); | ||||||
|         painter.draw_text(text_rect, text, header_font(), TextAlignment::CenterLeft, SystemColor::Text); |         painter.draw_text(text_rect, text, header_font(), TextAlignment::CenterLeft, SystemColor::ButtonText); | ||||||
|         x_offset += column_width + horizontal_padding() * 2; |         x_offset += column_width + horizontal_padding() * 2; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -63,7 +63,7 @@ void GCheckBox::paint_event(GPaintEvent& event) | ||||||
|     if (is_checked()) { |     if (is_checked()) { | ||||||
|         if (!s_checked_bitmap) |         if (!s_checked_bitmap) | ||||||
|             s_checked_bitmap = &CharacterBitmap::create_from_ascii(s_checked_bitmap_data, s_checked_bitmap_width, s_checked_bitmap_height).leak_ref(); |             s_checked_bitmap = &CharacterBitmap::create_from_ascii(s_checked_bitmap_data, s_checked_bitmap_width, s_checked_bitmap_height).leak_ref(); | ||||||
|         painter.draw_bitmap(box_rect.shrunken(4, 4).location(), *s_checked_bitmap, SystemColor::Text); |         painter.draw_bitmap(box_rect.shrunken(4, 4).location(), *s_checked_bitmap, SystemColor::ButtonText); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     paint_text(painter, text_rect, font(), TextAlignment::TopLeft); |     paint_text(painter, text_rect, font(), TextAlignment::TopLeft); | ||||||
|  |  | ||||||
|  | @ -230,7 +230,7 @@ void GItemView::paint_event(GPaintEvent& event) | ||||||
|         if (is_selected_item) |         if (is_selected_item) | ||||||
|             text_color = Color::White; |             text_color = Color::White; | ||||||
|         else |         else | ||||||
|             text_color = model()->data(model_index, GModel::Role::ForegroundColor).to_color(SystemColor::Text); |             text_color = model()->data(model_index, GModel::Role::ForegroundColor).to_color(SystemColor::WindowText); | ||||||
|         painter.fill_rect(text_rect, background_color); |         painter.fill_rect(text_rect, background_color); | ||||||
|         painter.draw_text(text_rect, item_text.to_string(), font, TextAlignment::Center, text_color, TextElision::Right); |         painter.draw_text(text_rect, item_text.to_string(), font, TextAlignment::Center, text_color, TextElision::Right); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -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(SystemColor::Text); |                 text_color = model()->data(index, GModel::Role::ForegroundColor).to_color(SystemColor::WindowText); | ||||||
|             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); | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ void GResizeCorner::paint_event(GPaintEvent& event) | ||||||
| { | { | ||||||
|     GPainter painter(*this); |     GPainter painter(*this); | ||||||
|     painter.add_clip_rect(event.rect()); |     painter.add_clip_rect(event.rect()); | ||||||
|     painter.fill_rect(rect(), SystemColor::Window); |     painter.fill_rect(rect(), SystemColor::Button); | ||||||
|     painter.blit({ 0, 0 }, *m_bitmap, m_bitmap->rect()); |     painter.blit({ 0, 0 }, *m_bitmap, m_bitmap->rect()); | ||||||
|     GWidget::paint_event(event); |     GWidget::paint_event(event); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -203,14 +203,14 @@ void GScrollBar::paint_event(GPaintEvent& event) | ||||||
|     GPainter painter(*this); |     GPainter painter(*this); | ||||||
|     painter.add_clip_rect(event.rect()); |     painter.add_clip_rect(event.rect()); | ||||||
| 
 | 
 | ||||||
|     painter.fill_rect(rect(), Color::from_rgb(0xd6d2ce)); |     painter.fill_rect(rect(), Color(SystemColor::Button).lightened()); | ||||||
| 
 | 
 | ||||||
|     StylePainter::paint_button(painter, decrement_button_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::DecrementButton); |     StylePainter::paint_button(painter, decrement_button_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::DecrementButton); | ||||||
|     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() ? SystemColor::Text : SystemColor::DisabledText); |         painter.draw_bitmap(decrement_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_up_arrow_bitmap : *s_left_arrow_bitmap, has_scrubber() ? SystemColor::ButtonText : 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); |         painter.draw_bitmap(increment_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_down_arrow_bitmap : *s_right_arrow_bitmap, has_scrubber() ? SystemColor::ButtonText : SystemColor::DisabledText); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (has_scrubber()) |     if (has_scrubber()) | ||||||
|  |  | ||||||
|  | @ -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(SystemColor::Text); |                         text_color = model()->data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::WindowText); | ||||||
|                     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); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -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 = SystemColor::Text; |         Color text_color = SystemColor::WindowText; | ||||||
|         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(SystemColor::Text); |                             text_color = model.data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::WindowText); | ||||||
|                         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); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | @ -69,7 +69,7 @@ GWidget::GWidget(GWidget* parent) | ||||||
|     , m_font(Font::default_font()) |     , m_font(Font::default_font()) | ||||||
| { | { | ||||||
|     m_background_color = SystemColor::Window; |     m_background_color = SystemColor::Window; | ||||||
|     m_foreground_color = SystemColor::Text; |     m_foreground_color = SystemColor::WindowText; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| GWidget::~GWidget() | GWidget::~GWidget() | ||||||
|  |  | ||||||
|  | @ -25,7 +25,7 @@ void WSButton::paint(Painter& painter) | ||||||
|     x_location.move_by(-(m_bitmap->width() / 2), -(m_bitmap->height() / 2)); |     x_location.move_by(-(m_bitmap->width() / 2), -(m_bitmap->height() / 2)); | ||||||
|     if (m_pressed) |     if (m_pressed) | ||||||
|         x_location.move_by(1, 1); |         x_location.move_by(1, 1); | ||||||
|     painter.draw_bitmap(x_location, *m_bitmap, SystemColor::Text); |     painter.draw_bitmap(x_location, *m_bitmap, SystemColor::ButtonText); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WSButton::on_mouse_event(const WSMouseEvent& event) | void WSButton::on_mouse_event(const WSMouseEvent& event) | ||||||
|  |  | ||||||
|  | @ -153,7 +153,7 @@ void WSMenu::draw() | ||||||
| 
 | 
 | ||||||
|     for (auto& item : m_items) { |     for (auto& item : m_items) { | ||||||
|         if (item.type() == WSMenuItem::Text) { |         if (item.type() == WSMenuItem::Text) { | ||||||
|             Color text_color = Color::Black; |             Color text_color = SystemColor::WindowText; | ||||||
|             if (&item == m_hovered_item && item.is_enabled()) { |             if (&item == m_hovered_item && item.is_enabled()) { | ||||||
|                 painter.fill_rect(item.rect(), SystemColor::MenuSelection); |                 painter.fill_rect(item.rect(), SystemColor::MenuSelection); | ||||||
|                 painter.draw_rect(item.rect(), Color(SystemColor::MenuSelection).darkened()); |                 painter.draw_rect(item.rect(), Color(SystemColor::MenuSelection).darkened()); | ||||||
|  | @ -169,7 +169,7 @@ void WSMenu::draw() | ||||||
|                 painter.fill_rect(checkbox_rect, SystemColor::Base); |                 painter.fill_rect(checkbox_rect, SystemColor::Base); | ||||||
|                 StylePainter::paint_frame(painter, checkbox_rect, FrameShape::Container, FrameShadow::Sunken, 2); |                 StylePainter::paint_frame(painter, checkbox_rect, FrameShape::Container, FrameShadow::Sunken, 2); | ||||||
|                 if (item.is_checked()) { |                 if (item.is_checked()) { | ||||||
|                     painter.draw_bitmap(checkmark_rect.location(), *s_checked_bitmap, SystemColor::Text); |                     painter.draw_bitmap(checkmark_rect.location(), *s_checked_bitmap, SystemColor::ButtonText); | ||||||
|                 } |                 } | ||||||
|             } else if (item.icon()) { |             } else if (item.icon()) { | ||||||
|                 Rect icon_rect { item.rect().x() + 3, 0, s_item_icon_width, s_item_icon_width }; |                 Rect icon_rect { item.rect().x() + 3, 0, s_item_icon_width, s_item_icon_width }; | ||||||
|  | @ -189,13 +189,13 @@ void WSMenu::draw() | ||||||
|                     s_submenu_arrow_bitmap_height |                     s_submenu_arrow_bitmap_height | ||||||
|                 }; |                 }; | ||||||
|                 submenu_arrow_rect.center_vertically_within(item.rect()); |                 submenu_arrow_rect.center_vertically_within(item.rect()); | ||||||
|                 painter.draw_bitmap(submenu_arrow_rect.location(), submenu_arrow_bitmap, Color::Black); |                 painter.draw_bitmap(submenu_arrow_rect.location(), submenu_arrow_bitmap, SystemColor::WindowText); | ||||||
|             } |             } | ||||||
|         } else if (item.type() == WSMenuItem::Separator) { |         } else if (item.type() == WSMenuItem::Separator) { | ||||||
|             Point p1(item.rect().translated(stripe_rect.width() + 4, 0).x(), item.rect().center().y() - 1); |             Point p1(item.rect().translated(stripe_rect.width() + 4, 0).x(), item.rect().center().y() - 1); | ||||||
|             Point p2(width - 7, item.rect().center().y() - 1); |             Point p2(width - 7, item.rect().center().y() - 1); | ||||||
|             painter.draw_line(p1, p2, Color::MidGray); |             painter.draw_line(p1, p2, SystemColor::ThreedShadow1); | ||||||
|             painter.draw_line(p1.translated(0, 1), p2.translated(0, 1), Color::White); |             painter.draw_line(p1.translated(0, 1), p2.translated(0, 1), SystemColor::ThreedHighlight); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -87,7 +87,7 @@ void WSMenuManager::draw() | ||||||
|     painter.draw_line({ 0, menubar_rect.bottom() }, { menubar_rect.right(), menubar_rect.bottom() }, SystemColor::ThreedShadow1); |     painter.draw_line({ 0, menubar_rect.bottom() }, { menubar_rect.right(), menubar_rect.bottom() }, SystemColor::ThreedShadow1); | ||||||
|     int index = 0; |     int index = 0; | ||||||
|     wm.for_each_active_menubar_menu([&](WSMenu& menu) { |     wm.for_each_active_menubar_menu([&](WSMenu& menu) { | ||||||
|         Color text_color = SystemColor::Text; |         Color text_color = SystemColor::WindowText; | ||||||
|         if (is_open(menu)) { |         if (is_open(menu)) { | ||||||
|             painter.fill_rect(menu.rect_in_menubar(), SystemColor::MenuSelection); |             painter.fill_rect(menu.rect_in_menubar(), SystemColor::MenuSelection); | ||||||
|             painter.draw_rect(menu.rect_in_menubar(), Color(SystemColor::MenuSelection).darkened()); |             painter.draw_rect(menu.rect_in_menubar(), Color(SystemColor::MenuSelection).darkened()); | ||||||
|  | @ -103,7 +103,7 @@ void WSMenuManager::draw() | ||||||
|         return IterationDecision::Continue; |         return IterationDecision::Continue; | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     painter.draw_text(m_username_rect, m_username, Font::default_bold_font(), TextAlignment::CenterRight, SystemColor::Text); |     painter.draw_text(m_username_rect, m_username, Font::default_bold_font(), TextAlignment::CenterRight, SystemColor::WindowText); | ||||||
| 
 | 
 | ||||||
|     time_t now = time(nullptr); |     time_t now = time(nullptr); | ||||||
|     auto* tm = localtime(&now); |     auto* tm = localtime(&now); | ||||||
|  | @ -115,7 +115,7 @@ void WSMenuManager::draw() | ||||||
|         tm->tm_min, |         tm->tm_min, | ||||||
|         tm->tm_sec); |         tm->tm_sec); | ||||||
| 
 | 
 | ||||||
|     painter.draw_text(m_time_rect, time_text, wm.font(), TextAlignment::CenterRight, SystemColor::Text); |     painter.draw_text(m_time_rect, time_text, wm.font(), TextAlignment::CenterRight, SystemColor::WindowText); | ||||||
| 
 | 
 | ||||||
|     for (auto& applet : m_applets) { |     for (auto& applet : m_applets) { | ||||||
|         if (!applet) |         if (!applet) | ||||||
|  |  | ||||||
|  | @ -192,7 +192,7 @@ void WSWindowFrame::paint(Painter& painter) | ||||||
|     if (!window.show_titlebar()) |     if (!window.show_titlebar()) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     painter.draw_line(titlebar_rect.bottom_left().translated(0, 1), titlebar_rect.bottom_right().translated(0, 1), Color::WarmGray); |     painter.draw_line(titlebar_rect.bottom_left().translated(0, 1), titlebar_rect.bottom_right().translated(0, 1), SystemColor::Button); | ||||||
| 
 | 
 | ||||||
|     auto leftmost_button_rect = m_buttons.is_empty() ? Rect() : m_buttons.last().relative_rect(); |     auto leftmost_button_rect = m_buttons.is_empty() ? Rect() : m_buttons.last().relative_rect(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling