All Projects → AirGuanZ → Imgui Filebrowser

AirGuanZ / Imgui Filebrowser

Licence: mit
File browser implementation for dear-imgui. C++17 is required.

Labels

Projects that are alternatives of or similar to Imgui Filebrowser

Sonyheadphonesclient
A {Windows, macOS, Linux} client recreating the functionality of the Sony Headphones app
Stars: ✭ 123 (-46.75%)
Mutual labels:  imgui
Rapidgui
Unity OnGUI(IMGUI) extensions for Rapid prototyping/development
Stars: ✭ 144 (-37.66%)
Mutual labels:  imgui
Imguizmo.quat
ImGui GIZMO widget - 3D object manipulator / orientator
Stars: ✭ 187 (-19.05%)
Mutual labels:  imgui
Node editor framework
A flexible and modular Node Editor Framework for creating node based displays and editors in Unity
Stars: ✭ 1,751 (+658.01%)
Mutual labels:  imgui
Wave Particles With Interactive Vortices
A dx12 river renderer using wave particles with interactive vortices.
Stars: ✭ 144 (-37.66%)
Mutual labels:  imgui
Imgui Ws
Dear ImGui over WebSockets
Stars: ✭ 165 (-28.57%)
Mutual labels:  imgui
Qtimgui
Qt (QOpenGLWidget / QOpenGLWindow) backend for ImGui
Stars: ✭ 119 (-48.48%)
Mutual labels:  imgui
Goesp
Cross-platform streamproof ESP hack for Counter-Strike: Global Offensive, written in modern C++. Rendering and GUI powered by Dear ImGui.
Stars: ✭ 210 (-9.09%)
Mutual labels:  imgui
Bimpy
imgui for python
Stars: ✭ 144 (-37.66%)
Mutual labels:  imgui
Vxr
General purpose engine written in C++ with emphasis on materials rendering (PBR, clear coat, anisotropy, iridescence)
Stars: ✭ 181 (-21.65%)
Mutual labels:  imgui
Imgui
Immediate Mode GUI for C#
Stars: ✭ 133 (-42.42%)
Mutual labels:  imgui
Imgui sdl
ImGuiSDL: SDL2 based renderer for Dear ImGui
Stars: ✭ 134 (-41.99%)
Mutual labels:  imgui
Libtorch Yolov3 Deepsort
Stars: ✭ 165 (-28.57%)
Mutual labels:  imgui
Nukleardotnet
.NET binding for the Nuklear immediate mode GUI
Stars: ✭ 126 (-45.45%)
Mutual labels:  imgui
Netimgui
'Dear Imgui' remote access library and application
Stars: ✭ 189 (-18.18%)
Mutual labels:  imgui
Hello imgui
Hello, Dear ImGui: cross-platform Gui apps for Windows / Mac / Linux / iOS / Android / Emscripten with the simplicity of a "Hello World" app
Stars: ✭ 120 (-48.05%)
Mutual labels:  imgui
Imguifontstudio
Font Helper Gui Tool for programming
Stars: ✭ 149 (-35.5%)
Mutual labels:  imgui
Nimgl
NimGL is a Nim library that offers bindings for popular libraries used in computer graphics
Stars: ✭ 218 (-5.63%)
Mutual labels:  imgui
Nuklear
A single-header ANSI C gui library
Stars: ✭ 13,365 (+5685.71%)
Mutual labels:  imgui
Webgui
An example demo of IMGUI (Immediate Mode GUI) on the web. Using only WebGL, GLFW and ImGui. Suitable for being compiled to web assembly (WASM).
Stars: ✭ 180 (-22.08%)
Mutual labels:  imgui

imgui-filebrowser

imgui-filebrowser is a header-only file browser implementation for dear-imgui. C++ 17 is required.

IMG

Getting Started

imfilebrowser.h should be included after imgui.h:

#include <imgui.h>
#include <imfilebrowser.h>

Instead of creating a file dialog with an immediate function call, you need to create a ImGui::FileBrowser instance, open it with member function Open(), and call Display() in each frame. Here is a simple example:

