libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
FileDrop.h
Go to the documentation of this file.
1#pragma once
2#include <vector>
3#include <memory>
6
13typedef bool (*FileDroppedFunc)(char*);
14
15namespace Ship {
16
29class FileDrop : public Component {
30 public:
32 explicit FileDrop(std::shared_ptr<Window> window = nullptr);
34
39 void SetDroppedFile(char* path);
40
43
45 bool FileDropped() const;
46
51 char* GetDroppedFile() const;
52
59
66
69
70 private:
71 std::vector<FileDroppedFunc> mRegisteredFuncs;
72 char* mPath = nullptr;
73 bool mFileDropped = false;
74 std::shared_ptr<Window> mWindow;
75
77 std::shared_ptr<Window> GetWindow() const;
78};
79
80} // namespace Ship
bool(* FileDroppedFunc)(char *)
Callback type for file-drop event handlers.
Definition FileDrop.h:13
A named Part with a parent/child hierarchy and optional thread safety.
Definition Component.h:34
Handles drag-and-drop file events for the application window.
Definition FileDrop.h:29
void ClearDroppedFile()
Clears the current dropped-file state.
void SetDroppedFile(char *path)
Records a file path as having been dropped onto the window.
bool RegisterDropHandler(FileDroppedFunc func)
Registers a callback to be invoked when a file is dropped.
FileDrop(std::shared_ptr< Window > window=nullptr)
Constructs the FileDrop component.
bool FileDropped() const
Returns true if a file has been dropped and not yet cleared.
bool UnregisterDropHandler(FileDroppedFunc func)
Removes a previously registered drop handler.
void CallHandlers()
Invokes all registered drop handlers with the current dropped file.
char * GetDroppedFile() const
Returns the path of the most recently dropped file.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14