diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-03 15:23:13 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-03 15:23:13 +0200 |
commit | dde224fe442751b09aa858c35479d2fa69ead1cb (patch) | |
tree | ac1622d720ce7b68f250a3c3572b4ae1a6b16dff /Applications/FontEditor/GlyphMapWidget.h | |
parent | b9738fa8ac001945d440d2c078d8a3ec2b2a893b (diff) | |
download | serenity-dde224fe442751b09aa858c35479d2fa69ead1cb.zip |
FontEditor: Break out classes into separate files.
Diffstat (limited to 'Applications/FontEditor/GlyphMapWidget.h')
-rw-r--r-- | Applications/FontEditor/GlyphMapWidget.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Applications/FontEditor/GlyphMapWidget.h b/Applications/FontEditor/GlyphMapWidget.h new file mode 100644 index 0000000000..23c85d6cf4 --- /dev/null +++ b/Applications/FontEditor/GlyphMapWidget.h @@ -0,0 +1,37 @@ +#pragma once + +#include <LibGUI/GWidget.h> +#include <AK/Function.h> + +class GlyphMapWidget final : public GWidget { +public: + GlyphMapWidget(Font&, GWidget* parent); + virtual ~GlyphMapWidget() override; + + byte selected_glyph() const { return m_selected_glyph; } + void set_selected_glyph(byte); + + int rows() const { return m_rows; } + int columns() const { return 256 / m_rows; } + + int preferred_width() const; + int preferred_height() const; + + Font& font() { return *m_font; } + const Font& font() const { return *m_font; } + + Function<void(byte)> on_glyph_selected; + +private: + virtual void paint_event(GPaintEvent&) override; + virtual void mousedown_event(GMouseEvent&) override; + virtual bool accepts_focus() const override { return true; } + + Rect get_outer_rect(byte glyph) const; + + RetainPtr<Font> m_font; + int m_rows { 8 }; + int m_horizontal_spacing { 2 }; + int m_vertical_spacing { 2 }; + byte m_selected_glyph { 0 }; +}; |