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
New feature: Allow customisation of dialog title, accept label, and cancel label (#180)
This PR makes it possible for clients to customise the dialog title and button labels. This allows clients to be more specific about the kind of file they want the user to select (e.g. "Open Project") or use different languages.
- Windows: All are customisable (if unspecified they fall back to the OS default), except that the cancel label is not customisable before Windows 7
- macOS / Cocoa: Title and accept button are customisable (if unspecified they fall back to the OS default), but the cancel button is not
- Linux / GTK: All are customisable (if unspecified they are hardcoded)
- Linux / Portal: Title and accept button are customisable (title is hardcoded if unspecified, accept button falls back to the OS default if unspecified)
Resolves#99.
Downgrading CMake for Windows Clang is not not possible or necessary, as `windows-latest` is now Windows Server 2025.
Copy file name to clipboardExpand all lines: README.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -207,6 +207,9 @@ typedef struct {
207
207
nfdfiltersize_t filterCount;
208
208
const nfdu8char_t* defaultPath;
209
209
nfdwindowhandle_t parentWindow;
210
+
const nfdu8char_t* title;
211
+
const nfdu8char_t* acceptLabel;
212
+
const nfdu8char_t* cancelLabel;
210
213
} nfdopendialogu8args_t;
211
214
```
212
215
@@ -218,6 +221,9 @@ typedef struct {
218
221
const nfdu8char_t* defaultPath;
219
222
const nfdu8char_t* defaultName;
220
223
nfdwindowhandle_t parentWindow;
224
+
const nfdu8char_t* title;
225
+
const nfdu8char_t* acceptLabel;
226
+
const nfdu8char_t* cancelLabel;
221
227
} nfdsavedialogu8args_t;
222
228
```
223
229
@@ -226,13 +232,19 @@ typedef struct {
226
232
typedefstruct {
227
233
const nfdu8char_t* defaultPath;
228
234
nfdwindowhandle_t parentWindow;
235
+
const nfdu8char_t* title;
236
+
const nfdu8char_t* acceptLabel;
237
+
const nfdu8char_t* cancelLabel;
229
238
} nfdpickfolderu8args_t;
230
239
```
231
240
232
241
-`filterList` and `filterCount`: Set these to customize the file filter (it appears as a dropdown menu on Windows and Linux, but simply hides files on macOS). Set `filterList` to a pointer to the start of the array of filter items and `filterCount` to the number of filter items in that array. See the "File Filter Syntax" section below for details.
233
242
-`defaultPath`: Set this to the default folder that the dialog should open to (see the "Platform-specific Quirks" section for more details about the behaviour of this option on Windows).
234
243
-`defaultName`: (For SaveDialog only) Set this to the file name that should be pre-filled on the dialog.
235
244
-`parentWindow`: Set this to the native window handle of the parent of this dialog. See the "Usage with a Platform Abstraction Framework" section for details. It is also possible to pass a handle even if you do not use a platform abstraction framework.
245
+
-`title`: Set this to customize the title of the dialog window. If left unset, the operating system's default title (in the user's language) is used on Windows and macOS, while a hardcoded English title (such as "Open File" or "Save File") is used on Linux (GTK and Portal).
246
+
-`acceptLabel`: Set this to customize the text of the accept (confirmation) button, e.g. the "Open" or "Save" button. If left unset, the operating system's default text (in the user's language) is used, except on Linux (GTK), where a hardcoded English label (such as "Open" or "Save") is used.
247
+
-`cancelLabel`: Set this to customize the text of the cancel button. If left unset, the operating system's default text (in the user's language) is used, except on Linux (GTK), where the hardcoded English label "Cancel" is used. *This option is supported on Windows (7 and later) and Linux (GTK); it is ignored on macOS and Linux (Portal), where the cancel button text is not customizable.*
0 commit comments