mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
WindowServer: Remove unused Menu->MenuBar link and "title font"
We kept a backpointer from the Menu to its containing MenuBar, but it was not used for anything so let's remove it. Since all menus have the same font now, there's no need to track a separate "title font".
This commit is contained in:
parent
dfb81242f3
commit
6203a4a2e9
3 changed files with 2 additions and 29 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2020, Shannon Booth <shannon.ml.booth@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -55,16 +55,6 @@ Menu::~Menu()
|
|||
{
|
||||
}
|
||||
|
||||
void Menu::set_title_font(const Gfx::Font& font)
|
||||
{
|
||||
m_title_font = &font;
|
||||
}
|
||||
|
||||
const Gfx::Font& Menu::title_font() const
|
||||
{
|
||||
return *m_title_font;
|
||||
}
|
||||
|
||||
const Gfx::Font& Menu::font() const
|
||||
{
|
||||
return Gfx::FontDatabase::default_font();
|
||||
|
|
|
@ -54,10 +54,6 @@ public:
|
|||
const ClientConnection* client() const { return m_client; }
|
||||
int menu_id() const { return m_menu_id; }
|
||||
|
||||
MenuBar* menubar() { return m_menubar; }
|
||||
const MenuBar* menubar() const { return m_menubar; }
|
||||
void set_menubar(MenuBar* menubar) { m_menubar = menubar; }
|
||||
|
||||
bool is_empty() const { return m_items.is_empty(); }
|
||||
int item_count() const { return m_items.size(); }
|
||||
const MenuItem& item(int index) const { return m_items.at(index); }
|
||||
|
@ -99,8 +95,6 @@ public:
|
|||
|
||||
void draw();
|
||||
const Gfx::Font& font() const;
|
||||
const Gfx::Font& title_font() const;
|
||||
void set_title_font(const Gfx::Font& font);
|
||||
|
||||
MenuItem* item_with_identifier(unsigned);
|
||||
void redraw();
|
||||
|
@ -135,8 +129,6 @@ public:
|
|||
private:
|
||||
virtual void event(Core::Event&) override;
|
||||
|
||||
RefPtr<Gfx::Font> m_title_font { &Gfx::FontDatabase::default_font() };
|
||||
|
||||
void handle_mouse_move_event(const MouseEvent&);
|
||||
int visible_item_count() const;
|
||||
|
||||
|
@ -150,7 +142,6 @@ private:
|
|||
String m_name;
|
||||
Gfx::IntRect m_rect_in_window_menubar;
|
||||
Gfx::IntRect m_text_rect_in_window_menubar;
|
||||
MenuBar* m_menubar { nullptr };
|
||||
NonnullOwnPtrVector<MenuItem> m_items;
|
||||
RefPtr<Window> m_menu_window;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -26,8 +26,6 @@
|
|||
|
||||
#include "MenuBar.h"
|
||||
#include "Menu.h"
|
||||
#include "MenuItem.h"
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
||||
namespace WindowServer {
|
||||
|
||||
|
@ -43,12 +41,6 @@ MenuBar::~MenuBar()
|
|||
|
||||
void MenuBar::add_menu(Menu& menu)
|
||||
{
|
||||
menu.set_menubar(this);
|
||||
|
||||
// NOTE: We assume that the first menu is the App menu, which has a bold font.
|
||||
if (m_menus.is_empty())
|
||||
menu.set_title_font(Gfx::FontDatabase::default_bold_font());
|
||||
|
||||
m_menus.append(&menu);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue