You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and also specific icons (with icon font files) or file type names :
199
+
ImGuiFileDialog accepts icon font macros as well as text tags for file types. See [IconFontCppHeaders](https://github.com/juliettef/IconFontCppHeaders) for a widely used Dear Imgui icon font helper or with [ImGuIFontStudio](https://github.com/aiekick/ImGuiFontStudio) (a gui tool for easily doing the same as IconFontCppHeaders)
This dialog will only verify the file in the file field.
330
-
So Not to be used with GetSelection()
348
+
This dialog will only verify the file in the file field, not with `GetSelection()`.
331
349
332
-
The Confirm dialog will be a forced Modal Dialog, not moveable, displayed
333
-
in the center of the current FileDialog.
350
+
The confirmation dialog will be a non-movable modal (input blocking) dialog displayed
351
+
in the middle of the current ImGuiFileDialog window.
334
352
335
-
As usual you can customize the dialog,
336
-
in you custom config file (CustomImGuiFileDialogConfig.h in this example)
353
+
As usual, you can customize the dialog in your custom config file (CustomImGuiFileDialogConfig.h in this example)
337
354
338
-
you can uncomment the next lines for customize it :
355
+
Uncomment these line for customization options:
339
356
```cpp
340
357
//#define OverWriteDialogTitleString "The file Already Exist !"
341
358
//#define OverWriteDialogMessageString "Would you like to OverWrite it ?"
@@ -349,22 +366,26 @@ See the result :
349
366
350
367
## Open / Save dialog Behavior :
351
368
352
-
There is no way to distinguish the "open dialog" behavior than "save dialog" behavior.
353
-
So you msut adapt the return according to your need :
369
+
ImGuiFileDialog uses the same code internally for Open and Save dialogs. To distinguish between them access the
370
+
various data return functions depending on what the dialog is doing.
354
371
355
-
if you want open file(s) or directory(s), you must use : GetSelection() method. you will obtain a std::map<FileName, FilePathName> of the selection
356
-
if you want create a file, you must use : GetFilePathName()/GetCurrentFileName()
372
+
When selecting an existing file (for example, a Load or Open dialog), use
357
373
358
-
the return method's and comments :
359
374
```cpp
360
-
std::map<std::string, std::string> GetSelection(); // Open File behavior : will return selection via a map<FileName, FilePathName>
361
-
std::string GetFilePathName(); // Create File behavior : will always return the content of the field with current filter extention and current path
362
-
std::string GetCurrentFileName(); // Create File behavior : will always return the content of the field with current filter extention
363
-
std::string GetCurrentPath(); // will return current path
364
-
std::string GetCurrentFilter(); // get selected filter
365
-
UserDatas GetUserDatas(); // get user datas send with Open Dialog
375
+
std::map<std::string, std::string> GetSelection(); // Returns selection via a map<FileName, FilePathName>
376
+
UserDatas GetUserDatas(); // Get user data provided by the Open dialog
366
377
```
367
378
379
+
To selecting a new file (for example, a Save As... dialog), use:
380
+
381
+
```cpp
382
+
std::string GetFilePathName(); // Returns the content of the selection field with current file extension and current path
383
+
std::string GetCurrentFileName(); // Returns the content of the selection field with current file extension but no path
384
+
std::string GetCurrentPath(); // Returns current path only
385
+
std::string GetCurrentFilter(); // The file extension
386
+
```
387
+
388
+
368
389
## How to Integrate ImGuiFileDialog in your project
369
390
370
391
### ImGuiFileDialog require :
@@ -374,18 +395,14 @@ UserDatas GetUserDatas(); // get user datas send with O
374
395
375
396
### Customize ImGuiFileDialog :
376
397
377
-
You just need to write your own config file by override the file : ImGuiFileDialog/ImGuiFileDialogConfig.h
378
-
like i do here with CustomImGuiFileDialogConfig.h
379
-
380
-
After that, for let ImGuiFileDialog your own custom file,
381
-
you must define the preprocessor directive CUSTOM_IMGUIFILEDIALOG_CONFIG with the path of you custom config file.
382
-
This path must be relative to the directory where you put ImGuiFileDialog module.
398
+
You can customize many aspects of ImGuiFileDialog by overriding `ImGuiFileDialogConfig.h`.
383
399
384
-
Thats all.
400
+
To enable your customizations, define the preprocessor directive CUSTOM_IMGUIFILEDIALOG_CONFIG with the path of your custom config file.
401
+
This path must be relative to the directory where you put the ImGuiFileDialog module.
385
402
386
-
You can check by example in this repo with the file CustomImGuiFileDialogConfig.h :
387
-
- this trick was used for have custom icon font instead of labels for buttons or messages titles
388
-
- you can also use your custom imgui button, the button call stamp must be same by the way :)
403
+
This operation is demonstrated in `CustomImGuiFileDialog.h` in the example project to:
404
+
* Have a custom icon font instead of labels for buttons or message titles
405
+
* Customize the button text (the button call signature must be the same, by the way! :)
389
406
390
407
The Custom Icon Font (in [CustomFont.cpp](CustomFont.cpp) and [CustomFont.h](CustomFont.h)) was made with [ImGuiFontStudio](https://github.com/aiekick/ImGuiFontStudio) i wrote for that :)
391
408
ImGuiFontStudio is using also ImGuiFileDialog.
@@ -738,4 +755,4 @@ feature : USE_BOOKMARK
738
755
IMGUIFILEDIALOG_API void IGFD_DeserializeBookmarks( // deserialize bookmarks : load bookmar buffer to load in the dialog (saved from previous use with SerializeBookmarks())
0 commit comments