2019-04-10 03:43:57 +03:00
|
|
|
#include <LibGUI/GFrame.h>
|
2019-04-03 16:23:13 +03:00
|
|
|
#include <AK/Function.h>
|
|
|
|
|
2019-04-10 03:43:57 +03:00
|
|
|
class GlyphEditorWidget final : public GFrame {
|
2019-04-03 16:23:13 +03:00
|
|
|
public:
|
|
|
|
GlyphEditorWidget(Font&, GWidget* parent);
|
|
|
|
virtual ~GlyphEditorWidget() override;
|
|
|
|
|
|
|
|
byte glyph() const { return m_glyph; }
|
|
|
|
void set_glyph(byte);
|
|
|
|
|
|
|
|
int preferred_width() const;
|
|
|
|
int preferred_height() const;
|
|
|
|
|
|
|
|
Font& font() { return *m_font; }
|
|
|
|
const Font& font() const { return *m_font; }
|
|
|
|
|
2019-04-06 16:28:06 +03:00
|
|
|
Function<void(byte)> on_glyph_altered;
|
2019-04-03 16:23:13 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
|
|
virtual void mousedown_event(GMouseEvent&) override;
|
|
|
|
virtual void mousemove_event(GMouseEvent&) override;
|
|
|
|
virtual bool accepts_focus() const override { return true; }
|
|
|
|
|
|
|
|
void draw_at_mouse(const GMouseEvent&);
|
|
|
|
|
|
|
|
RetainPtr<Font> m_font;
|
|
|
|
byte m_glyph { 0 };
|
|
|
|
int m_scale { 10 };
|
|
|
|
};
|