mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
5aefd7f828
Painter gains the ability to draw lines with arbitrary thickness. It's basically implemented by drawing filled rects for thickness>1. In PaintBrush, Tool classes can now override on_contextmenu() to provide a context menu for the toolbox button. :^)
23 lines
540 B
C++
23 lines
540 B
C++
#pragma once
|
|
|
|
#include "PaintableWidget.h"
|
|
class GMouseEvent;
|
|
|
|
class Tool {
|
|
public:
|
|
virtual ~Tool();
|
|
|
|
virtual const char* class_name() const = 0;
|
|
|
|
virtual void on_mousedown(GMouseEvent&) { }
|
|
virtual void on_mousemove(GMouseEvent&) { }
|
|
virtual void on_mouseup(GMouseEvent&) { }
|
|
virtual void on_contextmenu(GContextMenuEvent&) { }
|
|
|
|
void clear() { m_widget = nullptr; }
|
|
void setup(PaintableWidget& widget) { m_widget = widget.make_weak_ptr(); }
|
|
|
|
protected:
|
|
Tool();
|
|
WeakPtr<PaintableWidget> m_widget;
|
|
};
|