libui+libos: Move Action to libos

This commit is contained in:
apio 2023-10-07 15:31:50 +02:00
parent 945cfab3eb
commit 0b2a835336
Signed by: apio
GPG Key ID: B8A7D06E42258954
3 changed files with 14 additions and 5 deletions

View File

@ -1,7 +1,16 @@
/**
* @file Action.h
* @author apio (cloudapio.eu)
* @brief Wrapper for callable objects, like function pointers or lambdas.
*
* @copyright Copyright (c) 2023, the Luna authors.
*
*/
#pragma once
#include <luna/Heap.h>
namespace ui
namespace os
{
class Action
{

View File

@ -8,7 +8,7 @@
*/
#pragma once
#include <ui/Action.h>
#include <os/Action.h>
#include <ui/Widget.h>
namespace ui
@ -19,7 +19,7 @@ namespace ui
Button(Rect rect);
void set_widget(Widget& widget);
void set_action(Action&& action);
void set_action(os::Action&& action);
Result<EventResult> handle_mouse_move(Point position) override;
Result<EventResult> handle_mouse_leave() override;
@ -32,6 +32,6 @@ namespace ui
bool m_hovered { false };
bool m_clicked { false };
Widget* m_child;
Action m_action;
os::Action m_action;
};
}

View File

@ -24,7 +24,7 @@ namespace ui
widget.set_parent(this);
}
void Button::set_action(Action&& action)
void Button::set_action(os::Action&& action)
{
m_action = move(action);
}