diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-24 09:04:57 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-24 09:04:57 +0200 |
commit | 90ea4918d6c8b011710be2c4a1d7756a07cd45c3 (patch) | |
tree | 9853834f9ff790dad908594b9b35b4cfe1d6ff77 /Servers/WindowServer/WSMenu.h | |
parent | a635e62e6a99dbd732ea2fda1422d9179512e0f6 (diff) | |
download | serenity-90ea4918d6c8b011710be2c4a1d7756a07cd45c3.zip |
WindowServer: Convert Vector<OwnPtr> to NonnullOwnPtrVector.
Diffstat (limited to 'Servers/WindowServer/WSMenu.h')
-rw-r--r-- | Servers/WindowServer/WSMenu.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Servers/WindowServer/WSMenu.h b/Servers/WindowServer/WSMenu.h index a50d505349..438ec12009 100644 --- a/Servers/WindowServer/WSMenu.h +++ b/Servers/WindowServer/WSMenu.h @@ -1,7 +1,7 @@ #pragma once #include <AK/AKString.h> -#include <AK/Vector.h> +#include <AK/NonnullOwnPtrVector.h> #include <AK/WeakPtr.h> #include <LibCore/CObject.h> #include <LibDraw/Rect.h> @@ -28,10 +28,8 @@ public: bool is_empty() const { return m_items.is_empty(); } int item_count() const { return m_items.size(); } - WSMenuItem* item(int i) { return m_items[i].ptr(); } - const WSMenuItem* item(int i) const { return m_items[i].ptr(); } - void add_item(OwnPtr<WSMenuItem>&& item) { m_items.append(move(item)); } + void add_item(NonnullOwnPtr<WSMenuItem>&& item) { m_items.append(move(item)); } String name() const { return m_name; } @@ -39,7 +37,7 @@ public: void for_each_item(Callback callback) const { for (auto& item : m_items) - callback(*item); + callback(item); } Rect text_rect_in_menubar() const { return m_text_rect_in_menubar; } @@ -88,6 +86,6 @@ private: Rect m_text_rect_in_menubar; WSMenuBar* m_menubar { nullptr }; WSMenuItem* m_hovered_item { nullptr }; - Vector<OwnPtr<WSMenuItem>> m_items; + NonnullOwnPtrVector<WSMenuItem> m_items; OwnPtr<WSWindow> m_menu_window; }; |