summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-15 01:56:30 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-15 01:56:30 +0100
commitb011ea9962ec66e9ff1793e278ffb91239324528 (patch)
tree1a4c8938c1ca97c6c97704e0501498fe9980c8a6 /Libraries/LibGUI
parent9e83bbe1cdf730fb5f5869105419f66f2d10345b (diff)
downloadserenity-b011ea9962ec66e9ff1793e278ffb91239324528.zip
LibGUI: Reduce menu-related header dependencies
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/Menu.cpp1
-rw-r--r--Libraries/LibGUI/Menu.h2
-rw-r--r--Libraries/LibGUI/MenuBar.cpp3
-rw-r--r--Libraries/LibGUI/MenuBar.h6
-rw-r--r--Libraries/LibGUI/MenuItem.cpp10
-rw-r--r--Libraries/LibGUI/MenuItem.h10
6 files changed, 22 insertions, 10 deletions
diff --git a/Libraries/LibGUI/Menu.cpp b/Libraries/LibGUI/Menu.cpp
index cc5455a6b0..45a8485e77 100644
--- a/Libraries/LibGUI/Menu.cpp
+++ b/Libraries/LibGUI/Menu.cpp
@@ -29,6 +29,7 @@
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Menu.h>
+#include <LibGUI/MenuItem.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h>
diff --git a/Libraries/LibGUI/Menu.h b/Libraries/LibGUI/Menu.h
index a1e8b094ce..9d7c537e3d 100644
--- a/Libraries/LibGUI/Menu.h
+++ b/Libraries/LibGUI/Menu.h
@@ -30,12 +30,12 @@
#include <AK/NonnullOwnPtrVector.h>
#include <AK/NonnullRefPtr.h>
#include <LibCore/Object.h>
-#include <LibGUI/MenuItem.h>
#include <LibGfx/Forward.h>
namespace GUI {
class Action;
+class MenuItem;
class Menu final : public Core::Object {
C_OBJECT(Menu)
diff --git a/Libraries/LibGUI/MenuBar.cpp b/Libraries/LibGUI/MenuBar.cpp
index c674c77443..7cb671b5f5 100644
--- a/Libraries/LibGUI/MenuBar.cpp
+++ b/Libraries/LibGUI/MenuBar.cpp
@@ -24,7 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <AK/Badge.h>
+#include <LibGUI/Menu.h>
#include <LibGUI/MenuBar.h>
+#include <LibGUI/MenuItem.h>
#include <LibGUI/WindowServerConnection.h>
namespace GUI {
diff --git a/Libraries/LibGUI/MenuBar.h b/Libraries/LibGUI/MenuBar.h
index 2e94696d5a..751903f15d 100644
--- a/Libraries/LibGUI/MenuBar.h
+++ b/Libraries/LibGUI/MenuBar.h
@@ -26,13 +26,13 @@
#pragma once
-#include <AK/Badge.h>
-#include <AK/NonnullOwnPtrVector.h>
-#include <LibGUI/Menu.h>
+#include <AK/Forward.h>
+#include <AK/NonnullRefPtrVector.h>
namespace GUI {
class Application;
+class Menu;
class MenuBar {
public:
diff --git a/Libraries/LibGUI/MenuItem.cpp b/Libraries/LibGUI/MenuItem.cpp
index 1a5dd05eec..8b75a45e69 100644
--- a/Libraries/LibGUI/MenuItem.cpp
+++ b/Libraries/LibGUI/MenuItem.cpp
@@ -88,4 +88,14 @@ void MenuItem::update_window_server()
WindowServerConnection::the().send_sync<Messages::WindowServer::UpdateMenuItem>(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, shortcut_text);
}
+void MenuItem::set_menu_id(Badge<Menu>, unsigned int menu_id)
+{
+ m_menu_id = menu_id;
+}
+
+void MenuItem::set_identifier(Badge<Menu>, unsigned identifier)
+{
+ m_identifier = identifier;
+}
+
}
diff --git a/Libraries/LibGUI/MenuItem.h b/Libraries/LibGUI/MenuItem.h
index d243dba7b4..f8c7a439ae 100644
--- a/Libraries/LibGUI/MenuItem.h
+++ b/Libraries/LibGUI/MenuItem.h
@@ -26,10 +26,8 @@
#pragma once
-#include <AK/Badge.h>
-#include <AK/NonnullOwnPtr.h>
-#include <AK/OwnPtr.h>
-#include <AK/String.h>
+#include <AK/Forward.h>
+#include <AK/RefPtr.h>
namespace GUI {
@@ -68,8 +66,8 @@ public:
bool is_enabled() const { return m_enabled; }
void set_enabled(bool);
- void set_menu_id(Badge<Menu>, unsigned menu_id) { m_menu_id = menu_id; }
- void set_identifier(Badge<Menu>, unsigned identifier) { m_identifier = identifier; }
+ void set_menu_id(Badge<Menu>, unsigned menu_id);
+ void set_identifier(Badge<Menu>, unsigned identifier);
private:
void update_window_server();