Add file drop functionality
Adds the ability to drag and drop files from windows in order to attempt to execute them
This commit is contained in:
@@ -32,6 +32,7 @@ using xe::ui::KeyEvent;
|
||||
using xe::ui::MenuItem;
|
||||
using xe::ui::MouseEvent;
|
||||
using xe::ui::UIEvent;
|
||||
using xe::ui::FileDropEvent;
|
||||
|
||||
const std::wstring kBaseTitle = L"xenia";
|
||||
|
||||
@@ -81,6 +82,9 @@ bool EmulatorWindow::Initialize() {
|
||||
});
|
||||
loop_->on_quit.AddListener([this](UIEvent* e) { window_.reset(); });
|
||||
|
||||
window_->on_file_drop.AddListener(
|
||||
[this](FileDropEvent* e) { FileDrop(e->filename()); });
|
||||
|
||||
window_->on_key_down.AddListener([this](KeyEvent* e) {
|
||||
bool handled = true;
|
||||
switch (e->key_code()) {
|
||||
@@ -257,6 +261,15 @@ bool EmulatorWindow::Initialize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmulatorWindow::FileDrop(wchar_t* filename) {
|
||||
std::wstring path = filename;
|
||||
auto result = emulator_->LaunchPath(path);
|
||||
if (XFAILED(result)) {
|
||||
// TODO: Display a message box.
|
||||
XELOGE("Failed to launch target: %.8X", result);
|
||||
}
|
||||
}
|
||||
|
||||
void EmulatorWindow::FileOpen() {
|
||||
std::wstring path;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user