mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-06 13:35:03 +00:00
HackStudio: Introduce a Tool class with subs CursorTool and WidgetTool
These will be used to draw out new widgets on a FormWidget, or in the case of CursorTool, to select and manipulate existing widgets.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
#include "FormEditorWidget.h"
|
||||
#include "CursorTool.h"
|
||||
#include "FormWidget.h"
|
||||
#include <LibGUI/GPainter.h>
|
||||
|
||||
FormEditorWidget::FormEditorWidget(GWidget* parent)
|
||||
: GScrollableWidget(parent)
|
||||
, m_tool(make<CursorTool>(*this))
|
||||
{
|
||||
set_fill_with_background_color(true);
|
||||
set_background_color(Color::MidGray);
|
||||
@@ -26,3 +28,10 @@ void FormEditorWidget::paint_event(GPaintEvent& event)
|
||||
GPainter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
}
|
||||
|
||||
void FormEditorWidget::set_tool(NonnullOwnPtr<Tool> tool)
|
||||
{
|
||||
m_tool->detach();
|
||||
m_tool = move(tool);
|
||||
m_tool->attach();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user