file selection callback
This commit is contained in:
parent
b716194602
commit
6fe211f5c8
3 changed files with 25 additions and 4 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#include "../ta-utils.h"
|
||||
#include "../engine/config.h"
|
||||
#include <stdint.h>
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include "imgui.h"
|
||||
|
||||
|
|
@ -61,6 +62,8 @@ enum FilePickerFlags {
|
|||
FP_FLAGS_EMBEDDABLE=32
|
||||
};
|
||||
|
||||
typedef std::function<void(const char*)> FilePickerSelectCallback;
|
||||
|
||||
class FurnaceFilePicker {
|
||||
enum SortModes {
|
||||
FP_SORT_NAME=0,
|
||||
|
|
@ -115,6 +118,7 @@ class FurnaceFilePicker {
|
|||
size_t curFilterType;
|
||||
SortModes sortMode;
|
||||
FilePickerStatus curStatus;
|
||||
FilePickerSelectCallback selCallback;
|
||||
|
||||
std::vector<FileTypeStyle> fileTypeRegistry;
|
||||
FileTypeStyle defaultTypeStyle[FP_TYPE_MAX];
|
||||
|
|
@ -166,7 +170,7 @@ class FurnaceFilePicker {
|
|||
bool draw(ImGuiWindowFlags winFlags=0);
|
||||
bool isOpened();
|
||||
void close();
|
||||
bool open(String name, String path, String hint, int flags, const std::vector<String>& filter);
|
||||
bool open(String name, String path, String hint, int flags, const std::vector<String>& filter, FilePickerSelectCallback selectCallback=NULL);
|
||||
void loadSettings(DivConfig& conf);
|
||||
void saveSettings(DivConfig& conf);
|
||||
void setTypeStyle(FileType type, ImVec4 color, String icon);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue