1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

Userland: Rename Core::Object to Core::EventReceiver

This is a more precise description of what this class actually does.
This commit is contained in:
Andreas Kling 2023-08-06 18:09:39 +02:00 committed by Jelle Raaijmakers
parent bdf696e488
commit ddbe6bd7b4
128 changed files with 399 additions and 401 deletions

View file

@ -6,7 +6,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibGUI/AbstractTableView.h>
#include <LibGUI/Action.h>
#include <LibGUI/Button.h>

View file

@ -7,7 +7,7 @@
#include <AK/Debug.h>
#include <AK/StringBuilder.h>
#include <AK/Utf8View.h>
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibCore/Timer.h>
#include <LibGUI/AbstractView.h>
#include <LibGUI/DragOperation.h>

View file

@ -15,62 +15,62 @@
namespace GUI {
NonnullRefPtr<Action> Action::create(DeprecatedString text, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create(DeprecatedString text, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), move(icon), move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent));
}
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(icon), move(callback), parent));
}
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), move(icon), move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> Action::create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent, true));
}
ErrorOr<NonnullRefPtr<Action>> Action::try_create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent)
ErrorOr<NonnullRefPtr<Action>> Action::try_create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return adopt_nonnull_ref_or_enomem(new (nothrow) Action(move(text), shortcut, Shortcut {}, move(callback), parent, true));
}
RefPtr<Action> Action::find_action_for_shortcut(Core::Object& object, Shortcut const& shortcut)
RefPtr<Action> Action::find_action_for_shortcut(Core::EventReceiver& object, Shortcut const& shortcut)
{
RefPtr<Action> found_action = nullptr;
object.for_each_child_of_type<Action>([&](auto& action) {
@ -83,28 +83,28 @@ RefPtr<Action> Action::find_action_for_shortcut(Core::Object& object, Shortcut c
return found_action;
}
Action::Action(DeprecatedString text, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
Action::Action(DeprecatedString text, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Action(move(text), Shortcut {}, Shortcut {}, nullptr, move(on_activation_callback), parent, checkable)
{
}
Action::Action(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
Action::Action(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Action(move(text), Shortcut {}, Shortcut {}, move(icon), move(on_activation_callback), parent, checkable)
{
}
Action::Action(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
Action::Action(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Action(move(text), shortcut, Shortcut {}, nullptr, move(on_activation_callback), parent, checkable)
{
}
Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Action(move(text), shortcut, alternate_shortcut, nullptr, move(on_activation_callback), parent, checkable)
{
}
Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
: Core::Object(parent)
Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> on_activation_callback, Core::EventReceiver* parent, bool checkable)
: Core::EventReceiver(parent)
, on_activation(move(on_activation_callback))
, m_text(move(text))
, m_icon(move(icon))
@ -148,7 +148,7 @@ void Action::process_event(Window& window, Event& event)
event.ignore();
}
void Action::activate(Core::Object* activator)
void Action::activate(Core::EventReceiver* activator)
{
if (is_activating())
return;

View file

@ -15,7 +15,7 @@
#include <AK/String.h>
#include <AK/WeakPtr.h>
#include <AK/Weakable.h>
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibCore/Timer.h>
#include <LibGUI/Forward.h>
#include <LibGUI/Shortcut.h>
@ -25,39 +25,39 @@ namespace GUI {
namespace CommonActions {
NonnullRefPtr<Action> make_about_action(DeprecatedString const& app_name, Icon const& app_icon, Window* parent = nullptr);
NonnullRefPtr<Action> make_open_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_save_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_undo_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_redo_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_delete_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_open_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_save_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_undo_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_redo_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_delete_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_quit_action(Function<void(Action&)>);
NonnullRefPtr<Action> make_help_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_rename_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_properties_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_zoom_in_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_zoom_out_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_reset_zoom_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_rotate_clockwise_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_rotate_counterclockwise_action(Function<void(Action&)>, Core::Object* parent = nullptr);
NonnullRefPtr<Action> make_help_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_rename_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_properties_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_zoom_in_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_zoom_out_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_reset_zoom_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_rotate_clockwise_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_rotate_counterclockwise_action(Function<void(Action&)>, Core::EventReceiver* parent = nullptr);
NonnullRefPtr<Action> make_command_palette_action(Window* window = nullptr);
};
class Action final : public Core::Object {
class Action final : public Core::EventReceiver {
C_OBJECT(Action)
public:
enum class ShortcutScope {
@ -66,20 +66,20 @@ public:
WindowLocal,
ApplicationGlobal,
};
static NonnullRefPtr<Action> create(DeprecatedString text, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create(DeprecatedString text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static NonnullRefPtr<Action> create_checkable(DeprecatedString text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static ErrorOr<NonnullRefPtr<Action>> try_create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
static ErrorOr<NonnullRefPtr<Action>> try_create_checkable(DeprecatedString text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::EventReceiver* parent = nullptr);
static RefPtr<Action> find_action_for_shortcut(Core::Object& object, Shortcut const& shortcut);
static RefPtr<Action> find_action_for_shortcut(Core::EventReceiver& object, Shortcut const& shortcut);
virtual ~Action() override;
@ -97,12 +97,12 @@ public:
Gfx::Bitmap const* icon() const { return m_icon.ptr(); }
void set_icon(Gfx::Bitmap const*);
Core::Object const* activator() const { return m_activator.ptr(); }
Core::Object* activator() { return m_activator.ptr(); }
Core::EventReceiver const* activator() const { return m_activator.ptr(); }
Core::EventReceiver* activator() { return m_activator.ptr(); }
Function<void(Action&)> on_activation;
void activate(Core::Object* activator = nullptr);
void activate(Core::EventReceiver* activator = nullptr);
void process_event(Window& window, Event& event);
void flash_menubar_menu(GUI::Window& window);
@ -138,11 +138,11 @@ public:
HashTable<MenuItem*> const& menu_items() const { return m_menu_items; }
private:
Action(DeprecatedString, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Shortcut const&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Shortcut const&, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
Action(DeprecatedString, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
Action(DeprecatedString, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Shortcut const&, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(DeprecatedString, Shortcut const&, Shortcut const&, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
Action(DeprecatedString, RefPtr<Gfx::Bitmap const> icon, Function<void(Action&)> = nullptr, Core::EventReceiver* = nullptr, bool checkable = false);
template<typename Callback>
void for_each_toolbar_button(Callback);
@ -166,7 +166,7 @@ private:
HashTable<Button*> m_buttons;
HashTable<MenuItem*> m_menu_items;
WeakPtr<ActionGroup> m_action_group;
WeakPtr<Core::Object> m_activator;
WeakPtr<Core::EventReceiver> m_activator;
};
}

View file

@ -328,7 +328,7 @@ void Application::event(Core::Event& event)
if (on_theme_change)
on_theme_change();
}
Object::event(event);
EventReceiver::event(event);
}
void Application::set_config_domain(String config_domain)

View file

@ -12,7 +12,7 @@
#include <AK/String.h>
#include <AK/WeakPtr.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibGUI/Forward.h>
#include <LibGUI/Shortcut.h>
#include <LibGUI/Widget.h>
@ -21,7 +21,7 @@
namespace GUI {
class Application : public Core::Object {
class Application : public Core::EventReceiver {
C_OBJECT_ABSTRACT(Application);
public:

View file

@ -231,7 +231,7 @@ void CommandPalette::collect_actions(GUI::Window& parent_window)
{
OrderedHashTable<NonnullRefPtr<GUI::Action>> actions;
auto collect_action_children = [&](Core::Object& action_parent) {
auto collect_action_children = [&](Core::EventReceiver& action_parent) {
action_parent.for_each_child_of_type<GUI::Action>([&](GUI::Action& action) {
if (action.is_enabled() && action.is_visible())
actions.set(action);

View file

@ -32,85 +32,85 @@ NonnullRefPtr<Action> make_about_action(DeprecatedString const& app_name, Icon c
return action;
}
NonnullRefPtr<Action> make_open_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_open_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open an existing file"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_save_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_save_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file with a new name"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the top of the stack"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the bottom of the stack"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_undo_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_undo_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return Action::create("&Undo", { Mod_Ctrl, Key_Z }, Gfx::Bitmap::load_from_file("/res/icons/16x16/undo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_redo_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_redo_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return Action::create("&Redo", { Mod_Ctrl | Mod_Shift, Key_Z }, { Mod_Ctrl, Key_Y }, Gfx::Bitmap::load_from_file("/res/icons/16x16/redo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_delete_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_delete_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return Action::create("&Delete", { Mod_None, Key_Delete }, Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Cut to clipboard"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Copy to clipboard"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Paste from clipboard"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Insert Emoji...", { Mod_Ctrl | Mod_Alt, Key_Space }, Gfx::Bitmap::load_from_file("/res/icons/16x16/emoji.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open the Emoji Picker"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Fullscreen", { Mod_None, Key_F11 }, move(callback), parent);
action->set_status_tip("Enter fullscreen mode"_string.release_value_but_fixme_should_propagate_errors());
@ -125,80 +125,80 @@ NonnullRefPtr<Action> make_quit_action(Function<void(Action&)> callback)
return action;
}
NonnullRefPtr<Action> make_help_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_help_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Show help contents"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step backward in history"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step forward in history"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return Action::create("Go &Home", { Mod_Alt, Key_Home }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-home.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Close current tab"_string.release_value_but_fixme_should_propagate_errors());
return action;
}
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return Action::create("&Reload", { Mod_Ctrl, Key_R }, Key_F5, Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return Action::create("Select &All", { Mod_Ctrl, Key_A }, Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rename_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_rename_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return Action::create("Re&name...", Key_F2, Gfx::Bitmap::load_from_file("/res/icons/16x16/rename.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_properties_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_properties_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return Action::create("P&roperties", { Mod_Alt, Key_Return }, Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_zoom_in_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_zoom_in_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return GUI::Action::create("Zoom &In", { Mod_Ctrl, Key_Equal }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-in.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_reset_zoom_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_reset_zoom_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return GUI::Action::create("&Reset Zoom", { Mod_Ctrl, Key_0 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-reset.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_zoom_out_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_zoom_out_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return GUI::Action::create("Zoom &Out", { Mod_Ctrl, Key_Minus }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-out.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rotate_clockwise_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_rotate_clockwise_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return GUI::Action::create("Rotate Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rotate_counterclockwise_action(Function<void(Action&)> callback, Core::Object* parent)
NonnullRefPtr<Action> make_rotate_counterclockwise_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
return GUI::Action::create("Rotate &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}

View file

@ -57,5 +57,5 @@ private:
}
template<>
struct AK::Formatter<GUI::Dialog> : Formatter<Core::Object> {
struct AK::Formatter<GUI::Dialog> : Formatter<Core::EventReceiver> {
};

View file

@ -16,8 +16,8 @@ namespace GUI {
static DragOperation* s_current_drag_operation;
DragOperation::DragOperation(Core::Object* parent)
: Core::Object(parent)
DragOperation::DragOperation(Core::EventReceiver* parent)
: Core::EventReceiver(parent)
{
}

View file

@ -8,14 +8,14 @@
#pragma once
#include <AK/OwnPtr.h>
#include <LibCore/EventReceiver.h>
#include <LibCore/MimeData.h>
#include <LibCore/Object.h>
#include <LibGUI/Forward.h>
#include <LibGfx/Forward.h>
namespace GUI {
class DragOperation : public Core::Object {
class DragOperation : public Core::EventReceiver {
C_OBJECT(DragOperation)
public:
enum class Outcome {
@ -38,7 +38,7 @@ public:
static void notify_cancelled(Badge<ConnectionToWindowServer>);
protected:
explicit DragOperation(Core::Object* parent = nullptr);
explicit DragOperation(Core::EventReceiver* parent = nullptr);
private:
void done(Outcome);

View file

@ -8,7 +8,7 @@
#include <AK/String.h>
#include <AK/WeakPtr.h>
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibGUI/Action.h>
#include <LibGUI/ColorFilterer.h>
#include <LibGUI/Event.h>
@ -23,7 +23,7 @@ ErrorOr<NonnullRefPtr<Menu>> make_accessibility_menu(GUI::ColorFilterer&);
};
class Menu final : public Core::Object {
class Menu final : public Core::EventReceiver {
C_OBJECT(Menu)
public:
virtual ~Menu() override;

View file

@ -10,13 +10,13 @@
#include <AK/Badge.h>
#include <AK/IterationDecision.h>
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibGUI/Forward.h>
#include <LibGUI/Menu.h>
namespace GUI {
class Menubar : public Core::Object {
class Menubar : public Core::EventReceiver {
C_OBJECT(Menubar);
public:

View file

@ -6,14 +6,14 @@
#pragma once
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibGfx/Bitmap.h>
namespace GUI {
class ConnectionToNotificationServer;
class Notification : public Core::Object {
class Notification : public Core::EventReceiver {
C_OBJECT(Notification);
friend class ConnectionToNotificationServer;

View file

@ -8,8 +8,8 @@
namespace GUI {
Object::Object(Core::Object* parent)
: Core::Object(parent)
Object::Object(Core::EventReceiver* parent)
: Core::EventReceiver(parent)
{
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibGUI/Forward.h>
#include <LibGUI/Property.h>
@ -44,7 +44,7 @@ private:
ObjectClassRegistration* m_parent_class { nullptr };
};
class Object : public Core::Object {
class Object : public Core::EventReceiver {
C_OBJECT_ABSTRACT(Object);
public:
@ -55,7 +55,7 @@ public:
HashMap<DeprecatedString, NonnullOwnPtr<Property>> const& properties() const { return m_properties; }
protected:
explicit Object(Core::Object* parent = nullptr);
explicit Object(Core::EventReceiver* parent = nullptr);
void register_property(DeprecatedString const& name, Function<JsonValue()> getter, Function<bool(JsonValue const&)> setter = nullptr);

View file

@ -129,7 +129,7 @@ ErrorOr<void> ScrollableContainerWidget::load_from_gml_ast(NonnullRefPtr<GUI::GM
auto const& content_widget = static_cast<GUI::GML::Object const&>(*content_widget_value);
auto class_name = content_widget.name();
RefPtr<Core::Object> child;
RefPtr<Core::EventReceiver> child;
if (auto* registration = GUI::ObjectClassRegistration::find(class_name)) {
child = TRY(registration->construct());
} else {

View file

@ -6,7 +6,7 @@
*/
#include <AK/Debug.h>
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibGUI/HeaderView.h>
#include <LibGUI/Model.h>
#include <LibGUI/Painter.h>

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/Optional.h>
#include <LibCore/Object.h>
#include <LibCore/EventReceiver.h>
#include <LibGUI/EditingEngine.h>
#include <LibGUI/TextRange.h>

View file

@ -249,7 +249,7 @@ void Widget::child_event(Core::ChildEvent& event)
}
update();
}
return Core::Object::child_event(event);
return Core::EventReceiver::child_event(event);
}
void Widget::set_relative_rect(Gfx::IntRect const& a_rect)
@ -347,7 +347,7 @@ void Widget::event(Core::Event& event)
case Event::AppletAreaRectChange:
return applet_area_rect_change_event(static_cast<AppletAreaRectChangeEvent&>(event));
default:
return Core::Object::event(event);
return Core::EventReceiver::event(event);
}
}
@ -1134,7 +1134,7 @@ void Widget::set_override_cursor(AK::Variant<Gfx::StandardCursor, NonnullRefPtr<
ErrorOr<void> Widget::load_from_gml(StringView gml_string)
{
return load_from_gml(gml_string, [](DeprecatedString const& class_name) -> ErrorOr<NonnullRefPtr<Core::Object>> {
return load_from_gml(gml_string, [](DeprecatedString const& class_name) -> ErrorOr<NonnullRefPtr<Core::EventReceiver>> {
dbgln("Class '{}' not registered", class_name);
return Error::from_string_literal("Class not registered");
});
@ -1195,7 +1195,7 @@ ErrorOr<void> Widget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node const> ast,
}
this->layout()->add_spacer();
} else {
RefPtr<Core::Object> child;
RefPtr<Core::EventReceiver> child;
if (auto* registration = GUI::ObjectClassRegistration::find(class_name)) {
child = TRY(registration->construct());
if (!registration->is_derived_from(widget_class)) {

View file

@ -350,7 +350,7 @@ public:
AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap const>> const& override_cursor() const { return m_override_cursor; }
void set_override_cursor(AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap const>>);
using UnregisteredChildHandler = ErrorOr<NonnullRefPtr<Core::Object>>(DeprecatedString const&);
using UnregisteredChildHandler = ErrorOr<NonnullRefPtr<Core::EventReceiver>>(DeprecatedString const&);
ErrorOr<void> load_from_gml(StringView);
ErrorOr<void> load_from_gml(StringView, UnregisteredChildHandler);
@ -477,8 +477,8 @@ inline Widget const* Widget::parent_widget() const
}
template<>
inline bool Core::Object::fast_is<GUI::Widget>() const { return is_widget(); }
inline bool Core::EventReceiver::fast_is<GUI::Widget>() const { return is_widget(); }
template<>
struct AK::Formatter<GUI::Widget> : AK::Formatter<Core::Object> {
struct AK::Formatter<GUI::Widget> : AK::Formatter<Core::EventReceiver> {
};

View file

@ -71,7 +71,7 @@ Window* Window::from_window_id(int window_id)
return nullptr;
}
Window::Window(Core::Object* parent)
Window::Window(Core::EventReceiver* parent)
: GUI::Object(parent)
, m_menubar(Menubar::construct())
{
@ -760,7 +760,7 @@ void Window::event(Core::Event& event)
if (event.type() == Event::AppletAreaRectChange)
return handle_applet_area_rect_change_event(static_cast<AppletAreaRectChangeEvent&>(event));
Core::Object::event(event);
Core::EventReceiver::event(event);
}
bool Window::is_visible() const

View file

@ -242,7 +242,7 @@ public:
void propagate_shortcuts(KeyEvent& event, Widget* widget, ShortcutPropagationBoundary = ShortcutPropagationBoundary::Application);
protected:
Window(Core::Object* parent = nullptr);
Window(Core::EventReceiver* parent = nullptr);
virtual void wm_event(WMEvent&);
virtual void screen_rects_change_event(ScreenRectsChangeEvent&);
virtual void applet_area_rect_change_event(AppletAreaRectChangeEvent&);
@ -329,5 +329,5 @@ private:
}
template<>
struct AK::Formatter<GUI::Window> : Formatter<Core::Object> {
struct AK::Formatter<GUI::Window> : Formatter<Core::EventReceiver> {
};