mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:57:35 +00:00
LibGfx+Userland: Merge FrameShape and FrameShadow into FrameStyle
Previously, Frames could set both these properties along with a thickness to confusing effect: Most shapes of the same shadowing only differentiated at a thickness >= 2, and some not at all. This led to a lot of creative but ultimately superfluous choices in the code. Instead let's streamline our options, automate thickness, and get the right look without so much guesswork. Plain shadowing has been consolidated into a single Plain style, and 0 thickness can be had by setting style to NoFrame.
This commit is contained in:
parent
4c9933bfb7
commit
f7e034d4b2
58 changed files with 148 additions and 208 deletions
|
@ -176,7 +176,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto container = TRY(window->set_main_widget<GUI::Frame>());
|
||||
container->set_fill_with_background_color(true);
|
||||
container->set_frame_shape(Gfx::FrameShape::Window);
|
||||
container->set_frame_style(Gfx::FrameStyle::Window);
|
||||
container->set_layout<GUI::VerticalBoxLayout>(8);
|
||||
|
||||
auto& text_box = container->add<GUI::TextBox>();
|
||||
|
|
|
@ -206,11 +206,10 @@ void BrowserWindow::build_menus()
|
|||
tab.m_toolbar_container->set_visible(!is_fullscreen);
|
||||
tab.m_statusbar->set_visible(!is_fullscreen);
|
||||
|
||||
if (is_fullscreen) {
|
||||
tab.view().set_frame_thickness(0);
|
||||
} else {
|
||||
tab.view().set_frame_thickness(2);
|
||||
}
|
||||
if (is_fullscreen)
|
||||
tab.view().set_frame_style(Gfx::FrameStyle::NoFrame);
|
||||
else
|
||||
tab.view().set_frame_style(Gfx::FrameStyle::SunkenContainer);
|
||||
},
|
||||
this));
|
||||
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
|
||||
@GUI::Frame {
|
||||
name: "webdriver_banner"
|
||||
shape: "Box"
|
||||
shadow: "Sunken"
|
||||
thickness: 1
|
||||
style: "SunkenPanel"
|
||||
preferred_height: "shrink"
|
||||
foreground_role: "TooltipText"
|
||||
background_role: "Tooltip"
|
||||
|
|
|
@ -25,10 +25,7 @@ CalculatorWidget::CalculatorWidget()
|
|||
m_entry->set_text_alignment(Gfx::TextAlignment::CenterRight);
|
||||
|
||||
m_label = *find_descendant_of_type_named<GUI::Label>("label");
|
||||
|
||||
m_label->set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||
m_label->set_frame_shape(Gfx::FrameShape::Container);
|
||||
m_label->set_frame_thickness(2);
|
||||
m_label->set_frame_style(Gfx::FrameStyle::SunkenContainer);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
m_digit_button[i] = *find_descendant_of_type_named<GUI::Button>(DeprecatedString::formatted("{}_button", i));
|
||||
|
|
|
@ -63,9 +63,7 @@
|
|||
}
|
||||
|
||||
@GUI::Label {
|
||||
shape: "Container"
|
||||
thickness: 2
|
||||
shadow: "Sunken"
|
||||
style: "SunkenContainer"
|
||||
name: "clock_preview"
|
||||
text: "12:34:56"
|
||||
}
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
@GUI::Label {
|
||||
background_role: "Base"
|
||||
shadow: "Sunken"
|
||||
shape: "Container"
|
||||
thickness: 2
|
||||
style: "SunkenContainer"
|
||||
fill_with_background_color: true
|
||||
name: "default_font_label"
|
||||
}
|
||||
|
@ -47,9 +45,7 @@
|
|||
|
||||
@GUI::Label {
|
||||
background_role: "Base"
|
||||
shadow: "Sunken"
|
||||
shape: "Container"
|
||||
thickness: 2
|
||||
style: "SunkenContainer"
|
||||
fill_with_background_color: true
|
||||
name: "window_title_font_label"
|
||||
}
|
||||
|
@ -75,9 +71,7 @@
|
|||
|
||||
@GUI::Label {
|
||||
background_role: "Base"
|
||||
shadow: "Sunken"
|
||||
shape: "Container"
|
||||
thickness: 2
|
||||
style: "SunkenContainer"
|
||||
fill_with_background_color: true
|
||||
name: "fixed_width_font_label"
|
||||
}
|
||||
|
|
|
@ -223,8 +223,7 @@ void DirectoryView::setup_icon_view()
|
|||
};
|
||||
|
||||
if (is_desktop()) {
|
||||
m_icon_view->set_frame_shape(Gfx::FrameShape::NoFrame);
|
||||
m_icon_view->set_frame_thickness(0);
|
||||
m_icon_view->set_frame_style(Gfx::FrameStyle::NoFrame);
|
||||
m_icon_view->set_scrollbars_enabled(false);
|
||||
m_icon_view->set_fill_with_background_color(false);
|
||||
m_icon_view->set_draw_item_text_with_shadow(true);
|
||||
|
|
|
@ -661,9 +661,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
|
|||
|
||||
auto& progressbar = *widget->find_descendant_of_type_named<GUI::Progressbar>("progressbar");
|
||||
progressbar.set_format(GUI::Progressbar::Format::ValueSlashMax);
|
||||
progressbar.set_frame_shape(Gfx::FrameShape::Panel);
|
||||
progressbar.set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||
progressbar.set_frame_thickness(1);
|
||||
progressbar.set_frame_style(Gfx::FrameStyle::SunkenPanel);
|
||||
|
||||
auto refresh_tree_view = [&] {
|
||||
directories_model->invalidate();
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [4]
|
||||
}
|
||||
shape: "Box"
|
||||
shadow: "Sunken"
|
||||
thickness: 2
|
||||
style: "SunkenBox"
|
||||
|
||||
@GUI::Label {
|
||||
name: "preview_label"
|
||||
|
|
|
@ -115,7 +115,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
widget->on_doubleclick = [&] {
|
||||
window->set_fullscreen(!window->is_fullscreen());
|
||||
toolbar_container->set_visible(!window->is_fullscreen());
|
||||
widget->set_frame_thickness(window->is_fullscreen() ? 0 : 2);
|
||||
widget->set_frame_style(window->is_fullscreen() ? Gfx::FrameStyle::NoFrame : Gfx::FrameStyle::SunkenContainer);
|
||||
};
|
||||
|
||||
// Actions
|
||||
|
|
|
@ -49,8 +49,7 @@ private:
|
|||
|
||||
resize(200, 250);
|
||||
auto main_widget = set_main_widget<GUI::Frame>().release_value_but_fixme_should_propagate_errors();
|
||||
main_widget->set_frame_shape(Gfx::FrameShape::Container);
|
||||
main_widget->set_frame_shadow(Gfx::FrameShadow::Raised);
|
||||
main_widget->set_frame_style(Gfx::FrameStyle::RaisedContainer);
|
||||
main_widget->set_fill_with_background_color(true);
|
||||
main_widget->template set_layout<GUI::VerticalBoxLayout>(4);
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ void LayerListWidget::paint_event(GUI::PaintEvent& event)
|
|||
if (m_moving_gadget_index.has_value())
|
||||
paint_gadget(m_gadgets[m_moving_gadget_index.value()]);
|
||||
|
||||
Gfx::StylePainter::paint_frame(painter, rect(), palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2);
|
||||
Gfx::StylePainter::paint_frame(painter, rect(), palette(), Gfx::FrameStyle::SunkenBox);
|
||||
}
|
||||
|
||||
Optional<size_t> LayerListWidget::gadget_at(Gfx::IntPoint position)
|
||||
|
|
|
@ -94,9 +94,7 @@ private:
|
|||
|
||||
PaletteWidget::PaletteWidget()
|
||||
{
|
||||
set_frame_shape(Gfx::FrameShape::Panel);
|
||||
set_frame_shadow(Gfx::FrameShadow::Raised);
|
||||
set_frame_thickness(0);
|
||||
set_frame_style(Gfx::FrameStyle::NoFrame);
|
||||
set_fill_with_background_color(true);
|
||||
|
||||
set_fixed_height(35);
|
||||
|
|
|
@ -22,7 +22,7 @@ PresenterWidget::PresenterWidget()
|
|||
set_min_size(200, 120);
|
||||
set_fill_with_background_color(true);
|
||||
m_web_view = add<WebView::OutOfProcessWebView>();
|
||||
m_web_view->set_frame_thickness(0);
|
||||
m_web_view->set_frame_style(Gfx::FrameStyle::NoFrame);
|
||||
m_web_view->set_scrollbars_enabled(false);
|
||||
m_web_view->set_focus_policy(GUI::FocusPolicy::NoFocus);
|
||||
m_web_view->set_content_scales_to_viewport(true);
|
||||
|
|
|
@ -84,7 +84,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, Vector<NonnullR
|
|||
auto inline_widget = m_inline_documentation_window->set_main_widget<GUI::Frame>().release_value_but_fixme_should_propagate_errors();
|
||||
inline_widget->set_fill_with_background_color(true);
|
||||
inline_widget->set_layout<GUI::VerticalBoxLayout>(4);
|
||||
inline_widget->set_frame_shape(Gfx::FrameShape::Box);
|
||||
inline_widget->set_frame_style(Gfx::FrameStyle::Plain);
|
||||
m_inline_documentation_label = inline_widget->add<GUI::Label>();
|
||||
m_inline_documentation_label->set_fill_with_background_color(true);
|
||||
m_inline_documentation_label->set_autosize(false);
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
|
||||
@GUI::Label {
|
||||
background_role: "Base"
|
||||
shape: "Container"
|
||||
shadow: "Sunken"
|
||||
thickness: 2
|
||||
style: "SunkenContainer"
|
||||
fill_with_background_color: true
|
||||
name: "terminal_font_label"
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@ void VideoPlayerWidget::toggle_fullscreen()
|
|||
auto* bottom_container = find_descendant_of_type_named<GUI::Widget>("bottom_container");
|
||||
bottom_container->set_visible(!parent_window->is_fullscreen());
|
||||
auto* video_frame = find_descendant_of_type_named<VideoFrameWidget>("video_frame");
|
||||
video_frame->set_frame_thickness(parent_window->is_fullscreen() ? 0 : 2);
|
||||
video_frame->set_frame_style(parent_window->is_fullscreen() ? Gfx::FrameStyle::NoFrame : Gfx::FrameStyle::SunkenContainer);
|
||||
}
|
||||
|
||||
void VideoPlayerWidget::update_title()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue