1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:17:34 +00:00

WindowServer+LibGfx: Rename menu_bar => menubar

We had a mix of "menu_bar" and "menubar". Let's just use "menubar"
everywhere since that feels the most natural to write.
This commit is contained in:
Andreas Kling 2021-03-31 23:26:32 +02:00
parent 0e798234c7
commit ea34ba6fa6
5 changed files with 9 additions and 9 deletions

View file

@ -33,7 +33,7 @@
namespace Gfx { namespace Gfx {
static constexpr int menu_bar_height = 20; static constexpr int menubar_height = 20;
ClassicWindowTheme::ClassicWindowTheme() ClassicWindowTheme::ClassicWindowTheme()
{ {
@ -145,11 +145,11 @@ void ClassicWindowTheme::paint_tool_window_frame(Painter& painter, WindowState w
} }
} }
IntRect ClassicWindowTheme::menu_bar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette, int menu_row_count) const IntRect ClassicWindowTheme::menubar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette, int menu_row_count) const
{ {
if (window_type != WindowType::Normal) if (window_type != WindowType::Normal)
return {}; return {};
return { 4, 3 + title_bar_height(window_type, palette) + 2, window_rect.width(), menu_bar_height * menu_row_count }; return { 4, 3 + title_bar_height(window_type, palette) + 2, window_rect.width(), menubar_height * menu_row_count };
} }
IntRect ClassicWindowTheme::title_bar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const IntRect ClassicWindowTheme::title_bar_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const
@ -209,9 +209,9 @@ IntRect ClassicWindowTheme::frame_rect_for_window(WindowType window_type, const
case WindowType::ToolWindow: case WindowType::ToolWindow:
return { return {
window_rect.x() - 4, window_rect.x() - 4,
window_rect.y() - window_titlebar_height - 5 - menu_row_count * menu_bar_height, window_rect.y() - window_titlebar_height - 5 - menu_row_count * menubar_height,
window_rect.width() + 8, window_rect.width() + 8,
window_rect.height() + 9 + window_titlebar_height + menu_row_count * menu_bar_height window_rect.height() + 9 + window_titlebar_height + menu_row_count * menubar_height
}; };
case WindowType::Notification: case WindowType::Notification:
return { return {

View file

@ -45,7 +45,7 @@ public:
virtual IntRect title_bar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const override; virtual IntRect title_bar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const override;
virtual IntRect title_bar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const override; virtual IntRect title_bar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const override;
virtual IntRect menu_bar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override; virtual IntRect menubar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override;
virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override; virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const override;

View file

@ -60,7 +60,7 @@ public:
virtual IntRect title_bar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; virtual IntRect title_bar_icon_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0;
virtual IntRect title_bar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0; virtual IntRect title_bar_text_rect(WindowType, const IntRect& window_rect, const Palette&) const = 0;
virtual IntRect menu_bar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0; virtual IntRect menubar_rect(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0;
virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0; virtual IntRect frame_rect_for_window(WindowType, const IntRect& window_rect, const Palette&, int menu_row_count) const = 0;

View file

@ -971,7 +971,7 @@ void Window::set_menubar(MenuBar* menubar)
auto& wm = WindowManager::the(); auto& wm = WindowManager::the();
Gfx::IntPoint next_menu_location { 0, 0 }; Gfx::IntPoint next_menu_location { 0, 0 };
auto menubar_rect = Gfx::WindowTheme::current().menu_bar_rect(Gfx::WindowTheme::WindowType::Normal, rect(), wm.palette(), 1); auto menubar_rect = Gfx::WindowTheme::current().menubar_rect(Gfx::WindowTheme::WindowType::Normal, rect(), wm.palette(), 1);
m_menubar->for_each_menu([&](Menu& menu) { m_menubar->for_each_menu([&](Menu& menu) {
int text_width = wm.font().width(menu.name()); int text_width = wm.font().width(menu.name());
menu.set_rect_in_window_menubar({ next_menu_location.x(), 0, text_width + menubar_menu_margin, menubar_rect.height() }); menu.set_rect_in_window_menubar({ next_menu_location.x(), 0, text_width + menubar_menu_margin, menubar_rect.height() });

View file

@ -240,7 +240,7 @@ Gfx::IntRect WindowFrame::menubar_rect() const
{ {
if (!m_window.menubar() || !m_window.should_show_menubar()) if (!m_window.menubar() || !m_window.should_show_menubar())
return {}; return {};
return Gfx::WindowTheme::current().menu_bar_rect(to_theme_window_type(m_window.type()), m_window.rect(), WindowManager::the().palette(), menu_row_count()); return Gfx::WindowTheme::current().menubar_rect(to_theme_window_type(m_window.type()), m_window.rect(), WindowManager::the().palette(), menu_row_count());
} }
Gfx::IntRect WindowFrame::title_bar_rect() const Gfx::IntRect WindowFrame::title_bar_rect() const