diff --git a/LibGUI/GFrame.cpp b/LibGUI/GFrame.cpp index d4f0eeed7a..0d31da6c57 100644 --- a/LibGUI/GFrame.cpp +++ b/LibGUI/GFrame.cpp @@ -24,15 +24,22 @@ void GFrame::paint_event(GPaintEvent& event) Color top_left_color; Color bottom_right_color; + Color dark_shade = Color::from_rgb(0x808080); + Color light_shade = Color::from_rgb(0xffffff); + + if (m_shape == Shape::Container) { + dark_shade = Color::from_rgb(0x404040); + } + if (m_shadow == Shadow::Raised) { - top_left_color = Color::White; - bottom_right_color = Color::MidGray; + top_left_color = light_shade; + bottom_right_color = dark_shade; } else if (m_shadow == Shadow::Sunken) { - top_left_color = Color::MidGray; - bottom_right_color = Color::White; + top_left_color = dark_shade; + bottom_right_color = light_shade; } else if (m_shadow == Shadow::Plain) { - top_left_color = Color::MidGray; - bottom_right_color = Color::MidGray; + top_left_color = dark_shade; + bottom_right_color = dark_shade; } painter.draw_line(rect.top_left(), rect.top_right(), top_left_color); diff --git a/LibGUI/GFrame.h b/LibGUI/GFrame.h index 73ede6190c..f0a2b7138f 100644 --- a/LibGUI/GFrame.h +++ b/LibGUI/GFrame.h @@ -8,7 +8,7 @@ public: virtual ~GFrame() override; enum Shadow { Plain, Raised, Sunken }; - enum Shape { NoFrame, Box, Panel, VerticalLine, HorizontalLine }; + enum Shape { NoFrame, Container, Panel, VerticalLine, HorizontalLine }; int frame_thickness() const { return m_thickness; } void set_frame_thickness(int thickness) { m_thickness = thickness; } diff --git a/LibGUI/GItemView.cpp b/LibGUI/GItemView.cpp index 3f63520a63..21628c9f66 100644 --- a/LibGUI/GItemView.cpp +++ b/LibGUI/GItemView.cpp @@ -7,6 +7,9 @@ GItemView::GItemView(GWidget* parent) : GAbstractView(parent) { + set_frame_shape(GFrame::Shape::Container); + set_frame_shadow(GFrame::Shadow::Sunken); + set_frame_thickness(1); horizontal_scrollbar().set_visible(false); } @@ -93,10 +96,12 @@ void GItemView::doubleclick_event(GMouseEvent& event) void GItemView::paint_event(GPaintEvent& event) { + GFrame::paint_event(event); + Painter painter(*this); + painter.set_clip_rect(widget_inner_rect()); painter.set_clip_rect(event.rect()); painter.fill_rect(event.rect(), Color::White); - painter.save(); painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value()); auto column_metadata = model()->column_metadata(m_model_column); @@ -138,11 +143,6 @@ void GItemView::paint_event(GPaintEvent& event) painter.fill_rect(text_rect, background_color); painter.draw_text(text_rect, item_text.to_string(), font, TextAlignment::Center, text_color); }; - - painter.restore(); - - if (is_focused()) - painter.draw_rect({ { }, available_size() }, Color::from_rgb(0x84351a)); } int GItemView::item_count() const diff --git a/LibGUI/GTableView.cpp b/LibGUI/GTableView.cpp index fb783d0c0a..88100c4304 100644 --- a/LibGUI/GTableView.cpp +++ b/LibGUI/GTableView.cpp @@ -7,6 +7,9 @@ GTableView::GTableView(GWidget* parent) : GAbstractView(parent) { + set_frame_shape(GFrame::Shape::Container); + set_frame_shadow(GFrame::Shadow::Sunken); + set_frame_thickness(1); } GTableView::~GTableView() @@ -95,7 +98,10 @@ void GTableView::mousedown_event(GMouseEvent& event) void GTableView::paint_event(GPaintEvent& event) { + GFrame::paint_event(event); + Painter painter(*this); + painter.set_clip_rect(frame_inner_rect()); painter.set_clip_rect(event.rect()); painter.save(); painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value()); diff --git a/LibGUI/GTextEditor.cpp b/LibGUI/GTextEditor.cpp index 060bb34041..b22512ed62 100644 --- a/LibGUI/GTextEditor.cpp +++ b/LibGUI/GTextEditor.cpp @@ -13,7 +13,7 @@ GTextEditor::GTextEditor(Type type, GWidget* parent) : GScrollableWidget(parent) , m_type(type) { - set_frame_shape(GFrame::Shape::Panel); + set_frame_shape(GFrame::Shape::Container); set_frame_shadow(GFrame::Shadow::Sunken); set_frame_thickness(1); set_scrollbars_enabled(is_multi_line());