1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 18:07:35 +00:00

ProcessManager+LibGUI: Tweak things to improve ProcessManager look.

This commit is contained in:
Andreas Kling 2019-05-05 20:53:04 +02:00
parent 9e5ad25188
commit 3bdb95e128
7 changed files with 20 additions and 15 deletions

View file

@ -102,10 +102,3 @@ void MemoryStatsWidget::timer_event(CTimerEvent&)
{ {
refresh(); refresh();
} }
void MemoryStatsWidget::paint_event(GPaintEvent& event)
{
GPainter painter(*this);
painter.add_clip_rect(event.rect());
StylePainter::paint_surface(painter, rect());
}

View file

@ -14,7 +14,6 @@ public:
private: private:
virtual void timer_event(CTimerEvent&) override; virtual void timer_event(CTimerEvent&) override;
virtual void paint_event(GPaintEvent&) override;
GLabel* m_user_physical_pages_label { nullptr }; GLabel* m_user_physical_pages_label { nullptr };
GLabel* m_supervisor_physical_pages_label { nullptr }; GLabel* m_supervisor_physical_pages_label { nullptr };

View file

@ -18,7 +18,13 @@ int main(int argc, char** argv)
{ {
GApplication app(argc, argv); GApplication app(argc, argv);
auto* tabwidget = new GTabWidget(nullptr); auto* keeper = new GWidget;
keeper->set_layout(make<GBoxLayout>(Orientation::Vertical));
keeper->set_fill_with_background_color(true);
keeper->set_background_color(Color::LightGray);
keeper->layout()->set_margins({ 2, 2, 2, 2 });
auto* tabwidget = new GTabWidget(keeper);
auto* widget = new GWidget(nullptr); auto* widget = new GWidget(nullptr);
tabwidget->add_widget("Processes", widget); tabwidget->add_widget("Processes", widget);
@ -105,7 +111,7 @@ int main(int argc, char** argv)
auto* window = new GWindow; auto* window = new GWindow;
window->set_title("ProcessManager"); window->set_title("ProcessManager");
window->set_rect(20, 200, 680, 400); window->set_rect(20, 200, 680, 400);
window->set_main_widget(tabwidget); window->set_main_widget(keeper);
window->set_should_exit_event_loop_on_close(true); window->set_should_exit_event_loop_on_close(true);
window->show(); window->show();

View file

@ -92,7 +92,7 @@ void GTabWidget::paint_event(GPaintEvent& event)
padding_rect.shrink(2, 2); padding_rect.shrink(2, 2);
} }
StylePainter::paint_frame(painter, container_rect, FrameShape::Panel, FrameShadow::Raised, 2); StylePainter::paint_frame(painter, container_rect, FrameShape::Container, FrameShadow::Raised, 2);
for (int i = 0; i < m_tabs.size(); ++i) { for (int i = 0; i < m_tabs.size(); ++i) {
if (m_tabs[i].widget == m_active_widget) if (m_tabs[i].widget == m_active_widget)

View file

@ -81,5 +81,5 @@ void GToolBar::paint_event(GPaintEvent& event)
{ {
GPainter painter(*this); GPainter painter(*this);
painter.add_clip_rect(event.rect()); painter.add_clip_rect(event.rect());
StylePainter::paint_surface(painter, rect(), !spans_entire_window_horizontally()); StylePainter::paint_surface(painter, rect(), x() != 0, y() != 0);
} }

View file

@ -131,10 +131,10 @@ void StylePainter::paint_button(Painter& painter, const Rect& rect, ButtonStyle
} }
} }
void StylePainter::paint_surface(Painter& painter, const Rect& rect, bool paint_vertical_lines) 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 }, Color::LightGray); painter.fill_rect({ rect.x(), rect.y() + 1, rect.width(), rect.height() - 2 }, Color::LightGray);
painter.draw_line(rect.top_left(), rect.top_right(), Color::White); painter.draw_line(rect.top_left(), rect.top_right(), paint_top_line ? Color::White : Color::LightGray);
painter.draw_line(rect.bottom_left(), rect.bottom_right(), Color::MidGray); painter.draw_line(rect.bottom_left(), rect.bottom_right(), Color::MidGray);
if (paint_vertical_lines) { if (paint_vertical_lines) {
painter.draw_line(rect.top_left().translated(0, 1), rect.bottom_left().translated(0, -1), Color::White); painter.draw_line(rect.top_left().translated(0, 1), rect.bottom_left().translated(0, -1), Color::White);
@ -149,6 +149,12 @@ void StylePainter::paint_frame(Painter& painter, const Rect& rect, FrameShape sh
Color dark_shade = Color::from_rgb(0x808080); Color dark_shade = Color::from_rgb(0x808080);
Color light_shade = Color::from_rgb(0xffffff); Color light_shade = Color::from_rgb(0xffffff);
if (shape == FrameShape::Container && thickness >= 2) {
if (shadow == FrameShadow::Raised) {
dark_shade = Color::from_rgb(0x404040);
}
}
if (shadow == FrameShadow::Raised) { if (shadow == FrameShadow::Raised) {
top_left_color = light_shade; top_left_color = light_shade;
bottom_right_color = dark_shade; bottom_right_color = dark_shade;
@ -176,6 +182,7 @@ void StylePainter::paint_frame(Painter& painter, const Rect& rect, FrameShape sh
Color dark_shade = Color::from_rgb(0x404040); Color dark_shade = Color::from_rgb(0x404040);
Color light_shade = Color::from_rgb(0xc0c0c0); Color light_shade = Color::from_rgb(0xc0c0c0);
if (shadow == FrameShadow::Raised) { if (shadow == FrameShadow::Raised) {
dark_shade = Color::from_rgb(0x808080);
top_left_color = light_shade; top_left_color = light_shade;
bottom_right_color = dark_shade; bottom_right_color = dark_shade;
} else if (shadow == FrameShadow::Sunken) { } else if (shadow == FrameShadow::Sunken) {

View file

@ -11,7 +11,7 @@ class StylePainter {
public: public:
static void paint_button(Painter&, const Rect&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true); static void paint_button(Painter&, const Rect&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true);
static void paint_tab_button(Painter&, const Rect&, bool active, bool hovered, bool enabled); static void paint_tab_button(Painter&, const Rect&, bool active, bool hovered, bool enabled);
static void paint_surface(Painter&, const Rect&, bool paint_vertical_lines = true); static void paint_surface(Painter&, const Rect&, bool paint_vertical_lines = true, bool paint_top_line = true);
static void paint_frame(Painter&, const Rect&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false); static void paint_frame(Painter&, const Rect&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false);
static void paint_menu_frame(Painter&, const Rect&); static void paint_menu_frame(Painter&, const Rect&);
}; };