Add a display server and graphical user interface #38
@ -20,16 +20,6 @@ struct ColorWidget : public ui::Widget
|
||||
return ui::EventResult::DidHandle;
|
||||
}
|
||||
|
||||
Result<ui::EventResult> handle_mouse_down(ui::Point, int) override
|
||||
{
|
||||
return ui::EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<ui::EventResult> handle_mouse_up(ui::Point, int) override
|
||||
{
|
||||
return ui::EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<void> draw(ui::Canvas& canvas) override
|
||||
{
|
||||
canvas.fill(m_color);
|
||||
|
@ -84,10 +84,6 @@ namespace ui
|
||||
public:
|
||||
static Result<OwnedPtr<ImageWidget>> load(const os::Path& path);
|
||||
|
||||
Result<EventResult> handle_mouse_move(Point position) override;
|
||||
Result<EventResult> handle_mouse_leave() override;
|
||||
Result<EventResult> handle_mouse_down(Point position, int buttons) override;
|
||||
Result<EventResult> handle_mouse_up(Point position, int buttons) override;
|
||||
Result<void> draw(Canvas& canvas) override;
|
||||
|
||||
private:
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <luna/Ignore.h>
|
||||
#include <luna/Result.h>
|
||||
#include <ui/Canvas.h>
|
||||
#include <ui/Point.h>
|
||||
@ -26,10 +27,28 @@ namespace ui
|
||||
class Widget
|
||||
{
|
||||
public:
|
||||
virtual Result<EventResult> handle_mouse_move(Point position);
|
||||
virtual Result<EventResult> handle_mouse_down(Point position, int buttons);
|
||||
virtual Result<EventResult> handle_mouse_up(Point position, int buttons);
|
||||
virtual Result<EventResult> handle_mouse_leave();
|
||||
virtual Result<EventResult> handle_mouse_move(Point position)
|
||||
{
|
||||
ignore(position);
|
||||
return EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
virtual Result<EventResult> handle_mouse_down(Point position, int buttons)
|
||||
{
|
||||
ignore(position, buttons);
|
||||
return EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
virtual Result<EventResult> handle_mouse_up(Point position, int buttons)
|
||||
{
|
||||
ignore(position, buttons);
|
||||
return EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
virtual Result<EventResult> handle_mouse_leave()
|
||||
{
|
||||
return EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
virtual Result<void> draw(Canvas& canvas);
|
||||
|
||||
|
@ -40,26 +40,6 @@ namespace ui
|
||||
return widget;
|
||||
}
|
||||
|
||||
Result<EventResult> ImageWidget::handle_mouse_move(Point)
|
||||
{
|
||||
return EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<EventResult> ImageWidget::handle_mouse_leave()
|
||||
{
|
||||
return EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<EventResult> ImageWidget::handle_mouse_up(Point, int)
|
||||
{
|
||||
return EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<EventResult> ImageWidget::handle_mouse_down(Point, int)
|
||||
{
|
||||
return EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<void> ImageWidget::draw(Canvas& canvas)
|
||||
{
|
||||
canvas.subcanvas({ 0, 0, m_image->width(), m_image->height() }).fill(m_image->pixels(), m_image->width());
|
||||
|
Loading…
Reference in New Issue
Block a user