#include <imgui.h>
#include <imfilebrowser.h>

int main()
{
    //...initialize rendering window and imgui
    
    // create a file browser instance
    ImGui::FileBrowser fileDialog;
    
    // (optional) set browser properties
    fileDialog.SetTitle("title");
    fileDialog.SetTypeFilters({ ".h", ".cpp" });
    
    // mainloop
    while(continueRendering)
    {
        //...do other stuff like ImGui::NewFrame();
        
        if(ImGui::Begin("dummy window"))
        {
            // open file dialog when user clicks this button
            if(ImGui::Button("open file dialog"))
                fileDialog.Open();
        }
        ImGui::End();
        
        fileDialog.Display();
        
        if(fileDialog.HasSelected())
        {
            std::cout << "Selected filename" << fileDialog.GetSelected().string() << std::endl;
            fileDialog.ClearSelected();
        }
        
        //...do other stuff like ImGui::Render();
    }
    
    //...shutdown
}

Options

Various options can be combined with '|' and passed to the constructor:

enum ImGuiFileBrowserFlags_
{
    ImGuiFileBrowserFlags_SelectDirectory   = 1 << 0, // select directory instead of regular file
    ImGuiFileBrowserFlags_EnterNewFilename  = 1 << 1, // allow user to enter new filename when selecting regular file
    ImGuiFileBrowserFlags_NoModal           = 1 << 2, // file browsing window is modal by default. specify this to use a popup window
    ImGuiFileBrowserFlags_NoTitleBar        = 1 << 3, // hide window title bar
    ImGuiFileBrowserFlags_NoStatusBar       = 1 << 4, // hide status bar at the bottom of browsing window
    ImGuiFileBrowserFlags_CloseOnEsc        = 1 << 5, // close file browser when pressing 'ESC'
    ImGuiFileBrowserFlags_CreateNewDir      = 1 << 6, // allow user to create new directory
    ImGuiFileBrowserFlags_MultipleSelection = 1 << 7, // allow user to select multiple files. this will hide ImGuiFileBrowserFlags_EnterNewFilename
};

When ImGuiFileBrowserFlags_MultipleSelection is enabled, use fileBrowser.GetMultiSelected() to get all selected filenames (instead of fileBrowser.GetSelected(), which returns only one of them).

Here are some common examples:

// select single regular file for opening
0
// select multiple regular files for opening
ImGuiFileBrowserFlags_MultipleSelection
// select single directory for opening
ImGuiFileBrowserFlags_SelectDirectory
// select multiple directories for opening
ImGuiFileBrowserFlags_SelectDirectory | ImGuiFileBrowserFlags_MultipleSelection
// select single regular file for saving
ImGuiFileBrowserFlags_EnterNewFilename | ImGuiFileBrowserFlags_CreateNewDir
// select single directory for saving
ImGuiFileBrowserFlags_SelectDirectory | ImGuiFileBrowserFlags_CreateNewDir

Usage

  • double click to enter a directory
  • single click to (de)select a regular file (or directory, when ImGuiFileBrowserFlags_SelectDirectory is enabled)
  • When ImGuiFileBrowserFlags_SelectDirectory is enabled and no directory is selected, click ok to choose the current directory as selected result
  • When ImGuiFileBrowserFlags_MultipleSelection is enabled, hold Shift or Ctrl to select more than one file
  • When ImGuiFileBrowserFlags_CreateNewDir is enabled, click the top-right little button "+" to create a new directory
  • When ImGuiFileBrowserFlags_SelectDirectory is not specified, double click to choose a regular file as selected result.

Type Filters

  • (optionally) use browser.SetTypeFilters({".h", ".cpp"}) to set file extension filters.
  • ".*" matches with any extension
  • filters are case-insensitive on Windows platform

Note

The filebrowser implementation queries drive list via Win32 API (only on Windows). Thus <Windows.h> is included in <imfilebrowser.h>, which may pollute the global namespace. This can be solved by simply moving the GetDrivesBitMask() definition into a cpp file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].