mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05: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)
|
||||
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:
|
||||
FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&);
|
||||
|
||||
virtual void drop_event(GUI::DropEvent&) override;
|
||||
|
||||
void open_file(String const&);
|
||||
void undo();
|
||||
void redo();
|
||||
|
|
Loading…
Add table
Reference in a new issue