浏览代码

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.
Andreas Kling 4 年之前
父节点
当前提交
ea34ba6fa6

+ 5 - 5
Userland/Libraries/LibGfx/ClassicWindowTheme.cpp

@@ -33,7 +33,7 @@
 
 namespace Gfx {
 
-static constexpr int menu_bar_height = 20;
+static constexpr int menubar_height = 20;
 
 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)
         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
@@ -209,9 +209,9 @@ IntRect ClassicWindowTheme::frame_rect_for_window(WindowType window_type, const
     case WindowType::ToolWindow:
         return {
             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.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:
         return {

+ 1 - 1
Userland/Libraries/LibGfx/ClassicWindowTheme.h

@@ -45,7 +45,7 @@ public:
     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 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;
 

+ 1 - 1
Userland/Libraries/LibGfx/WindowTheme.h

@@ -60,7 +60,7 @@ public:
     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 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;
 

+ 1 - 1
Userland/Services/WindowServer/Window.cpp

@@ -971,7 +971,7 @@ void Window::set_menubar(MenuBar* menubar)
 
         auto& wm = WindowManager::the();
         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) {
             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() });

+ 1 - 1
Userland/Services/WindowServer/WindowFrame.cpp

@@ -240,7 +240,7 @@ Gfx::IntRect WindowFrame::menubar_rect() const
 {
     if (!m_window.menubar() || !m_window.should_show_menubar())
         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