Skip to content

Limeoats/L2DFileDialog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lime2D File Dialog

A C++ file dialog using Dear ImGui.

Buy Me a Coffee at ko-fi.com

L2DFileDialog

Usage

Add L2DFileDialog.h to your C++ project and include it where you use ImGui. Then, set FileDialog::fileDialogOpen to true to set the open state. Finally, in your update method, check if FileDialog::fileDialogOpen == true and if so, call FileDialog::ShowFileDialog, passing in a char array as a buffer to store the chosen file/folder path.

Features

  • New folder
  • Delete folder
  • Sort by:
    • File
    • Size
    • Type
    • Last modified date

Example

You can see L2dFileDialog/src/main.cpp for a full example. Here is a very minimal sample:

...
static char* file_dialog_buffer = nullptr;
static char path[500] = "";

ImGui::TextUnformatted("Path: ");
ImGui::InputText("##path", path, sizeof(path));
ImGui::SameLine();
if (ImGui::Button("Browse##path")) {
  file_dialog_buffer = path;
  FileDialog::file_dialog_open = true;
  FileDialog::file_dialog_open_type = FileDialog::FileDialogType::SelectFolder;
}

if (FileDialog::file_dialog_open) {
  FileDialog::ShowFileDialog(&FileDialog::file_dialog_open, file_dialog_buffer, sizeof(file_dialog_buffer), FileDialog::file_dialog_open_type);
}
...

L2DFileDialogGif

License

This project is under the Apache License.