Skip to content

IMFB is a cross-platform, modern C++ file browser widget for Dear ImGui. It provides a customizable, efficient, and easy-to-integrate file selection dialog for desktop applications.

License

Notifications You must be signed in to change notification settings

Life4gal/imgui-file-browser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMFB (ImGui File Browser)

License GitHub stars

Overview

IMFB is a cross-platform, modern C++ file browser widget for Dear ImGui. It provides a customizable, efficient, and easy-to-integrate file selection dialog for desktop applications.

Features

  • Cross-platform: Windows, Linux, macOS
  • Modern C++ (C++23)
  • Multiple selection, directory selection, filter support
  • Customizable flags and appearance
  • Example integration with SFML3

Getting Started

Prerequisites

  • CMake >= 3.25
  • C++23 compatible compiler (MSVC, Clang, GCC, AppleClang)
  • Dear ImGui
  • (Optional) SFML3 for example

Build Instructions

git clone https://github.com/Life4gal/imgui-file-browser.git 
cd imgui-file-browser

# Configure with CMake
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE="C:/workspace/vcpkg/scripts/buildsystems/vcpkg.cmake" cmake --build build

Usage

Include the header and link the library:

#include <imgui-file_browser.hpp>

auto main() noexcept -> int
{
	ImGui::FileBrowser file_browser{"FileBrowser"}; 

	file_browser.set_flags(
			// ImGui::FileBrowserFlags::NO_MODAL,
			ImGui::FileBrowserFlags::CLOSE_ON_ESCAPE,
			ImGui::FileBrowserFlags::CONFIRM_ON_ENTER,
			ImGui::FileBrowserFlags::MULTIPLE_SELECTION,
			ImGui::FileBrowserFlags::PATH_EDITABLE
		);
	file_browser.set_filter({".hpp", ".cpp", ".dll"});

	while (main_loop())
	{
		// Process event
		// ...

		// Update
		// ...

		ImGui::Begin("IMFB");
		{
			if (ImGui::Button("Open FileBrowser"))
			{
				file_browser.open();
			}
		}
		ImGui::End();

		file_browser.show(); 

		if (file_browser.has_selected()) 
		{ 
			auto selected = file_browser.get_selected(); 
			// Use selected file 
			// ...
		}

		// Render
		// ...
	}
}

See example/SFML3/main.cpp for a full integration example.

License

This project is licensed under the ISC License.

Links

About

IMFB is a cross-platform, modern C++ file browser widget for Dear ImGui. It provides a customizable, efficient, and easy-to-integrate file selection dialog for desktop applications.

Resources

License

Stars

Watchers

Forks