mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:28:11 +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:
parent
a04ab219d1
commit
e87756424d
12 changed files with 166 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue