mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
FontEditor: Accept file drops
This commit is contained in:
parent
a0cb8cfefd
commit
0a54a86a8b
2 changed files with 19 additions and 0 deletions
|
@ -714,3 +714,20 @@ void FontEditorWidget::update_preview()
|
||||||
if (m_font_preview_window)
|
if (m_font_preview_window)
|
||||||
m_font_preview_window->update();
|
m_font_preview_window->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FontEditorWidget::drop_event(GUI::DropEvent& event)
|
||||||
|
{
|
||||||
|
event.accept();
|
||||||
|
|
||||||
|
if (event.mime_data().has_urls()) {
|
||||||
|
auto urls = event.mime_data().urls();
|
||||||
|
if (urls.is_empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
window()->move_to_front();
|
||||||
|
if (!request_close())
|
||||||
|
return;
|
||||||
|
|
||||||
|
open_file(urls.first().path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
private:
|
private:
|
||||||
FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&);
|
FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&);
|
||||||
|
|
||||||
|
virtual void drop_event(GUI::DropEvent&) override;
|
||||||
|
|
||||||
void open_file(String const&);
|
void open_file(String const&);
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue